cvs commit: src/sys/netinet udp_usrreq.c
Robert Watson
rwatson at FreeBSD.org
Mon Nov 22 07:17:08 PST 2004
rwatson 2004-11-22 15:17:08 UTC
FreeBSD src repository
Modified files: (Branch: RELENG_5)
sys/netinet udp_usrreq.c
Log:
Merge udp_usrreq.c:1.168 from HEAD to RELENG_5:
date: 2004/11/04 01:25:23; author: rwatson; state: Exp; lines: +24 -57
Until this change, the UDP input code used global variables udp_in,
udp_in6, and udp_ip6 to pass socket address state between udp_input(),
udp_append(), and soappendaddr_locked(). While fine in the default
configuration, when running with multiple netisrs or direct ithread
dispatch, this can result in races wherein user processes using
recvmsg() get back the wrong source IP/port. To correct this and
related races:
- Eliminate udp_ip6, which is believed to be generated but then never
used. Eliminate ip_2_ip6_hdr() as it is now unneeded.
- Eliminate setting, testing, and existence of 'init' status fields
for the IPv6 structures. While with multiple UDP delivery this
could lead to amortization of IPv4 -> IPv6 conversion when
delivering an IPv4 UDP packet to an IPv6 socket, it added
substantial complexity and side effects.
- Move global structures into the stack, declaring udp_in in
udp_input(), and udp_in6 in udp_append() to be used if a conversion
is required. Pass &udp_in into udp_append().
- Re-annotate comments to reflect updates.
With this change, UDP appears to operate correctly in the presence of
substantial inbound processing parallelism. This solution avoids
introducing additional synchronization, but does increase the
potential stack depth.
Discovered by: kris (Bug Magnet)
MFC after: 3 weeks
Note that this bug does not effect the default configuration, only systems
running with net.isr.enable=1, or with modified network stacks to increase
parallelism.
Revision Changes Path
1.162.2.4 +24 -57 src/sys/netinet/udp_usrreq.c
More information about the cvs-src
mailing list