patch-pre2.0.10 linux/net/ipv4/ip_input.c

Next file: linux/net/ipv4/ip_masq.c
Previous file: linux/net/ipv4/ip_fw.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.9/linux/net/ipv4/ip_input.c linux/net/ipv4/ip_input.c
@@ -529,25 +529,26 @@
 		}
 
 #endif
+
 #ifdef CONFIG_IP_MASQUERADE
-	{
 		/*
 		 * Do we need to de-masquerade this packet?
 		 */
-		int ret = ip_fw_demasquerade(&skb,dev);
-		if (ret < 0) {
-			kfree_skb(skb, FREE_WRITE);
-			return 0;
-		}
-
-		if (ret)
 		{
-			struct iphdr *iph=skb->h.iph;
-			if (ip_forward(skb, dev, IPFWD_MASQUERADED, iph->daddr))
+			int ret = ip_fw_demasquerade(&skb,dev);
+			if (ret < 0) {
 				kfree_skb(skb, FREE_WRITE);
-			return 0;
+				return 0;
+			}
+
+			if (ret)
+			{
+				struct iphdr *iph=skb->h.iph;
+				if (ip_forward(skb, dev, IPFWD_MASQUERADED, iph->daddr))
+					kfree_skb(skb, FREE_WRITE);
+				return 0;
+			}
 		}
-	}
 #endif
 
 		/*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this