Clear h/w csum flags on mbuf handled by UDP.
authorae <ae@FreeBSD.org>
Thu, 13 Apr 2017 17:03:57 +0000 (17:03 +0000)
committerae <ae@FreeBSD.org>
Thu, 13 Apr 2017 17:03:57 +0000 (17:03 +0000)
commit629029d02000d9c8bf605e60bb4688f5837fa3ee
treedd6c6c18904c3d16eeeb8d2b763e0c4f73e1e7b4
parentab6a57c4a3830429394aed71bfd8559f0cb2890e
Clear h/w csum flags on mbuf handled by UDP.

When checksums of received IP and UDP header already checked, UDP uses
sbappendaddr_locked() to pass received data to the socket.
sbappendaddr_locked() uses given mbuf as is, and if NIC supports checksum
offloading, mbuf contains csum_data and csum_flags that were calculated
for already stripped headers. Some NICs support only limited checksums
offloading and do not use CSUM_PSEUDO_HDR flag, and csum_data contains
some value that UDP/TCP should use for pseudo header checksum calculation.

When L2TP is used for tunneling with mpd5, ng_ksocket receives mbuf with
filled csum_flags and csum_data, that were calculated for outer headers.
When L2TP header is stripped, a packet that was tunneled goes to the IP
layer and due to presence of csum_flags (without CSUM_PSEUDO_HDR) and
csum_data, the UDP/TCP checksum check fails for this packet.

Reported by: Irina Liakh <spell at itl ua>
Tested by: Irina Liakh <spell at itl ua>
MFC after: 1 week
sys/netinet/udp_usrreq.c
sys/netinet6/udp6_usrreq.c