svn commit: r317258 - stable/11/sys/kern
Andrey V. Elsukov
ae at FreeBSD.org
Fri Apr 21 16:45:44 UTC 2017
Author: ae
Date: Fri Apr 21 16:45:43 2017
New Revision: 317258
URL: https://svnweb.freebsd.org/changeset/base/317258
Log:
MFC r316770:
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 r316822,316823:
Rework r316770 to make it protocol independent and general, like we
do for streaming sockets.
And do more cleanup in the sbappendaddr_locked_internal() to prevent
leak information from existing mbuf to the one, that will be possible
created later by netgraph.
Suggested by: glebius
Tested by: Irina Liakh <spell at itl ua>
Modified:
stable/11/sys/kern/uipc_sockbuf.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/uipc_sockbuf.c
==============================================================================
--- stable/11/sys/kern/uipc_sockbuf.c Fri Apr 21 15:59:58 2017 (r317257)
+++ stable/11/sys/kern/uipc_sockbuf.c Fri Apr 21 16:45:43 2017 (r317258)
@@ -794,8 +794,20 @@ sbappendaddr_locked_internal(struct sock
return (0);
m->m_len = asa->sa_len;
bcopy(asa, mtod(m, caddr_t), asa->sa_len);
- if (m0)
+ if (m0) {
m_clrprotoflags(m0);
+ m_tag_delete_chain(m0, NULL);
+ /*
+ * Clear some persistent info from pkthdr.
+ * We don't use m_demote(), because some netgraph consumers
+ * expect M_PKTHDR presence.
+ */
+ m0->m_pkthdr.rcvif = NULL;
+ m0->m_pkthdr.flowid = 0;
+ m0->m_pkthdr.csum_flags = 0;
+ m0->m_pkthdr.fibnum = 0;
+ m0->m_pkthdr.rsstype = 0;
+ }
if (ctrl_last)
ctrl_last->m_next = m0; /* concatenate data to control */
else
More information about the svn-src-stable-11
mailing list