Commit cfdb93fc authored by Baptiste Jonglez's avatar Baptiste Jonglez Committed by Juliusz Chroboczek

Cap neighbour cost to INFINITY

With large txcost and rxcost, the calculated cost to a neighbour can
exceed 65535, i.e. INFINITY.  This is not a real issue, since any cost
over 65535 is equally seen as infinity.

However, it can confuse other tools (e.g. babelweb) who wouldn't
expect a cost higher than infinity.
parent 71fdd46d
......@@ -320,6 +320,6 @@ neighbour_cost(struct neighbour *neigh)
b = MAX(b, 256);
/* 1/(alpha * beta), which is just plain ETX. */
/* Since a and b are capped to 16 bits, overflow is impossible. */
return (a * b + 128) >> 8;
return MIN((a * b + 128) >> 8, 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