svn commit: r339195 - head/sys/netinet

Tom Jones thj at FreeBSD.org
Fri Oct 5 12:51:31 UTC 2018


Author: thj
Date: Fri Oct  5 12:51:30 2018
New Revision: 339195
URL: https://svnweb.freebsd.org/changeset/base/339195

Log:
  Convert UDP length to host byte order
  
  When getting the number of bytes to checksum make sure to convert the UDP
  length to host byte order when the entire header is not in the first mbuf.
  
  Reviewed by: jtl, tuexen, ae
  Approved by: re (gjb), jtl (mentor)
  Differential Revision:  https://reviews.freebsd.org/D17357

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Fri Oct  5 12:08:32 2018	(r339194)
+++ head/sys/netinet/ip_output.c	Fri Oct  5 12:51:30 2018	(r339195)
@@ -932,10 +932,11 @@ in_delayed_cksum(struct mbuf *m)
 
 	if (m->m_pkthdr.csum_flags & CSUM_UDP) {
 		/* if udp header is not in the first mbuf copy udplen */
-		if (offset + sizeof(struct udphdr) > m->m_len)
+		if (offset + sizeof(struct udphdr) > m->m_len) {
 			m_copydata(m, offset + offsetof(struct udphdr,
 			    uh_ulen), sizeof(cklen), (caddr_t)&cklen);
-		else {
+			cklen = ntohs(cklen);
+		} else {
 			uh = (struct udphdr *)mtodo(m, offset);
 			cklen = ntohs(uh->uh_ulen);
 		}


More information about the svn-src-all mailing list