From: Igor Ryzhov Date: Tue, 13 Oct 2020 23:39:08 +0000 (+0300) Subject: ospfd: remove all "ip ospf area" params when clearing instance X-Git-Tag: frr-7.5~4^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F7407%2Fhead;p=mirror%2Ffrr.git ospfd: remove all "ip ospf area" params when clearing instance Currently, only default area parameter is cleared, but we should do the same for all area parameters with interface addresses. Signed-off-by: Igor Ryzhov --- diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 53e8260621..83ad474f41 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8021,6 +8021,7 @@ DEFUN (ip_ospf_area, struct ospf *ospf = NULL; unsigned short instance = 0; char *areaid; + uint32_t count = 0; if (argv_find(argv, argc, "(1-65535)", &idx)) instance = strtol(argv[idx]->arg, NULL, 10); @@ -8045,15 +8046,28 @@ DEFUN (ip_ospf_area, * allow the other instance(process) handle * the configuration command. */ + count = 0; + params = IF_DEF_PARAMS(ifp); if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) { UNSET_IF_PARAM(params, if_area); - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); + count++; + } + + for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) + if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) { + UNSET_IF_PARAM(params, if_area); + count++; + } + + if (count > 0) { + ospf = ospf_lookup_by_vrf_id(ifp->vrf_id); if (ospf) { ospf_interface_area_unset(ospf, ifp); - ospf->if_ospf_cli_count--; + ospf->if_ospf_cli_count -= count; } } + return CMD_NOT_MY_INSTANCE; }