diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-09 19:09:46 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-09 19:09:46 +0000 |
commit | 106961a59aea757c275173fd6d9b586c73bae088 (patch) | |
tree | c68f89b2f707f1fec11eb23f59f2f08a57e44aaa /usr.sbin/bgpctl | |
parent | cfcc8923d3acdff51209b5fc0b3b4bfb37e0f0a0 (diff) |
show fib connected|static|bgp|nexthop|[address]
ok claudio@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index c8d5e526949..5b01a3cca9d 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.22 2004/01/09 13:48:10 henning Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.23 2004/01/09 19:09:45 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -103,6 +103,7 @@ main(int argc, char *argv[]) { struct sockaddr_un sun; int fd, n, done; + int i, flags; struct imsg imsg; enum actions action = SHOW_SUMMARY; struct bgpd_addr addr; @@ -143,9 +144,26 @@ again: show_summary_head(); break; case SHOW_FIB: - if (argc >= 4) - errx(1, "\"show fib\" does not take arguments"); - imsg_compose(&ibuf, IMSG_CTL_KROUTE, 0, NULL, 0); + flags = 0; + bzero(&addr, sizeof(addr)); + for (i = 3; i < argc; i++) + if (!strncmp(argv[i], "connected", strlen(argv[i]))) + flags |= F_CONNECTED; + else if (!strncmp(argv[i], "static", strlen(argv[i]))) + flags |= F_STATIC; + else if (!strncmp(argv[i], "bgp", strlen(argv[i]))) + flags |= F_BGPD_INSERTED; + else if (!strncmp(argv[i], "nexthop", strlen(argv[i]))) + flags |= F_NEXTHOP; + else if (!parse_addr(argv[i], &addr)) + errx(1, "usage: \"show fib connected|static|" + "bgp|nexthop|[address]"); + if (!addr.af) + imsg_compose(&ibuf, IMSG_CTL_KROUTE, 0, &flags, + sizeof(flags)); + else + imsg_compose(&ibuf, IMSG_CTL_KROUTE_ADDR, 0, &addr, + sizeof(addr)); show_fib_head(); break; case SHOW_NEIGHBOR: |