]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: add bmp loc-rib 64 bit gauge value 15845/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 25 Apr 2024 15:50:24 +0000 (17:50 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 26 Apr 2024 06:12:41 +0000 (08:12 +0200)
There is no support for option 8, as per RFC7854.
Add the 64 bit counter in the peer structure.
Add the missing per peer statistic.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_bmp.c
bgpd/bgp_route.c
bgpd/bgpd.h
doc/user/bmp.rst

index 817a80a034a1d04864a15e0fb297e8081881a667..14066ae29dc9572867b0109e9ca311d6e10d5b34 100644 (file)
@@ -1647,6 +1647,8 @@ static void bmp_stats(struct event *thread)
                                         peer->stat_pfx_nh_invalid);
                bmp_stat_put_u64(s, &count, BMP_STATS_SIZE_ADJ_RIB_IN,
                                 peer->stat_pfx_adj_rib_in);
+               bmp_stat_put_u64(s, &count, BMP_STATS_SIZE_LOC_RIB,
+                                peer->stat_pfx_loc_rib);
 
                stream_putl_at(s, count_pos, count);
 
index 3feb2717d1b25d1e17783f5f5478880b7d95023d..e3690099384979f1de0360f7aa8e76cbb313d65b 100644 (file)
@@ -487,6 +487,8 @@ void bgp_path_info_add_with_caller(const char *name, struct bgp_dest *dest,
        bgp_dest_lock_node(dest);
        peer_lock(pi->peer); /* bgp_path_info peer reference */
        bgp_dest_set_defer_flag(dest, false);
+       if (pi->peer)
+               pi->peer->stat_pfx_loc_rib++;
        hook_call(bgp_snmp_update_stats, dest, pi, true);
 }
 
@@ -507,6 +509,8 @@ struct bgp_dest *bgp_path_info_reap(struct bgp_dest *dest,
        pi->next = NULL;
        pi->prev = NULL;
 
+       if (pi->peer)
+               pi->peer->stat_pfx_loc_rib--;
        hook_call(bgp_snmp_update_stats, dest, pi, false);
 
        bgp_path_info_unlock(pi);
@@ -521,6 +525,8 @@ static struct bgp_dest *bgp_path_info_reap_unsorted(struct bgp_dest *dest,
        pi->next = NULL;
        pi->prev = NULL;
 
+       if (pi->peer)
+               pi->peer->stat_pfx_loc_rib--;
        hook_call(bgp_snmp_update_stats, dest, pi, false);
        bgp_path_info_unlock(pi);
 
index 107fc8b95c045a4be9082ed24b066c5ce24df161..9779df3d2a957ecd8967e398884a5ba951d80742 100644 (file)
@@ -1667,6 +1667,7 @@ struct peer {
        uint32_t stat_pfx_nh_invalid;
        uint32_t stat_pfx_dup_withdraw;
        uint32_t stat_upd_7606;  /* RFC7606: treat-as-withdraw */
+       uint64_t stat_pfx_loc_rib; /* RFC7854 : Number of routes in Loc-RIB */
        uint64_t stat_pfx_adj_rib_in; /* RFC7854 : Number of routes in Adj-RIBs-In */
 
        /* BGP state count */
index ec1a51d0f8292ea978c8c3c9ffa689c5fb2e644b..14d0849b34109cef6f2f5129e3fbe8076a531a87 100644 (file)
@@ -24,6 +24,7 @@ The `BMP` implementation in FRR has the following properties:
   - 4: count of **prefixes** with loop in AS-path
   - 5: count of **prefixes** with loop in originator
   - 7: count of **routes** in adj-rib-in
+  - 8: count of **routes** in Loc-RIB
   - 11: count of updates subjected to :rfc:`7607` "treat as withdrawal"
     handling due to errors
   - 65531: *experimental* count of prefixes rejected due to invalid next-hop