Skip to content

Commit

Permalink
bgpd: fix add json attribute to reflect suppressed path
Browse files Browse the repository at this point in the history
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 FRRouting#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 FRRouting#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 <[email protected]>
  • Loading branch information
pguibert6WIND committed Jan 27, 2025
1 parent ed63f84 commit c742817
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c742817

Please sign in to comment.