Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Oct 2012 15:08:08 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241547 - head/sys/netinet
Message-ID:  <201210141508.q9EF88iO087803@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



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