patch-1.3.51 linux/net/ipv4/arp.c

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

diff -u --recursive --new-file v1.3.50/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -895,15 +895,22 @@
  */
 
 /*
- *	try to switch to alias device whose address is tip, if any
+ *	try to switch to alias device whose addr is tip or closest to sip.
  */
 
 #ifdef CONFIG_NET_ALIAS
-	if (net_alias_has(dev))
+	if (tip != dev->pa_addr && net_alias_has(skb->dev)) 
 	{
-		struct device *adev;
-		adev = net_alias_chk32(dev,AF_INET,tip,IFF_UP,IFF_NOARP);
-		if (adev != NULL) dev = adev;
+		/*
+		 *	net_alias_dev_rcv_sel32 returns main dev if it fails to found other.
+		 */
+		dev = net_alias_dev_rcv_sel32(dev, AF_INET, sip, tip);
+
+		if (dev->type != ntohs(arp->ar_hrd) || dev->flags & IFF_NOARP)
+		{
+			kfree_skb(skb, FREE_READ);
+			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