patch-2.1.11 linux/net/ipv4/ip_forward.c

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

diff -u --recursive --new-file v2.1.10/linux/net/ipv4/ip_forward.c linux/net/ipv4/ip_forward.c
@@ -16,6 +16,7 @@
  *					use output device for accounting.
  *		Jos Vos		:	Call forward firewall after routing
  *					(always use output device).
+ *		Alan Cox	: 	Unshare buffer on forward.
  */
 
 #include <linux/config.h>
@@ -120,6 +121,13 @@
 	struct sk_buff *skb_in = skb;	/* So we can remember if the masquerader did some swaps */
 #endif /* CONFIG_IP_MASQUERADE */
 #endif /* CONFIG_FIREWALL */
+
+	/*
+	 *	We may be sharing the buffer with a snooper. That won't do
+	 */
+	 
+	if((skb=skb_unshare(skb, GFP_ATOMIC,FREE_READ))==NULL)
+		return -1;
 	
 	/*
 	 *	According to the RFC, we must first decrease the TTL field. If

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov