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

Add feasible parameter to find_best_route.

parent 14eb3454
......@@ -242,7 +242,7 @@ update_feasible(const unsigned char *a,
/* This returns the feasible route with the smallest metric. */
struct route *
find_best_route(const unsigned char *prefix, unsigned char plen)
find_best_route(const unsigned char *prefix, unsigned char plen, int feasible)
{
struct route *route = NULL;
int i;
......@@ -252,7 +252,7 @@ find_best_route(const unsigned char *prefix, unsigned char plen)
continue;
if(routes[i].time < now.tv_sec - route_timeout_delay)
continue;
if(!route_feasible(&routes[i]))
if(feasible && !route_feasible(&routes[i]))
continue;
if(route && route->metric <= routes[i].metric)
continue;
......@@ -575,7 +575,7 @@ trigger_route_change(struct route *route,
if(route->metric > oldmetric) {
struct route *better_route;
better_route =
find_best_route(route->src->prefix, route->src->plen);
find_best_route(route->src->prefix, route->src->plen, 1);
if(better_route && better_route->metric <= route->metric - 96)
consider_route(better_route);
}
......@@ -593,7 +593,7 @@ void
route_lost(struct source *src, int oldmetric)
{
struct route *new_route;
new_route = find_best_route(src->prefix, src->plen);
new_route = find_best_route(src->prefix, src->plen, 1);
if(new_route) {
consider_route(new_route);
} else {
......
......@@ -53,7 +53,8 @@ int route_feasible(struct route *route);
int update_feasible(const unsigned char *a,
const unsigned char *p, unsigned char plen,
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 route *install_best_route(const unsigned char prefix[16],
unsigned char plen);
void update_neighbour_metric(struct neighbour *neigh);
......
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