udp: Save original protocol processing port for later synchronizing.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 23 Oct 2015 13:37:46 +0000 (21:37 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 29 Oct 2015 01:26:02 +0000 (09:26 +0800)
commit9ca1e337e73f0ab6f5dfd46527c1cd25996fe59b
treec866f55074026a3c11a3362e0111b10bd7d771f4
parent8756ce9107278fb3962785698d2a0f2cc3810d6e
udp: Save original protocol processing port for later synchronizing.

Unlike TCP, user could send data w/ address to a UDP socket that
connect(2) is being called (those data messages will be on the
original protocol processing port and forwarded to the new protocol
processing port later), and then close the UDP socket (the detach
message could be sent to the new protocol processing port before
the inflight data messages).  The inflight data messages will cause
later panic, since the socket/inp has been destroyed by the detach
message.  I will have to say this probably will never happen for any
real world applications.

We fix this by recording the original message port, and synchronize
inflight data messages on it upon detaching.  If the connect(2) moves
between protocol processing ports more than once, we will go though
all UDP processing netisrs to synchronize all possible inflight data
messages.
sys/netinet/udp_usrreq.c
sys/sys/socketvar.h