mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 15:16:20 +00:00
Merge pull request #6794 from ton31337/fix/handle_bgp_vrf_all_statistics_crash_7.4
bgpd: [7.4] Handle default bgp vrf all for statistics
This commit is contained in:
commit
2c44ac162c
@ -10607,6 +10607,8 @@ DEFUN (show_ip_bgp_large_community,
|
||||
bgp_show_type_lcommunity_all, NULL, uj);
|
||||
}
|
||||
|
||||
static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json_array);
|
||||
static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json);
|
||||
|
||||
@ -10626,7 +10628,7 @@ DEFUN(show_ip_bgp_statistics_all, show_ip_bgp_statistics_all_cmd,
|
||||
|
||||
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
||||
&bgp, false);
|
||||
if (!bgp)
|
||||
if (!idx)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (uj)
|
||||
@ -11385,8 +11387,18 @@ static int bgp_table_stats_walker(struct thread *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json_array)
|
||||
static void bgp_table_stats_all(struct vty *vty, afi_t afi, safi_t safi,
|
||||
struct json_object *json_array)
|
||||
{
|
||||
struct listnode *node, *nnode;
|
||||
struct bgp *bgp;
|
||||
|
||||
for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
|
||||
bgp_table_stats_single(vty, bgp, afi, safi, json_array);
|
||||
}
|
||||
|
||||
static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json_array)
|
||||
{
|
||||
struct bgp_table_stats ts;
|
||||
unsigned int i;
|
||||
@ -11414,8 +11426,10 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
}
|
||||
|
||||
if (!json)
|
||||
vty_out(vty, "BGP %s RIB statistics\n",
|
||||
get_afi_safi_str(afi, safi, false));
|
||||
vty_out(vty, "BGP %s RIB statistics (%s)\n",
|
||||
get_afi_safi_str(afi, safi, false), bgp->name_pretty);
|
||||
else
|
||||
json_object_string_add(json, "instance", bgp->name_pretty);
|
||||
|
||||
/* labeled-unicast routes live in the unicast table */
|
||||
if (safi == SAFI_LABELED_UNICAST)
|
||||
@ -11604,6 +11618,17 @@ end_table_stats:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json_array)
|
||||
{
|
||||
if (!bgp) {
|
||||
bgp_table_stats_all(vty, afi, safi, json_array);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
return bgp_table_stats_single(vty, bgp, afi, safi, json_array);
|
||||
}
|
||||
|
||||
enum bgp_pcounts {
|
||||
PCOUNT_ADJ_IN = 0,
|
||||
PCOUNT_DAMPED,
|
||||
|
Loading…
Reference in New Issue
Block a user