Commit 13f0c503 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use unicast Hellos for reachability on wired links.

parent 643c839c
...@@ -256,15 +256,32 @@ check_neighbours() ...@@ -256,15 +256,32 @@ check_neighbours()
return msecs; return msecs;
} }
/* To lose one hello is a misfortune, to lose two is carelessness. */
static int
two_three(int reach)
{
if((reach & 0xC000) == 0xC000)
return 1;
else if((reach & 0xC000) == 0)
return 0;
else if((reach & 0x2000))
return 1;
else
return 0;
}
unsigned unsigned
neighbour_rxcost(struct neighbour *neigh) neighbour_rxcost(struct neighbour *neigh)
{ {
unsigned delay; unsigned delay, udelay;
unsigned short reach = neigh->hello.reach; unsigned short reach = neigh->hello.reach;
unsigned short ureach = neigh->uhello.reach;
delay = timeval_minus_msec(&now, &neigh->hello.time); delay = timeval_minus_msec(&now, &neigh->hello.time);
udelay = timeval_minus_msec(&now, &neigh->uhello.time);
if((reach & 0xFFF0) == 0 || delay >= 180000) { if(((reach & 0xFFF0) == 0 || delay >= 180000) &&
((ureach & 0xFFF0) == 0 || udelay >= 180000)) {
return INFINITY; return INFINITY;
} else if((neigh->ifp->flags & IF_LQ)) { } else if((neigh->ifp->flags & IF_LQ)) {
int sreach = int sreach =
...@@ -278,12 +295,7 @@ neighbour_rxcost(struct neighbour *neigh) ...@@ -278,12 +295,7 @@ neighbour_rxcost(struct neighbour *neigh)
cost = (cost * (delay - 20000) + 10000) / 20000; cost = (cost * (delay - 20000) + 10000) / 20000;
return MIN(cost, INFINITY); return MIN(cost, INFINITY);
} else { } else {
/* To lose one hello is a misfortune, to lose two is carelessness. */ if(two_three(reach) || two_three(ureach))
if((reach & 0xC000) == 0xC000)
return neigh->ifp->cost;
else if((reach & 0xC000) == 0)
return INFINITY;
else if((reach & 0x2000))
return neigh->ifp->cost; return neigh->ifp->cost;
else else
return INFINITY; return INFINITY;
......
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