]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_asbr.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / ospfd / ospf_asbr.c
index 89c462693b6c7babaf74067e4c4835915743147c..ba2e04bf766b23b4f8daa2ad0e0b520fd6e3f9bd 100644 (file)
@@ -58,9 +58,8 @@ void ospf_external_route_remove(struct ospf *ospf, struct prefix_ipv4 *p)
 
                        /* Remove route from zebra. */
                        if (or->type == OSPF_DESTINATION_NETWORK)
-                               ospf_zebra_delete(ospf,
-                                                 (struct prefix_ipv4 *)&rn->p,
-                                                 or);
+                               ospf_zebra_delete(
+                                       ospf, (struct prefix_ipv4 *)&rn->p, or);
 
                        ospf_route_free(or);
                        rn->info = NULL;
@@ -74,28 +73,9 @@ void ospf_external_route_remove(struct ospf *ospf, struct prefix_ipv4 *p)
                  p->prefixlen);
 }
 
-/* Lookup external route. */
-struct ospf_route *ospf_external_route_lookup(struct ospf *ospf,
-                                             struct prefix_ipv4 *p)
-{
-       struct route_node *rn;
-
-       rn = route_node_lookup(ospf->old_external_route, (struct prefix *)p);
-       if (rn) {
-               route_unlock_node(rn);
-               if (rn->info)
-                       return rn->info;
-       }
-
-       zlog_warn("Route[%s/%d]: lookup, no such prefix", inet_ntoa(p->prefix),
-                 p->prefixlen);
-
-       return NULL;
-}
-
-
 /* Add an External info for AS-external-LSA. */
-struct external_info *ospf_external_info_new(u_char type, u_short instance)
+struct external_info *ospf_external_info_new(uint8_t type,
+                                            unsigned short instance)
 {
        struct external_info *new;
 
@@ -127,20 +107,19 @@ int ospf_route_map_set_compare(struct route_map_set_values *values1,
 }
 
 /* Add an External info for AS-external-LSA. */
-struct external_info *ospf_external_info_add(u_char type, u_short instance,
-                                            struct prefix_ipv4 p,
-                                            ifindex_t ifindex,
-                                            struct in_addr nexthop,
-                                            route_tag_t tag)
+struct external_info *
+ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance,
+                      struct prefix_ipv4 p, ifindex_t ifindex,
+                      struct in_addr nexthop, route_tag_t tag)
 {
        struct external_info *new;
        struct route_node *rn;
        struct ospf_external *ext;
        char inetbuf[INET6_BUFSIZ];
 
-       ext = ospf_external_lookup(type, instance);
+       ext = ospf_external_lookup(ospf, type, instance);
        if (!ext)
-               ext = ospf_external_add(type, instance);
+               ext = ospf_external_add(ospf, type, instance);
 
        rn = route_node_get(EXTERNAL_INFO(ext), (struct prefix *)&p);
        /* If old info exists, -- discard new one or overwrite with new one? */
@@ -156,10 +135,12 @@ struct external_info *ospf_external_info_add(u_char type, u_short instance,
 
                        inet_ntop(AF_INET, (void *)&nexthop.s_addr, inetbuf,
                                  INET6_BUFSIZ);
-                       zlog_warn(
-                               "Redistribute[%s][%d]: %s/%d discarding old info with NH %s.",
-                               ospf_redist_string(type), instance,
-                               inet_ntoa(p.prefix), p.prefixlen, inetbuf);
+                       if (IS_DEBUG_OSPF(lsa, LSA_GENERATE))
+                               zlog_debug(
+                                       "Redistribute[%s][%d][%u]: %s/%d discarding old info with NH %s.",
+                                       ospf_redist_string(type), instance,
+                                       ospf->vrf_id, inet_ntoa(p.prefix),
+                                       p.prefixlen, inetbuf);
                        XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info);
                        rn->info = NULL;
                }
@@ -179,20 +160,20 @@ struct external_info *ospf_external_info_add(u_char type, u_short instance,
                inet_ntop(AF_INET, (void *)&nexthop.s_addr, inetbuf,
                          INET6_BUFSIZ);
                zlog_debug(
-                       "Redistribute[%s]: %s/%d external info created, with NH %s",
-                       ospf_redist_string(type), inet_ntoa(p.prefix),
-                       p.prefixlen, inetbuf);
+                       "Redistribute[%s][%u]: %s/%d external info created, with NH %s",
+                       ospf_redist_string(type), ospf->vrf_id,
+                       inet_ntoa(p.prefix), p.prefixlen, inetbuf);
        }
        return new;
 }
 
-void ospf_external_info_delete(u_char type, u_short instance,
-                              struct prefix_ipv4 p)
+void ospf_external_info_delete(struct ospf *ospf, uint8_t type,
+                              unsigned short instance, struct prefix_ipv4 p)
 {
        struct route_node *rn;
        struct ospf_external *ext;
 
-       ext = ospf_external_lookup(type, instance);
+       ext = ospf_external_lookup(ospf, type, instance);
        if (!ext)
                return;
 
@@ -205,13 +186,14 @@ void ospf_external_info_delete(u_char type, u_short instance,
        }
 }
 
-struct external_info *ospf_external_info_lookup(u_char type, u_short instance,
+struct external_info *ospf_external_info_lookup(struct ospf *ospf, uint8_t type,
+                                               unsigned short instance,
                                                struct prefix_ipv4 *p)
 {
        struct route_node *rn;
        struct ospf_external *ext;
 
-       ext = ospf_external_lookup(type, instance);
+       ext = ospf_external_lookup(ospf, type, instance);
        if (!ext)
                return NULL;
 
@@ -255,7 +237,7 @@ struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *ospf,
 
 
 /* Update ASBR status. */
-void ospf_asbr_status_update(struct ospf *ospf, u_char status)
+void ospf_asbr_status_update(struct ospf *ospf, uint8_t status)
 {
        zlog_info("ASBR[Status:%d]: Update", status);
 
@@ -281,14 +263,14 @@ void ospf_asbr_status_update(struct ospf *ospf, u_char status)
        ospf_router_lsa_update(ospf);
 }
 
-void ospf_redistribute_withdraw(struct ospf *ospf, u_char type,
-                               u_short instance)
+void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type,
+                               unsigned short instance)
 {
        struct route_node *rn;
        struct external_info *ei;
        struct ospf_external *ext;
 
-       ext = ospf_external_lookup(type, instance);
+       ext = ospf_external_lookup(ospf, type, instance);
        if (!ext)
                return;