Commit 91e69d82 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't consider infinite metric xroutes if not blackhole routes.

parent 03475d29
......@@ -73,12 +73,14 @@ find_best_xroute(unsigned char *prefix, unsigned short plen)
int i;
for(i = 0; i < numxroutes; i++) {
if(xroutes[i].plen == plen &&
memcmp(xroutes[i].prefix, prefix, 16) == 0) {
if((!xroute || xroutes[i].metric < xroute->metric) &&
find_installed_route(xroutes[i].gateway) != NULL)
xroute = &xroutes[i];
}
if(xroutes[i].metric >= INFINITY && xroutes[i].cost < INFINITY)
continue;
if(xroutes[i].plen != plen ||
memcmp(xroutes[i].prefix, prefix, 16) != 0)
continue;
if((!xroute || xroutes[i].metric < xroute->metric) &&
find_installed_route(xroutes[i].gateway) != NULL)
xroute = &xroutes[i];
}
return xroute;
}
......@@ -93,6 +95,9 @@ install_xroute(struct xroute *xroute)
if(xroute->installed)
return;
if(xroute->metric >= INFINITY && xroute->cost < INFINITY)
return;
if(xroute->plen >= 8 &&
(xroute->prefix[0] == 0 || xroute->prefix[0] == 0xFF)) {
fprintf(stderr, "Attempted to install martian xroute.\n");
......
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