netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: arp: process only if ipv4 address configured
@ 2014-02-12 17:27 Florian Westphal
  2014-02-12 18:26 ` Eric Dumazet
  2014-02-13  0:24 ` Hannes Frederic Sowa
  0 siblings, 2 replies; 6+ messages in thread
From: Florian Westphal @ 2014-02-12 17:27 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

8030f54499925d073a88c09f ([IPV4] devinet: Register inetdev earlier.)
changed arp behaviour (2.6.22 onwards).

Before this, inetdev_init() was called only when the first address was
added to the interface, i.e. arp_process always dropped incoming arp
packets as __in_dev_get_rcu() returned NULL when no IP address was set
on the interface.

With >= 2.6.22 we now process arp packets even if no address is assigned.
It can cause issues if the machine has several interfaces in the same
segment; requests receive answers from multiple macs.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
IMO such configurations are just asking for trouble, but it used
to work on older kernels.  Do we care about such setups?

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1a9b99e..8a44ed2 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -738,7 +738,7 @@ static int arp_process(struct sk_buff *skb)
 	 * is ARP'able.
 	 */
 
-	if (in_dev == NULL)
+	if (in_dev == NULL || in_dev->ifa_list == NULL)
 		goto out;
 
 	arp = arp_hdr(skb);
-- 
1.8.1.5

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

* Re: [PATCH] ipv4: arp: process only if ipv4 address configured
  2014-02-12 17:27 [PATCH] ipv4: arp: process only if ipv4 address configured Florian Westphal
@ 2014-02-12 18:26 ` Eric Dumazet
  2014-02-12 22:01   ` Florian Westphal
  2014-02-13  0:24 ` Hannes Frederic Sowa
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2014-02-12 18:26 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev

On Wed, 2014-02-12 at 18:27 +0100, Florian Westphal wrote:
> 8030f54499925d073a88c09f ([IPV4] devinet: Register inetdev earlier.)
> changed arp behaviour (2.6.22 onwards).
> 
> Before this, inetdev_init() was called only when the first address was
> added to the interface, i.e. arp_process always dropped incoming arp
> packets as __in_dev_get_rcu() returned NULL when no IP address was set
> on the interface.
> 
> With >= 2.6.22 we now process arp packets even if no address is assigned.
> It can cause issues if the machine has several interfaces in the same
> segment; requests receive answers from multiple macs.


What about arp_filter value/meaning ?

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

* Re: [PATCH] ipv4: arp: process only if ipv4 address configured
  2014-02-12 18:26 ` Eric Dumazet
@ 2014-02-12 22:01   ` Florian Westphal
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Westphal @ 2014-02-12 22:01 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Florian Westphal, netdev

Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2014-02-12 at 18:27 +0100, Florian Westphal wrote:
> > 8030f54499925d073a88c09f ([IPV4] devinet: Register inetdev earlier.)
> > changed arp behaviour (2.6.22 onwards).
> > 
> > Before this, inetdev_init() was called only when the first address was
> > added to the interface, i.e. arp_process always dropped incoming arp
> > packets as __in_dev_get_rcu() returned NULL when no IP address was set
> > on the interface.
> > 
> > With >= 2.6.22 we now process arp packets even if no address is assigned.
> > It can cause issues if the machine has several interfaces in the same
> > segment; requests receive answers from multiple macs.
> 
> What about arp_filter value/meaning ?

Sure, arp_filter=1 avoids this.

If you mean "we don't care, its been like this for years and if you
don't want it then set arp_filter=1" -- fine with me.

Sorry if this wasn't clear -- its more about the change in behaviour
and if we should care.

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

* Re: [PATCH] ipv4: arp: process only if ipv4 address configured
  2014-02-12 17:27 [PATCH] ipv4: arp: process only if ipv4 address configured Florian Westphal
  2014-02-12 18:26 ` Eric Dumazet
@ 2014-02-13  0:24 ` Hannes Frederic Sowa
  2014-02-13  0:25   ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2014-02-13  0:24 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev

On Wed, Feb 12, 2014 at 06:27:47PM +0100, Florian Westphal wrote:
> 8030f54499925d073a88c09f ([IPV4] devinet: Register inetdev earlier.)
> changed arp behaviour (2.6.22 onwards).
> 
> Before this, inetdev_init() was called only when the first address was
> added to the interface, i.e. arp_process always dropped incoming arp
> packets as __in_dev_get_rcu() returned NULL when no IP address was set
> on the interface.
> 
> With >= 2.6.22 we now process arp packets even if no address is assigned.
> It can cause issues if the machine has several interfaces in the same
> segment; requests receive answers from multiple macs.

I actually expect arp answers for ip addresses bound to loopback even from an
interface without ip address, if we strictly conform to the week end host
model in linux.

This is e.g. a common setup for BGP routers, where you assign the IBGP
address to loopback or dummy and thus make it interface independent.

Greetings,

  Hannes

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

* Re: [PATCH] ipv4: arp: process only if ipv4 address configured
  2014-02-13  0:24 ` Hannes Frederic Sowa
@ 2014-02-13  0:25   ` David Miller
  2014-02-13  8:56     ` Florian Westphal
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2014-02-13  0:25 UTC (permalink / raw)
  To: hannes; +Cc: fw, netdev

From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Thu, 13 Feb 2014 01:24:13 +0100

> I actually expect arp answers for ip addresses bound to loopback even from an
> interface without ip address, if we strictly conform to the week end host
> model in linux.

Agreed.

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

* Re: [PATCH] ipv4: arp: process only if ipv4 address configured
  2014-02-13  0:25   ` David Miller
@ 2014-02-13  8:56     ` Florian Westphal
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Westphal @ 2014-02-13  8:56 UTC (permalink / raw)
  To: David Miller; +Cc: hannes, fw, netdev

David Miller <davem@davemloft.net> wrote:
> From: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Date: Thu, 13 Feb 2014 01:24:13 +0100
> 
> > I actually expect arp answers for ip addresses bound to loopback even from an
> > interface without ip address, if we strictly conform to the week end host
> > model in linux.
> 
> Agreed.

Thanks for your inpout everyone.  I've self-rejected the patch.

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

end of thread, other threads:[~2014-02-13  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 17:27 [PATCH] ipv4: arp: process only if ipv4 address configured Florian Westphal
2014-02-12 18:26 ` Eric Dumazet
2014-02-12 22:01   ` Florian Westphal
2014-02-13  0:24 ` Hannes Frederic Sowa
2014-02-13  0:25   ` David Miller
2014-02-13  8:56     ` Florian Westphal

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