Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 2010 15:22:33 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r212746 - stable/8/sys/netinet/ipfw
Message-ID:  <201009161522.o8GFMXRq096229@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Sep 16 15:22:33 2010
New Revision: 212746
URL: http://svn.freebsd.org/changeset/base/212746

Log:
  MFhead 212256:
    in_delayed_cksum() requires host byte order.
  
    Reported by:  Alexander Levin <amindomao googlemail.com>

Modified:
  stable/8/sys/netinet/ipfw/ip_fw_nat.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/ipfw/ip_fw_nat.c
==============================================================================
--- stable/8/sys/netinet/ipfw/ip_fw_nat.c	Thu Sep 16 15:22:30 2010	(r212745)
+++ stable/8/sys/netinet/ipfw/ip_fw_nat.c	Thu Sep 16 15:22:33 2010	(r212746)
@@ -295,12 +295,9 @@ ipfw_nat(struct ip_fw_args *args, struct
 		struct udphdr 	*uh;
 		u_short cksum;
 
-		/* XXX check if ip_len can stay in net format */
-		cksum = in_pseudo(
-		    ip->ip_src.s_addr,
-		    ip->ip_dst.s_addr,
-		    htons(ip->ip_p + ntohs(ip->ip_len) - (ip->ip_hl << 2))
-		);
+		ip->ip_len = ntohs(ip->ip_len);
+		cksum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
+		    htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2)));
 
 		switch (ip->ip_p) {
 		case IPPROTO_TCP:
@@ -326,6 +323,7 @@ ipfw_nat(struct ip_fw_args *args, struct
 			in_delayed_cksum(mcl);
 			mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 		}
+		ip->ip_len = htons(ip->ip_len);
 	}
 	args->m = mcl;
 	return (IP_FW_NAT);



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