Patchwork ipv4: arp_notify address list bug

login
register
mail settings
Submitter stephen hemminger
Date Oct. 6, 2009, 2:15 a.m.
Message ID <20091005191505.75c929a6@nehalam>
Download mbox | patch
Permalink /patch/35060/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Oct. 6, 2009, 2:15 a.m.
This fixes a bug with arp_notify and also adds a small enhancement.

If arp_notify is enabled, kernel will crash if address is changed
and no IP address is assigned.
  http://bugzilla.kernel.org/show_bug.cgi?id=14330

The fix is to walk the (possibly empty) list when sending
the gratuitous ARP's.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
This should go to stable kernel fixes as well.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Oct. 6, 2009, 3:13 a.m.
Stephen Hemminger a écrit :
> This fixes a bug with arp_notify and also adds a small enhancement.
> 
> If arp_notify is enabled, kernel will crash if address is changed
> and no IP address is assigned.
>   http://bugzilla.kernel.org/show_bug.cgi?id=14330
> 
> The fix is to walk the (possibly empty) list when sending
> the gratuitous ARP's.

> 
> -				 NULL, dev->dev_addr, NULL);
> +		/* Send gratitious ARP to notify of link change */

	/* gratuitous */

> +		if (IN_DEV_ARP_NOTIFY(in_dev)) {
> +			struct in_ifaddr *ifa;
> +			for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next)
> +				arp_send(ARPOP_REQUEST, ETH_P_ARP,
> +					 ifa->ifa_address, dev,
> +					 ifa->ifa_address, NULL,
> +					 dev->dev_addr, NULL);
> +		}

This sends a broadcast storm if device has a long address list.

Maybe we should change arp_notify to an INTEGER to be able to give a limit.

If people used to set arp_notify to 1, they wont be surprised too much.

I suggest splitting patch in two parts, one to fix the bug for linux-2.6 and stable,
and another one for net-next-2.6 for the enhancement ?

Thanks

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Oct. 6, 2009, 4:31 a.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 06 Oct 2009 05:13:00 +0200

> I suggest splitting patch in two parts, one to fix the bug for linux-2.6 and stable,
> and another one for net-next-2.6 for the enhancement ?
> 

Good idea.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/net/ipv4/devinet.c	2009-10-05 17:31:35.759514625 -0700
+++ b/net/ipv4/devinet.c	2009-10-05 17:44:04.204494945 -0700
@@ -1077,12 +1077,15 @@  static int inetdev_event(struct notifier
 		ip_mc_up(in_dev);
 		/* fall through */
 	case NETDEV_CHANGEADDR:
-		if (IN_DEV_ARP_NOTIFY(in_dev))
-			arp_send(ARPOP_REQUEST, ETH_P_ARP,
-				 in_dev->ifa_list->ifa_address,
-				 dev,
-				 in_dev->ifa_list->ifa_address,
-				 NULL, dev->dev_addr, NULL);
+		/* Send gratitious ARP to notify of link change */
+		if (IN_DEV_ARP_NOTIFY(in_dev)) {
+			struct in_ifaddr *ifa;
+			for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next)
+				arp_send(ARPOP_REQUEST, ETH_P_ARP,
+					 ifa->ifa_address, dev,
+					 ifa->ifa_address, NULL,
+					 dev->dev_addr, NULL);
+		}
 		break;
 	case NETDEV_DOWN:
 		ip_mc_down(in_dev);