Commit 9f6b322a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Remove support for idle detection (-i).

This feature was little used, and complicated the code somewhat.
parent ff03fc66
...@@ -60,12 +60,10 @@ int debug = 0; ...@@ -60,12 +60,10 @@ int debug = 0;
time_t reboot_time; time_t reboot_time;
int idle_time = 320;
int link_detect = 0; int link_detect = 0;
int all_wireless = 0; int all_wireless = 0;
int wireless_hello_interval = -1; int wireless_hello_interval = -1;
int wired_hello_interval = -1; int wired_hello_interval = -1;
int idle_hello_interval = -1;
int do_daemonise = 0; int do_daemonise = 0;
char *logfile = NULL, *pidfile = "/var/run/babeld.pid"; char *logfile = NULL, *pidfile = "/var/run/babeld.pid";
...@@ -159,11 +157,6 @@ main(int argc, char **argv) ...@@ -159,11 +157,6 @@ main(int argc, char **argv)
if(wired_hello_interval <= 0 || wired_hello_interval > 0xFFFF * 10) if(wired_hello_interval <= 0 || wired_hello_interval > 0xFFFF * 10)
goto usage; goto usage;
break; break;
case 'i':
idle_hello_interval = parse_msec(optarg);
if(idle_hello_interval <= 0 || idle_hello_interval > 0xFFFF * 10)
goto usage;
break;
case 'k': case 'k':
kernel_metric = atoi(optarg); kernel_metric = atoi(optarg);
if(kernel_metric < 0 || kernel_metric > 0xFFFF) if(kernel_metric < 0 || kernel_metric > 0xFFFF)
...@@ -784,7 +777,7 @@ main(int argc, char **argv) ...@@ -784,7 +777,7 @@ main(int argc, char **argv)
"Syntax: %s " "Syntax: %s "
"[-m multicast_address] [-p port] [-S state-file]\n" "[-m multicast_address] [-p port] [-S state-file]\n"
" " " "
"[-h hello] [-H wired_hello] [-i idle_hello] [-z kind[,factor]]\n" "[-h hello] [-H wired_hello] [-z kind[,factor]]\n"
" " " "
"[-k metric] [-A metric] [-s] [-P] [-l] [-w] [-u] [-g port]\n" "[-k metric] [-A metric] [-s] [-P] [-l] [-w] [-u] [-g port]\n"
" " " "
......
...@@ -83,8 +83,7 @@ THE SOFTWARE. ...@@ -83,8 +83,7 @@ THE SOFTWARE.
extern struct timeval now; extern struct timeval now;
extern int debug; extern int debug;
extern time_t reboot_time; extern time_t reboot_time;
extern int wireless_hello_interval, wired_hello_interval, idle_hello_interval; extern int wireless_hello_interval, wired_hello_interval;
extern int idle_time;
extern int link_detect; extern int link_detect;
extern int all_wireless; extern int all_wireless;
extern int local_socket; extern int local_socket;
......
...@@ -44,13 +44,6 @@ sent on wireless interfaces. The default is 4 seconds. ...@@ -44,13 +44,6 @@ sent on wireless interfaces. The default is 4 seconds.
Specify the interval in seconds at which scheduled hello packets are Specify the interval in seconds at which scheduled hello packets are
sent on wired interfaces. The default is 4 seconds. sent on wired interfaces. The default is 4 seconds.
.TP .TP
.BI \-i " idle-hello-interval"
Enable detection of idle networks (networks on which we haven't received
a hello packet in the last 5 minutes) and specify the interval in seconds
at which scheduled hello packets are sent on idle interfaces. This
functionality is experimental, don't use it unless you know what you are
doing.
.TP
.BI \-z " kind" " \fR[\fB," factor "\fR]" .BI \-z " kind" " \fR[\fB," factor "\fR]"
Enable diversity-sensitive routing. The value Enable diversity-sensitive routing. The value
.B kind .B kind
......
...@@ -78,7 +78,6 @@ add_interface(char *ifname, struct interface_conf *if_conf) ...@@ -78,7 +78,6 @@ add_interface(char *ifname, struct interface_conf *if_conf)
memset(ifp, 0, sizeof(struct interface)); memset(ifp, 0, sizeof(struct interface));
strncpy(ifp->name, ifname, IF_NAMESIZE); strncpy(ifp->name, ifname, IF_NAMESIZE);
ifp->conf = if_conf; ifp->conf = if_conf;
ifp->activity_time = now.tv_sec;
ifp->bucket_time = now.tv_sec; ifp->bucket_time = now.tv_sec;
ifp->bucket = BUCKET_TOKENS_MAX; ifp->bucket = BUCKET_TOKENS_MAX;
ifp->hello_seqno = (random() & 0xFFFF); ifp->hello_seqno = (random() & 0xFFFF);
...@@ -91,36 +90,6 @@ add_interface(char *ifname, struct interface_conf *if_conf) ...@@ -91,36 +90,6 @@ add_interface(char *ifname, struct interface_conf *if_conf)
return ifp; return ifp;
} }
int
interface_idle(struct interface *ifp)
{
return (idle_hello_interval > 0 &&
ifp->activity_time < now.tv_sec - idle_time);
}
int
update_hello_interval(struct interface *ifp)
{
int rc = 0;
unsigned short interval;
if(interface_idle(ifp))
interval = idle_hello_interval;
else if(IF_CONF(ifp, hello_interval) > 0)
interval = IF_CONF(ifp, hello_interval);
else if((ifp->flags & IF_WIRED))
interval = wired_hello_interval;
else
interval = wireless_hello_interval;
if(ifp->hello_interval != interval) {
ifp->hello_interval = interval;
rc = 1;
}
return rc;
}
/* This should be no more than half the hello interval, so that hellos /* This should be no more than half the hello interval, so that hellos
aren't sent late. The result is in milliseconds. */ aren't sent late. The result is in milliseconds. */
unsigned unsigned
...@@ -322,14 +291,17 @@ interface_up(struct interface *ifp, int up) ...@@ -322,14 +291,17 @@ interface_up(struct interface *ifp, int up)
if(IF_CONF(ifp, faraway) == CONFIG_YES) if(IF_CONF(ifp, faraway) == CONFIG_YES)
ifp->flags |= IF_FARAWAY; ifp->flags |= IF_FARAWAY;
ifp->activity_time = now.tv_sec; if(IF_CONF(ifp, hello_interval) > 0)
update_hello_interval(ifp); ifp->hello_interval = IF_CONF(ifp, hello_interval);
/* Since the interface was marked as active above, the else if((ifp->flags & IF_WIRED))
idle_hello_interval cannot be the one being used here. */ ifp->hello_interval = wired_hello_interval;
else
ifp->hello_interval = wireless_hello_interval;
ifp->update_interval = ifp->update_interval =
IF_CONF(ifp, update_interval) > 0 ? IF_CONF(ifp, update_interval) > 0 ?
IF_CONF(ifp, update_interval) : IF_CONF(ifp, update_interval) :
ifp->hello_interval * 4; ifp->hello_interval * 4;
memset(&mreq, 0, sizeof(mreq)); memset(&mreq, 0, sizeof(mreq));
memcpy(&mreq.ipv6mr_multiaddr, protocol_group, 16); memcpy(&mreq.ipv6mr_multiaddr, protocol_group, 16);
......
...@@ -85,7 +85,6 @@ struct interface { ...@@ -85,7 +85,6 @@ struct interface {
int update_bufsize; int update_bufsize;
time_t bucket_time; time_t bucket_time;
unsigned int bucket; unsigned int bucket;
time_t activity_time;
time_t last_update_time; time_t last_update_time;
unsigned short hello_seqno; unsigned short hello_seqno;
unsigned hello_interval; unsigned hello_interval;
...@@ -106,8 +105,6 @@ if_up(struct interface *ifp) ...@@ -106,8 +105,6 @@ if_up(struct interface *ifp)
} }
struct interface *add_interface(char *ifname, struct interface_conf *if_conf); struct interface *add_interface(char *ifname, struct interface_conf *if_conf);
int interface_idle(struct interface *ifp);
int update_hello_interval(struct interface *ifp);
unsigned jitter(struct interface *ifp, int urgent); unsigned jitter(struct interface *ifp, int urgent);
unsigned update_jitter(struct interface *ifp, int urgent); unsigned update_jitter(struct interface *ifp, int urgent);
void set_timeout(struct timeval *timeout, int msecs); void set_timeout(struct timeval *timeout, int msecs);
......
...@@ -272,8 +272,6 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -272,8 +272,6 @@ parse_packet(const unsigned char *from, struct interface *ifp,
debugf("Received hello %d (%d) from %s on %s.\n", debugf("Received hello %d (%d) from %s on %s.\n",
seqno, interval, seqno, interval,
format_address(from), ifp->name); format_address(from), ifp->name);
ifp->activity_time = now.tv_sec;
update_hello_interval(ifp);
changed = update_neighbour(neigh, seqno, interval); changed = update_neighbour(neigh, seqno, interval);
update_neighbour_metric(neigh, changed); update_neighbour_metric(neigh, changed);
if(interval > 0) if(interval > 0)
...@@ -735,11 +733,9 @@ send_hello_noupdate(struct interface *ifp, unsigned interval) ...@@ -735,11 +733,9 @@ send_hello_noupdate(struct interface *ifp, unsigned interval)
void void
send_hello(struct interface *ifp) send_hello(struct interface *ifp)
{ {
int changed;
changed = update_hello_interval(ifp);
send_hello_noupdate(ifp, (ifp->hello_interval + 9) / 10); send_hello_noupdate(ifp, (ifp->hello_interval + 9) / 10);
/* Send full IHU every 3 hellos, and marginal IHU each time */ /* Send full IHU every 3 hellos, and marginal IHU each time */
if(changed || ifp->hello_seqno % 3 == 0) if(ifp->hello_seqno % 3 == 0)
send_ihu(NULL, ifp); send_ihu(NULL, ifp);
else else
send_marginal_ihu(ifp); send_marginal_ihu(ifp);
...@@ -1130,12 +1126,10 @@ send_update(struct interface *ifp, int urgent, ...@@ -1130,12 +1126,10 @@ send_update(struct interface *ifp, int urgent,
buffer_update(ifp, prefix, plen); buffer_update(ifp, prefix, plen);
} }
} else { } else {
if(!interface_idle(ifp)) { send_self_update(ifp);
send_self_update(ifp); if(!parasitic) {
if(!parasitic) { debugf("Sending update to %s for any.\n", ifp->name);
debugf("Sending update to %s for any.\n", ifp->name); for_all_installed_routes(buffer_update_callback, ifp);
for_all_installed_routes(buffer_update_callback, ifp);
}
} }
set_timeout(&ifp->update_timeout, ifp->update_interval); set_timeout(&ifp->update_timeout, ifp->update_interval);
ifp->last_update_time = now.tv_sec; ifp->last_update_time = now.tv_sec;
...@@ -1213,10 +1207,8 @@ send_self_update(struct interface *ifp) ...@@ -1213,10 +1207,8 @@ send_self_update(struct interface *ifp)
return; return;
} }
if(!interface_idle(ifp)) { debugf("Sending self update to %s.\n", ifp->name);
debugf("Sending self update to %s.\n", ifp->name); for_all_xroutes(send_xroute_update_callback, ifp);
for_all_xroutes(send_xroute_update_callback, ifp);
}
} }
void void
......
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