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