summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-06 23:23:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-06 23:23:50 +0000
commitc9eb27d54ac859ca7ee7c12c7493f1813366697e (patch)
treea4a7cee7afaaceca028c6355f1208b5671535ab8
parent46b167ceff7922791726347f290e24c26eb7734d (diff)
neighbor 1.2.3.4 up/down
ok claudio@
-rw-r--r--usr.sbin/bgpctl/bgpctl.86
-rw-r--r--usr.sbin/bgpctl/bgpctl.c48
2 files changed, 46 insertions, 8 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8
index d684fbd1fce..0fe4760634b 100644
--- a/usr.sbin/bgpctl/bgpctl.8
+++ b/usr.sbin/bgpctl/bgpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgpctl.8,v 1.7 2004/01/06 16:48:06 jmc Exp $
+.\" $OpenBSD: bgpctl.8,v 1.8 2004/01/06 23:23:49 henning Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\"
@@ -54,6 +54,10 @@ routing table.
.It Li fib decouple
Remove the learned routes into the Forward Information Base aka the kernel
routing table.
+.It Li neighbor Ar address up
+Take the bgp session to the specified neighbor up.
+.It Li neighbor Ar address down
+Take the bgp session to the specified neighbor down.
.El
.Sh FILES
.Bl -tag -width "/etc/bgpd.conf" -compact
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 0a6f3efc5f8..c1153ccf724 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.19 2004/01/06 19:24:37 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.20 2004/01/06 23:23:49 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -36,7 +36,10 @@ enum actions {
RELOAD,
FIB,
FIB_COUPLE,
- FIB_DECOUPLE
+ FIB_DECOUPLE,
+ NEIGHBOR,
+ NEIGHBOR_UP,
+ NEIGHBOR_DOWN
};
enum neighbor_views {
@@ -52,7 +55,8 @@ struct keywords {
static const struct keywords keywords_main[] = {
{ "reload", RELOAD},
{ "show", SHOW},
- { "fib", FIB}
+ { "fib", FIB},
+ { "neighbor", NEIGHBOR}
};
static const struct keywords keywords_show[] = {
@@ -60,7 +64,7 @@ static const struct keywords keywords_show[] = {
{ "summary", SHOW_SUMMARY}
};
-static const struct keywords keywords_neighbor[] = {
+static const struct keywords keywords_show_neighbor[] = {
{ "timers", SHOW_NEIGHBOR_TIMERS},
{ "messages", SHOW_NEIGHBOR}
};
@@ -70,6 +74,11 @@ static const struct keywords keywords_fib[] = {
{ "decouple", FIB_DECOUPLE}
};
+static const struct keywords keywords_neighbor[] = {
+ { "up", NEIGHBOR_UP},
+ { "down", NEIGHBOR_DOWN}
+};
+
int main(int, char *[]);
int match_keyword(const char *, const struct keywords [], size_t);
void show_summary_head(void);
@@ -140,9 +149,9 @@ again:
imsg_compose(&ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, NULL, 0);
if (argc >= 5)
- action = match_keyword(argv[4], keywords_neighbor,
- sizeof(keywords_neighbor)/
- sizeof(keywords_neighbor[0]));
+ action = match_keyword(argv[4], keywords_show_neighbor,
+ sizeof(keywords_show_neighbor)/
+ sizeof(keywords_show_neighbor[0]));
break;
case RELOAD:
if (argc >= 3)
@@ -173,6 +182,28 @@ again:
printf("decouple request sent.\n");
done = 1;
break;
+ case NEIGHBOR:
+ if (argc < 4)
+ errx(1, "usage: neighbor address command");
+ if (!parse_addr(argv[2], &addr))
+ errx(1, "%s: not an IP address", argv[2]);
+ action = match_keyword(argv[3], keywords_neighbor,
+ sizeof(keywords_neighbor)/
+ sizeof(keywords_neighbor[0]));
+ goto again;
+ break;
+ case NEIGHBOR_UP:
+ imsg_compose(&ibuf, IMSG_CTL_NEIGHBOR_UP, 0,
+ &addr, sizeof(addr));
+ printf("request sent.\n");
+ done = 1;
+ break;
+ case NEIGHBOR_DOWN:
+ imsg_compose(&ibuf, IMSG_CTL_NEIGHBOR_DOWN, 0,
+ &addr, sizeof(addr));
+ printf("request sent.\n");
+ done = 1;
+ break;
}
while (!done) {
@@ -201,6 +232,9 @@ again:
case FIB:
case FIB_COUPLE:
case FIB_DECOUPLE:
+ case NEIGHBOR:
+ case NEIGHBOR_UP:
+ case NEIGHBOR_DOWN:
break;
}
imsg_free(&imsg);