]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_ase.c
ospf6d: Ensure expire thread is properly stopped
[mirror_frr.git] / ospfd / ospf_ase.c
index 6905b716ab974657632225357a68954fef27a01b..aaacebca14df6f081ed24b7b59bf56b2bc33a35c 100644 (file)
@@ -156,84 +156,6 @@ static int ospf_ase_forward_address_check(struct ospf *ospf,
        return 1;
 }
 
-#if 0
-/* Calculate ASBR route. */
-static struct ospf_route *
-ospf_ase_calculate_asbr_route (struct ospf *ospf,
-                              struct route_table *rt_network,
-                              struct route_table *rt_router,
-                              struct as_external_lsa *al)
-{
-  struct prefix_ipv4 asbr;
-  struct ospf_route *asbr_route;
-  struct route_node *rn;
-
-  /* Find ASBR route from Router routing table. */
-  asbr.family = AF_INET;
-  asbr.prefix = al->header.adv_router;
-  asbr.prefixlen = IPV4_MAX_BITLEN;
-  apply_mask_ipv4 (&asbr);
-
-  asbr_route = ospf_find_asbr_route (ospf, rt_router, &asbr);
-
-  if (asbr_route == NULL)
-    {
-      if (IS_DEBUG_OSPF (lsa, LSA))
-       zlog_debug ("ospf_ase_calculate(): Route to ASBR %pI4 not found",
-                   &asbr.prefix);
-      return NULL;
-    }
-
-  if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL))
-    {
-      if (IS_DEBUG_OSPF (lsa, LSA))
-       zlog_debug ("ospf_ase_calculate(): Originating router is not an ASBR");
-      return NULL;
-    }
-
-  if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
-    {
-      if (IS_DEBUG_OSPF (lsa, LSA))
-       zlog_debug ("ospf_ase_calculate(): Forwarding address is not 0.0.0.0.");
-
-      if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr))
-       {
-         if (IS_DEBUG_OSPF (lsa, LSA))
-           zlog_debug ("ospf_ase_calculate(): Forwarding address is one of our addresses, Ignore.");
-         return NULL;
-        }
-
-      if (IS_DEBUG_OSPF (lsa, LSA))
-       zlog_debug ("ospf_ase_calculate(): Looking up in the Network Routing Table.");
-
-      /* Looking up the path to the fwd_addr from Network route. */
-      asbr.family = AF_INET;
-      asbr.prefix = al->e[0].fwd_addr;
-      asbr.prefixlen = IPV4_MAX_BITLEN;
-
-      rn = route_node_match (rt_network, (struct prefix *) &asbr);
-
-      if (rn == NULL)
-       {
-         if (IS_DEBUG_OSPF (lsa, LSA))
-           zlog_debug ("ospf_ase_calculate(): Couldn't find a route to the forwarding address.");
-         return NULL;
-       }
-
-      route_unlock_node (rn);
-
-      if ((asbr_route = rn->info) == NULL)
-       {
-         if (IS_DEBUG_OSPF (lsa, LSA))
-           zlog_debug ("ospf_ase_calculate(): Somehow OSPF route to ASBR is lost");
-         return NULL;
-       }
-    }
-
-  return asbr_route;
-}
-#endif
-
 static struct ospf_route *
 ospf_ase_calculate_new_route(struct ospf_lsa *lsa,
                             struct ospf_route *asbr_route, uint32_t metric)
@@ -687,6 +609,16 @@ static int ospf_ase_calculate_timer(struct thread *t)
                                        + (stop_time.tv_usec
                                           - start_time.tv_usec));
        }
+
+       /*
+        * Uninstall remnant routes that were installed before the restart, but
+        * that are no longer valid.
+        */
+       if (ospf->gr_info.finishing_restart) {
+               ospf_zebra_gr_disable(ospf);
+               ospf->gr_info.finishing_restart = false;
+       }
+
        return 0;
 }
 
@@ -748,8 +680,12 @@ void ospf_ase_unregister_external_lsa(struct ospf_lsa *lsa, struct ospf *top)
 
        if (rn) {
                lst = rn->info;
-               listnode_delete(lst, lsa);
-               ospf_lsa_unlock(&lsa); /* external_lsas list */
+               struct listnode *node = listnode_lookup(lst, lsa);
+               /* Unlock lsa only if node is present in the list */
+               if (node) {
+                       listnode_delete(lst, lsa);
+                       ospf_lsa_unlock(&lsa); /* external_lsas list */
+               }
 
                route_unlock_node(rn);
        }