diff mbox

[net-next,2/2] arp: flush arp cache on IFF_NOARP change

Message ID 1369303109-12003-2-git-send-email-timo.teras@iki.fi
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Timo Teras May 23, 2013, 9:58 a.m. UTC
IFF_NOARP affects what kind of neighbor entries are created
(nud NOARP or nud INCOMPLETE). If the flag changes, flush the arp
cache to refresh all entries.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
 net/ipv4/arp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Timo Teras May 23, 2013, 12:01 p.m. UTC | #1
On Thu, 23 May 2013 11:23:28 +0100
"David Laight" <David.Laight@ACULAB.COM> wrote:

> > IFF_NOARP affects what kind of neighbor entries are created
> > (nud NOARP or nud INCOMPLETE). If the flag changes, flush the arp
> > cache to refresh all entries.
> 
> Might someone want to use this to stop further arp table
> entries being created?
> In which case you don't want anything flushed.

I don't think that would make any sense. The entries we have would
expire soon, and the other hosts would not be able to get arp replies
for our host.

Normally this flag is not changed. My use case is with ip gre tunnels,
and starting opennhrp daemon. Opennhrp enables address resolution via
netlink for gre tunnels - it turns off NOARP flag and configures real
ARP off and enables netlink ARPD requests. If before startup there was
traffic to gre tunnel, there will be stale NOARP entries preventing
traffic after daemon is started.

- Timo
--
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
diff mbox

Patch

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 247ec19..0a15fb7 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1241,6 +1241,10 @@  static int arp_netdev_event(struct notifier_block *this, unsigned long event,
 		neigh_changeaddr(&arp_tbl, dev);
 		rt_cache_flush(dev_net(dev));
 		break;
+	case NETDEV_CHANGE:
+		if (dev->flags_changed & IFF_NOARP)
+			neigh_changeaddr(&arp_tbl, dev);
+		break;
 	default:
 		break;
 	}