{
struct bgp_table_stats ts;
unsigned int i;
-
+
if (!bgp->rib[afi][safi])
{
vty_outln (vty, "%% No RIB exist's for the AFI(%d)/SAFI(%d)",
afi, safi);
return CMD_WARNING;
}
-
+
+ vty_outln (vty, "BGP %s RIB statistics%s",
+ afi_safi_print (afi, safi), VTYNL);
+
+ /* labeled-unicast routes live in the unicast table */
+ if (safi == SAFI_LABELED_UNICAST)
+ safi = SAFI_UNICAST;
+
memset (&ts, 0, sizeof (ts));
ts.table = bgp->rib[afi][safi];
thread_execute (bm->master, bgp_table_stats_walker, &ts, 0);
- vty_outln (vty, "BGP %s RIB statistics%s",
- afi_safi_print (afi, safi), VTYNL);
-
for (i = 0; i < BGP_STATS_MAX; i++)
{
if (!table_stats_strs[i])
bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi,
safi_t safi, enum bgp_show_type type, u_char use_json)
{
- /* labeled-unicast routes live in the unicast table */
- if (safi == SAFI_LABELED_UNICAST)
- safi = SAFI_UNICAST;
-
if (! peer || ! peer->afc[afi][safi])
{
if (use_json)
return CMD_WARNING;
}
+ /* labeled-unicast routes live in the unicast table */
+ if (safi == SAFI_LABELED_UNICAST)
+ safi = SAFI_UNICAST;
+
return bgp_show (vty, peer->bgp, afi, safi, type, &peer->su, use_json);
}
int neighbor_col_default_width = 16;
int len;
int max_neighbor_width = 0;
+ int pfx_rcd_safi;
json_object *json_peer = NULL;
json_object *json_peers = NULL;
+ /* labeled-unicast routes are installed in the unicast table so in order to
+ * display the correct PfxRcd value we must look at SAFI_UNICAST
+ */
+ if (safi == SAFI_LABELED_UNICAST)
+ pfx_rcd_safi = SAFI_UNICAST;
+ else
+ pfx_rcd_safi = safi;
+
if (use_json)
{
if (json == NULL)
json_object_int_add(json_peer, "outq", peer->obuf->count);
json_object_int_add(json_peer, "inq", 0);
peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer);
- json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]);
+ json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][pfx_rcd_safi]);
if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
json_object_string_add(json_peer, "state", "Idle (Admin)");
peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
if (peer->status == Established)
- vty_out (vty, " %12ld", peer->pcount[afi][safi]);
+ vty_out (vty, " %12ld", peer->pcount[afi][pfx_rcd_safi]);
else
{
if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))