]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "ospf6d: fix LSAs remain in LSDB with an old router-id value" revert-8795-fix-ospf6-router-id 8974/head
authorDonald Sharp <donaldsharp72@gmail.com>
Fri, 2 Jul 2021 16:38:11 +0000 (12:38 -0400)
committerGitHub <noreply@github.com>
Fri, 2 Jul 2021 16:38:11 +0000 (12:38 -0400)
ospf6d/ospf6_asbr.c
ospf6d/ospf6_top.c
ospf6d/ospf6_top.h
ospf6d/ospf6_zebra.c

index 91e33c858e1c9c8dac820d40d8598984ea227fb1..d4e52f0ede8c4f32d10b46f782b08237e64c3439 100644 (file)
@@ -2484,23 +2484,21 @@ void ospf6_asbr_redistribute_disable(struct ospf6 *ospf6)
        int type;
        struct ospf6_redist *red;
 
-       for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
-               if (type == ZEBRA_ROUTE_OSPF6)
-                       continue;
+       for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
                red = ospf6_redist_lookup(ospf6, type, 0);
                if (!red)
                        continue;
-
-               if (type == DEFAULT_ROUTE) {
-                       ospf6_asbr_routemap_unset(red);
-                       ospf6_redist_del(ospf6, red, type);
-                       ospf6_redistribute_default_set(ospf6,
-                                                      DEFAULT_ORIGINATE_NONE);
+               if (type == ZEBRA_ROUTE_OSPF6)
                        continue;
-               }
                ospf6_asbr_redistribute_unset(ospf6, red, type);
                ospf6_redist_del(ospf6, red, type);
        }
+       red = ospf6_redist_lookup(ospf6, DEFAULT_ROUTE, 0);
+       if (red) {
+               ospf6_asbr_routemap_unset(red);
+               ospf6_redist_del(ospf6, red, type);
+               ospf6_redistribute_default_set(ospf6, DEFAULT_ORIGINATE_NONE);
+       }
 }
 
 void ospf6_asbr_redistribute_reset(struct ospf6 *ospf6)
index d4557e0ef6df0329ca5705e4391e22c6adfd262f..6f40989efddc9ffcb025d4d0dab91ba1f0700e41 100644 (file)
@@ -73,8 +73,6 @@ struct ospf6_master *om6;
 
 static void ospf6_disable(struct ospf6 *o);
 
-static void ospf6_process_reset(struct ospf6 *ospf6);
-
 static void ospf6_add(struct ospf6 *ospf6)
 {
        listnode_add(om6->ospf6, ospf6);
@@ -227,7 +225,7 @@ static int ospf6_vrf_enable(struct vrf *vrf)
                        thread_add_read(master, ospf6_receive, ospf6, ospf6->fd,
                                        &ospf6->t_ospf6_receive);
 
-                       ospf6_router_id_update(ospf6, true, NULL);
+                       ospf6_router_id_update(ospf6);
                }
        }
 
@@ -442,7 +440,7 @@ struct ospf6 *ospf6_instance_create(const char *name)
        if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES)
                SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
        if (ospf6->router_id == 0)
-               ospf6_router_id_update(ospf6, true, NULL);
+               ospf6_router_id_update(ospf6);
        ospf6_add(ospf6);
        if (ospf6->vrf_id != VRF_UNKNOWN) {
                vrf = vrf_lookup_by_id(ospf6->vrf_id);
@@ -596,43 +594,15 @@ void ospf6_maxage_remove(struct ospf6 *o)
                                 &o->maxage_remover);
 }
 
-void ospf6_router_id_update(struct ospf6 *ospf6, bool init, struct vty *vty)
+void ospf6_router_id_update(struct ospf6 *ospf6)
 {
-       in_addr_t new_router_id;
-       struct listnode *node;
-       struct ospf6_area *oa;
-
        if (!ospf6)
                return;
 
        if (ospf6->router_id_static != 0)
-               new_router_id = ospf6->router_id_static;
+               ospf6->router_id = ospf6->router_id_static;
        else
-               new_router_id = ospf6->router_id_zebra;
-
-       if (ospf6->router_id == new_router_id)
-               return;
-
-       if (!init)
-               for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
-                       if (oa->full_nbrs) {
-                               if (vty)
-                                       vty_out(vty,
-                                               "For this router-id change to take effect,"
-                                               " run the \"clear ipv6 ospf6 process\" command\n");
-                               else
-                                       zlog_err(
-                                               "%s: cannot update router-id."
-                                               " Run the \"clear ipv6 ospf6 process\" command\n",
-                                               __func__);
-                               return;
-                       }
-               }
-
-       ospf6->router_id = new_router_id;
-
-       if (!init)
-               ospf6_process_reset(ospf6);
+               ospf6->router_id = ospf6->router_id_zebra;
 }
 
 /* start ospf6 */
@@ -724,7 +694,7 @@ static void ospf6_process_reset(struct ospf6 *ospf6)
        ospf6->inst_shutdown = 0;
        ospf6_db_clear(ospf6);
 
-       ospf6_router_id_update(ospf6, true, NULL);
+       ospf6_router_id_update(ospf6);
 
        ospf6_asbr_redistribute_reset(ospf6);
        FOR_ALL_INTERFACES (vrf, ifp)
@@ -768,6 +738,8 @@ DEFUN(ospf6_router_id,
        int ret;
        const char *router_id_str;
        uint32_t router_id;
+       struct ospf6_area *oa;
+       struct listnode *node;
 
        argv_find(argv, argc, "A.B.C.D", &idx);
        router_id_str = argv[idx]->arg;
@@ -780,7 +752,15 @@ DEFUN(ospf6_router_id,
 
        o->router_id_static = router_id;
 
-       ospf6_router_id_update(o, false, vty);
+       for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
+               if (oa->full_nbrs) {
+                       vty_out(vty,
+                               "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n");
+                       return CMD_SUCCESS;
+               }
+       }
+
+       o->router_id = router_id;
 
        return CMD_SUCCESS;
 }
@@ -793,10 +773,21 @@ DEFUN(no_ospf6_router_id,
       V4NOTATION_STR)
 {
        VTY_DECLVAR_CONTEXT(ospf6, o);
+       struct ospf6_area *oa;
+       struct listnode *node;
 
        o->router_id_static = 0;
 
-       ospf6_router_id_update(o, false, vty);
+       for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
+               if (oa->full_nbrs) {
+                       vty_out(vty,
+                               "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n");
+                       return CMD_SUCCESS;
+               }
+       }
+       o->router_id = 0;
+       if (o->router_id_zebra)
+               o->router_id = o->router_id_zebra;
 
        return CMD_SUCCESS;
 }
index 820622c743b1185200a592c5a598d1d609536acc..3eb423f68155816e6f80cc3f8e73bdd5748f9553 100644 (file)
@@ -178,8 +178,7 @@ extern void ospf6_master_init(struct thread_master *master);
 extern void install_element_ospf6_clear_process(void);
 extern void ospf6_top_init(void);
 extern void ospf6_delete(struct ospf6 *o);
-extern void ospf6_router_id_update(struct ospf6 *ospf6, bool init,
-                                  struct vty *vty);
+extern void ospf6_router_id_update(struct ospf6 *ospf6);
 
 extern void ospf6_maxage_remove(struct ospf6 *o);
 extern struct ospf6 *ospf6_instance_create(const char *name);
index 727e6f7fef22de410d9fac97725878cdbf623af5..a7e15c68ae81f35b6fba3a446de1acdd38804d2a 100644 (file)
@@ -101,7 +101,7 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
 
        o->router_id_zebra = router_id.u.prefix4.s_addr;
 
-       ospf6_router_id_update(o, false, NULL);
+       ospf6_router_id_update(o);
 
        return 0;
 }