From: Erik Kline Date: Mon, 18 May 2015 10:44:41 +0000 (+0900) Subject: neigh: Better handling of transition to NUD_PROBE state X-Git-Tag: firefly_0821_release~4090^2~1 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e4a6d6ba5a9e9e1796bbe6efe4f20ce7072df667;p=firefly-linux-kernel-4.4.55.git neigh: Better handling of transition to NUD_PROBE state [1] When entering NUD_PROBE state via neigh_update(), perhaps received from userspace, correctly (re)initialize the probes count to zero. This is useful for forcing revalidation of a neighbor (for example if the host is attempting to do DNA [IPv4 4436, IPv6 6059]). [2] Notify listeners when a neighbor goes into NUD_PROBE state. By sending notifications on entry to NUD_PROBE state listeners get more timely warnings of imminent connectivity issues. The current notifications on entry to NUD_STALE have somewhat limited usefulness: NUD_STALE is a perfectly normal state, as is NUD_DELAY, whereas notifications on entry to NUD_FAILURE come after a neighbor reachability problem has been confirmed (typically after three probes). Change-Id: I1d01d40ef3bc4753b0eaa79da2b27235425b1934 Signed-off-by: Erik Kline Acked-By: Lorenzo Colitti Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller --- diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 5c56b217b999..703cd2ac5f29 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -926,6 +926,7 @@ static void neigh_timer_handler(unsigned long arg) neigh->nud_state = NUD_PROBE; neigh->updated = jiffies; atomic_set(&neigh->probes, 0); + notify = 1; next = now + neigh->parms->retrans_time; } } else { @@ -1153,6 +1154,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, if (new != old) { neigh_del_timer(neigh); + if (new & NUD_PROBE) + atomic_set(&neigh->probes, 0); if (new & NUD_IN_TIMER) neigh_add_timer(neigh, (jiffies + ((new & NUD_REACHABLE) ?