public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* Issue with gratuitous arps when new addr is different from cached addr
@ 2013-11-21  0:40 Salam Noureddine
  2013-11-21  4:40 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Salam Noureddine @ 2013-11-21  0:40 UTC (permalink / raw)
  To: David S. Miller, Daniel Borkmann, Willem de Bruijn, Phil Sutter,
	Eric Dumazet, netdev

Hi,

It seems to me that neigh_update is not handling correctly the case
when the new address is different from the cached one and
NEIGH_UPDATE_F_OVERRIDE is not set. When we receive a gratuitous arp
request we check jiffies against the neigh->updated + locktime in
arp_process. If we're passed that time then the flag is set.

In neigh_update, we set neigh->updated before checking for the case
where we have a new address and the override flag is not set. This
means, that we "extend the life of the old address". By setting
locktime to 2 sec and sending an arp with a new address every 1 sec, I
was able to perpetuate the old entry for as long as I wanted.

To fix this, we can just move setting neigh->updated to after the
check for new address and override flag not present,

--- linux-3.4.orig/net/core/neighbour.c
+++ linux-3.4/net/core/neighbour.c
@@ -1206,10 +1206,6 @@ int neigh_update(struct neighbour *neigh
                lladdr = neigh->ha;
        }

-       if (new & NUD_CONNECTED)
-               neigh->confirmed = jiffies;
-       neigh->updated = jiffies;
-
        /* If entry was valid and address is not changed,
           do not change entry state, if new one is STALE.
         */
@@ -1233,6 +1229,10 @@ int neigh_update(struct neighbour *neigh
                }
        }

+       if (new & NUD_CONNECTED)
+               neigh->confirmed = jiffies;
+       neigh->updated = jiffies;
+
        if (new != old) {
                neigh_del_timer(neigh);
                if (new & NUD_IN_TIMER)

If that seems like a an acceptable solution, I would post a patch shortly.

Thanks,

Salam

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

end of thread, other threads:[~2013-11-21  6:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21  0:40 Issue with gratuitous arps when new addr is different from cached addr Salam Noureddine
2013-11-21  4:40 ` Hannes Frederic Sowa
2013-11-21  6:06   ` Salam Noureddine
2013-11-21  6:23     ` Hannes Frederic Sowa
2013-11-21  6:26       ` Hannes Frederic Sowa
2013-11-21  6:33       ` Salam Noureddine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox