mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 14:19:44 +00:00
Merge pull request #11218 from opensourcerouting/fix/adv_routes_best_path_wrong_local_as
bgpd: Show a correct local AS for the advertised/bestpath routes
This commit is contained in:
commit
2c5d51d6f7
@ -13469,7 +13469,7 @@ DEFUN (show_bgp_l2vpn_evpn_route_prefix,
|
||||
RPKI_NOT_BEING_USED, use_json(argc, argv));
|
||||
}
|
||||
|
||||
static void show_adj_route_header(struct vty *vty, struct bgp *bgp,
|
||||
static void show_adj_route_header(struct vty *vty, struct peer *peer,
|
||||
struct bgp_table *table, int *header1,
|
||||
int *header2, json_object *json,
|
||||
json_object *json_scode,
|
||||
@ -13481,10 +13481,13 @@ static void show_adj_route_header(struct vty *vty, struct bgp *bgp,
|
||||
if (json) {
|
||||
json_object_int_add(json, "bgpTableVersion", version);
|
||||
json_object_string_addf(json, "bgpLocalRouterId",
|
||||
"%pI4", &bgp->router_id);
|
||||
"%pI4", &peer->bgp->router_id);
|
||||
json_object_int_add(json, "defaultLocPrf",
|
||||
bgp->default_local_pref);
|
||||
json_object_int_add(json, "localAS", bgp->as);
|
||||
peer->bgp->default_local_pref);
|
||||
json_object_int_add(json, "localAS",
|
||||
peer->change_local_as
|
||||
? peer->change_local_as
|
||||
: peer->local_as);
|
||||
json_object_object_add(json, "bgpStatusCodes",
|
||||
json_scode);
|
||||
json_object_object_add(json, "bgpOriginCodes",
|
||||
@ -13493,15 +13496,17 @@ static void show_adj_route_header(struct vty *vty, struct bgp *bgp,
|
||||
vty_out(vty,
|
||||
"BGP table version is %" PRIu64
|
||||
", local router ID is %pI4, vrf id ",
|
||||
version, &bgp->router_id);
|
||||
if (bgp->vrf_id == VRF_UNKNOWN)
|
||||
version, &peer->bgp->router_id);
|
||||
if (peer->bgp->vrf_id == VRF_UNKNOWN)
|
||||
vty_out(vty, "%s", VRFID_NONE_STR);
|
||||
else
|
||||
vty_out(vty, "%u", bgp->vrf_id);
|
||||
vty_out(vty, "%u", peer->bgp->vrf_id);
|
||||
vty_out(vty, "\n");
|
||||
vty_out(vty, "Default local pref %u, ",
|
||||
bgp->default_local_pref);
|
||||
vty_out(vty, "local AS %u\n", bgp->as);
|
||||
peer->bgp->default_local_pref);
|
||||
vty_out(vty, "local AS %u\n",
|
||||
peer->change_local_as ? peer->change_local_as
|
||||
: peer->local_as);
|
||||
vty_out(vty, BGP_SHOW_SCODE_HEADER);
|
||||
vty_out(vty, BGP_SHOW_NCODE_HEADER);
|
||||
vty_out(vty, BGP_SHOW_OCODE_HEADER);
|
||||
@ -13554,7 +13559,10 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
"%pI4", &bgp->router_id);
|
||||
json_object_int_add(json, "defaultLocPrf",
|
||||
bgp->default_local_pref);
|
||||
json_object_int_add(json, "localAS", bgp->as);
|
||||
json_object_int_add(json, "localAS",
|
||||
peer->change_local_as
|
||||
? peer->change_local_as
|
||||
: peer->local_as);
|
||||
json_object_object_add(json, "bgpStatusCodes",
|
||||
json_scode);
|
||||
json_object_object_add(json, "bgpOriginCodes",
|
||||
@ -13574,7 +13582,9 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
vty_out(vty, "\n");
|
||||
vty_out(vty, "Default local pref %u, ",
|
||||
bgp->default_local_pref);
|
||||
vty_out(vty, "local AS %u\n", bgp->as);
|
||||
vty_out(vty, "local AS %u\n",
|
||||
peer->change_local_as ? peer->change_local_as
|
||||
: peer->local_as);
|
||||
vty_out(vty, BGP_SHOW_SCODE_HEADER);
|
||||
vty_out(vty, BGP_SHOW_NCODE_HEADER);
|
||||
vty_out(vty, BGP_SHOW_OCODE_HEADER);
|
||||
@ -13593,7 +13603,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
if (ain->peer != peer)
|
||||
continue;
|
||||
|
||||
show_adj_route_header(vty, bgp, table, header1,
|
||||
show_adj_route_header(vty, peer, table, header1,
|
||||
header2, json, json_scode,
|
||||
json_ocode, wide);
|
||||
|
||||
@ -13650,7 +13660,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
if (paf->peer != peer || !adj->attr)
|
||||
continue;
|
||||
|
||||
show_adj_route_header(vty, bgp, table,
|
||||
show_adj_route_header(vty, peer, table,
|
||||
header1, header2,
|
||||
json, json_scode,
|
||||
json_ocode, wide);
|
||||
@ -13694,9 +13704,9 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
} else if (type == bgp_show_adj_route_bestpath) {
|
||||
struct bgp_path_info *pi;
|
||||
|
||||
show_adj_route_header(vty, bgp, table, header1, header2,
|
||||
json, json_scode, json_ocode,
|
||||
wide);
|
||||
show_adj_route_header(vty, peer, table, header1,
|
||||
header2, json, json_scode,
|
||||
json_ocode, wide);
|
||||
|
||||
for (pi = bgp_dest_get_bgp_path_info(dest); pi;
|
||||
pi = pi->next) {
|
||||
|
Loading…
Reference in New Issue
Block a user