]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix advertisedRoutes json key
authorTrey Aspelund <taspelund@nvidia.com>
Fri, 14 Jan 2022 21:57:32 +0000 (21:57 +0000)
committermergify-bot <noreply@mergify.com>
Sat, 15 Jan 2022 19:54:20 +0000 (19:54 +0000)
'show bgp ... neighbor [routes|received-routes]' both incorrectly
used a json key of 'advertisedRoutes'.
This corrects the key to be 'receivedRoutes' for commands where
the displayed routes were received, not advertised.

before:
unet> r3 show ip bgp neigh 10.2.30.2 received-routes json | include Routes
  "advertisedRoutes":{

after:
ub18# show ip bgp neighbors enp1s0 received-routes json | include Routes
  "receivedRoutes":{
ub18# show ip bgp neighbors enp1s0 advertised-routes json | include Routes
  "advertisedRoutes":{

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
(cherry picked from commit c1984955b7bda1c0d40786bc97a6c787bfa99f11)

bgpd/bgp_route.c

index 00cea67e152d28ab9c264c4ae346083eefffa7d6..b5093737629892c66dbcb703edd5983b3f6998ba 100644 (file)
@@ -13747,7 +13747,11 @@ static int peer_adj_routes(struct vty *vty, struct peer *peer, afi_t afi,
                               &output_count, &filtered_count);
 
        if (use_json) {
-               json_object_object_add(json, "advertisedRoutes", json_ar);
+               if (type == bgp_show_adj_route_advertised)
+                       json_object_object_add(json, "advertisedRoutes",
+                                              json_ar);
+               else
+                       json_object_object_add(json, "receivedRoutes", json_ar);
                json_object_int_add(json, "totalPrefixCounter", output_count);
                json_object_int_add(json, "filteredPrefixCounter",
                                    filtered_count);