Skip to content

Commit

Permalink
Merge pull request FRRouting#17423 from opensourcerouting/fix/show_ad…
Browse files Browse the repository at this point in the history
…vertised_routes_plain_with_addpath

bgpd: Show neighbor advertised paths including addpath
  • Loading branch information
donaldsharp authored Nov 13, 2024
2 parents 5456bc5 + 5cf9f6a commit ced2658
Showing 1 changed file with 44 additions and 48 deletions.
92 changes: 44 additions & 48 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -14675,6 +14675,8 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
}

for (dest = bgp_table_top(table); dest; dest = bgp_route_next(dest)) {
struct bgp_path_info *bpi = NULL;

if (type == bgp_show_adj_route_received
|| type == bgp_show_adj_route_filtered) {
for (ain = dest->adj_in; ain; ain = ain->next) {
Expand Down Expand Up @@ -14779,57 +14781,51 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
peer, rn_p, &attr, afi, safi,
rmap_name);

if (ret != RMAP_DENY) {
if ((safi == SAFI_MPLS_VPN)
|| (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
if (use_json)
json_object_string_add(
json_ar,
"rd",
rd_str);
else if (show_rd
&& rd_str) {
vty_out(vty,
"Route Distinguisher: %s\n",
rd_str);
show_rd = false;
}
if (ret == RMAP_DENY) {
(*filtered_count)++;
bgp_attr_flush(&attr);
continue;
}

if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) ||
(safi == SAFI_EVPN)) {
if (use_json)
json_object_string_add(json_ar, "rd",
rd_str);
else if (show_rd && rd_str) {
vty_out(vty, "Route Distinguisher: %s\n",
rd_str);
show_rd = false;
}
if (detail) {
if (use_json)
json_net =
json_object_new_object();
bgp_show_path_info(
NULL /* prefix_rd
*/
,
dest, vty, bgp,
afi, safi,
json_net,
BGP_PATH_SHOW_ALL,
&display,
RPKI_NOT_BEING_USED);
if (use_json)
json_object_object_addf(
json_ar,
json_net,
"%pFX",
rn_p);
} else
route_vty_out_tmp(vty,
bgp,
dest,
rn_p,
&attr,
safi,
use_json,
json_ar,
wide);
(*output_count)++;
}
if (detail) {
if (use_json)
json_net = json_object_new_object();
bgp_show_path_info(NULL, dest, vty, bgp, afi, safi,
json_net, BGP_PATH_SHOW_ALL,
&display, RPKI_NOT_BEING_USED);
if (use_json)
json_object_object_addf(json_ar, json_net,
"%pFX", rn_p);
} else {
(*filtered_count)++;
/* For JSON output use route_vty_out_tmp() instead
* of route_vty_out().
* route_vty_out() is path-aware, while
* route_vty_out_tmp() prints only the best path.
* This is for backward compatibility.
*/
if (use_json) {
route_vty_out_tmp(vty, bgp, dest, rn_p,
&attr, safi, use_json,
json_ar, wide);
} else {
for (bpi = bgp_dest_get_bgp_path_info(dest);
bpi; bpi = bpi->next)
route_vty_out(vty, rn_p, bpi, 0,
safi, NULL, wide);
}
}
(*output_count)++;

bgp_attr_flush(&attr);
}
Expand Down

0 comments on commit ced2658

Please sign in to comment.