summaryrefslogtreecommitdiffstats
path: root/usr.sbin/eigrpctl
diff options
context:
space:
mode:
authorrenato <renato@openbsd.org>2016-01-15 12:57:48 +0000
committerrenato <renato@openbsd.org>2016-01-15 12:57:48 +0000
commit956c66a0c0f0cdfddaa22c65630f0f5f05f3e523 (patch)
treec62bbdc0c1b91d8cae2998afc80344c66f1afbeb /usr.sbin/eigrpctl
parentFor each prefix, order routes by their nexthop. (diff)
downloadwireguard-openbsd-956c66a0c0f0cdfddaa22c65630f0f5f05f3e523.tar.xz
wireguard-openbsd-956c66a0c0f0cdfddaa22c65630f0f5f05f3e523.zip
Introduce the 'eigrpctl clear neighbors' command.
Diffstat (limited to 'usr.sbin/eigrpctl')
-rw-r--r--usr.sbin/eigrpctl/eigrpctl.817
-rw-r--r--usr.sbin/eigrpctl/eigrpctl.c13
-rw-r--r--usr.sbin/eigrpctl/parser.c30
-rw-r--r--usr.sbin/eigrpctl/parser.h3
4 files changed, 58 insertions, 5 deletions
diff --git a/usr.sbin/eigrpctl/eigrpctl.8 b/usr.sbin/eigrpctl/eigrpctl.8
index 86832335ed8..7137a4b7123 100644
--- a/usr.sbin/eigrpctl/eigrpctl.8
+++ b/usr.sbin/eigrpctl/eigrpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: eigrpctl.8,v 1.4 2015/12/13 18:55:53 renato Exp $
+.\" $OpenBSD: eigrpctl.8,v 1.5 2016/01/15 12:57:48 renato Exp $
.\"
.\" Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
.\" Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 13 2015 $
+.Dd $Mdocdate: January 15 2016 $
.Dt EIGRPCTL 8
.Os
.Sh NAME
@@ -38,6 +38,19 @@ for
.Pp
The following commands are available:
.Bl -tag -width Ds
+.It Xo
+.Cm clear neighbors
+.Op Cm family Ar family
+.Op Cm as Ar as
+.Op Ar address
+.Xc
+Delete entries from the neighbor table.
+.Ar family ,
+.Ar as ,
+and
+.Ar address
+can be used to limit the scope of the command to the given address family, autonomous system and/or address.
+If no argument is given, all neighbors from all EIGRP instances will be deleted.
.It Cm fib couple
Insert the learned routes into the Forwarding Information Base
a.k.a. the kernel routing table.
diff --git a/usr.sbin/eigrpctl/eigrpctl.c b/usr.sbin/eigrpctl/eigrpctl.c
index ac2ddf6eaee..c45ded6b5c8 100644
--- a/usr.sbin/eigrpctl/eigrpctl.c
+++ b/usr.sbin/eigrpctl/eigrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpctl.c,v 1.7 2015/12/13 18:55:53 renato Exp $ */
+/* $OpenBSD: eigrpctl.c,v 1.8 2016/01/15 12:57:48 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -83,6 +83,7 @@ main(int argc, char *argv[])
int done = 0;
int n, verbose = 0;
struct ctl_show_topology_req treq;
+ struct ctl_nbr nbr;
/* parse options */
if ((res = parse(argc - 1, argv + 1)) == NULL)
@@ -161,6 +162,15 @@ main(int argc, char *argv[])
case SHOW_STATS:
imsg_compose(ibuf, IMSG_CTL_SHOW_STATS, 0, 0, -1, NULL, 0);
break;
+ case CLEAR_NBR:
+ memset(&nbr, 0, sizeof(nbr));
+ nbr.af = res->family;
+ nbr.as = res->as;
+ memcpy(&nbr.addr, &res->addr, sizeof(res->addr));
+ imsg_compose(ibuf, IMSG_CTL_CLEAR_NBR, 0, 0, -1, &nbr,
+ sizeof(nbr));
+ done = 1;
+ break;
case FIB:
errx(1, "fib couple|decouple");
break;
@@ -232,6 +242,7 @@ main(int argc, char *argv[])
case SHOW_STATS:
done = show_stats_msg(&imsg, res);
break;
+ case CLEAR_NBR:
case NONE:
case FIB:
case FIB_COUPLE:
diff --git a/usr.sbin/eigrpctl/parser.c b/usr.sbin/eigrpctl/parser.c
index 55d744633b6..d9af97ec046 100644
--- a/usr.sbin/eigrpctl/parser.c
+++ b/usr.sbin/eigrpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.3 2015/12/13 18:55:53 renato Exp $ */
+/* $OpenBSD: parser.c,v 1.4 2016/01/15 12:57:49 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -71,11 +71,16 @@ static const struct token t_show_stats[];
static const struct token t_show_stats_af[];
static const struct token t_show_stats_as[];
static const struct token t_log[];
+static const struct token t_clear[];
+static const struct token t_clear_nbr[];
+static const struct token t_clear_nbr_af[];
+static const struct token t_clear_nbr_as[];
static const struct token t_main[] = {
{KEYWORD, "reload", RELOAD, NULL},
{KEYWORD, "fib", FIB, t_fib},
{KEYWORD, "show", SHOW, t_show},
+ {KEYWORD, "clear", NONE, t_clear},
{KEYWORD, "log", NONE, t_log},
{ENDTOKEN, "", NONE, NULL}
};
@@ -185,6 +190,29 @@ static const struct token t_show_stats_as[] = {
{ENDTOKEN, "", NONE, NULL}
};
+static const struct token t_clear[] = {
+ {KEYWORD, "neighbors", CLEAR_NBR, t_clear_nbr},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
+static const struct token t_clear_nbr[] = {
+ {NOTOKEN, "", NONE, NULL},
+ {KEYWORD, "as", NONE, t_clear_nbr_as},
+ {KEYWORD, "family", NONE, t_clear_nbr_af},
+ {ADDRESS, "", NONE, NULL},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
+static const struct token t_clear_nbr_af[] = {
+ {FAMILY, "", NONE, t_clear_nbr},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
+static const struct token t_clear_nbr_as[] = {
+ {ASNUM, "", NONE, t_clear_nbr},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
static const struct token t_log[] = {
{KEYWORD, "verbose", LOG_VERBOSE, NULL},
{KEYWORD, "brief", LOG_BRIEF, NULL},
diff --git a/usr.sbin/eigrpctl/parser.h b/usr.sbin/eigrpctl/parser.h
index 0af3352b3e0..3649ed1f633 100644
--- a/usr.sbin/eigrpctl/parser.h
+++ b/usr.sbin/eigrpctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.2 2015/12/13 18:55:53 renato Exp $ */
+/* $OpenBSD: parser.h,v 1.3 2016/01/15 12:57:49 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -40,6 +40,7 @@ enum actions {
SHOW_FIB,
SHOW_FIB_IFACE,
SHOW_STATS,
+ CLEAR_NBR,
RELOAD
};