svn commit: r201078 - user/luigi/ipfw3-head/sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Mon Dec 28 01:53:53 UTC 2009


Author: luigi
Date: Mon Dec 28 01:53:52 2009
New Revision: 201078
URL: http://svn.freebsd.org/changeset/base/201078

Log:
  remove a useless conversion of ip_len to net format

Modified:
  user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c	Mon Dec 28 01:50:23 2009	(r201077)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c	Mon Dec 28 01:53:52 2009	(r201078)
@@ -298,11 +298,11 @@ ipfw_nat(struct ip_fw_args *args, struct
 		struct udphdr 	*uh;
 		u_short cksum;
 
-		ip->ip_len = ntohs(ip->ip_len);
+		/* 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 + ip->ip_len - (ip->ip_hl << 2))
+		    htons(ip->ip_p + ntohs(ip->ip_len) - (ip->ip_hl << 2))
 		);
 
 		switch (ip->ip_p) {
@@ -329,7 +329,6 @@ 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);
 	}
 	if (args->eh == NULL) {
 		SET_HOST_IPLEN(ip);


More information about the svn-src-user mailing list