Skip to contentSkip to conversation

ipv4: arp: process only if ipv4 address configured

PATCH In review Florian Westphal 4 participants 6 messages Feb 12, 2014 – Feb 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: arp: process only if ipv4 address configured

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.

---
IMO such configurations are just asking for trouble, but it used to work on older kernels. Do we care about such setups?

net/ipv4/arp.c +1 -1
index 1a9b99e..8a44ed2 100644
@@ -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);
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 11 lines · 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.

What about arp_filter value/meaning ?

#2 lore raw
Quoted 9 lines · Eric Dumazet
Quoted 8 lines · 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.

Quoted 5 lines
Quoted 3 lines

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.

#3 lore raw
In reply to Florian Westphal
Quoted 11 lines · 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.

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

maintainer
#4 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 13 Feb 2014 01:24:13 +0100

Quoted 3 lines

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.

#5 lore raw
Quoted 8 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 13 Feb 2014 01:24:13 +0100

Quoted 3 lines

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.