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

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

diff -u --recursive --new-file v2.1.0/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -1984,13 +1984,14 @@
 	{
 		if (!mask && ip)
 			return -EINVAL;
-		if (!dev)
+		if (!dev) {
 			dev = dev_getbytype(r->arp_ha.sa_family);
+			if (!dev)
+				return -ENODEV;
+		}
 	}
 	else
 	{
-		if (ip_chk_addr(ip) && dev->type != ARPHRD_METRICOM)
-			return -EINVAL;
 		if (!dev)
 		{
 			struct rtable * rt;
@@ -1999,9 +2000,13 @@
 				return -ENETUNREACH;
 			dev = rt->rt_dev;
 			ip_rt_put(rt);
+			if (!dev)
+				return -ENODEV;
 		}
+		if (dev->type != ARPHRD_METRICOM && ip_chk_addr(ip))
+			return -EINVAL;
 	}
-	if (!dev || (dev->flags&(IFF_LOOPBACK|IFF_NOARP)))
+	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP))
 		return -ENODEV;
 
 	if (r->arp_ha.sa_family != dev->type)	

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