summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-12-30 11:26:19 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-12-30 11:26:19 +0100
commit28e62b46ba3361699125df58553f86303ce88d5e (patch)
treec6e5613a41ce913ddf4eec1bc37776bc626ba64b /bgpd/bgp_vty.c
parentMerge pull request #17720 from jvoss/srv6_cli (diff)
downloadfrr-28e62b46ba3361699125df58553f86303ce88d5e.tar.xz
frr-28e62b46ba3361699125df58553f86303ce88d5e.zip
bgpd: Show prefix-related stats per neighbor
E.g.: ``` Prefix statistics: Inbound filtered: 0 AS-PATH loop: 0 Originator loop: 0 Cluster loop: 0 Invalid next-hop: 0 Withdrawn: 0 Attributes discarded: 3 ``` JSON: ``` "prefixStats":{ "inboundFiltered":0, "aspathLoop":0, "originatorLoop":0, "clusterLoop":0, "invalidNextHop":0, "withdrawn":0, "attributesDiscarded":3 }, ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r--bgpd/bgp_vty.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index e336b54eb..550adf93d 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -15464,9 +15464,12 @@ CPP_NOTICE("Remove `gracefulRestartCapability` JSON field")
if (use_json) {
json_object *json_stat = NULL;
+ json_object *json_pfx_stat = NULL;
+
json_stat = json_object_new_object();
- /* Packet counts. */
+ json_pfx_stat = json_object_new_object();
+ /* Packet counts. */
atomic_size_t outq_count, inq_count;
outq_count = atomic_load_explicit(&p->connection->obuf->count,
memory_order_relaxed);
@@ -15516,6 +15519,16 @@ CPP_NOTICE("Remove `gracefulRestartCapability` JSON field")
json_object_int_add(json_stat, "totalSent", PEER_TOTAL_TX(p));
json_object_int_add(json_stat, "totalRecv", PEER_TOTAL_RX(p));
json_object_object_add(json_neigh, "messageStats", json_stat);
+
+ /* Prefix statistics */
+ json_object_int_add(json_pfx_stat, "inboundFiltered", p->stat_pfx_filter);
+ json_object_int_add(json_pfx_stat, "aspathLoop", p->stat_pfx_aspath_loop);
+ json_object_int_add(json_pfx_stat, "originatorLoop", p->stat_pfx_originator_loop);
+ json_object_int_add(json_pfx_stat, "clusterLoop", p->stat_pfx_cluster_loop);
+ json_object_int_add(json_pfx_stat, "invalidNextHop", p->stat_pfx_nh_invalid);
+ json_object_int_add(json_pfx_stat, "withdrawn", p->stat_pfx_withdraw);
+ json_object_int_add(json_pfx_stat, "attributesDiscarded", p->stat_pfx_discard);
+ json_object_object_add(json_neigh, "prefixStats", json_pfx_stat);
} else {
atomic_size_t outq_count, inq_count, open_out, open_in,
notify_out, notify_in, update_out, update_in,
@@ -15567,8 +15580,18 @@ CPP_NOTICE("Remove `gracefulRestartCapability` JSON field")
refresh_in);
vty_out(vty, " Capability: %10zu %10zu\n",
dynamic_cap_out, dynamic_cap_in);
- vty_out(vty, " Total: %10u %10u\n",
- (uint32_t)PEER_TOTAL_TX(p), (uint32_t)PEER_TOTAL_RX(p));
+ vty_out(vty, " Total: %10u %10u\n\n", (uint32_t)PEER_TOTAL_TX(p),
+ (uint32_t)PEER_TOTAL_RX(p));
+
+ /* Prefix statistics */
+ vty_out(vty, " Prefix statistics:\n");
+ vty_out(vty, " Inbound filtered: %u\n", p->stat_pfx_filter);
+ vty_out(vty, " AS-PATH loop: %u\n", p->stat_pfx_aspath_loop);
+ vty_out(vty, " Originator loop: %u\n", p->stat_pfx_originator_loop);
+ vty_out(vty, " Cluster loop: %u\n", p->stat_pfx_cluster_loop);
+ vty_out(vty, " Invalid next-hop: %u\n", p->stat_pfx_nh_invalid);
+ vty_out(vty, " Withdrawn: %u\n", p->stat_pfx_withdraw);
+ vty_out(vty, " Attributes discarded: %u\n\n", p->stat_pfx_discard);
}
if (use_json) {