diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-08-10 14:12:35 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-08-10 14:12:35 +0000 |
commit | cceb6370b24742a9d22ae252c673ff1e3e2a49f0 (patch) | |
tree | 446163e896314191e8dda077bbfe21e106f6e585 /usr.sbin/bgpd | |
parent | 6796414b5975e08e455a4a8bd1d9726aca441c4b (diff) |
handle extended communities in bgpctl.
From Dennis Fondras, thanks!
ok phessler@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/control.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 7 |
3 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 5bd970789f6..32698a03fb6 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.311 2017/08/06 13:23:12 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.312 2017/08/10 14:12:34 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -383,6 +383,7 @@ enum imsg_type { IMSG_CTL_SHOW_RIB_PREFIX, IMSG_CTL_SHOW_RIB_ATTR, IMSG_CTL_SHOW_RIB_COMMUNITY, + IMSG_CTL_SHOW_RIB_EXTCOMMUNITY, IMSG_CTL_SHOW_RIB_LARGECOMMUNITY, IMSG_CTL_SHOW_NETWORK, IMSG_CTL_SHOW_RIB_MEM, @@ -697,6 +698,7 @@ struct ctl_show_rib_request { struct bgpd_addr prefix; struct filter_as as; struct filter_community community; + struct filter_extcommunity extcommunity; struct filter_largecommunity large_community; u_int32_t peerid; pid_t pid; diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 4da12e3b337..db4f8bb1108 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.88 2017/05/28 12:21:36 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.89 2017/08/10 14:12:34 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -252,6 +252,7 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) case IMSG_CTL_SHOW_RIB_PREFIX: case IMSG_CTL_SHOW_RIB_MEM: case IMSG_CTL_SHOW_RIB_COMMUNITY: + case IMSG_CTL_SHOW_RIB_EXTCOMMUNITY: case IMSG_CTL_SHOW_RIB_LARGECOMMUNITY: case IMSG_CTL_SHOW_NETWORK: case IMSG_CTL_SHOW_TERSE: @@ -480,6 +481,7 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) break; case IMSG_CTL_SHOW_RIB_MEM: case IMSG_CTL_SHOW_RIB_COMMUNITY: + case IMSG_CTL_SHOW_RIB_EXTCOMMUNITY: case IMSG_CTL_SHOW_RIB_LARGECOMMUNITY: case IMSG_CTL_SHOW_NETWORK: c->ibuf.pid = imsg.hdr.pid; diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index f98da41438d..a572a8e18b7 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.368 2017/05/29 13:10:40 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.369 2017/08/10 14:12:34 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -571,6 +571,7 @@ badnet: case IMSG_CTL_SHOW_RIB: case IMSG_CTL_SHOW_RIB_AS: case IMSG_CTL_SHOW_RIB_COMMUNITY: + case IMSG_CTL_SHOW_RIB_EXTCOMMUNITY: case IMSG_CTL_SHOW_RIB_LARGECOMMUNITY: case IMSG_CTL_SHOW_RIB_PREFIX: if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(req)) { @@ -2308,6 +2309,9 @@ rde_dump_filter(struct prefix *p, struct ctl_show_rib_request *req) !community_match(p->aspath, req->community.as, req->community.type)) return; + if (req->type == IMSG_CTL_SHOW_RIB_EXTCOMMUNITY && + !community_ext_match(p->aspath, &req->extcommunity, 0)) + return; if (req->type == IMSG_CTL_SHOW_RIB_LARGECOMMUNITY && !community_large_match(p->aspath, req->large_community.as, req->large_community.ld1, req->large_community.ld2)) @@ -2394,6 +2398,7 @@ rde_dump_ctx_new(struct ctl_show_rib_request *req, pid_t pid, case IMSG_CTL_SHOW_RIB: case IMSG_CTL_SHOW_RIB_AS: case IMSG_CTL_SHOW_RIB_COMMUNITY: + case IMSG_CTL_SHOW_RIB_EXTCOMMUNITY: case IMSG_CTL_SHOW_RIB_LARGECOMMUNITY: ctx->ribctx.ctx_upcall = rde_dump_upcall; break; |