Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

This commit is contained in:
Don Slice 2016-04-22 05:40:09 -07:00
commit 1a5d323c02

View File

@ -2587,65 +2587,66 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
{ {
struct route_node *rn; struct route_node *rn;
struct rib *rib; struct rib *rib;
struct nexthop *nexthop;
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
u_int32_t i; u_int32_t i;
u_int32_t is_ibgp;
memset (&rib_cnt, 0, sizeof(rib_cnt)); memset (&rib_cnt, 0, sizeof(rib_cnt));
memset (&fib_cnt, 0, sizeof(fib_cnt)); memset (&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top (table); rn; rn = route_next (rn)) for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib) RNODE_FOREACH_RIB (rn, rib)
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) {
{ is_ibgp = (rib->type == ZEBRA_ROUTE_BGP &&
rib_cnt[ZEBRA_ROUTE_TOTAL]++; CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP));
rib_cnt[rib->type]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) rib_cnt[ZEBRA_ROUTE_TOTAL]++;
|| nexthop_has_fib_child(nexthop)) if (is_ibgp)
{ rib_cnt[ZEBRA_ROUTE_IBGP]++;
fib_cnt[ZEBRA_ROUTE_TOTAL]++; else
fib_cnt[rib->type]++; rib_cnt[rib->type]++;
}
if (rib->type == ZEBRA_ROUTE_BGP && if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) {
{ fib_cnt[ZEBRA_ROUTE_TOTAL]++;
rib_cnt[ZEBRA_ROUTE_IBGP]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) if (is_ibgp)
|| nexthop_has_fib_child(nexthop)) fib_cnt[ZEBRA_ROUTE_IBGP]++;
fib_cnt[ZEBRA_ROUTE_IBGP]++; else
} fib_cnt[rib->type]++;
} }
}
vty_out (vty, "%-20s %-20s %s (vrf %s)%s", vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
"Route Source", "Routes", "FIB", "Route Source", "Routes", "FIB",
((rib_table_info_t *)table->info)->zvrf->name, ((rib_table_info_t *)table->info)->zvrf->name,
VTY_NEWLINE); VTY_NEWLINE);
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{ {
if (rib_cnt[i] > 0) if (rib_cnt[i] > 0)
{ {
if (i == ZEBRA_ROUTE_BGP) if (i == ZEBRA_ROUTE_BGP)
{ {
vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
VTY_NEWLINE); VTY_NEWLINE);
vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
VTY_NEWLINE); VTY_NEWLINE);
} }
else else
vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
rib_cnt[i], fib_cnt[i], VTY_NEWLINE); rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
} }
} }
vty_out (vty, "------%s", VTY_NEWLINE); vty_out (vty, "------%s", VTY_NEWLINE);
vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
} }