Commit f775438a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make update-interval a per-interface value.

The -u flag is gone, update-interval defaults to five times the hello interval.
parent fc490571
......@@ -65,7 +65,6 @@ int all_wireless = 0;
int wireless_hello_interval = -1;
int wired_hello_interval = -1;
int idle_hello_interval = -1;
int update_interval = -1;
int do_daemonise = 0;
char *logfile = NULL, *pidfile = "/var/run/babel.pid";
......@@ -173,11 +172,6 @@ main(int argc, char **argv)
idle_hello_interval = parse_msec(*arg);
if(idle_hello_interval <= 0 || idle_hello_interval > 0xFFFF * 10)
goto syntax;
} else if(strcmp(*arg, "-u") == 0) {
SHIFTE();
update_interval = parse_msec(*arg);
if(update_interval <= 0 || update_interval > 0xFFFF * 10)
goto syntax;
} else if(strcmp(*arg, "-k") == 0) {
SHIFTE();
kernel_metric = atoi(*arg);
......@@ -260,12 +254,6 @@ main(int argc, char **argv)
wired_hello_interval = 20000;
wired_hello_interval = MAX(wired_hello_interval, 5);
if(update_interval <= 0)
update_interval =
MIN(MIN(wireless_hello_interval * 5, wired_hello_interval * 2),
70000);
update_interval = MAX(update_interval, 70);
if(do_daemonise) {
if(logfile == NULL)
logfile = "/var/log/babel.log";
......
......@@ -98,7 +98,6 @@ extern unsigned char protocol_group[16];
extern int protocol_socket;
extern int kernel_socket;
extern int max_request_hopcount;
extern int update_interval;
void schedule_neighbours_check(int msecs, int override);
int resize_receive_buffer(int size);
......@@ -774,7 +774,7 @@ really_send_update(struct network *net,
accumulate_byte(net, flags);
accumulate_byte(net, real_plen);
accumulate_byte(net, omit);
accumulate_short(net, (update_interval + 5) / 10);
accumulate_short(net, (net->update_interval + 5) / 10);
accumulate_short(net, seqno);
accumulate_short(net, metric);
accumulate_bytes(net, real_prefix + omit, (real_plen + 7) / 8 - omit);
......@@ -1005,7 +1005,7 @@ send_update(struct network *net, int urgent,
routes[i].src->plen);
}
}
delay_jitter(&net->update_timeout, update_interval);
delay_jitter(&net->update_timeout, net->update_interval);
}
schedule_update_flush(net, urgent);
}
......
......@@ -274,6 +274,10 @@ network_up(struct network *net, int up)
net->flags |= NET_LQ;
else
net->flags &= ~NET_LQ;
net->update_interval =
NET_CONF(net, hello_interval) > 0 ?
NET_CONF(net, hello_interval) * 5 :
wired_hello_interval * 5;
} else {
net->flags &= ~NET_WIRED;
net->cost = NET_CONF(net, cost);
......@@ -286,6 +290,10 @@ network_up(struct network *net, int up)
net->flags &= ~NET_LQ;
else
net->flags |= NET_LQ;
net->update_interval =
NET_CONF(net, hello_interval) > 0 ?
NET_CONF(net, hello_interval) * 5 :
wireless_hello_interval * 5;
}
update_hello_interval(net);
......@@ -320,7 +328,7 @@ network_up(struct network *net, int up)
}
}
delay_jitter(&net->hello_timeout, net->hello_interval);
delay_jitter(&net->update_timeout, update_interval);
delay_jitter(&net->update_timeout, net->update_interval);
send_hello(net);
send_request(net, NULL, 0);
} else {
......
......@@ -78,6 +78,7 @@ struct network {
time_t activity_time;
unsigned short hello_seqno;
unsigned hello_interval;
unsigned update_interval;
};
#define NET_CONF(_net, _field) \
......
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