]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: permit reconfiguring network after area suppressed
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 8 Nov 2018 16:37:50 +0000 (17:37 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 9 Nov 2018 08:48:38 +0000 (09:48 +0100)
avoid counting twice the number of areas configured, when entering back
to router ospf config node.

PR=61288
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Acked-by: Emmanuel Vize <emmanuel.vize@6wind.com>
ospfd/ospf_vty.c
ospfd/ospfd.c
ospfd/ospfd.h

index 52652821d612e3fd195e64b8c7c21e6787327f4d..67f5c7e8902558d40d1d00ed9b5ca2b98b64c5f1 100644 (file)
@@ -245,8 +245,11 @@ DEFUN_NOSH (router_ospf,
                                                return ret;
                                        }
                                }
-                               ospf_interface_area_set(ospf, ifp);
-                               ospf->if_ospf_cli_count++;
+                               if (!ospf_interface_area_is_already_set(ospf,
+                                                                       ifp)) {
+                                       ospf_interface_area_set(ospf, ifp);
+                                       ospf->if_ospf_cli_count++;
+                               }
                        }
                }
 
index d5d1a7a605180a3b859717ed9e1bfc7ddcc4ad40..a18e2de72511b7d14429489e376ba4f8fd98be84 100644 (file)
@@ -1149,6 +1149,32 @@ void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp)
        update_redistributed(ospf, 0); /* interfaces possibly removed */
 }
 
+bool ospf_interface_area_is_already_set(struct ospf *ospf,
+                                       struct interface *ifp)
+{
+       struct route_node *rn_oi;
+
+       if (!ospf)
+               return false; /* Ospf not ready yet */
+
+       /* Find interfaces that may need to be removed. */
+       for (rn_oi = route_top(IF_OIFS(ifp)); rn_oi;
+            rn_oi = route_next(rn_oi)) {
+               struct ospf_interface *oi = rn_oi->info;
+
+               if (oi == NULL)
+                       continue;
+
+               if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+                       continue;
+               /* at least one route covered by interface
+                * that implies already done
+                */
+               return true;
+       }
+       return false;
+}
+
 /* Check whether interface matches given network
  * returns: 1, true. 0, false
  */
index bc9c68d570d758155730035e595d4661870332e2..cbea033b7357a9ba0e9efa3fac3bac3a68318ee7 100644 (file)
@@ -561,6 +561,8 @@ extern void ospf_area_del_if(struct ospf_area *, struct ospf_interface *);
 
 extern void ospf_interface_area_set(struct ospf *, struct interface *);
 extern void ospf_interface_area_unset(struct ospf *, struct interface *);
+extern bool ospf_interface_area_is_already_set(struct ospf *ospf,
+                                              struct interface *ifp);
 
 extern void ospf_route_map_init(void);