port number zero (TCP/UDP)
Here's a funny one.
Following on from the "IP 0.0.0.0" thread...
IS port number 0 legal as a source or destination port in TCP/ UDP ?
This I know:
1. It is impossible using the BSD sockets API (or anything derived from it), to bind a socket to port 0 (because it is a placeholder for "let the OS choose"). So using it as a source port or listening port is right out.
2. Therefore, if everyone in the world was using BSD sockets exclusively, it would be pointless to send or connect to port 0, as nobody else would be able to bind to it.
3. It is probably possible using lower level sockets API to send and receive TCP or UDP frames to/from port 0, provided your code sorts the tcp checksums out
- Is there any known use for it (legitimate or otherwise (for instance by trojans))
- Will these packets be dropped by some routers (i.e. non-firewalling routers which let most stuff through) as illegal?
- Does it get NAT'd correctly by DNAT boxes?
NB: I can do experiments to try and determine some of these things.
Slarty