TFTP/UDP/IP on 4.2bsd

Nathaniel Mishkin mishkin at apollo.uucp
Fri Jan 31 06:23:27 AEST 1986


I am implementing a new socket domain.  This domain supports only datagram
style sockets.  So, I figured, what better way to test my new sockets
than by hacking up "tftp" and "tftpd" a bit (just enough to remove the
IP addressing dependencies).  Unfortunately, when I looked through the
code, I saw that once the daemon gets a "request" packet on the "tftp"
well-known port, it forks.  The child continues to read on the same file
descriptor (port).  The parent goes back to the top of its listen loop,
creates a new socket, and binds its end to the "tftp" well-known port
again.  Well, I said, someone's understanding of how UDP works is different
from mine because if the implementation is correct, then "tftp/tftpd"
could never work since both the parent and the child would be reading
packets from the same port -- it would be random which were gotten by
the parent and which were gotten by the child.  The apparent reason things
work on 4.2 is because the kernel demultiplexes incoming UDP packets
based on BOTH the packet's local AND foreign port.  If I understand the
UDP/IP spec, this is a bug -- you're supposed to demultiplex incoming
packets by looking ONLY at the local port.

Comments?

            -- Nat Mishkin
               Apollo Computer Inc.
               {wangins,yale,uw-beaver}!apollo!mishkin



More information about the Comp.unix.wizards mailing list