From 79bc257a1d750789ff9116b03812375bc8abcb5d Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 2 Jan 2019 19:25:02 -0200 Subject: [PATCH] bgpd: fix parsing of community number in the "show bgp community" command Fixes #3545. Signed-off-by: Renato Westphal --- bgpd/bgp_route.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2c361bef4d..31cd3d1f05 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9529,9 +9529,16 @@ DEFUN (show_ip_bgp_json, } if (argv_find(argv, argc, "community", &idx)) { - char *maybecomm = idx + 1 < argc ? argv[idx + 1]->text : NULL; + char *maybecomm = NULL; char *community = NULL; + if (idx + 1 < argc) { + if (argv[idx + 1]->type == VARIABLE_TKN) + maybecomm = argv[idx + 1]->arg; + else + maybecomm = argv[idx + 1]->text; + } + if (maybecomm && !strmatch(maybecomm, "json") && !strmatch(maybecomm, "exact-match")) community = maybecomm; -- 2.39.5