patch-pre2.0.5 linux/net/ipv4/ip_forward.c

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

diff -u --recursive --new-file pre2.0.4/linux/net/ipv4/ip_forward.c linux/net/ipv4/ip_forward.c
@@ -250,7 +250,15 @@
 		 * (Don't masquerade de-masqueraded fragments)
 		 */
 		if (!(is_frag&IPFWD_MASQUERADED) && fw_res==FW_MASQUERADE)
-			ip_fw_masquerade(&skb, dev2);
+			if (ip_fw_masquerade(&skb, dev2) < 0)
+			{
+				/*
+				 * Masquerading failed; silently discard this packet.
+				 */
+				if (rt)
+					ip_rt_put(rt);
+				return -1;
+			}
 #endif
 		IS_SKB(skb);
 

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