[net.bugs.4bsd] TFTP/UDP/IP on 4.2bsd

mishkin@apollo.uucp (Nathaniel Mishkin) (01/30/86)

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

brad@gcc-milo.ARPA (Brad Parker) (02/03/86)

In article <2ba5fe22.3166@apollo.uucp> mishkin@apollo.UUCP (Nathaniel Mishkin) writes:
>...  The apparent reason things work on 4.2 is because... this is a bug...

SUPRISE! (standard look of shock when discovering a bug in 4.2 networking)

-- 

J Bradford Parker
seismo!harvard!gcc-milo!brad

"I want to go up to Detroit
 I want to lie in the shade
 I want to visit the President
 And then I want to get laid" - O.M.D. "Bloc Bloc Bloc"