]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: add 'bmp stat send-experimental' command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 25 Apr 2024 15:30:57 +0000 (17:30 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 26 Apr 2024 06:12:38 +0000 (08:12 +0200)
Some wireshark versions can not decode the experimental
bmp stat code. This may also be the case for some collectors.
Add a vty command to be able to disable bmp to sending
those values.

> [no] bmp stat send-experimental

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

index d4e1f871ab6eb893fdb955e2cda18db2c420f41c..817a80a034a1d04864a15e0fb297e8081881a667 100644 (file)
@@ -1642,8 +1642,9 @@ static void bmp_stats(struct event *thread)
                                peer->stat_pfx_dup_withdraw);
                bmp_stat_put_u32(s, &count, BMP_STATS_UPD_7606_WITHDRAW,
                                peer->stat_upd_7606);
-               bmp_stat_put_u32(s, &count, BMP_STATS_FRR_NH_INVALID,
-                               peer->stat_pfx_nh_invalid);
+               if (bt->stats_send_experimental)
+                       bmp_stat_put_u32(s, &count, BMP_STATS_FRR_NH_INVALID,
+                                        peer->stat_pfx_nh_invalid);
                bmp_stat_put_u64(s, &count, BMP_STATS_SIZE_ADJ_RIB_IN,
                                 peer->stat_pfx_adj_rib_in);
 
@@ -1900,6 +1901,7 @@ static struct bmp_targets *bmp_targets_get(struct bgp *bgp, const char *name)
        bt->name = XSTRDUP(MTYPE_BMP_TARGETSNAME, name);
        bt->bgp = bgp;
        bt->bmpbgp = bmp_bgp_get(bgp);
+       bt->stats_send_experimental = true;
        bmp_session_init(&bt->sessions);
        bmp_qhash_init(&bt->updhash);
        bmp_qlist_init(&bt->updlist);
@@ -2480,6 +2482,21 @@ DEFPY(bmp_stats_cfg,
        return CMD_SUCCESS;
 }
 
+DEFPY(bmp_stats_send_experimental,
+      bmp_stats_send_experimental_cmd,
+      "[no] bmp stats send-experimental",
+      NO_STR
+      BMP_STR
+      "Send BMP statistics messages\n"
+      "Send experimental BMP stats [65531-65534]\n")
+{
+       VTY_DECLVAR_CONTEXT_SUB(bmp_targets, bt);
+
+       bt->stats_send_experimental = !!no;
+
+       return CMD_SUCCESS;
+}
+
 #define BMP_POLICY_IS_LOCRIB(str) ((str)[0] == 'l') /* __l__oc-rib */
 #define BMP_POLICY_IS_PRE(str) ((str)[1] == 'r')    /* p__r__e-policy */
 
@@ -2772,6 +2789,9 @@ static int bmp_config_write(struct bgp *bgp, struct vty *vty)
                if (bt->acl_name)
                        vty_out(vty, "  ip access-list %s\n", bt->acl_name);
 
+               if (!bt->stats_send_experimental)
+                       vty_out(vty, "  no bmp stats send-experimental\n");
+
                if (bt->stat_msec)
                        vty_out(vty, "  bmp stats interval %d\n",
                                        bt->stat_msec);
@@ -2827,6 +2847,7 @@ static int bgp_bmp_init(struct event_loop *tm)
        install_element(BMP_NODE, &no_bmp_listener_cmd);
        install_element(BMP_NODE, &bmp_connect_cmd);
        install_element(BMP_NODE, &bmp_acl_cmd);
+       install_element(BMP_NODE, &bmp_stats_send_experimental_cmd);
        install_element(BMP_NODE, &bmp_stats_cmd);
        install_element(BMP_NODE, &bmp_monitor_cmd);
        install_element(BMP_NODE, &bmp_mirror_cmd);
index dadd99eb6d0a367394f96fb85c03de5de96ea541..33247c402504d5c1c96976607c213145e9b2212b 100644 (file)
@@ -240,6 +240,8 @@ struct bmp_targets {
 
        uint64_t cnt_accept, cnt_aclrefused;
 
+       bool stats_send_experimental;
+
        QOBJ_FIELDS;
 };
 DECLARE_QOBJ_TYPE(bmp_targets);
index c553b7c985dbdff6fd64aaac4843067d4e72f1bc..ec1a51d0f8292ea978c8c3c9ffa689c5fb2e644b 100644 (file)
@@ -147,6 +147,11 @@ associated with a particular ``bmp targets``:
    Send BMP Statistics (counter) messages at the specified interval (in
    milliseconds.)
 
+.. clicmd:: bmp stats send-experimental
+
+   Send BMP Statistics (counter) messages whose code is defined as
+   experimental (in the [65531-65534] range).
+
 .. clicmd:: bmp monitor AFI SAFI <pre-policy|post-policy|loc-rib>
 
    Perform Route Monitoring for the specified AFI and SAFI.  Only IPv4 and