]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: add config control to hide backup nh events in nht
authorMark Stapp <mjs@voltanet.io>
Mon, 1 Mar 2021 15:48:05 +0000 (10:48 -0500)
committerMartin Winter <mwinter@opensourcerouting.org>
Sun, 25 Jul 2021 13:17:07 +0000 (15:17 +0200)
Add a config that can control hiding of backup-nexthop activation
changes in nexthop-tracking.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zebra_vty.c

index 5e2e6f6ce49279789cf5c5ffe8a94b96227ce55d..a4382441c862c1a6243d24938baa1f3205ba5bd1 100644 (file)
 
 DEFINE_MTYPE_STATIC(ZEBRA, RNH, "Nexthop tracking object");
 
+/* UI controls whether to notify about changes that only involve backup
+ * nexthops. Default is to notify all changes.
+ */
+static bool rnh_hide_backups;
+
 static void free_state(vrf_id_t vrf_id, struct route_entry *re,
                       struct route_node *rn);
 static void copy_state(struct rnh *rnh, const struct route_entry *re,
@@ -1504,3 +1509,16 @@ int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family)
        else
                return 0;
 }
+
+/*
+ * UI control to avoid notifications if backup nexthop status changes
+ */
+void rnh_set_hide_backups(bool hide_p)
+{
+       rnh_hide_backups = hide_p;
+}
+
+bool rnh_get_hide_backups(void)
+{
+       return rnh_hide_backups;
+}
index c71a2b9ccefd4fd83d45dca355482cb4402b7438..4897a6af300b2fa54a4199c70c2a52560662cc7e 100644 (file)
@@ -64,6 +64,10 @@ extern void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty,
 
 extern int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family);
 
+/* UI control to avoid notifications if backup nexthop status changes */
+void rnh_set_hide_backups(bool hide_p);
+bool rnh_get_hide_backups(void);
+
 #ifdef __cplusplus
 }
 #endif
index 8061f34d2ba99dde6b6fc834c308c4e116ecf683..7859460e61bf3fd91c4fe2b2145e18723abf8e11 100644 (file)
@@ -1701,7 +1701,6 @@ DEFUN (no_ipv6_nht_default_route,
        "Filter Next Hop tracking route resolution\n"
        "Resolve via default route\n")
 {
-
        ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
 
        if (!zvrf)
@@ -1715,6 +1714,17 @@ DEFUN (no_ipv6_nht_default_route,
        return CMD_SUCCESS;
 }
 
+DEFPY_HIDDEN(rnh_hide_backups, rnh_hide_backups_cmd,
+            "[no] ip nht hide-backup-events",
+            NO_STR
+            IP_STR
+            "Nexthop-tracking configuration\n"
+            "Hide notification about backup nexthops\n")
+{
+       rnh_set_hide_backups(!no);
+       return CMD_SUCCESS;
+}
+
 DEFPY (show_route,
        show_route_cmd,
        "show\
@@ -3661,6 +3671,9 @@ static int config_write_protocol(struct vty *vty)
        if (!zebra_nhg_recursive_use_backups())
                vty_out(vty, "no zebra nexthop resolve-via-backup\n");
 
+       if (rnh_get_hide_backups())
+               vty_out(vty, "ip nht hide-backup-events\n");
+
 #ifdef HAVE_NETLINK
        /* Include netlink info */
        netlink_config_write_helper(vty);
@@ -4120,6 +4133,8 @@ void zebra_vty_init(void)
        install_element(VRF_NODE, &no_ip_nht_default_route_cmd);
        install_element(VRF_NODE, &ipv6_nht_default_route_cmd);
        install_element(VRF_NODE, &no_ipv6_nht_default_route_cmd);
+       install_element(CONFIG_NODE, &rnh_hide_backups_cmd);
+
        install_element(VIEW_NODE, &show_ipv6_mroute_cmd);
 
        /* Commands for VRF */