patch-1.3.9 linux/net/ipv4/ip.c

Next file: linux/net/ipx/Makefile
Previous file: linux/net/ipv4/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.8/linux/net/ipv4/ip.c linux/net/ipv4/ip.c
@@ -81,6 +81,7 @@
  *		Alan Cox	:	Set saddr on raw output frames as per BSD.
  *		Alan Cox	:	Stopped broadcast source route explosions.
  *		Alan Cox	:	Can disable source routing
+ *		Takeshi Sone    :	Masquerading didn't work.
  *
  *  
  *
@@ -1023,11 +1024,21 @@
 	 */
 
 	
-	if(!(is_frag&4) && (fw_res=ip_fw_chk(skb->h.iph, dev, ip_fw_fwd_chain, ip_fw_fwd_policy, 0))!=1)
+	if(!(is_frag&4))
 	{
-		if(fw_res==-1)
+		fw_res=ip_fw_chk(skb->h.iph, dev, ip_fw_fwd_chain, ip_fw_fwd_policy, 0);
+		switch (fw_res) {
+		case 1:
+#ifdef CONFIG_IP_MASQUERADE
+		case 2:
+#endif
+			break;
+		case -1:
 			icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, dev);
-		return;
+			/* fall thru */
+		default:
+			return;
+		}
 	}
 #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