svn commit: r241547 - head/sys/netinet

Gleb Smirnoff glebius at FreeBSD.org
Sun Oct 14 15:08:08 UTC 2012


Author: glebius
Date: Sun Oct 14 15:08:07 2012
New Revision: 241547
URL: http://svn.freebsd.org/changeset/base/241547

Log:
  Fix a miss from r241344: in ip_mloopback() we need to go to
  net byte order prior to calling in_delayed_cksum().
  
  Reported by:	 Olivier Cochard-Labbe <olivier cochard.me>

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Sun Oct 14 15:03:06 2012	(r241546)
+++ head/sys/netinet/ip_output.c	Sun Oct 14 15:08:07 2012	(r241547)
@@ -1313,6 +1313,9 @@ ip_mloopback(struct ifnet *ifp, struct m
 	if (copym != NULL && (copym->m_flags & M_EXT || copym->m_len < hlen))
 		copym = m_pullup(copym, hlen);
 	if (copym != NULL) {
+		ip = mtod(copym, struct ip *);
+		ip->ip_len = htons(ip->ip_len);
+		ip->ip_off = htons(ip->ip_off);
 		/* If needed, compute the checksum and mark it as valid. */
 		if (copym->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
 			in_delayed_cksum(copym);
@@ -1325,9 +1328,6 @@ ip_mloopback(struct ifnet *ifp, struct m
 		 * We don't bother to fragment if the IP length is greater
 		 * than the interface's MTU.  Can this possibly matter?
 		 */
-		ip = mtod(copym, struct ip *);
-		ip->ip_len = htons(ip->ip_len);
-		ip->ip_off = htons(ip->ip_off);
 		ip->ip_sum = 0;
 		ip->ip_sum = in_cksum(copym, hlen);
 #if 1 /* XXX */


More information about the svn-src-all mailing list