]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_routemap.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / ospfd / ospf_routemap.c
index bec0ec039b4c23722154c8449d660b8171138129..54009639fc37ea03af10f486c15fbdb3b580182b 100644 (file)
@@ -32,6 +32,7 @@
 #include "log.h"
 #include "plist.h"
 #include "vrf.h"
+#include "frrstr.h"
 
 #include "ospfd/ospfd.h"
 #include "ospfd/ospf_asbr.h"
@@ -39,6 +40,7 @@
 #include "ospfd/ospf_lsa.h"
 #include "ospfd/ospf_route.h"
 #include "ospfd/ospf_zebra.h"
+#include "ospfd/ospf_errors.h"
 
 /* Hook function for updating route_map assignment. */
 static void ospf_route_map_update(const char *name)
@@ -117,7 +119,7 @@ static void ospf_route_map_event(route_map_event_t event, const char *name)
 /* `match ip netxthop ' */
 /* Match function return 1 if match is success else return zero. */
 static route_map_result_t route_match_ip_nexthop(void *rule,
-                                                struct prefix *prefix,
+                                                const struct prefix *prefix,
                                                 route_map_object_t type,
                                                 void *object)
 {
@@ -162,7 +164,7 @@ struct route_map_rule_cmd route_match_ip_nexthop_cmd = {
 /* `match ip next-hop prefix-list PREFIX_LIST' */
 
 static route_map_result_t
-route_match_ip_next_hop_prefix_list(void *rule, struct prefix *prefix,
+route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
                                    route_map_object_t type, void *object)
 {
        struct prefix_list *plist;
@@ -204,7 +206,7 @@ struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = {
 /* Match function should return 1 if match is success else return
    zero. */
 static route_map_result_t route_match_ip_address(void *rule,
-                                                struct prefix *prefix,
+                                                const struct prefix *prefix,
                                                 route_map_object_t type,
                                                 void *object)
 {
@@ -243,7 +245,7 @@ struct route_map_rule_cmd route_match_ip_address_cmd = {
 
 /* `match ip address prefix-list PREFIX_LIST' */
 static route_map_result_t
-route_match_ip_address_prefix_list(void *rule, struct prefix *prefix,
+route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
                                   route_map_object_t type, void *object)
 {
        struct prefix_list *plist;
@@ -279,7 +281,7 @@ struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = {
 /* Match function should return 1 if match is success else return
    zero. */
 static route_map_result_t route_match_interface(void *rule,
-                                               struct prefix *prefix,
+                                               const struct prefix *prefix,
                                                route_map_object_t type,
                                                void *object)
 {
@@ -317,7 +319,8 @@ struct route_map_rule_cmd route_match_interface_cmd = {
        route_match_interface_free};
 
 /* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
+static route_map_result_t route_match_tag(void *rule,
+                                         const struct prefix *prefix,
                                          route_map_object_t type, void *object)
 {
        route_tag_t *tag;
@@ -342,12 +345,13 @@ static struct route_map_rule_cmd route_match_tag_cmd = {
 struct ospf_metric {
        enum { metric_increment, metric_decrement, metric_absolute } type;
        bool used;
-       u_int32_t metric;
+       uint32_t metric;
 };
 
 /* `set metric METRIC' */
 /* Set metric to attribute. */
-static route_map_result_t route_set_metric(void *rule, struct prefix *prefix,
+static route_map_result_t route_set_metric(void *rule,
+                                          const struct prefix *prefix,
                                           route_map_object_t type,
                                           void *object)
 {
@@ -382,14 +386,15 @@ static void *route_set_metric_compile(const char *arg)
 {
        struct ospf_metric *metric;
 
-       metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t));
+       metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
        metric->used = false;
 
        if (all_digit(arg))
                metric->type = metric_absolute;
 
        if (strmatch(arg, "+rtt") || strmatch(arg, "-rtt")) {
-               zlog_warn("OSPF does not support 'set metric +rtt / -rtt'");
+               flog_warn(EC_OSPF_SET_METRIC_PLUS,
+                         "OSPF does not support 'set metric +rtt / -rtt'");
                return metric;
        }
 
@@ -426,11 +431,11 @@ struct route_map_rule_cmd route_set_metric_cmd = {
 /* `set metric-type TYPE' */
 /* Set metric-type to attribute. */
 static route_map_result_t route_set_metric_type(void *rule,
-                                               struct prefix *prefix,
+                                               const struct prefix *prefix,
                                                route_map_object_t type,
                                                void *object)
 {
-       u_int32_t *metric_type;
+       uint32_t *metric_type;
        struct external_info *ei;
 
        if (type == RMAP_OSPF) {
@@ -447,9 +452,9 @@ static route_map_result_t route_set_metric_type(void *rule,
 /* set metric-type compilation. */
 static void *route_set_metric_type_compile(const char *arg)
 {
-       u_int32_t *metric_type;
+       uint32_t *metric_type;
 
-       metric_type = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t));
+       metric_type = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
        if (strcmp(arg, "type-1") == 0)
                *metric_type = EXTERNAL_METRIC_TYPE_1;
        else if (strcmp(arg, "type-2") == 0)
@@ -475,7 +480,7 @@ struct route_map_rule_cmd route_set_metric_type_cmd = {
        route_set_metric_type_free,
 };
 
-static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
+static route_map_result_t route_set_tag(void *rule, const struct prefix *prefix,
                                        route_map_object_t type, void *object)
 {
        route_tag_t *tag;