]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_abr.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / ospfd / ospf_abr.c
index b29f35d7ce5c6f537ed86cb0b07dc26e62329799..c8b8b611efcbd9fdc06ac55af6223e2f50336920 100644 (file)
@@ -49,6 +49,7 @@
 #include "ospfd/ospf_ase.h"
 #include "ospfd/ospf_zebra.h"
 #include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_errors.h"
 
 static struct ospf_area_range *ospf_area_range_new(struct prefix_ipv4 *p)
 {
@@ -195,6 +196,8 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id,
 
        range = ospf_area_range_lookup(area, p);
        if (range != NULL) {
+               if (!CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
+                       range->cost_config = OSPF_AREA_RANGE_COST_UNSPEC;
                if ((CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)
                     && !CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
                    || (!CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)
@@ -208,14 +211,16 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id,
 
        if (CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
                SET_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE);
-       else
+       else {
                UNSET_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE);
+               range->cost_config = OSPF_AREA_RANGE_COST_UNSPEC;
+       }
 
        return 1;
 }
 
 int ospf_area_range_cost_set(struct ospf *ospf, struct in_addr area_id,
-                            struct prefix_ipv4 *p, u_int32_t cost)
+                            struct prefix_ipv4 *p, uint32_t cost)
 {
        struct ospf_area *area;
        struct ospf_area_range *range;
@@ -379,7 +384,7 @@ static void ospf_abr_nssa_check_status(struct ospf *ospf)
        struct listnode *lnode, *nnode;
 
        for (ALL_LIST_ELEMENTS(ospf->areas, lnode, nnode, area)) {
-               u_char old_state = area->NSSATranslatorState;
+               uint8_t old_state = area->NSSATranslatorState;
 
                if (area->external_routing != OSPF_AREA_NSSA)
                        continue;
@@ -471,7 +476,7 @@ void ospf_check_abr_status(struct ospf *ospf)
        int bb_act_attached = 0;
        int areas_configured = 0;
        int areas_act_attached = 0;
-       u_char new_flags = ospf->flags;
+       uint8_t new_flags = ospf->flags;
 
        if (IS_DEBUG_OSPF_EVENT)
                zlog_debug("ospf_check_abr_status(): Start");
@@ -585,12 +590,12 @@ static void ospf_abr_update_aggregate(struct ospf_area_range *range,
        range->specifics++;
 }
 
-static void set_metric(struct ospf_lsa *lsa, u_int32_t metric)
+static void set_metric(struct ospf_lsa *lsa, uint32_t metric)
 {
        struct summary_lsa *header;
-       u_char *mp;
+       uint8_t *mp;
        metric = htonl(metric);
-       mp = (u_char *)&metric;
+       mp = (uint8_t *)&metric;
        mp++;
        header = (struct summary_lsa *)lsa->data;
        memcpy(header->metric, mp, 3);
@@ -683,18 +688,18 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
        return 0;
 }
 
-static void ospf_abr_translate_nssa_range(struct prefix_ipv4 *p, u_int32_t cost)
+static void ospf_abr_translate_nssa_range(struct prefix_ipv4 *p, uint32_t cost)
 {
        /* The Type-7 is created from the aggregated prefix and forwarded
           for lsa installation and flooding... to be added... */
 }
 
-void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, u_int32_t cost,
+void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
                                       struct ospf_area *area)
 {
        struct ospf_lsa *lsa, *old = NULL;
        struct summary_lsa *sl = NULL;
-       u_int32_t full_cost;
+       uint32_t full_cost;
 
        if (IS_DEBUG_OSPF_EVENT)
                zlog_debug("ospf_abr_announce_network_to_area(): Start");
@@ -742,7 +747,8 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, u_int32_t cost,
 
                                prefix2str((struct prefix *)p, buf,
                                           sizeof(buf));
-                               zlog_warn("%s: Could not refresh %s to %s",
+                               flog_warn(EC_OSPF_LSA_MISSING,
+                                         "%s: Could not refresh %s to %s",
                                          __func__, buf,
                                          inet_ntoa(area->area_id));
                                return;
@@ -764,7 +770,8 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, u_int32_t cost,
                        char buf[PREFIX2STR_BUFFER];
 
                        prefix2str((struct prefix *)p, buf, sizeof(buf));
-                       zlog_warn("%s: Could not originate %s to %s", __func__,
+                       flog_warn(EC_OSPF_LSA_MISSING,
+                                 "%s: Could not originate %s to %s", __func__,
                                  buf, inet_ntoa(area->area_id));
                        return;
                }
@@ -1089,7 +1096,7 @@ static void ospf_abr_process_network_rt(struct ospf *ospf,
                zlog_debug("ospf_abr_process_network_rt(): Stop");
 }
 
-static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, u_int32_t cost,
+static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
                                          struct ospf_area *area)
 {
        struct ospf_lsa *lsa, *old = NULL;
@@ -1132,7 +1139,8 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, u_int32_t cost,
                        char buf[PREFIX2STR_BUFFER];
 
                        prefix2str((struct prefix *)p, buf, sizeof(buf));
-                       zlog_warn("%s: Could not refresh/originate %s to %s",
+                       flog_warn(EC_OSPF_LSA_MISSING,
+                                 "%s: Could not refresh/originate %s to %s",
                                  __func__, buf, inet_ntoa(area->area_id));
                        return;
                }