Commit c7f860f2 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement -c.

parent 676a011e
......@@ -161,6 +161,11 @@ main(int argc, char **argv)
goto syntax;
} else if(strcmp(*arg, "-P") == 0) {
parasitic = 1;
} else if(strcmp(*arg, "-c") == 0) {
SHIFTE();
add_cost = atoi(*arg);
if(add_cost < 0 || add_cost > INFINITY)
goto syntax;
} else if(strcmp(*arg, "-s") == 0) {
split_horizon = 0;
} else if(strcmp(*arg, "-b") == 0) {
......@@ -485,9 +490,9 @@ main(int argc, char **argv)
" "
"[-h hello_interval] [-H wired_hello_interval]\n"
" "
"[-u update_interval] [-k metric] [-s] [-P] [-d level]\n"
"[-u update_interval] [-k metric] [-s] [-P] [-c cost]\n"
" "
"[-n net cost]... address interface...\n",
"[-d level] [-n net cost]... address interface...\n",
argv[0]);
exit(1);
......
......@@ -43,6 +43,7 @@ const unsigned char packet_header[4] = {42, 0, 0, 0};
unsigned int jitter;
unsigned int update_jitter;
int add_cost = 0;
int parasitic = 0;
int silent_time = 30;
int broadcast_txcost = 0;
......@@ -384,7 +385,7 @@ flushupdates(void)
route->nexthop->network == net)
continue;
seqno = route->seqno;
metric = route->metric;
metric = MIN(route->metric + add_cost, INFINITY);
} else {
seqno = buffered_updates[i]->seqno;
metric = INFINITY;
......
......@@ -26,6 +26,7 @@ extern int seqno_interval;
extern unsigned int jitter;
extern unsigned int update_jitter;
extern int add_cost;
extern int parasitic;
extern int silent_time;
extern int broadcast_txcost;
......
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