From 67486f32ae23668093d282cba58ac4f9cbab1294 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Sat, 30 Oct 2021 01:49:04 +0300 Subject: [PATCH] isisd: remove useless checks when configuring passive interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently, we have some checks in the CLI and NB layer to "protect" from setting loopback interfaces into non-passive mode. These checks are not correct, because we can not rely on operational data during config reading and validation stage as this data doesn't exist yet. There's nothing wrong in allowing "incorrect" configuration – it is already correctly handled by the actual code. Signed-off-by: Igor Ryzhov --- isisd/isis_cli.c | 14 -------------- isisd/isis_nb_config.c | 16 ---------------- 2 files changed, 30 deletions(-) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 96ca074b86..c0727a6695 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -131,7 +131,6 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, const struct lyd_node *if_dnode, *inst_dnode; const char *circ_type = NULL; const char *vrf_name; - struct interface *ifp; if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH); if (!if_dnode) { @@ -161,12 +160,6 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, circ_type); - /* check if the interface is a loopback and if so set it as passive */ - ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); - if (ifp && if_is_loopback_or_vrf(ifp)) - nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", - NB_OP_MODIFY, "true"); - return nb_cli_apply_changes(vty, NULL); } @@ -188,7 +181,6 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, const struct lyd_node *if_dnode, *inst_dnode; const char *circ_type = NULL; const char *vrf_name; - struct interface *ifp; if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH); if (!if_dnode) { @@ -218,12 +210,6 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, circ_type); - /* check if the interface is a loopback and if so set it as passive */ - ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); - if (ifp && if_is_loopback_or_vrf(ifp)) - nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", - NB_OP_MODIFY, "true"); - return nb_cli_apply_changes(vty, NULL); } diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 4a01c728f0..f54ee75ede 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2979,24 +2979,8 @@ int lib_interface_isis_network_type_modify(struct nb_cb_modify_args *args) int lib_interface_isis_passive_modify(struct nb_cb_modify_args *args) { struct isis_circuit *circuit; - struct interface *ifp; bool passive = yang_dnode_get_bool(args->dnode, NULL); - /* validation only applies if we are setting passive to false */ - if (!passive && args->event == NB_EV_VALIDATE) { - circuit = nb_running_get_entry(args->dnode, NULL, false); - if (!circuit) - return NB_OK; - ifp = circuit->interface; - if (!ifp) - return NB_OK; - if (if_is_loopback_or_vrf(ifp)) { - snprintf(args->errmsg, args->errmsg_len, - "Loopback is always passive"); - return NB_ERR_VALIDATION; - } - } - if (args->event != NB_EV_APPLY) return NB_OK; -- 2.39.5