summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpctl
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ldpctl')
-rw-r--r--usr.sbin/ldpctl/ldpctl.89
-rw-r--r--usr.sbin/ldpctl/ldpctl.c12
-rw-r--r--usr.sbin/ldpctl/parser.c16
-rw-r--r--usr.sbin/ldpctl/parser.h3
4 files changed, 36 insertions, 4 deletions
diff --git a/usr.sbin/ldpctl/ldpctl.8 b/usr.sbin/ldpctl/ldpctl.8
index 9df8a04a2d0..60994a34bea 100644
--- a/usr.sbin/ldpctl/ldpctl.8
+++ b/usr.sbin/ldpctl/ldpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ldpctl.8,v 1.12 2016/05/23 19:04:55 renato Exp $
+.\" $OpenBSD: ldpctl.8,v 1.13 2016/05/23 19:06:03 renato Exp $
.\"
.\" Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.\" Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -38,6 +38,13 @@ for
.Pp
The following commands are available:
.Bl -tag -width Ds
+.It Xo
+.Cm clear neighbors
+.Op Ar address
+.Xc
+Delete entries from the neighbor table.
+.Ar address
+can be used to limit the scope of the command to the given neighbor.
.It Cm fib couple
Insert the learned labels into the Label Forwarding Information Base a.k.a.
the kernel routing table.
diff --git a/usr.sbin/ldpctl/ldpctl.c b/usr.sbin/ldpctl/ldpctl.c
index 17be13badad..50568c2b5c2 100644
--- a/usr.sbin/ldpctl/ldpctl.c
+++ b/usr.sbin/ldpctl/ldpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpctl.c,v 1.30 2016/05/23 19:04:55 renato Exp $
+/* $OpenBSD: ldpctl.c,v 1.31 2016/05/23 19:06:03 renato Exp $
*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -82,6 +82,7 @@ main(int argc, char *argv[])
int ctl_sock;
int done = 0, verbose = 0;
int n;
+ struct ctl_nbr nbr;
/* parse options */
if ((res = parse(argc - 1, argv + 1)) == NULL)
@@ -170,6 +171,14 @@ main(int argc, char *argv[])
imsg_compose(ibuf, IMSG_CTL_SHOW_L2VPN_BINDING, 0, 0, -1,
NULL, 0);
break;
+ case CLEAR_NBR:
+ memset(&nbr, 0, sizeof(nbr));
+ nbr.af = res->family;
+ memcpy(&nbr.raddr, &res->addr, sizeof(nbr.raddr));
+ imsg_compose(ibuf, IMSG_CTL_CLEAR_NBR, 0, 0, -1, &nbr,
+ sizeof(nbr));
+ done = 1;
+ break;
case FIB:
errx(1, "fib couple|decouple");
break;
@@ -241,6 +250,7 @@ main(int argc, char *argv[])
done = show_l2vpn_binding_msg(&imsg);
break;
case NONE:
+ case CLEAR_NBR:
case FIB:
case FIB_COUPLE:
case FIB_DECOUPLE:
diff --git a/usr.sbin/ldpctl/parser.c b/usr.sbin/ldpctl/parser.c
index 058f112a37e..02873312781 100644
--- a/usr.sbin/ldpctl/parser.c
+++ b/usr.sbin/ldpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.11 2016/05/23 19:04:55 renato Exp $ */
+/* $OpenBSD: parser.c,v 1.12 2016/05/23 19:06:03 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -65,12 +65,15 @@ static const struct token t_show_lib_af[];
static const struct token t_show_fib[];
static const struct token t_show_fib_af[];
static const struct token t_show_l2vpn[];
+static const struct token t_clear[];
+static const struct token t_clear_nbr[];
static const struct token t_log[];
static const struct token t_main[] = {
{KEYWORD, "reload", RELOAD, NULL},
{KEYWORD, "fib", FIB, t_fib},
{KEYWORD, "show", SHOW, t_show},
+ {KEYWORD, "clear", CLEAR_NBR, t_clear},
{KEYWORD, "log", NONE, t_log},
{ENDTOKEN, "", NONE, NULL}
};
@@ -157,6 +160,17 @@ static const struct token t_show_l2vpn[] = {
{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},
+ {ADDRESS, "", NONE, NULL},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
static const struct token t_log[] = {
{KEYWORD, "verbose", LOG_VERBOSE, NULL},
{KEYWORD, "brief", LOG_BRIEF, NULL},
diff --git a/usr.sbin/ldpctl/parser.h b/usr.sbin/ldpctl/parser.h
index a294e7ada5c..d790108369c 100644
--- a/usr.sbin/ldpctl/parser.h
+++ b/usr.sbin/ldpctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.9 2016/05/23 19:04:55 renato Exp $ */
+/* $OpenBSD: parser.h,v 1.10 2016/05/23 19:06:03 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -41,6 +41,7 @@ enum actions {
SHOW_FIB_IFACE,
SHOW_L2VPN_PW,
SHOW_L2VPN_BINDING,
+ CLEAR_NBR,
RELOAD
};