Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2017 22:58:20 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314430 - head/sys/netinet6
Message-ID:  <201702282258.v1SMwKdj086828@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue Feb 28 22:58:19 2017
New Revision: 314430
URL: https://svnweb.freebsd.org/changeset/base/314430

Log:
  When IPv6 fragments reassembly is complete, update mbuf's csum_data
  and csum_flags using information from all fragments. This fixes
  dropping of reassembled packets due to wrong checksum when the IPv6
  checksum offloading is enabled on a network card.
  
  Obtained from:	Yandex LLC
  MFC after:	1 week
  Sponsored by:	Yandex LLC

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Tue Feb 28 22:54:52 2017	(r314429)
+++ head/sys/netinet6/frag6.c	Tue Feb 28 22:58:19 2017	(r314430)
@@ -528,6 +528,11 @@ insert:
 	af6 = ip6af->ip6af_down;
 	frag6_deq(ip6af);
 	while (af6 != (struct ip6asfrag *)q6) {
+		m->m_pkthdr.csum_flags &=
+		    IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags;
+		m->m_pkthdr.csum_data +=
+		    IP6_REASS_MBUF(af6)->m_pkthdr.csum_data;
+
 		af6dwn = af6->ip6af_down;
 		frag6_deq(af6);
 		while (t->m_next)
@@ -538,6 +543,10 @@ insert:
 		af6 = af6dwn;
 	}
 
+	while (m->m_pkthdr.csum_data & 0xffff0000)
+		m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) +
+		    (m->m_pkthdr.csum_data >> 16);
+
 	/* adjust offset to point where the original next header starts */
 	offset = ip6af->ip6af_offset - sizeof(struct ip6_frag);
 	free(ip6af, M_FTABLE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702282258.v1SMwKdj086828>