summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 734b5fb502d..f860a32509f 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.26 2004/01/11 02:36:48 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.27 2004/01/17 18:06:04 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <net/if.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,6 +37,7 @@ enum actions {
SHOW_NEIGHBOR_TIMERS,
SHOW_FIB,
SHOW_NEXTHOP,
+ SHOW_INTERFACE,
RELOAD,
FIB,
FIB_COUPLE,
@@ -66,7 +68,8 @@ static const struct keywords keywords_show[] = {
{ "neighbor", SHOW_NEIGHBOR},
{ "summary", SHOW_SUMMARY},
{ "fib", SHOW_FIB},
- { "nexthop", SHOW_NEXTHOP}
+ { "nexthop", SHOW_NEXTHOP},
+ { "interfaces", SHOW_INTERFACE}
};
static const struct keywords keywords_show_neighbor[] = {
@@ -99,6 +102,8 @@ void show_fib_head(void);
int show_fib_msg(struct imsg *);
void show_nexthop_head(void);
int show_nexthop_msg(struct imsg *);
+void show_interface_head(void);
+int show_interface_msg(struct imsg *);
struct imsgbuf ibuf;
@@ -174,6 +179,10 @@ again:
imsg_compose(&ibuf, IMSG_CTL_SHOW_NEXTHOP, 0, NULL, 0);
show_nexthop_head();
break;
+ case SHOW_INTERFACE:
+ imsg_compose(&ibuf, IMSG_CTL_SHOW_INTERFACE, 0, NULL, 0);
+ show_interface_head();
+ break;
case SHOW_NEIGHBOR:
case SHOW_NEIGHBOR_TIMERS:
/* get ip address of neighbor, limit query to that */
@@ -269,6 +278,9 @@ again:
case SHOW_NEXTHOP:
done = show_nexthop_msg(&imsg);
break;
+ case SHOW_INTERFACE:
+ done = show_interface_msg(&imsg);
+ break;
case SHOW_NEIGHBOR:
done = show_neighbor_msg(&imsg, NV_DEFAULT);
break;
@@ -606,3 +618,33 @@ show_nexthop_msg(struct imsg *imsg)
return (0);
}
+
+void
+show_interface_head(void)
+{
+ printf("%-20s%s\n", "Interface", "Flags");
+}
+
+int
+show_interface_msg(struct imsg *imsg)
+{
+ struct kif *k;
+
+ switch (imsg->hdr.type) {
+ case IMSG_CTL_SHOW_INTERFACE:
+ k = imsg->data;
+ printf("%-20u", k->ifindex);
+ if (k->flags & IFF_UP)
+ printf("UP ");
+ printf("\n");
+ break;
+ case IMSG_CTL_END:
+ return (1);
+ break;
+ default:
+printf("beep");
+ break;
+ }
+
+ return (0);
+}