summaryrefslogtreecommitdiffstats
path: root/usr.sbin/eigrpd
diff options
context:
space:
mode:
authorrenato <renato@openbsd.org>2015-10-04 22:54:38 +0000
committerrenato <renato@openbsd.org>2015-10-04 22:54:38 +0000
commit9d6d4006feac988743942a2e05751efdea8afb96 (patch)
tree49af1a5dddc33598ab696701dcd43227bbd32796 /usr.sbin/eigrpd
parentmention sendto(2) destination address restriction for "rw" (diff)
downloadwireguard-openbsd-9d6d4006feac988743942a2e05751efdea8afb96.tar.xz
wireguard-openbsd-9d6d4006feac988743942a2e05751efdea8afb96.zip
Add option to configure or disable the DUAL active timeout.
Diffstat (limited to 'usr.sbin/eigrpd')
-rw-r--r--usr.sbin/eigrpd/eigrp.h8
-rw-r--r--usr.sbin/eigrpd/eigrpd.h3
-rw-r--r--usr.sbin/eigrpd/parse.y17
-rw-r--r--usr.sbin/eigrpd/printconf.c3
-rw-r--r--usr.sbin/eigrpd/rde_dual.c14
5 files changed, 35 insertions, 10 deletions
diff --git a/usr.sbin/eigrpd/eigrp.h b/usr.sbin/eigrpd/eigrp.h
index b6bd3cfd06e..359585b730e 100644
--- a/usr.sbin/eigrpd/eigrp.h
+++ b/usr.sbin/eigrpd/eigrp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrp.h,v 1.1 2015/10/02 04:26:47 renato Exp $ */
+/* $OpenBSD: eigrp.h,v 1.2 2015/10/04 22:54:38 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -38,8 +38,6 @@
#define RTP_ACK_TIMEOUT 100000
-#define EIGRP_ACTIVE_TIMEOUT 180
-
#define EIGRP_VERSION_MAJOR 1
#define EIGRP_VERSION_MINOR 2
@@ -78,6 +76,10 @@
#define MIN_KVALUE 0
#define MAX_KVALUE 254
+#define DEFAULT_ACTIVE_TIMEOUT 3
+#define MIN_ACTIVE_TIMEOUT 0
+#define MAX_ACTIVE_TIMEOUT 65535
+
#define DEFAULT_MAXIMUM_HOPS 100
#define MIN_MAXIMUM_HOPS 1
#define MAX_MAXIMUM_HOPS 255
diff --git a/usr.sbin/eigrpd/eigrpd.h b/usr.sbin/eigrpd/eigrpd.h
index 214e6263d4a..bfe89a26bad 100644
--- a/usr.sbin/eigrpd/eigrpd.h
+++ b/usr.sbin/eigrpd/eigrpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpd.h,v 1.2 2015/10/03 18:57:11 renato Exp $ */
+/* $OpenBSD: eigrpd.h,v 1.3 2015/10/04 22:54:38 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -251,6 +251,7 @@ struct eigrp {
int af;
uint16_t as;
uint8_t kvalues[6];
+ uint16_t active_timeout;
uint8_t maximum_hops;
uint8_t maximum_paths;
uint8_t variance;
diff --git a/usr.sbin/eigrpd/parse.y b/usr.sbin/eigrpd/parse.y
index 1228399f2e7..f8b1ac8f07c 100644
--- a/usr.sbin/eigrpd/parse.y
+++ b/usr.sbin/eigrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.1 2015/10/02 04:26:47 renato Exp $ */
+/* $OpenBSD: parse.y,v 1.2 2015/10/04 22:54:38 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -90,6 +90,7 @@ struct eigrp_iface *ei = NULL;
struct config_defaults {
uint8_t kvalues[6];
+ uint16_t active_timeout;
uint8_t maximum_hops;
uint8_t maximum_paths;
uint8_t variance;
@@ -124,7 +125,7 @@ typedef struct {
%token ROUTERID AS FIBUPDATE RDOMAIN REDISTRIBUTE METRIC DFLTMETRIC
%token MAXHOPS MAXPATHS VARIANCE FIBPRIORITY_INT FIBPRIORITY_EXT
-%token AF IPV4 IPV6 HELLOINTERVAL HOLDTIME KVALUES
+%token AF IPV4 IPV6 HELLOINTERVAL HOLDTIME KVALUES ACTIVETIMEOUT
%token INTERFACE PASSIVE DELAY BANDWIDTH SPLITHORIZON
%token YES NO
%token INCLUDE
@@ -332,6 +333,15 @@ defaults : KVALUES NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER {
defs->kvalues[4] = $6;
defs->kvalues[5] = $7;
}
+ | ACTIVETIMEOUT NUMBER {
+ if ($2 < MIN_ACTIVE_TIMEOUT ||
+ $2 > MAX_ACTIVE_TIMEOUT) {
+ yyerror("active-timeout out of range (%d-%d)",
+ MIN_ACTIVE_TIMEOUT, MAX_ACTIVE_TIMEOUT);
+ YYERROR;
+ }
+ defs->active_timeout = $2;
+ }
| MAXHOPS NUMBER {
if ($2 < MIN_MAXIMUM_HOPS ||
$2 > MAX_MAXIMUM_HOPS) {
@@ -450,6 +460,7 @@ as : AS NUMBER {
} as_block {
memcpy(eigrp->kvalues, defs->kvalues,
sizeof(eigrp->kvalues));
+ eigrp->active_timeout = defs->active_timeout;
eigrp->maximum_hops = defs->maximum_hops;
eigrp->maximum_paths = defs->maximum_paths;
eigrp->variance = defs->variance;
@@ -548,6 +559,7 @@ lookup(char *s)
{
/* this has to be sorted always */
static const struct keywords keywords[] = {
+ {"active-timeout", ACTIVETIMEOUT},
{"address-family", AF},
{"autonomous-system", AS},
{"bandwidth", BANDWIDTH},
@@ -911,6 +923,7 @@ parse_config(char *filename, int opts)
memset(&globaldefs, 0, sizeof(globaldefs));
defs = &globaldefs;
defs->kvalues[0] = defs->kvalues[2] = 1;
+ defs->active_timeout = DEFAULT_ACTIVE_TIMEOUT;
defs->maximum_hops = DEFAULT_MAXIMUM_HOPS;
defs->maximum_paths = DEFAULT_MAXIMUM_PATHS;
defs->variance = DEFAULT_VARIANCE;
diff --git a/usr.sbin/eigrpd/printconf.c b/usr.sbin/eigrpd/printconf.c
index acdbeba07f6..5d9ad72845b 100644
--- a/usr.sbin/eigrpd/printconf.c
+++ b/usr.sbin/eigrpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.1 2015/10/02 04:26:47 renato Exp $ */
+/* $OpenBSD: printconf.c,v 1.2 2015/10/04 22:54:38 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -128,6 +128,7 @@ print_as(struct eigrp *eigrp)
printf("\t\tk-values %u %u %u %u %u %u\n", eigrp->kvalues[0],
eigrp->kvalues[1], eigrp->kvalues[2], eigrp->kvalues[3],
eigrp->kvalues[4], eigrp->kvalues[5]);
+ printf("\t\tactive-timeout %u\n", eigrp->active_timeout);
printf("\t\tmaximum-hops %u\n", eigrp->maximum_hops);
printf("\t\tmaximum-paths %u\n", eigrp->maximum_paths);
printf("\t\tvariance %u\n", eigrp->variance);
diff --git a/usr.sbin/eigrpd/rde_dual.c b/usr.sbin/eigrpd/rde_dual.c
index 6af2dc2e90b..52543fc5f24 100644
--- a/usr.sbin/eigrpd/rde_dual.c
+++ b/usr.sbin/eigrpd/rde_dual.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_dual.c,v 1.1 2015/10/02 04:26:47 renato Exp $ */
+/* $OpenBSD: rde_dual.c,v 1.2 2015/10/04 22:54:38 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -441,10 +441,14 @@ reply_active_timer(int fd, short event, void *arg)
void
reply_active_start_timer(struct reply_node *reply)
{
+ struct eigrp *eigrp = reply->nbr->eigrp;
struct timeval tv;
+ if (eigrp->active_timeout == 0)
+ return;
+
timerclear(&tv);
- tv.tv_sec = EIGRP_ACTIVE_TIMEOUT;
+ tv.tv_sec = eigrp->active_timeout * 60;
if (evtimer_add(&reply->ev_active_timeout, &tv) == -1)
fatal("reply_active_start_timer");
}
@@ -500,15 +504,19 @@ reply_sia_timer(int fd, short event, void *arg)
void
reply_sia_start_timer(struct reply_node *reply)
{
+ struct eigrp *eigrp = reply->nbr->eigrp;
struct timeval tv;
+ if (eigrp->active_timeout == 0)
+ return;
+
/*
* draft-savage-eigrp-04 - Section 4.4.1.1:
* "The SIA-QUERY packet SHOULD be sent on a per-destination basis
* at one-half of the ACTIVE timeout period."
*/
timerclear(&tv);
- tv.tv_sec = EIGRP_ACTIVE_TIMEOUT / 2;
+ tv.tv_sec = (eigrp->active_timeout * 60) / 2;
if (evtimer_add(&reply->ev_sia_timeout, &tv) == -1)
fatal("reply_sia_start_timer");
}