patch-pre2.0.13 linux/net/ipv4/arp.c

Next file: linux/net/ipv4/ip_forward.c
Previous file: linux/net/ipv4/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.12/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -2025,36 +2025,31 @@
 
 	while ((entry = *entryp) != NULL)
 	{
-		if (entry->ip == ip && entry->mask == mask && entry->dev == dev)
-			break;
+		/* User supplied arp entries are definitive - RHP 960603 */
+
+		if (entry->ip == ip && entry->mask == mask && entry->dev == dev) {
+			*entryp=entry->next;
+			arp_free_entry(entry);
+			continue;
+		}
 		if ((entry->mask & mask) != mask)
-		{
-			entry = NULL;
 			break;
-		}
 		entryp = &entry->next;
 	}
 
-	/*
-	 *	Do we need to create a new entry?
-	 */
-	
+	entry = arp_alloc_entry();
 	if (entry == NULL)
 	{
-		entry = arp_alloc_entry();
-		if (entry == NULL)
-		{
-			arp_unlock();
-			return -ENOMEM;
-		}
-		entry->ip = ip;
-		entry->dev = dev;
-		entry->mask = mask;
-		entry->flags = r->arp_flags;
-
-		entry->next = *entryp;
-		*entryp = entry;
+		arp_unlock();
+		return -ENOMEM;
 	}
+	entry->ip = ip;
+	entry->dev = dev;
+	entry->mask = mask;
+	entry->flags = r->arp_flags;
+
+	entry->next = *entryp;
+	*entryp = entry;
 
 	ha = r->arp_ha.sa_data;
 	if (empty(ha, dev->addr_len))

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected] with Sam's (original) version
of this