summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-04-15 13:34:09 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-04-15 13:34:09 +0000
commit02c77acc6bb20a35fce03f66108e7d38f3763106 (patch)
treeeb0482ca583f23419130e20db38b5b4b729ca18b
parentab2fc5617b7e278c997cc1cb7c7664e5aabc11c6 (diff)
Check for subnet overlap between the configured summary-addresses.
-rw-r--r--usr.sbin/eigrpd/eigrpd.h4
-rw-r--r--usr.sbin/eigrpd/parse.y17
-rw-r--r--usr.sbin/eigrpd/rde.h4
3 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/eigrpd/eigrpd.h b/usr.sbin/eigrpd/eigrpd.h
index da9efbba12e..34dd0b1b71b 100644
--- a/usr.sbin/eigrpd/eigrpd.h
+++ b/usr.sbin/eigrpd/eigrpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpd.h,v 1.13 2016/04/15 13:21:45 renato Exp $ */
+/* $OpenBSD: eigrpd.h,v 1.14 2016/04/15 13:34:08 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -433,6 +433,8 @@ struct ctl_stats {
struct eigrp_stats stats;
};
+#define min(x,y) ((x) <= (y) ? (x) : (y))
+
/* parse.y */
struct eigrpd_conf *parse_config(char *);
int cmdline_symset(char *);
diff --git a/usr.sbin/eigrpd/parse.y b/usr.sbin/eigrpd/parse.y
index 72d155bd76a..46b90ddbd9d 100644
--- a/usr.sbin/eigrpd/parse.y
+++ b/usr.sbin/eigrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.13 2016/04/15 13:24:52 renato Exp $ */
+/* $OpenBSD: parse.y,v 1.14 2016/04/15 13:34:08 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -355,7 +355,7 @@ interfaceopts_l : interfaceopts_l interfaceoptsl nl
interfaceoptsl : PASSIVE { ei->passive = 1; }
| SUMMARY_ADDR STRING {
- struct summary_addr *s;
+ struct summary_addr *s, *tmp;
if ((s = calloc(1, sizeof(*s))) == NULL)
fatal(NULL);
@@ -365,8 +365,19 @@ interfaceoptsl : PASSIVE { ei->passive = 1; }
free(s);
YYERROR;
}
-
free($2);
+
+ TAILQ_FOREACH(tmp, &ei->summary_list, entry) {
+ if (eigrp_prefixcmp(af, &s->prefix,
+ &tmp->prefix, min(s->prefixlen,
+ tmp->prefixlen)) == 0) {
+ yyerror("summary-address conflicts "
+ "with another summary-address "
+ "already configured");
+ YYERROR;
+ }
+ }
+
TAILQ_INSERT_TAIL(&ei->summary_list, s, entry);
}
| iface_defaults
diff --git a/usr.sbin/eigrpd/rde.h b/usr.sbin/eigrpd/rde.h
index 84e6e109fa2..e2caa4b72d4 100644
--- a/usr.sbin/eigrpd/rde.h
+++ b/usr.sbin/eigrpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.7 2016/04/15 13:10:56 renato Exp $ */
+/* $OpenBSD: rde.h,v 1.8 2016/04/15 13:34:08 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -26,8 +26,6 @@
#include <event.h>
#include <limits.h>
-#define min(x,y) ((x) <= (y) ? (x) : (y))
-
/* just the info RDE needs */
struct rde_nbr {
RB_ENTRY(rde_nbr) entry;