Commit 0c3cbd37 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement -u: keep unfeasible routes.

This is useful in order to provide extra information to a graphic
front-end.  In can cause the RIB to explode in some pathological cases,
so it is not the default.
parent ec07953a
......@@ -125,7 +125,7 @@ main(int argc, char **argv)
protocol_port = 6697;
while(1) {
opt = getopt(argc, argv, "m:p:h:H:i:k:A:PsS:d:g:lwt:T:c:C:DL:I:");
opt = getopt(argc, argv, "m:p:h:H:i:k:A:PsuS:d:g:lwt:T:c:C:DL:I:");
if(opt < 0)
break;
......@@ -180,6 +180,9 @@ main(int argc, char **argv)
case 's':
split_horizon = 0;
break;
case 'u':
keep_unfeasible = 1;
break;
case 'S':
state_file = optarg;
break;
......@@ -776,11 +779,11 @@ main(int argc, char **argv)
" "
"[-h hello] [-H wired_hello] [-i idle_hello]\n"
" "
"[-k metric] [-A metric] [-s] [-P] [-l] [-w] [-d level] [-g port]\n"
"[-k metric] [-A metric] [-s] [-P] [-l] [-w] [-u] [-g port]\n"
" "
"[-t table] [-T table] [-c file] [-C statement]\n"
" "
"[-D] [-L logfile] [-I pidfile]\n"
"[-d level] [-D] [-L logfile] [-I pidfile]\n"
" "
"[id] interface...\n",
argv[0]);
......
......@@ -44,6 +44,7 @@ struct route *routes = NULL;
int numroutes = 0, maxroutes = 0;
int kernel_metric = 0;
int allow_duplicates = -1;
int keep_unfeasible = 0;
struct route *
find_route(const unsigned char *prefix, unsigned char plen,
......@@ -455,7 +456,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
}
route->src = src;
if(feasible && refmetric < INFINITY)
if((feasible || keep_unfeasible) && refmetric < INFINITY)
route->time = now.tv_sec;
route->seqno = seqno;
route->refmetric = refmetric;
......@@ -475,8 +476,10 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return NULL;
if(!feasible) {
send_unfeasible_request(neigh, 0, seqno, metric, src);
if(!keep_unfeasible)
return NULL;
}
if(numroutes >= maxroutes) {
struct route *new_routes;
int n = maxroutes < 1 ? 8 : 2 * maxroutes;
......
......@@ -41,6 +41,7 @@ route_metric(const struct route *route)
extern struct route *routes;
extern int numroutes, maxroutes;
extern int kernel_metric, allow_duplicates;
extern int keep_unfeasible;
struct route *find_route(const unsigned char *prefix, unsigned char plen,
struct neighbour *neigh, const unsigned char *nexthop);
......
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