Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: Show neighbor advertised paths including addpath #17423

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading