patch-1.3.60 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.59/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -1660,7 +1660,7 @@
 	u32 ip;
 
 	/*
-	 *	Find out about the hardware type.
+	 *	Extract destination.
 	 */
 	
 	si = (struct sockaddr_in *) &r->arp_pa;
@@ -1680,8 +1680,16 @@
 		ip_rt_put(rt);
 	}
 
-	if (!dev)	/* this is can only be NULL if ATF_PUBL is not set */
+	/* good guess about the device if it isn't a ATF_PUBL entry */
+	if (!dev) {
+		if (dev1->flags&(IFF_LOOPBACK|IFF_NOARP))
+			return -ENODEV;
 		dev = dev1;
+	}
+
+	/* this needs to be checked only for dev=dev1 but it doesnt hurt */	
+	if (r->arp_ha.sa_family != dev->type)	
+		return -EINVAL;
 		
 	if (((r->arp_flags & ATF_PUBL) && dev == dev1) ||
 	    (!(r->arp_flags & ATF_PUBL) && dev != dev1))
@@ -1997,11 +2005,13 @@
 	/* Register for device down reports */
 	register_netdevice_notifier(&arp_dev_notifier);
 
+#ifdef CONFIG_PROC_FS
 	proc_net_register(&(struct proc_dir_entry) {
 		PROC_NET_ARP, 3, "arp",
 		S_IFREG | S_IRUGO, 1, 0, 0,
 		0, &proc_net_inode_operations,
 		arp_get_info
 	});
+#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