4.2bsd UDP/IP Bug?

Nathaniel Mishkin (apollo!mishkin@uw-beaver.arpa)
Wed, 5 Feb 86 11:45:11 est

For reasons that don't bear explanation, I recently had to look through
the 4.2bsd "tftp" server and client code. I saw some strange things
that led me to wonder how UDP works under 4.2 and how it's supposed to

I saw that once the server 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.
According to my understand of how UDP is supposed to work, if the
implementation is correct, then "tftp" 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.

Do I misunderstand UDP? Is 4.2 broken? Is 4.3 fixed? Please respond
to me since I'm not on this list.

            -- Nat Mishkin
               Apollo Computer Inc.


This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:35:40 GMT