Commit fb475f71 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement rxcost configuration keyword.

parent 6f530114
...@@ -357,7 +357,15 @@ parse_nconf(gnc_t gnc, void *closure) ...@@ -357,7 +357,15 @@ parse_nconf(gnc_t gnc, void *closure)
if(c < -1) if(c < -1)
goto error; goto error;
goto error; /* for now */ if(strcmp(token, "rxcost") == 0) {
int cost;
c = getint(c, &cost, gnc, closure);
if(c < -1 || cost <= 0 || cost > 0xFFFF)
goto error;
nconf->cost = cost;
} else {
goto error;
}
} }
return nconf; return nconf;
......
...@@ -261,12 +261,14 @@ network_up(struct network *net, int up) ...@@ -261,12 +261,14 @@ network_up(struct network *net, int up)
if(wired) { if(wired) {
net->flags |= NET_WIRED; net->flags |= NET_WIRED;
net->cost = 96; net->cost =
net->conf && net->conf->cost > 0 ? net->conf->cost : 96;
if(split_horizon) if(split_horizon)
net->flags |= NET_SPLIT_HORIZON; net->flags |= NET_SPLIT_HORIZON;
} else { } else {
net->flags &= ~NET_WIRED; net->flags &= ~NET_WIRED;
net->cost = 256; net->cost =
net->conf && net->conf->cost > 0 ? net->conf->cost : 256;
} }
update_hello_interval(net); update_hello_interval(net);
......
...@@ -29,6 +29,7 @@ struct buffered_update { ...@@ -29,6 +29,7 @@ struct buffered_update {
struct network_conf { struct network_conf {
char *ifname; char *ifname;
unsigned short cost;
struct network_conf *next; struct network_conf *next;
}; };
......
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