All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bonding: send arp requests even if there's no route to them
@ 2014-02-28 10:57 Veaceslav Falico
  2014-02-28 11:12 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Veaceslav Falico @ 2014-02-28 10:57 UTC (permalink / raw)
  To: netdev
  Cc: Veaceslav Falico, François CACHEREUL, Zhenjie Chen,
	Jay Vosburgh, Andy Gospodarek

Currently we're only sending arp requests if we have a route to the target
(and, thus, can find out the source ip address).

There are some use cases, however, where we don't want/need to set an ip
address (or set up a specific route) for bonding to use arp monitoring *for
traffic generation*. We can easily send arp probes (arp requests with src
ip == 0) to generate arp broadcast responses from the target ip and use
them for determining if the target is up.

This, obviously, won't work with arp validation - because we don't have the
ip address set and, thus, will filter out the responses. So in that case -
print a warning.

CC: François CACHEREUL <f.cachereul@alphalink.fr>
CC: Zhenjie Chen <zhchen@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 12948b3..a217536 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2155,8 +2155,13 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
 		rt = ip_route_output(dev_net(bond->dev), targets[i], 0,
 				     RTO_ONLINK, 0);
 		if (IS_ERR(rt)) {
-			pr_debug("%s: no route to arp_ip_target %pI4\n",
-				 bond->dev->name, &targets[i]);
+			/* there's no route to target - try to send arp
+			 * probe to generate any traffic (arp_validate=0)
+			 */
+			if (bond->params.arp_validate)
+				pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
+					bond->dev->name, &targets[i]);
+			bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 0, 0);
 			continue;
 		}
 
-- 
1.8.4

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

* Re: [PATCH net-next] bonding: send arp requests even if there's no route to them
  2014-02-28 10:57 [PATCH net-next] bonding: send arp requests even if there's no route to them Veaceslav Falico
@ 2014-02-28 11:12 ` Joe Perches
  2014-02-28 11:28   ` Veaceslav Falico
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-02-28 11:12 UTC (permalink / raw)
  To: Veaceslav Falico
  Cc: netdev, François CACHEREUL, Zhenjie Chen, Jay Vosburgh,
	Andy Gospodarek

On Fri, 2014-02-28 at 11:57 +0100, Veaceslav Falico wrote:
> Currently we're only sending arp requests if we have a route to the target
> (and, thus, can find out the source ip address).
> 
> There are some use cases, however, where we don't want/need to set an ip
> address (or set up a specific route) for bonding to use arp monitoring *for
> traffic generation*. We can easily send arp probes (arp requests with src
> ip == 0) to generate arp broadcast responses from the target ip and use
> them for determining if the target is up.
> 
> This, obviously, won't work with arp validation - because we don't have the
> ip address set and, thus, will filter out the responses. So in that case -
> print a warning.
[]
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
[]
> @@ -2155,8 +2155,13 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
[]
> +			if (bond->params.arp_validate)
> +				pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
> +					bond->dev->name, &targets[i]);

Maybe

			if (bond->params.arp_validate && net_ratelimit())

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

* Re: [PATCH net-next] bonding: send arp requests even if there's no route to them
  2014-02-28 11:12 ` Joe Perches
@ 2014-02-28 11:28   ` Veaceslav Falico
  2014-02-28 11:38     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Veaceslav Falico @ 2014-02-28 11:28 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, François CACHEREUL, Zhenjie Chen, Jay Vosburgh,
	Andy Gospodarek

On Fri, Feb 28, 2014 at 03:12:51AM -0800, Joe Perches wrote:
>On Fri, 2014-02-28 at 11:57 +0100, Veaceslav Falico wrote:
...snip...
>> +			if (bond->params.arp_validate)
>> +				pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
>> +					bond->dev->name, &targets[i]);
>
>Maybe
>
>			if (bond->params.arp_validate && net_ratelimit())

Hm, not that I'm against it - but bond_arp_send_all() is called every
arp_interval - which is usually >50ms. Does it really make sense to put it
here?

Thanks for a quick review!

>
>

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

* Re: [PATCH net-next] bonding: send arp requests even if there's no route to them
  2014-02-28 11:28   ` Veaceslav Falico
@ 2014-02-28 11:38     ` Joe Perches
  2014-02-28 11:40       ` Veaceslav Falico
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-02-28 11:38 UTC (permalink / raw)
  To: Veaceslav Falico
  Cc: netdev, François CACHEREUL, Zhenjie Chen, Jay Vosburgh,
	Andy Gospodarek

On Fri, 2014-02-28 at 12:28 +0100, Veaceslav Falico wrote:
> On Fri, Feb 28, 2014 at 03:12:51AM -0800, Joe Perches wrote:
> >On Fri, 2014-02-28 at 11:57 +0100, Veaceslav Falico wrote:
> ...snip...
> >> +			if (bond->params.arp_validate)
> >> +				pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
> >> +					bond->dev->name, &targets[i]);
> >
> >Maybe
> >
> >			if (bond->params.arp_validate && net_ratelimit())
> 
> Hm, not that I'm against it - but bond_arp_send_all() is called every
> arp_interval - which is usually >50ms. Does it really make sense to put it
> here?

Dunno, but you're converting a generally not emitted pr_debug
(DEBUG isn't set, so it'd have to be enabled by dynamic_debug)
to something that'll always print out a line for each of up to
16 targets, so it seems it could be pretty noisy.

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

* Re: [PATCH net-next] bonding: send arp requests even if there's no route to them
  2014-02-28 11:38     ` Joe Perches
@ 2014-02-28 11:40       ` Veaceslav Falico
  0 siblings, 0 replies; 5+ messages in thread
From: Veaceslav Falico @ 2014-02-28 11:40 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, François CACHEREUL, Zhenjie Chen, Jay Vosburgh,
	Andy Gospodarek

On Fri, Feb 28, 2014 at 03:38:19AM -0800, Joe Perches wrote:
>On Fri, 2014-02-28 at 12:28 +0100, Veaceslav Falico wrote:
>> On Fri, Feb 28, 2014 at 03:12:51AM -0800, Joe Perches wrote:
>> >On Fri, 2014-02-28 at 11:57 +0100, Veaceslav Falico wrote:
>> ...snip...
>> >> +			if (bond->params.arp_validate)
>> >> +				pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
>> >> +					bond->dev->name, &targets[i]);
>> >
>> >Maybe
>> >
>> >			if (bond->params.arp_validate && net_ratelimit())
>>
>> Hm, not that I'm against it - but bond_arp_send_all() is called every
>> arp_interval - which is usually >50ms. Does it really make sense to put it
>> here?
>
>Dunno, but you're converting a generally not emitted pr_debug
>(DEBUG isn't set, so it'd have to be enabled by dynamic_debug)
>to something that'll always print out a line for each of up to
>16 targets, so it seems it could be pretty noisy.

Yeah, completely agree (I've missed that there might be 16 targets).

Thanks a lot, will resend.

>
>

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

end of thread, other threads:[~2014-02-28 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28 10:57 [PATCH net-next] bonding: send arp requests even if there's no route to them Veaceslav Falico
2014-02-28 11:12 ` Joe Perches
2014-02-28 11:28   ` Veaceslav Falico
2014-02-28 11:38     ` Joe Perches
2014-02-28 11:40       ` Veaceslav Falico

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.