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;
time_t reboot_time;
int idle_time = 320;
int link_detect = 0;
int all_wireless = 0;
int wireless_hello_interval = -1;
int wired_hello_interval = -1;
int idle_hello_interval = -1;
int do_daemonise = 0;
char *logfile = NULL, *pidfile = "/var/run/babeld.pid";
......@@ -159,11 +157,6 @@ main(int argc, char **argv)
if(wired_hello_interval <= 0 || wired_hello_interval > 0xFFFF * 10)
goto usage;
break;
case 'i':
idle_hello_interval = parse_msec(optarg);
if(idle_hello_interval <= 0 || idle_hello_interval > 0xFFFF * 10)
goto usage;
break;
case 'k':
kernel_metric = atoi(optarg);
if(kernel_metric < 0 || kernel_metric > 0xFFFF)
......@@ -784,7 +777,7 @@ main(int argc, char **argv)
"Syntax: %s "
"[-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"
" "
......
......@@ -83,8 +83,7 @@ THE SOFTWARE.
extern struct timeval now;
extern int debug;
extern time_t reboot_time;
extern int wireless_hello_interval, wired_hello_interval, idle_hello_interval;
extern int idle_time;
extern int wireless_hello_interval, wired_hello_interval;
extern int link_detect;
extern int all_wireless;
extern int local_socket;
......
......@@ -44,13 +44,6 @@ sent on wireless interfaces. The default is 4 seconds.
Specify the interval in seconds at which scheduled hello packets are
sent on wired interfaces. The default is 4 seconds.
.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]"
Enable diversity-sensitive routing. The value
.B kind
......
......@@ -78,7 +78,6 @@ add_interface(char *ifname, struct interface_conf *if_conf)
memset(ifp, 0, sizeof(struct interface));
strncpy(ifp->name, ifname, IF_NAMESIZE);
ifp->conf = if_conf;
ifp->activity_time = now.tv_sec;
ifp->bucket_time = now.tv_sec;
ifp->bucket = BUCKET_TOKENS_MAX;
ifp->hello_seqno = (random() & 0xFFFF);
......@@ -91,36 +90,6 @@ add_interface(char *ifname, struct interface_conf *if_conf)
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
aren't sent late. The result is in milliseconds. */
unsigned
......@@ -322,10 +291,13 @@ interface_up(struct interface *ifp, int up)
if(IF_CONF(ifp, faraway) == CONFIG_YES)
ifp->flags |= IF_FARAWAY;
ifp->activity_time = now.tv_sec;
update_hello_interval(ifp);
/* Since the interface was marked as active above, the
idle_hello_interval cannot be the one being used here. */
if(IF_CONF(ifp, hello_interval) > 0)
ifp->hello_interval = IF_CONF(ifp, hello_interval);
else if((ifp->flags & IF_WIRED))
ifp->hello_interval = wired_hello_interval;
else
ifp->hello_interval = wireless_hello_interval;
ifp->update_interval =
IF_CONF(ifp, update_interval) > 0 ?
IF_CONF(ifp, update_interval) :
......
......@@ -85,7 +85,6 @@ struct interface {
int update_bufsize;
time_t bucket_time;
unsigned int bucket;
time_t activity_time;
time_t last_update_time;
unsigned short hello_seqno;
unsigned hello_interval;
......@@ -106,8 +105,6 @@ if_up(struct interface *ifp)
}
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 update_jitter(struct interface *ifp, int urgent);
void set_timeout(struct timeval *timeout, int msecs);
......
......@@ -272,8 +272,6 @@ parse_packet(const unsigned char *from, struct interface *ifp,
debugf("Received hello %d (%d) from %s on %s.\n",
seqno, interval,
format_address(from), ifp->name);
ifp->activity_time = now.tv_sec;
update_hello_interval(ifp);
changed = update_neighbour(neigh, seqno, interval);
update_neighbour_metric(neigh, changed);
if(interval > 0)
......@@ -735,11 +733,9 @@ send_hello_noupdate(struct interface *ifp, unsigned interval)
void
send_hello(struct interface *ifp)
{
int changed;
changed = update_hello_interval(ifp);
send_hello_noupdate(ifp, (ifp->hello_interval + 9) / 10);
/* 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);
else
send_marginal_ihu(ifp);
......@@ -1130,13 +1126,11 @@ send_update(struct interface *ifp, int urgent,
buffer_update(ifp, prefix, plen);
}
} else {
if(!interface_idle(ifp)) {
send_self_update(ifp);
if(!parasitic) {
debugf("Sending update to %s for any.\n", ifp->name);
for_all_installed_routes(buffer_update_callback, ifp);
}
}
set_timeout(&ifp->update_timeout, ifp->update_interval);
ifp->last_update_time = now.tv_sec;
}
......@@ -1213,10 +1207,8 @@ send_self_update(struct interface *ifp)
return;
}
if(!interface_idle(ifp)) {
debugf("Sending self update to %s.\n", ifp->name);
for_all_xroutes(send_xroute_update_callback, ifp);
}
}
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