Commit 6e4b3d91 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix handling of hellos in case of link outage.

parent a0ee038c
...@@ -125,8 +125,9 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -125,8 +125,9 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if(hello < 0) { if(hello < 0) {
if(neigh->hello_interval <= 0) if(neigh->hello_interval <= 0)
return rc; return rc;
missed_hellos = (timeval_minus_msec(&now, &neigh->hello_time) - missed_hellos =
neigh->hello_interval * 6) / (timeval_minus_msec(&now, &neigh->hello_time) -
neigh->hello_interval * 7) /
(neigh->hello_interval * 10); (neigh->hello_interval * 10);
if(missed_hellos <= 0) if(missed_hellos <= 0)
return rc; return rc;
...@@ -136,10 +137,17 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -136,10 +137,17 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if(neigh->hello_seqno >= 0 && neigh->reach > 0) { if(neigh->hello_seqno >= 0 && neigh->reach > 0) {
missed_hellos = seqno_minus(hello, neigh->hello_seqno) - 1; missed_hellos = seqno_minus(hello, neigh->hello_seqno) - 1;
if(missed_hellos < 0) { if(missed_hellos < 0) {
/* This neighbour has increased its hello interval, and we if(hello_interval > neigh->hello_interval) {
didn't notice. */ /* This neighbour has increased its hello interval,
neigh->reach <<= -missed_hellos; and we didn't notice. */
missed_hellos = 0; neigh->reach <<= -missed_hellos;
missed_hellos = 0;
} else {
/* Late hello. Probably due to the link layer buffering
packets during a link outage. Ignore it. */
hello = 0;
missed_hellos = 0;
}
rc = 1; rc = 1;
} }
} else { } else {
...@@ -151,6 +159,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -151,6 +159,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if(missed_hellos > 0) { if(missed_hellos > 0) {
neigh->reach >>= missed_hellos; neigh->reach >>= missed_hellos;
neigh->hello_seqno = (neigh->hello_seqno + missed_hellos) & 0xFFFF;
missed_hellos = 0; missed_hellos = 0;
rc = 1; rc = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment