]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_asbr.c
Merge pull request #5305 from ton31337/feature/draft-ietf-idr-deprecate-as-set-confed-set
[mirror_frr.git] / ospfd / ospf_asbr.c
index 33461e6df841cb9f100777a4fdf629040afea109..a60af36564f6974ff5c9bb756ab398f069f0e439 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,33 +73,13 @@ 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;
 
-       new = (struct external_info *)XCALLOC(MTYPE_OSPF_EXTERNAL_INFO,
-                                             sizeof(struct external_info));
+       new = XCALLOC(MTYPE_OSPF_EXTERNAL_INFO, sizeof(struct external_info));
        new->type = type;
        new->instance = instance;
 
@@ -127,12 +106,10 @@ 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(struct ospf *ospf, 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;
@@ -157,11 +134,12 @@ struct external_info *ospf_external_info_add(struct ospf *ospf, u_char type,
 
                        inet_ntop(AF_INET, (void *)&nexthop.s_addr, inetbuf,
                                  INET6_BUFSIZ);
-                       zlog_warn(
-                               "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);
+                       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;
                }
@@ -188,8 +166,8 @@ struct external_info *ospf_external_info_add(struct ospf *ospf, u_char type,
        return new;
 }
 
-void ospf_external_info_delete(struct ospf *ospf, 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;
@@ -207,8 +185,8 @@ void ospf_external_info_delete(struct ospf *ospf, u_char type, u_short instance,
        }
 }
 
-struct external_info *ospf_external_info_lookup(struct ospf *ospf, 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;
@@ -258,22 +236,25 @@ 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);
+       zlog_info("ASBR[%s:Status:%d]: Update",
+                 ospf_get_name(ospf), status);
 
        /* ASBR on. */
        if (status) {
                /* Already ASBR. */
                if (IS_OSPF_ASBR(ospf)) {
-                       zlog_info("ASBR[Status:%d]: Already ASBR", status);
+                       zlog_info("ASBR[%s:Status:%d]: Already ASBR",
+                                 ospf_get_name(ospf), status);
                        return;
                }
                SET_FLAG(ospf->flags, OSPF_FLAG_ASBR);
        } else {
                /* Already non ASBR. */
                if (!IS_OSPF_ASBR(ospf)) {
-                       zlog_info("ASBR[Status:%d]: Already non ASBR", status);
+                       zlog_info("ASBR[%s:Status:%d]: Already non ASBR",
+                                 ospf_get_name(ospf), status);
                        return;
                }
                UNSET_FLAG(ospf->flags, OSPF_FLAG_ASBR);
@@ -284,8 +265,8 @@ 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;