]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix parsing of community number in the "show bgp community" command 3560/head
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 2 Jan 2019 21:25:02 +0000 (19:25 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 2 Jan 2019 21:32:15 +0000 (19:32 -0200)
Fixes #3545.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
bgpd/bgp_route.c

index 2c361bef4d5b2693f85bd1289914d44da0a86176..31cd3d1f051ee9aba04ef9f216986227e34f7d52 100644 (file)
@@ -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;