]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, doc: add bgp snmp traps rfc4382 command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 18 Jul 2024 12:43:45 +0000 (14:43 +0200)
committerton31337 <3352707+ton31337@users.noreply.github.com>
Sun, 11 Aug 2024 19:28:50 +0000 (19:28 +0000)
Add a trap command to disable or enable the traps defined by
the RFC4382.

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

index 3344e9e0a5d1f03b6546ff2585010a0a255884f4..93d9f67245e83cbc61155edea05f564d18cc0719 100644 (file)
@@ -590,6 +590,11 @@ static int bgp_vrf_check_update_active(struct bgp *bgp, struct interface *ifp)
                /* add trap in here */
                bgp->snmp_stats->active = new_active;
 
+               if (!CHECK_FLAG(bm->options, BGP_OPT_TRAPS_RFC4382)) {
+                       bgp_mpls_l3vpn_update_last_changed(bgp);
+                       return 0;
+               }
+
                /* send relevent trap */
                if (bgp->snmp_stats->active)
                        trap = MPLSL3VPNVRFUP;
index 065ea7672c1edac905e7bc9551114a9e95bf17ff..eff7c5e0f6531b54e4d71acc193afb5183131eb4 100644 (file)
@@ -50,6 +50,21 @@ DEFPY(bgp_snmp_traps_rfc4273, bgp_snmp_traps_rfc4273_cmd,
        return CMD_SUCCESS;
 }
 
+DEFPY(bgp_snmp_traps_rfc4382, bgp_snmp_traps_rfc4382_cmd,
+      "[no$no] bgp snmp traps rfc4382",
+      NO_STR BGP_STR
+      "Configure BGP SNMP\n"
+      "Configure SNMP traps for BGP\n"
+      "Configure use of rfc4382 SNMP traps for BGP\n")
+{
+       if (no) {
+               UNSET_FLAG(bm->options, BGP_OPT_TRAPS_RFC4382);
+               return CMD_SUCCESS;
+       }
+       SET_FLAG(bm->options, BGP_OPT_TRAPS_RFC4382);
+       return CMD_SUCCESS;
+}
+
 DEFPY(bgp_snmp_traps_bgp4_mibv2, bgp_snmp_traps_bgp4_mibv2_cmd,
       "[no$no] bgp snmp traps bgp4-mibv2",
       NO_STR BGP_STR
@@ -69,9 +84,12 @@ static void bgp_snmp_traps_init(void)
 {
        install_element(CONFIG_NODE, &bgp_snmp_traps_rfc4273_cmd);
        install_element(CONFIG_NODE, &bgp_snmp_traps_bgp4_mibv2_cmd);
+       install_element(CONFIG_NODE, &bgp_snmp_traps_rfc4382_cmd);
 
        SET_FLAG(bm->options, BGP_OPT_TRAPS_RFC4273);
        /* BGP4MIBv2 traps are disabled by default */
+
+       SET_FLAG(bm->options, BGP_OPT_TRAPS_RFC4382);
 }
 
 int bgp_cli_snmp_traps_config_write(struct vty *vty)
@@ -86,6 +104,10 @@ int bgp_cli_snmp_traps_config_write(struct vty *vty)
                vty_out(vty, "bgp snmp traps bgp4-mibv2\n");
                write++;
        }
+       if (!CHECK_FLAG(bm->options, BGP_OPT_TRAPS_RFC4382)) {
+               vty_out(vty, "no bgp snmp traps rfc4382\n");
+               write++;
+       }
 
        return write;
 }
index 626a76ba0b83d9ca63716b2a22d47d530a0f4ece..7f1b82d9c763d225694e4f64209d4aff3d998ca0 100644 (file)
@@ -131,6 +131,7 @@ struct bgp_master {
 #define BGP_OPT_NO_ZEBRA                 (1 << 2)
 #define BGP_OPT_TRAPS_RFC4273            (1 << 3)
 #define BGP_OPT_TRAPS_BGP4MIBV2          (1 << 4)
+#define BGP_OPT_TRAPS_RFC4382           (1 << 5)
 
        uint64_t updgrp_idspace;
        uint64_t subgrp_idspace;
index df534e28bd479f7bb8828d10d4e32f5c68b1e0e6..52b1904665df1fa5bf1cd311a3a345d26c589d62 100644 (file)
@@ -215,3 +215,9 @@ possibility to select the MIB he wants to receive traps from:
 By default, only rfc4273 traps are enabled and sent.
 
 .. [Draft-IETF-idr-bgp4-mibv2-11] <https://tools.ietf.org/id/draft-ietf-idr-bgp4-mibv2-11.txt>
+
+The :rfc:`4382` also defines traps to inform when an L3VPN network changes
+the operational status of its VRF interface. The user can choose to suppress
+those traps or not.
+
+.. clicmd:: bgp snmp traps rfc4382