Commit 3a5ae8ee authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Allow update_xroute_metric to deal with blackhole xroutes.

parent dc905c81
......@@ -286,16 +286,13 @@ update_xroute_metric(struct xroute *xroute, int cost)
int rc;
gwroute = find_installed_route(xroute->gateway);
if(!gwroute)
return;
oldmetric = xroute->metric;
newmetric = MIN(gwroute->metric + cost, INFINITY);
newmetric = gwroute ? MIN(gwroute->metric + cost, INFINITY) : INFINITY;
if(xroute->cost != cost || oldmetric != newmetric) {
xroute->cost = cost;
if(xroute->installed) {
struct route *gwroute = find_installed_route(xroute->gateway);
if(gwroute == NULL) {
fprintf(stderr, "Found installed blackhole xroute!.\n");
return;
......
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