Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 2009 10:43:07 +0000 (UTC)
From:      Paolo Pisati <piso@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r190548 - user/piso/sys/netinet
Message-ID:  <200903301043.n2UAh78Y064217@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: piso
Date: Mon Mar 30 10:43:07 2009
New Revision: 190548
URL: http://svn.freebsd.org/changeset/base/190548

Log:
  Revert previous experiment with ip_reass().

Modified:
  user/piso/sys/netinet/ip_fw_nat.c

Modified: user/piso/sys/netinet/ip_fw_nat.c
==============================================================================
--- user/piso/sys/netinet/ip_fw_nat.c	Mon Mar 30 10:18:43 2009	(r190547)
+++ user/piso/sys/netinet/ip_fw_nat.c	Mon Mar 30 10:43:07 2009	(r190548)
@@ -72,7 +72,6 @@ MALLOC_DECLARE(M_IPFW);
 #ifdef VIMAGE_GLOBALS
 extern struct ip_fw_chain layer3_chain;
 static eventhandler_tag ifaddr_event_tag;
-static int nat_reass;
 #endif
 
 extern ipfw_nat_t *ipfw_nat_ptr;
@@ -81,10 +80,6 @@ extern ipfw_nat_cfg_t *ipfw_nat_del_ptr;
 extern ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr;
 extern ipfw_nat_cfg_t *ipfw_nat_get_log_ptr;
 
-SYSCTL_DECL(_net_inet_ip_fw);
-SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, nat_reass, CTLFLAG_RW,
-    nat_reass, 0, "Reassemble ip fragments before ipfw nat");
-
 static void 
 ifaddr_change(void *arg __unused, struct ifnet *ifp)
 {
@@ -257,7 +252,7 @@ ipfw_nat(struct ip_fw_args *args, struct
 	struct mbuf *mcl;
 	struct ip *ip;
 	/* XXX - libalias duct tape */
-	int ldt, retval, off;
+	int ldt, retval;
 	char *c;
 
 	ldt = 0;
@@ -266,63 +261,11 @@ ipfw_nat(struct ip_fw_args *args, struct
 	    NULL)
 		goto badnat;
 	ip = mtod(mcl, struct ip *);
-
-	/* Shall we reassemble ip fragments? */
-	if (!V_nat_reass) {
-		if (args->eh == NULL) {
-			ip->ip_len = htons(ip->ip_len);
-			ip->ip_off = htons(ip->ip_off);
-		}
-	} else {
-		off = (args->eh == NULL) ? ip->ip_off : ntohs(ip->ip_off);
-		/* 
-		 * In case of fragments, reassemble the packet 
-		 * before passing it to libalias.
-		 */
-		if (off & (IP_MF | IP_OFFMASK)) {
-			struct mbuf *reass;
-
-			/* 
-			 * Ip_reass() expects len & off in host byte order:
-			 * fix them in case we come from layer2.
-			 */
-			if (args->eh != NULL) {
-				ip->ip_len = ntohs(ip->ip_len);
-				ip->ip_off = ntohs(ip->ip_off);
-			}
-
-			/* Reassemble packet. */
-			reass = ip_reass(mcl);
-
-			/*
-			 * IP header checksum fixup after reassembly and leave header
-			 * in network byte order.
-			 */
-			if (reass != NULL) {
-				int hlen;
-			
-				ip = mtod(reass, struct ip *);
-				hlen = ip->ip_hl << 2;
-				ip->ip_len = htons(ip->ip_len);
-				ip->ip_off = htons(ip->ip_off);
-				ip->ip_sum = 0;
-				if (hlen == sizeof(struct ip))
-					ip->ip_sum = in_cksum_hdr(ip);
-				else
-					ip->ip_sum = in_cksum(reass, hlen);
-				if ((mcl = m_megapullup(reass, reass->m_pkthdr.len)) ==
-				    NULL)
-					goto badnat;
-				ip = mtod(mcl, struct ip *);
-			} else {
-				mcl = NULL;
-				goto badnat;
-			}
-		} else if (args->eh == NULL) {
-			ip->ip_len = htons(ip->ip_len);
-			ip->ip_off = htons(ip->ip_off);
-		}
+	if (args->eh == NULL) {
+		ip->ip_len = htons(ip->ip_len);
+		ip->ip_off = htons(ip->ip_off);
 	}
+
 	/* 
 	 * XXX - Libalias checksum offload 'duct tape':
 	 * 
@@ -664,7 +607,6 @@ ipfw_nat_init(void)
 	IPFW_WUNLOCK(&V_layer3_chain);
 	V_ifaddr_event_tag = EVENTHANDLER_REGISTER(ifaddr_event, ifaddr_change, 
 	    NULL, EVENTHANDLER_PRI_ANY);
-	V_nat_reass = 1;
 }
 
 static void



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