svn commit: r212256 - head/sys/netinet/ipfw

Gleb Smirnoff glebius at FreeBSD.org
Mon Sep 6 13:17:02 UTC 2010


Author: glebius
Date: Mon Sep  6 13:17:01 2010
New Revision: 212256
URL: http://svn.freebsd.org/changeset/base/212256

Log:
  in_delayed_cksum() requires host byte order.
  
  Reported by:	Alexander Levin <amindomao googlemail.com>
  MFC after:	1 week

Modified:
  head/sys/netinet/ipfw/ip_fw_nat.c

Modified: head/sys/netinet/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_nat.c	Mon Sep  6 12:55:07 2010	(r212255)
+++ head/sys/netinet/ipfw/ip_fw_nat.c	Mon Sep  6 13:17:01 2010	(r212256)
@@ -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);


More information about the svn-src-all mailing list