From c74281731257a906caca1b18c7bfc5a5c5b58346 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 24 Jan 2025 13:22:03 +0100 Subject: [PATCH] bgpd: fix add json attribute to reflect suppressed path When aggregate is used, the suppressed information is not displayed in the json attributes of a given path. To illustrate, the dump of the 192.168.2.1/32 path in the bgp_aggregate_address_topo1 topotest: > # show bgp ipv4 > [..] > s> 192.168.2.1/32 10.0.0.2 0 65001 i > > # show bgp ipv4 detail > [..] > BGP routing table entry for 192.168.2.1/32, version 17 > Paths: (1 available, best #1, table default, vrf (null), Advertisements suppressed by an aggregate.) > Not advertised to any peer > 65001 <---- missing suppressed flag > 10.0.0.2 from 10.0.0.2 (10.254.254.3) > Origin IGP, valid, external, best (First path received) > Last update: Fri Jan 24 13:11:41 2025 > > # show bgp ipv4 detail json > [..] > ,"192.168.2.1/32": [{"aspath":{"string":"65001","segments":[{"type":"as-sequence","list":[65001]}],"length":1},"origin":"IGP","valid":true,"version":17, > "bestpath":{"overall":true,"selectionReason":"First path received"}, <---- missing suppressed flag > "lastUpdate":{"epoch":1737720700,"string":"Fri Jan 24 13:11:40 2025\n"}, > "nexthops":[{"ip":"10.0.0.2","afi":"ipv4","metric":0,"accessible":true,"used":true}], > "peer":{"peerId":"10.0.0.2","routerId":"10.254.254.3","type":"external"}}] Fix this by adding the json information. > # show bgp ipv4 detail > [..] > BGP routing table entry for 192.168.2.1/32, version 17 > Paths: (1 available, best #1, table default, vrf (null), Advertisements suppressed by an aggregate.) > Not advertised to any peer > 65001, (suppressed) > 10.0.0.2 from 10.0.0.2 (10.254.254.3) > Origin IGP, valid, external, best (First path received) > Last update: Fri Jan 24 13:11:41 2025 > > # show bgp ipv4 detail json > [..] > ,"192.168.2.1/32": [{"aspath":{"string":"65001","segments":[{"type":"as-sequence","list":[65001]}],"length":1},"suppressed":true,"origin":"IGP","valid":true,"version":17, > "bestpath":{"overall":true,"selectionReason":"First path received"}, > "lastUpdate":{"epoch":1737720991,"string":"Fri Jan 24 13:16:31 2025"}, > "nexthops":[{"ip":"10.0.0.2","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"10.0.0.2","routerId":"10.254.254.3","type":"external"}}] Signed-off-by: Philippe Guibert --- bgpd/bgp_route.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 672c43b37c..a2620a5a4c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10951,6 +10951,12 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, else vty_out(vty, ", (stale)"); } + if (bgp_path_suppressed(path)) { + if (json_paths) + json_object_boolean_true_add(json_path, "suppressed"); + else + vty_out(vty, ", (suppressed)"); + } if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR))) { if (json_paths) { -- 2.39.5