Problem with port 0

Bill Fenner fenner at research.att.com
Tue Jan 16 22:19:00 UTC 2007


I'd note that RFC 768 explicitly mentions this possibility:

Source Port is an optional field, when meaningful, it indicates the port
of the sending  process,  and may be assumed  to be the port  to which a
reply should  be addressed  in the absence of any other information.  If
not used, a value of zero is inserted.

I think Hug is saying that since the boot loader is the only thing that's
running on the box, it's got no reason to use a port number, so it's
not used.

Hug's error message:
>with default tftp - Jan 12 09:37:55 dukeengi01 tftpd[80898]: connect: Can't
>assign requested address

is consistent with the following code from in_pcbconnect_setup():

        if (sin->sin_port == 0)
                return (EADDRNOTAVAIL);

which dates back to BSD 4.4 and before.

This is probably not completely wrong, but it's not right in this particular
case - tftpd should be able to connect a UDP socket to a remote port 0 in
order to respond to this request.

(FreeBSD definitely can't send from port 0, but that's OK because we don't
want to.)

  Bill


More information about the freebsd-net mailing list