patch-2.0.31 linux/net/ipv4/icmp.c

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

diff -u --recursive --new-file v2.0.30/linux/net/ipv4/icmp.c linux/net/ipv4/icmp.c
@@ -39,6 +39,9 @@
  *		Thomas Quinot	:	ICMP Dest Unreach codes up to 15 are
  *					valid (RFC 1812).
  *		Alan Cox	:	Spoofing and junk icmp protections.
+ *              Elliot Poger    :       Added support for SO_BINDTODEVICE.
+ *	Willy Konynenberg	:	Transparent proxy adapted to new
+ *					socket hash code.
  *
  *
  * RFC1122 (Host Requirements -- Comm. Layer) Status:
@@ -748,7 +751,7 @@
 				break;
 		}
 		if(icmph->code>NR_ICMP_UNREACH)	/* Invalid type */
-			return;
+			goto flush_it;
 	}
 	
 	/*
@@ -831,8 +834,9 @@
 	NETDEBUG(printk(KERN_INFO "icmp: ICMP redirect ignored. dest = %lX, "
 	       "orig gw = %lX, \"new\" gw = %lX, device = %s.\n", ntohl(ip),
 		ntohl(source), ntohl(icmph->un.gateway), dev->name));
+		goto flush_it;
 	}
-#else	
+#endif
 	switch(icmph->code & 7) 
 	{
 		case ICMP_REDIR_NET:
@@ -870,7 +874,7 @@
 		default:
 			break;
   	}
-#endif  	
+
   	/*
   	 *	Discard the original packet
   	 */
@@ -991,9 +995,8 @@
  *	in udp.c or tcp.c...
  */
 
-/* This should work with the new hashes now. -DaveM */
-extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport);
-extern struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport);
+extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, struct device *dev);
+extern struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, struct device *dev);
 
 int icmp_chkaddr(struct sk_buff *skb)
 {
@@ -1009,7 +1012,7 @@
 			{
 			struct tcphdr *th = (struct tcphdr *)(((unsigned char *)iph)+(iph->ihl<<2));
 
-			sk = tcp_v4_lookup(iph->saddr, th->source, iph->daddr, th->dest);
+			sk = tcp_v4_lookup(iph->saddr, th->source, iph->daddr, th->dest, skb->dev);
 			if (!sk) return 0;
 			if (sk->saddr != iph->saddr) return 0;
 			if (sk->daddr != iph->daddr) return 0;
@@ -1023,7 +1026,7 @@
 			{
 			struct udphdr *uh = (struct udphdr *)(((unsigned char *)iph)+(iph->ihl<<2));
 
-			sk = udp_v4_lookup(iph->saddr, uh->source, iph->daddr, uh->dest);
+			sk = udp_v4_lookup(iph->saddr, uh->source, iph->daddr, uh->dest, skb->dev);
 			if (!sk) return 0;
 			if (sk->saddr != iph->saddr && ip_chk_addr(iph->saddr) != IS_MYADDR)
 				return 0;

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