/* id counter to keep in sync with kernel */
uint32_t id_counter;
-/* */
+/* Controlled through ui */
static bool g_nexthops_enabled = true;
static bool proto_nexthops_only;
+static bool use_recursive_backups = true;
static struct nhg_hash_entry *depends_find(const struct nexthop *nh, afi_t afi,
int type, bool from_dplane);
/* Examine installed backup nexthops, if any. There
* are only installed backups *if* there is a
- * dedicated fib list.
+ * dedicated fib list. The UI can also control use
+ * of backups for resolution.
*/
nhg = rib_get_fib_backup_nhg(match);
- if (nhg == NULL || nhg->nexthop == NULL)
+ if (!use_recursive_backups ||
+ nhg == NULL || nhg->nexthop == NULL)
goto done_with_match;
for (ALL_NEXTHOPS_PTR(nhg, newhop)) {
return g_nexthops_enabled;
}
+/* Global control for use of activated backups for recursive resolution. */
+void zebra_nhg_set_recursive_use_backups(bool set)
+{
+ use_recursive_backups = set;
+}
+
+bool zebra_nhg_recursive_use_backups(void)
+{
+ return use_recursive_backups;
+}
+
/*
* Global control to only use kernel nexthops for protocol created NHGs.
* There are some use cases where you may not want zebra to implicitly
void zebra_nhg_set_proto_nexthops_only(bool set);
bool zebra_nhg_proto_nexthops_only(void);
+/* Global control for use of activated backups for recursive resolution. */
+void zebra_nhg_set_recursive_use_backups(bool set);
+bool zebra_nhg_recursive_use_backups(void);
+
/**
* NHE abstracted tree functions.
* Use these where possible instead of direct access.
return CMD_SUCCESS;
}
+DEFPY_HIDDEN(backup_nexthop_recursive_use_enable,
+ backup_nexthop_recursive_use_enable_cmd,
+ "[no] zebra nexthop resolve-via-backup",
+ NO_STR
+ ZEBRA_STR
+ "Nexthop configuration \n"
+ "Configure use of backup nexthops in recursive resolution\n")
+{
+ zebra_nhg_set_recursive_use_backups(!no);
+ return CMD_SUCCESS;
+}
+
DEFUN (no_ip_nht_default_route,
no_ip_nht_default_route_cmd,
"no ip nht resolve-via-default",
if (zebra_nhg_proto_nexthops_only())
vty_out(vty, "zebra nexthop proto only\n");
+ if (!zebra_nhg_recursive_use_backups())
+ vty_out(vty, "no zebra nexthop resolve-via-backup\n");
+
#ifdef HAVE_NETLINK
/* Include netlink info */
netlink_config_write_helper(vty);
install_element(CONFIG_NODE, &no_zebra_packet_process_cmd);
install_element(CONFIG_NODE, &nexthop_group_use_enable_cmd);
install_element(CONFIG_NODE, &proto_nexthop_group_only_cmd);
+ install_element(CONFIG_NODE, &backup_nexthop_recursive_use_enable_cmd);
install_element(VIEW_NODE, &show_nexthop_group_cmd);
install_element(VIEW_NODE, &show_interface_nexthop_group_cmd);