diff options
author | Erik Kline <ek@google.com> | 2015-05-18 19:44:41 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2016-01-26 06:33:11 +0000 |
commit | bcb748c2268c08689e1e98a1d7c6bb3f540552e1 (patch) | |
tree | d7876d1fd66b309df14bebe3a63bb21405420e95 | |
parent | e603010c1d5abba2b652efa9b8009512c83564b1 (diff) |
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).
[Cherry-pick of upstream 765c9c639fbb132af0cafc6e1da22fe6cea26bb8]
Signed-off-by: Erik Kline <ek@google.com>
Acked-By: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/neighbour.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ef31fef25e5a..ad1c823a9e56 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -933,6 +933,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_VAR(neigh->parms, RETRANS_TIME); } } else { @@ -1164,6 +1165,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) ? |