svn commit: r334707 - head/sys/netinet6

Andrey V. Elsukov ae at FreeBSD.org
Wed Jun 6 10:46:25 UTC 2018


Author: ae
Date: Wed Jun  6 10:46:24 2018
New Revision: 334707
URL: https://svnweb.freebsd.org/changeset/base/334707

Log:
  Use m_copyback() function to write delayed checksum when it isn't located
  in the first mbuf of the chain.
  
  MFC after:	1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Wed Jun  6 07:13:27 2018	(r334706)
+++ head/sys/netinet6/ip6_output.c	Wed Jun  6 10:46:24 2018	(r334707)
@@ -199,18 +199,10 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_sho
 		csum = 0xffff;
 	offset += m->m_pkthdr.csum_data;	/* checksum offset */
 
-	if (offset + sizeof(u_short) > m->m_len) {
-		printf("%s: delayed m_pullup, m->len: %d plen %u off %u "
-		    "csum_flags=%b\n", __func__, m->m_len, plen, offset,
-		    (int)m->m_pkthdr.csum_flags, CSUM_BITS);
-		/*
-		 * XXX this should not happen, but if it does, the correct
-		 * behavior may be to insert the checksum in the appropriate
-		 * next mbuf in the chain.
-		 */
-		return;
-	}
-	*(u_short *)(m->m_data + offset) = csum;
+	if (offset + sizeof(csum) > m->m_len)
+		m_copyback(m, offset, sizeof(csum), (caddr_t)&csum);
+	else
+		*(u_short *)mtodo(m, offset) = csum;
 }
 
 int


More information about the svn-src-head mailing list