]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: remove all "ip ospf area" params when clearing instance
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 13 Oct 2020 23:39:08 +0000 (02:39 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 28 Oct 2020 18:35:49 +0000 (21:35 +0300)
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 <iryzhov@nfware.com>
ospfd/ospf_vty.c

index 53e8260621b8c039edeb55a5323eafb57506c398..83ad474f416b8471e445bc35760b2cc3027aafe0 100644 (file)
@@ -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;
        }