Commit 42d655e6 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Change calling sequence of update_feasible.

This avoids searching for the source again.
parent edda7de4
...@@ -228,17 +228,13 @@ change_route_metric(struct route *route, unsigned newmetric) ...@@ -228,17 +228,13 @@ change_route_metric(struct route *route, unsigned newmetric)
int int
route_feasible(struct route *route) route_feasible(struct route *route)
{ {
return update_feasible(route->src->id, return update_feasible(route->src, route->seqno, route->refmetric);
route->src->prefix, route->src->plen,
route->seqno, route->refmetric);
} }
int int
update_feasible(const unsigned char *id, update_feasible(struct source *src,
const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric) unsigned short seqno, unsigned short refmetric)
{ {
struct source *src = find_source(id, p, plen, 0, 0);
if(src == NULL) if(src == NULL)
return 1; return 1;
...@@ -359,7 +355,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen, ...@@ -359,7 +355,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
if(src == NULL) if(src == NULL)
return NULL; return NULL;
feasible = update_feasible(a, p, plen, seqno, refmetric); feasible = update_feasible(src, seqno, refmetric);
route = find_route(p, plen, neigh, nexthop); route = find_route(p, plen, neigh, nexthop);
metric = MIN((int)refmetric + neighbour_cost(neigh) + add_metric, INFINITY); metric = MIN((int)refmetric + neighbour_cost(neigh) + add_metric, INFINITY);
......
...@@ -47,8 +47,7 @@ void uninstall_route(struct route *route); ...@@ -47,8 +47,7 @@ void uninstall_route(struct route *route);
void switch_route(struct route *old, struct route *new); void switch_route(struct route *old, struct route *new);
void change_route_metric(struct route *route, unsigned newmetric); void change_route_metric(struct route *route, unsigned newmetric);
int route_feasible(struct route *route); int route_feasible(struct route *route);
int update_feasible(const unsigned char *id, int update_feasible(struct source *src,
const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric); unsigned short seqno, unsigned short refmetric);
struct route *find_best_route(const unsigned char *prefix, unsigned char plen, struct route *find_best_route(const unsigned char *prefix, unsigned char plen,
int feasible, struct neighbour *exclude); int feasible, struct neighbour *exclude);
......
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