diff options
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 795bd15613..f10f7425c6 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8163,7 +8163,7 @@ static int bgp_show_regexp(struct vty *vty, struct bgp *bgp, const char *regstr, afi_t afi, safi_t safi, enum bgp_show_type type); static int bgp_show_community(struct vty *vty, struct bgp *bgp, const char *comstr, int exact, afi_t afi, - safi_t safi); + safi_t safi, uint8_t use_json); static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, @@ -9038,7 +9038,6 @@ DEFUN (show_ip_bgp, |prefix-list WORD\ |filter-list WORD\ |statistics\ - |community <AA:NN|local-AS|no-advertise|no-export|graceful-shutdown> [exact-match]\ |community-list <(1-500)|WORD> [exact-match]\ |A.B.C.D/M longer-prefixes\ |X:X::X:X/M longer-prefixes\ @@ -9058,13 +9057,6 @@ DEFUN (show_ip_bgp, "Display routes conforming to the filter-list\n" "Regular expression access list name\n" "BGP RIB advertisement statistics\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Graceful shutdown (well-known community)\n" - "Exact match of the communities\n" "Display routes matching the community-list\n" "community-list number\n" "community-list name\n" @@ -9079,7 +9071,6 @@ DEFUN (show_ip_bgp, int exact_match = 0; struct bgp *bgp = NULL; int idx = 0; - int idx_community_type = 0; bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi, &bgp); @@ -9106,24 +9097,6 @@ DEFUN (show_ip_bgp, return bgp_show_route_map(vty, bgp, argv[idx + 1]->arg, afi, safi, bgp_show_type_route_map); - if (argv_find(argv, argc, "community", &idx)) { - /* show a specific community */ - if (argv_find(argv, argc, "local-AS", &idx_community_type) - || argv_find(argv, argc, "no-advertise", - &idx_community_type) - || argv_find(argv, argc, "no-export", &idx_community_type) - || argv_find(argv, argc, "graceful-shutdown", - &idx_community_type) - || argv_find(argv, argc, "AA:NN", &idx_community_type)) { - - if (argv_find(argv, argc, "exact-match", &idx)) - exact_match = 1; - return bgp_show_community(vty, bgp, - argv[idx_community_type]->arg, - exact_match, afi, safi); - } - } - if (argv_find(argv, argc, "community-list", &idx)) { const char *clist_number_or_name = argv[++idx]->arg; if (++idx < argc && strmatch(argv[idx]->text, "exact-match")) @@ -9148,7 +9121,7 @@ DEFUN (show_ip_bgp_json, [<\ cidr-only\ |dampening <flap-statistics|dampened-paths>\ - |community \ + |community [<AA:NN|local-AS|no-advertise|no-export|graceful-shutdown>] [exact-match]\ >] [json]", SHOW_STR IP_STR @@ -9161,6 +9134,12 @@ DEFUN (show_ip_bgp_json, "Display flap statistics of routes\n" "Display paths suppressed due to dampening\n" "Display routes matching the communities\n" + COMMUNITY_AANN_STR + "Do not send outside local AS (well-known community)\n" + "Do not advertise to any peer (well-known community)\n" + "Do not export to next AS (well-known community)\n" + "Graceful shutdown (well-known community)\n" + "Exact match of the communities\n" JSON_STR) { afi_t afi = AFI_IP6; @@ -9168,6 +9147,8 @@ DEFUN (show_ip_bgp_json, enum bgp_show_type sh_type = bgp_show_type_normal; struct bgp *bgp = NULL; int idx = 0; + int idx_community_type = 0; + int exact_match = 0; bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi, &bgp); @@ -9193,10 +9174,31 @@ DEFUN (show_ip_bgp_json, } if (argv_find(argv, argc, "community", &idx)) { - /* show all communities */ - return bgp_show(vty, bgp, afi, safi, - bgp_show_type_community_all, NULL, uj); + + /* show a specific community */ + if (argv_find(argv, argc, "local-AS", &idx_community_type) || + argv_find(argv, argc, "no-advertise", + &idx_community_type) || + argv_find(argv, argc, "no-export", + &idx_community_type) || + argv_find(argv, argc, "graceful-shutdown", + &idx_community_type) || + argv_find(argv, argc, "AA:NN", &idx_community_type)) { + if (argv_find(argv, argc, "exact-match", &idx)) + exact_match = 1; + + return (bgp_show_community(vty, bgp, + argv[idx_community_type]->arg, + exact_match, afi, safi, uj)); + } else { + + /* show all communities */ + return (bgp_show(vty, bgp, afi, safi, + bgp_show_type_community_all, NULL, + uj)); + } } + return bgp_show(vty, bgp, afi, safi, sh_type, NULL, uj); } @@ -9403,7 +9405,7 @@ static int bgp_show_route_map(struct vty *vty, struct bgp *bgp, static int bgp_show_community(struct vty *vty, struct bgp *bgp, const char *comstr, int exact, afi_t afi, - safi_t safi) + safi_t safi, uint8_t use_json) { struct community *com; int ret = 0; @@ -9417,7 +9419,7 @@ static int bgp_show_community(struct vty *vty, struct bgp *bgp, ret = bgp_show(vty, bgp, afi, safi, (exact ? bgp_show_type_community_exact : bgp_show_type_community), - com, 0); + com, use_json); community_free(com); return ret; |
