mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 07:37:54 +00:00
Merge pull request #10878 from ton31337/fix/bgp_crash_vrf_all_all
bgpd: Fix crash for `show ip bgp vrf all all`
This commit is contained in:
commit
a80d833f6b
122
bgpd/bgp_route.c
122
bgpd/bgp_route.c
@ -12463,6 +12463,8 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||||||
output_arg, show_flags,
|
output_arg, show_flags,
|
||||||
rpki_target_state);
|
rpki_target_state);
|
||||||
} else {
|
} else {
|
||||||
|
struct listnode *node;
|
||||||
|
struct bgp *abgp;
|
||||||
/* show <ip> bgp ipv4 all: AFI_IP, show <ip> bgp ipv6 all:
|
/* show <ip> bgp ipv4 all: AFI_IP, show <ip> bgp ipv6 all:
|
||||||
* AFI_IP6 */
|
* AFI_IP6 */
|
||||||
|
|
||||||
@ -12474,66 +12476,80 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||||||
afi = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_IP)
|
afi = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_IP)
|
||||||
? AFI_IP
|
? AFI_IP
|
||||||
: AFI_IP6;
|
: AFI_IP6;
|
||||||
FOREACH_SAFI (safi) {
|
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) {
|
||||||
if (!bgp_afi_safi_peer_exists(bgp, afi, safi))
|
FOREACH_SAFI (safi) {
|
||||||
continue;
|
if (!bgp_afi_safi_peer_exists(abgp, afi,
|
||||||
|
safi))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (uj) {
|
if (uj) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
|
else
|
||||||
|
vty_out(vty, ",\n");
|
||||||
|
vty_out(vty, "\"%s\":{\n",
|
||||||
|
get_afi_safi_str(afi,
|
||||||
|
safi,
|
||||||
|
true));
|
||||||
|
} else
|
||||||
|
vty_out(vty,
|
||||||
|
"\nFor address family: %s\n",
|
||||||
|
get_afi_safi_str(
|
||||||
|
afi, safi,
|
||||||
|
false));
|
||||||
|
|
||||||
|
if (community)
|
||||||
|
bgp_show_community(
|
||||||
|
vty, abgp, community,
|
||||||
|
exact_match, afi, safi,
|
||||||
|
show_flags);
|
||||||
else
|
else
|
||||||
vty_out(vty, ",\n");
|
bgp_show(vty, abgp, afi, safi,
|
||||||
vty_out(vty, "\"%s\":{\n",
|
sh_type, output_arg,
|
||||||
get_afi_safi_str(afi, safi,
|
show_flags,
|
||||||
true));
|
rpki_target_state);
|
||||||
} else
|
if (uj)
|
||||||
vty_out(vty,
|
vty_out(vty, "}\n");
|
||||||
"\nFor address family: %s\n",
|
}
|
||||||
get_afi_safi_str(afi, safi,
|
|
||||||
false));
|
|
||||||
|
|
||||||
if (community)
|
|
||||||
bgp_show_community(vty, bgp, community,
|
|
||||||
exact_match, afi,
|
|
||||||
safi, show_flags);
|
|
||||||
else
|
|
||||||
bgp_show(vty, bgp, afi, safi, sh_type,
|
|
||||||
output_arg, show_flags,
|
|
||||||
rpki_target_state);
|
|
||||||
if (uj)
|
|
||||||
vty_out(vty, "}\n");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* show <ip> bgp all: for each AFI and SAFI*/
|
/* show <ip> bgp all: for each AFI and SAFI*/
|
||||||
FOREACH_AFI_SAFI (afi, safi) {
|
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) {
|
||||||
if (!bgp_afi_safi_peer_exists(bgp, afi, safi))
|
FOREACH_AFI_SAFI (afi, safi) {
|
||||||
continue;
|
if (!bgp_afi_safi_peer_exists(abgp, afi,
|
||||||
|
safi))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (uj) {
|
if (uj) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
|
else
|
||||||
|
vty_out(vty, ",\n");
|
||||||
|
|
||||||
|
vty_out(vty, "\"%s\":{\n",
|
||||||
|
get_afi_safi_str(afi,
|
||||||
|
safi,
|
||||||
|
true));
|
||||||
|
} else
|
||||||
|
vty_out(vty,
|
||||||
|
"\nFor address family: %s\n",
|
||||||
|
get_afi_safi_str(
|
||||||
|
afi, safi,
|
||||||
|
false));
|
||||||
|
|
||||||
|
if (community)
|
||||||
|
bgp_show_community(
|
||||||
|
vty, abgp, community,
|
||||||
|
exact_match, afi, safi,
|
||||||
|
show_flags);
|
||||||
else
|
else
|
||||||
vty_out(vty, ",\n");
|
bgp_show(vty, abgp, afi, safi,
|
||||||
|
sh_type, output_arg,
|
||||||
vty_out(vty, "\"%s\":{\n",
|
show_flags,
|
||||||
get_afi_safi_str(afi, safi,
|
rpki_target_state);
|
||||||
true));
|
if (uj)
|
||||||
} else
|
vty_out(vty, "}\n");
|
||||||
vty_out(vty,
|
}
|
||||||
"\nFor address family: %s\n",
|
|
||||||
get_afi_safi_str(afi, safi,
|
|
||||||
false));
|
|
||||||
|
|
||||||
if (community)
|
|
||||||
bgp_show_community(vty, bgp, community,
|
|
||||||
exact_match, afi,
|
|
||||||
safi, show_flags);
|
|
||||||
else
|
|
||||||
bgp_show(vty, bgp, afi, safi, sh_type,
|
|
||||||
output_arg, show_flags,
|
|
||||||
rpki_target_state);
|
|
||||||
if (uj)
|
|
||||||
vty_out(vty, "}\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uj)
|
if (uj)
|
||||||
|
Loading…
Reference in New Issue
Block a user