mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
Get route counts right for show ip route summary
Ticket: CM-9974 Reviewed By: CCR-4531 Testing Done: Testing with both single & multiple NHs Zebra is counting each NH as a separate route which leads to all wrong stats. Count routes, not NHs.
This commit is contained in:
parent
d651649ed5
commit
1ff0858e52
@ -2587,34 +2587,35 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
|
||||
{
|
||||
struct route_node *rn;
|
||||
struct rib *rib;
|
||||
struct nexthop *nexthop;
|
||||
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
|
||||
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
|
||||
u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
||||
u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
||||
u_int32_t i;
|
||||
u_int32_t is_ibgp;
|
||||
|
||||
memset (&rib_cnt, 0, sizeof(rib_cnt));
|
||||
memset (&fib_cnt, 0, sizeof(fib_cnt));
|
||||
for (rn = route_top (table); rn; rn = route_next (rn))
|
||||
RNODE_FOREACH_RIB (rn, rib)
|
||||
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
|
||||
{
|
||||
is_ibgp = (rib->type == ZEBRA_ROUTE_BGP &&
|
||||
CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP));
|
||||
|
||||
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
||||
if (is_ibgp)
|
||||
rib_cnt[ZEBRA_ROUTE_IBGP]++;
|
||||
else
|
||||
rib_cnt[rib->type]++;
|
||||
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
|
||||
|| nexthop_has_fib_child(nexthop))
|
||||
|
||||
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
|
||||
{
|
||||
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
||||
fib_cnt[rib->type]++;
|
||||
}
|
||||
if (rib->type == ZEBRA_ROUTE_BGP &&
|
||||
CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
|
||||
{
|
||||
rib_cnt[ZEBRA_ROUTE_IBGP]++;
|
||||
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
|
||||
|| nexthop_has_fib_child(nexthop))
|
||||
|
||||
if (is_ibgp)
|
||||
fib_cnt[ZEBRA_ROUTE_IBGP]++;
|
||||
else
|
||||
fib_cnt[rib->type]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user