diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-11-28 09:18:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 09:18:00 -0500 |
| commit | f5be225e63506535e5b06b0868d2f8b6b5004cd0 (patch) | |
| tree | 7cd041ca78d102fce10d336c05b15b6ef1986136 /lib/routemap.c | |
| parent | 32d25b73752d2216889d2d984accaad62b9f3611 (diff) | |
| parent | 3a63f70a827bbe8d0ba557b3ff85e4e14dff64c6 (diff) | |
Merge pull request #14893 from FRRouting/mergify/bp/stable/8.5/pr-14856
lib: fix show route map JSON display (backport #14856)
Diffstat (limited to 'lib/routemap.c')
| -rw-r--r-- | lib/routemap.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/routemap.c b/lib/routemap.c index 010d4bff0b..683943eb6d 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1047,20 +1047,17 @@ static int vty_show_route_map(struct vty *vty, const char *name, bool use_json) { struct route_map *map; json_object *json = NULL; - json_object *json_proto = NULL; - if (use_json) { + if (use_json) json = json_object_new_object(); - json_proto = json_object_new_object(); - json_object_object_add(json, frr_protonameinst, json_proto); - } else + else vty_out(vty, "%s:\n", frr_protonameinst); if (name) { map = route_map_lookup_by_name(name); if (map) { - vty_show_route_map_entry(vty, map, json_proto); + vty_show_route_map_entry(vty, map, json); } else if (!use_json) { vty_out(vty, "%s: 'route-map %s' not found\n", frr_protonameinst, name); @@ -1076,7 +1073,7 @@ static int vty_show_route_map(struct vty *vty, const char *name, bool use_json) list_sort(maplist, sort_route_map); for (ALL_LIST_ELEMENTS_RO(maplist, ln, map)) - vty_show_route_map_entry(vty, map, json_proto); + vty_show_route_map_entry(vty, map, json); list_delete(&maplist); } @@ -3141,13 +3138,13 @@ DEFPY (rmap_clear_counters, } -DEFUN (rmap_show_name, - rmap_show_name_cmd, - "show route-map [WORD] [json]", - SHOW_STR - "route-map information\n" - "route-map name\n" - JSON_STR) +DEFUN_NOSH (rmap_show_name, + rmap_show_name_cmd, + "show route-map [WORD] [json]", + SHOW_STR + "route-map information\n" + "route-map name\n" + JSON_STR) { bool uj = use_json(argc, argv); int idx = 0; |
