netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: arp_notify address list bug
@ 2009-10-06  2:15 Stephen Hemminger
  2009-10-06  3:13 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2009-10-06  2:15 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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.

--- 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);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06  2:15 [PATCH] ipv4: arp_notify address list bug Stephen Hemminger
@ 2009-10-06  3:13 ` Eric Dumazet
  2009-10-06  4:31   ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2009-10-06  3:13 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06  3:13 ` Eric Dumazet
@ 2009-10-06  4:31   ` David Miller
  2009-10-06  5:20     ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-10-06  4:31 UTC (permalink / raw)
  To: eric.dumazet; +Cc: shemminger, netdev

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] ipv4: arp_notify address list bug
  2009-10-06  4:31   ` David Miller
@ 2009-10-06  5:20     ` Eric Dumazet
  2009-10-06 15:29       ` Stephen Hemminger
  2009-10-07 10:18       ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2009-10-06  5:20 UTC (permalink / raw)
  To: David Miller; +Cc: Hannes Frederic Sowa, shemminger, netdev

From: Stephen Hemminger <shemminger@vyatta.com>

This fixes a bug with arp_notify.

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

Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv4/devinet.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e92f1fd..5df2f6a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1077,12 +1077,16 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
 		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 gratuitous ARP to notify of link change */
+		if (IN_DEV_ARP_NOTIFY(in_dev)) {
+			struct in_ifaddr *ifa = in_dev->ifa_list;
+
+			if (ifa)
+				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);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06  5:20     ` Eric Dumazet
@ 2009-10-06 15:29       ` Stephen Hemminger
  2009-10-06 15:43         ` Eric Dumazet
  2009-10-07 10:18       ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2009-10-06 15:29 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Hannes Frederic Sowa, netdev

On Tue, 06 Oct 2009 07:20:19 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> 
> This fixes a bug with arp_notify.
> 
> 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
> 
> Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  net/ipv4/devinet.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index e92f1fd..5df2f6a 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -1077,12 +1077,16 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
>  		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 gratuitous ARP to notify of link change */
> +		if (IN_DEV_ARP_NOTIFY(in_dev)) {
> +			struct in_ifaddr *ifa = in_dev->ifa_list;
> +
> +			if (ifa)
> +				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);

Okay, but I can't see that sending out one per address is going to be a big
storm. Can't imagine user with 100's of addresses on same interface, but I guess
it is possible.

-- 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06 15:29       ` Stephen Hemminger
@ 2009-10-06 15:43         ` Eric Dumazet
  2009-10-06 21:19           ` Mark Smith
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2009-10-06 15:43 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, Hannes Frederic Sowa, netdev

Stephen Hemminger a écrit :
> 
> Okay, but I can't see that sending out one per address is going to be a big
> storm. Can't imagine user with 100's of addresses on same interface, but I guess
> it is possible.
> 

I saw some setups with hundred of ip addresses.

But they probably dont change MAC addresses very often :)

Who knows...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06 15:43         ` Eric Dumazet
@ 2009-10-06 21:19           ` Mark Smith
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Smith @ 2009-10-06 21:19 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Stephen Hemminger, David Miller, Hannes Frederic Sowa, netdev

On Tue, 06 Oct 2009 17:43:52 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Stephen Hemminger a écrit :
> > 
> > Okay, but I can't see that sending out one per address is going to be a big
> > storm. Can't imagine user with 100's of addresses on same interface, but I guess
> > it is possible.
> > 
> 
> I saw some setups with hundred of ip addresses.
> 
> But they probably dont change MAC addresses very often :)
> 
> Who knows...

Colo shared webhosts with per customer/site https/SSL certificates could
be an example.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ipv4: arp_notify address list bug
  2009-10-06  5:20     ` Eric Dumazet
  2009-10-06 15:29       ` Stephen Hemminger
@ 2009-10-07 10:18       ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2009-10-07 10:18 UTC (permalink / raw)
  To: eric.dumazet; +Cc: hannes, shemminger, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 06 Oct 2009 07:20:19 +0200

> From: Stephen Hemminger <shemminger@vyatta.com>
> 
> This fixes a bug with arp_notify.
> 
> 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
> 
> Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-10-07 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06  2:15 [PATCH] ipv4: arp_notify address list bug Stephen Hemminger
2009-10-06  3:13 ` Eric Dumazet
2009-10-06  4:31   ` David Miller
2009-10-06  5:20     ` Eric Dumazet
2009-10-06 15:29       ` Stephen Hemminger
2009-10-06 15:43         ` Eric Dumazet
2009-10-06 21:19           ` Mark Smith
2009-10-07 10:18       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).