Commit 8a495801 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use retract_route in sundry places.

parent d714dca1
......@@ -333,31 +333,30 @@ find_best_route(const unsigned char *prefix, unsigned char plen, int feasible,
void
update_route_metric(struct route *route)
{
int oldmetric;
int newmetric;
int oldmetric = route_metric(route);
oldmetric = route_metric(route);
if(route_expired(route)) {
if(route->refmetric < INFINITY) {
route->seqno = seqno_plus(route->src->seqno, 1);
route->refmetric = INFINITY;
retract_route(route);
if(oldmetric < INFINITY)
route_changed(route, route->src, oldmetric);
}
newmetric = INFINITY;
} else {
struct neighbour *neigh = route->neigh;
int add_metric = input_filter(route->src->id,
route->src->prefix, route->src->plen,
neigh->address,
neigh->network->ifindex);
newmetric = MIN(route->refmetric +
add_metric +
neighbour_cost(route->neigh),
INFINITY);
}
if(newmetric != oldmetric) {
change_route_metric(route, newmetric);
route_changed(route, route->src, oldmetric);
int newmetric = MIN(route->refmetric +
add_metric +
neighbour_cost(route->neigh),
INFINITY);
if(newmetric != oldmetric) {
change_route_metric(route, newmetric);
route_changed(route, route->src, oldmetric);
}
}
}
......@@ -581,7 +580,7 @@ retract_neighbour_routes(struct neighbour *neigh)
if(routes[i].neigh == neigh) {
unsigned short oldmetric = route_metric(&routes[i]);
if(oldmetric != INFINITY) {
change_route_metric(&routes[i], INFINITY);
retract_route(&routes[i]);
route_changed(&routes[i], routes[i].src, oldmetric);
}
}
......
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