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