diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2007-03-28 12:34:09 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2007-03-28 12:34:09 +0000 |
commit | 00d2a05829dcd1881976428b02deb92bd90e33e9 (patch) | |
tree | f0d0a63ab84295d806c2ebbfdb541f2145d244e4 /usr.sbin/bgpctl | |
parent | 34d950a9d7f2f8e26b6dacf7a3211b985f8d7b06 (diff) |
add support for bgpctl show rib community <community>
mostly from rivo nurges <rix@estpak.ee>, ok claudio
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.8 | 5 | ||||
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 7 | ||||
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpctl/parser.h | 3 |
4 files changed, 23 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8 index 5792232e450..24de3a8a91a 100644 --- a/usr.sbin/bgpctl/bgpctl.8 +++ b/usr.sbin/bgpctl/bgpctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpctl.8,v 1.42 2007/03/07 11:55:54 henning Exp $ +.\" $OpenBSD: bgpctl.8,v 1.43 2007/03/28 12:34:08 henning Exp $ .\" .\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org> .\" @@ -187,6 +187,9 @@ Show all entries with as leftmost AS. .It Cm empty-as Show all entries that are internal routes with no AS's in the AS path. +.It Cm community Ar community +Show all entries with community +.Ar community . .It Cm neighbor Ar peer Show only entries from the specified peer. .It Cm summary diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 6c9e8986f69..7d7a6ead337 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.118 2007/03/16 20:48:38 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.119 2007/03/28 12:34:08 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -213,6 +213,11 @@ main(int argc, char *argv[]) ribreq.prefixlen = res->prefixlen; type = IMSG_CTL_SHOW_RIB_PREFIX; } + if (res->community.as != 0 && res->community.type != 0) { + memcpy(&ribreq.community, &res->community, + sizeof(res->community)); + type = IMSG_CTL_SHOW_RIB_COMMUNITY; + } memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor)); ribreq.af = res->af; diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index b795397f2d4..d894bf7eeb0 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.40 2007/03/07 11:55:54 henning Exp $ */ +/* $OpenBSD: parser.c,v 1.41 2007/03/28 12:34:08 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -73,6 +73,7 @@ static const struct token t_neighbor_modifiers[]; static const struct token t_show_as[]; static const struct token t_show_prefix[]; static const struct token t_show_ip[]; +static const struct token t_show_community[]; static const struct token t_network[]; static const struct token t_network_show[]; static const struct token t_prefix[]; @@ -135,6 +136,7 @@ static const struct token t_show_rib[] = { { ASTYPE, "transit-as", AS_TRANSIT, t_show_as}, { ASTYPE, "peer-as", AS_PEER, t_show_as}, { ASTYPE, "empty-as", AS_EMPTY, t_show_rib}, + { KEYWORD, "community", NONE, t_show_community}, { FLAG, "detail", F_CTL_DETAIL, t_show_rib}, { FLAG, "in", F_CTL_ADJ_IN, t_show_rib}, { FLAG, "out", F_CTL_ADJ_OUT, t_show_rib}, @@ -203,6 +205,11 @@ static const struct token t_show_ip[] = { { ENDTOKEN, "", NONE, NULL} }; +static const struct token t_show_community[] = { + { COMMUNITY, "", NONE, t_show_rib}, + { ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_network[] = { { KEYWORD, "add", NETWORK_ADD, t_prefix}, { KEYWORD, "delete", NETWORK_REMOVE, t_prefix}, @@ -773,6 +780,9 @@ done: fs->action.community.as = as; fs->action.community.type = type; + r->community.as = as; + r->community.type = type; + TAILQ_INSERT_TAIL(&r->set, fs, entry); return (1); } diff --git a/usr.sbin/bgpctl/parser.h b/usr.sbin/bgpctl/parser.h index fa92508744b..18981134b22 100644 --- a/usr.sbin/bgpctl/parser.h +++ b/usr.sbin/bgpctl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.15 2007/03/03 11:45:30 henning Exp $ */ +/* $OpenBSD: parser.h,v 1.16 2007/03/28 12:34:08 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -53,6 +53,7 @@ struct parse_result { struct bgpd_addr peeraddr; struct filter_as as; struct filter_set_head set; + struct filter_community community; char peerdesc[PEER_DESCR_LEN]; int flags; enum actions action; |