Commit 6a3bd794 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement hello-interval configuration option.

parent 90616166
......@@ -363,6 +363,12 @@ parse_nconf(gnc_t gnc, void *closure)
if(c < -1 || cost <= 0 || cost > 0xFFFF)
goto error;
nconf->cost = cost;
} else if(strcmp(token, "hello-interval") == 0) {
int interval;
c = getint(c, &interval, gnc, closure);
if(c < -1 || interval <= 0 || interval > 0xFFFF)
goto error;
nconf->hello_interval = interval;
} else {
goto error;
}
......
......@@ -99,22 +99,20 @@ int
update_hello_interval(struct network *net)
{
int rc = 0;
unsigned short interval;
if(network_idle(net))
interval = idle_hello_interval;
else if(NET_CONF(net, hello_interval, 0) > 0)
interval = NET_CONF(net, hello_interval, 0);
else if((net->flags & NET_WIRED))
interval = wired_hello_interval;
else
interval = wireless_hello_interval;
if(network_idle(net)) {
if(net->hello_interval != idle_hello_interval) {
net->hello_interval = idle_hello_interval;
rc = 1;
}
} else if((net->flags & NET_WIRED)) {
if(net->hello_interval != wired_hello_interval) {
net->hello_interval = wired_hello_interval;
if(net->hello_interval != interval) {
net->hello_interval = interval;
rc = 1;
}
} else {
if(net->hello_interval != wireless_hello_interval) {
net->hello_interval = wireless_hello_interval;
rc = 1;
}
}
net->self_update_interval =
......
......@@ -30,6 +30,7 @@ struct buffered_update {
struct network_conf {
char *ifname;
unsigned short cost;
unsigned short hello_interval;
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