]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix add json attribute to reflect suppressed path
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 24 Jan 2025 12:22:03 +0000 (13:22 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 27 Jan 2025 10:47:41 +0000 (11:47 +0100)
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 <philippe.guibert@6wind.com>
bgpd/bgp_route.c

index 672c43b37cdefe566581ab4591255237522d8080..a2620a5a4c3f33b262d7a132ddbbf967c0e0630c 100644 (file)
@@ -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) {