]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_routemap.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / eigrpd / eigrp_routemap.c
index 0823201fec4e0e63c8196b03c0acae9a1091258d..ee8d5f75827076e60fb609d45f1b320cd0075ac2 100644 (file)
@@ -137,16 +137,19 @@ static int eigrp_route_match_add(struct vty *vty, struct route_map_index *index,
 {
        int ret;
        ret = route_map_add_match(index, command, arg);
-       if (ret) {
-               switch (ret) {
-               case RMAP_RULE_MISSING:
-                       vty_out(vty, "%% Can't find rule.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               case RMAP_COMPILE_ERROR:
-                       vty_out(vty, "%% Argument is malformed.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               }
+       switch (ret) {
+       case RMAP_RULE_MISSING:
+               vty_out(vty, "%% Can't find rule.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_ERROR:
+               vty_out(vty, "%% Argument is malformed.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_SUCCESS:
+               break;
        }
+
        return CMD_SUCCESS;
 }
 
@@ -157,16 +160,19 @@ static int eigrp_route_match_delete(struct vty *vty,
 {
        int ret;
        ret = route_map_delete_match(index, command, arg);
-       if (ret) {
-               switch (ret) {
-               case RMAP_RULE_MISSING:
-                       vty_out(vty, "%% Can't find rule.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               case RMAP_COMPILE_ERROR:
-                       vty_out(vty, "%% Argument is malformed.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               }
+       switch (ret) {
+       case RMAP_RULE_MISSING:
+               vty_out(vty, "%% Can't find rule.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_ERROR:
+               vty_out(vty, "%% Argument is malformed.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_SUCCESS:
+               break;
        }
+
        return CMD_SUCCESS;
 }
 
@@ -177,25 +183,27 @@ static int eigrp_route_set_add(struct vty *vty, struct route_map_index *index,
        int ret;
 
        ret = route_map_add_set(index, command, arg);
-       if (ret) {
-               switch (ret) {
-               case RMAP_RULE_MISSING:
-                       vty_out(vty, "%% Can't find rule.\n");
+       switch (ret) {
+       case RMAP_RULE_MISSING:
+               vty_out(vty, "%% Can't find rule.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_ERROR:
+               /*
+                * rip, ripng and other protocols share the set metric command
+                * but only values from 0 to 16 are valid for rip and ripng
+                * if metric is out of range for rip and ripng, it is
+                * not for other protocols. Do not return an error
+                */
+               if (strcmp(command, "metric")) {
+                       vty_out(vty, "%% Argument is malformed.\n");
                        return CMD_WARNING_CONFIG_FAILED;
-               case RMAP_COMPILE_ERROR:
-                       /* rip, ripng and other protocols share the set metric
-                          command
-                          but only values from 0 to 16 are valid for rip and
-                          ripng
-                          if metric is out of range for rip and ripng, it is
-                          not for
-                          other protocols. Do not return an error */
-                       if (strcmp(command, "metric")) {
-                               vty_out(vty, "%% Argument is malformed.\n");
-                               return CMD_WARNING_CONFIG_FAILED;
-                       }
                }
+               break;
+       case RMAP_COMPILE_SUCCESS:
+               break;
        }
+
        return CMD_SUCCESS;
 }
 
@@ -207,16 +215,19 @@ static int eigrp_route_set_delete(struct vty *vty,
        int ret;
 
        ret = route_map_delete_set(index, command, arg);
-       if (ret) {
-               switch (ret) {
-               case RMAP_RULE_MISSING:
-                       vty_out(vty, "%% Can't find rule.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               case RMAP_COMPILE_ERROR:
-                       vty_out(vty, "%% Argument is malformed.\n");
-                       return CMD_WARNING_CONFIG_FAILED;
-               }
+       switch (ret) {
+       case RMAP_RULE_MISSING:
+               vty_out(vty, "%% Can't find rule.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_ERROR:
+               vty_out(vty, "%% Argument is malformed.\n");
+               return CMD_WARNING_CONFIG_FAILED;
+               break;
+       case RMAP_COMPILE_SUCCESS:
+               break;
        }
+
        return CMD_SUCCESS;
 }
 
@@ -244,10 +255,10 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix,
                                             route_map_object_t type,
                                             void *object)
 {
-       //  u_int32_t *metric;
-       //  u_int32_t  check;
+       //  uint32_t *metric;
+       //  uint32_t  check;
        //  struct rip_info *rinfo;
-       //  struct eigrp_neighbor_entry *te;
+       //  struct eigrp_nexthop_entry *te;
        //  struct eigrp_prefix_entry *pe;
        //  struct listnode *node, *node2, *nnode, *nnode2;
        //  struct eigrp *e;
@@ -275,9 +286,9 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix,
 /* Route map `match metric' match statement. `arg' is METRIC value */
 static void *route_match_metric_compile(const char *arg)
 {
-       //  u_int32_t *metric;
+       //  uint32_t *metric;
        //
-       //  metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
+       //  metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (uint32_t));
        //  *metric = atoi (arg);
        //
        //  if(*metric > 0)
@@ -518,7 +529,7 @@ static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = {
 static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
                                          route_map_object_t type, void *object)
 {
-       //  u_short *tag;
+       //  unsigned short *tag;
        //  struct rip_info *rinfo;
        //
        //  if (type == RMAP_EIGRP)
@@ -538,9 +549,9 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
 /* Route map `match tag' match statement. `arg' is TAG value */
 static void *route_match_tag_compile(const char *arg)
 {
-       //  u_short *tag;
+       //  unsigned short *tag;
        //
-       //  tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
+       //  tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
        //  *tag = atoi (arg);
        //
        //  return tag;
@@ -644,9 +655,7 @@ static void route_set_metric_free(void *rule)
 
 /* Set metric rule structure. */
 static struct route_map_rule_cmd route_set_metric_cmd = {
-       "metric",
-       route_set_metric,
-       route_set_metric_compile,
+       "metric", route_set_metric, route_set_metric_compile,
        route_set_metric_free,
 };
 
@@ -712,7 +721,7 @@ static struct route_map_rule_cmd route_set_ip_nexthop_cmd = {
 static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
                                        route_map_object_t type, void *object)
 {
-       //  u_short *tag;
+       //  unsigned short *tag;
        //  struct rip_info *rinfo;
        //
        //  if(type == RMAP_RIP)
@@ -729,12 +738,12 @@ static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
 }
 
 /* Route map `tag' compile function.  Given string is converted
-   to u_short. */
+   to unsigned short. */
 static void *route_set_tag_compile(const char *arg)
 {
-       //  u_short *tag;
+       //  unsigned short *tag;
        //
-       //  tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
+       //  tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short));
        //  *tag = atoi (arg);
        //
        //  return tag;
@@ -778,8 +787,7 @@ DEFUN (no_match_metric,
 }
 
 ALIAS(no_match_metric, no_match_metric_val_cmd,
-      "no match metric <0-4294967295>",
-      NO_STR MATCH_STR
+      "no match metric <0-4294967295>", NO_STR MATCH_STR
       "Match metric of route\n"
       "Metric value\n")
 
@@ -842,8 +850,7 @@ DEFUN (no_match_ip_next_hop,
 }
 
 ALIAS(no_match_ip_next_hop, no_match_ip_next_hop_val_cmd,
-      "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
-      NO_STR MATCH_STR IP_STR
+      "no match ip next-hop (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
       "Match next-hop address of route\n"
       "IP access-list number\n"
       "IP access-list number (expanded range)\n"
@@ -881,8 +888,7 @@ DEFUN (no_match_ip_next_hop_prefix_list,
 
 ALIAS(no_match_ip_next_hop_prefix_list,
       no_match_ip_next_hop_prefix_list_val_cmd,
-      "no match ip next-hop prefix-list WORD",
-      NO_STR MATCH_STR IP_STR
+      "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
       "Match next-hop address of route\n"
       "Match entries of prefix-lists\n"
       "IP prefix-list name\n")
@@ -916,8 +922,7 @@ DEFUN (no_match_ip_address,
 }
 
 ALIAS(no_match_ip_address, no_match_ip_address_val_cmd,
-      "no match ip address (<1-199>|<1300-2699>|WORD)",
-      NO_STR MATCH_STR IP_STR
+      "no match ip address (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
       "Match address of route\n"
       "IP access-list number\n"
       "IP access-list number (expanded range)\n"
@@ -954,8 +959,7 @@ DEFUN (no_match_ip_address_prefix_list,
 }
 
 ALIAS(no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_val_cmd,
-      "no match ip address prefix-list WORD",
-      NO_STR MATCH_STR IP_STR
+      "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
       "Match address of route\n"
       "Match entries of prefix-lists\n"
       "IP prefix-list name\n")
@@ -1000,8 +1004,7 @@ DEFUN (set_metric,
        return eigrp_route_set_add(vty, vty->index, "metric", argv[0]);
 }
 
-ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>",
-      SET_STR
+ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>", SET_STR
       "Metric value for destination routing protocol\n"
       "Add or subtract metric\n")
 
@@ -1019,8 +1022,7 @@ DEFUN (no_set_metric,
 }
 
 ALIAS(no_set_metric, no_set_metric_val_cmd,
-      "no set metric (<0-4294967295>|<+/-metric>)",
-      NO_STR SET_STR
+      "no set metric (<0-4294967295>|<+/-metric>)", NO_STR SET_STR
       "Metric value for destination routing protocol\n"
       "Metric value\n"
       "Add or subtract metric\n")
@@ -1061,8 +1063,7 @@ DEFUN (no_set_ip_nexthop,
 }
 
 ALIAS(no_set_ip_nexthop, no_set_ip_nexthop_val_cmd,
-      "no set ip next-hop A.B.C.D",
-      NO_STR SET_STR IP_STR
+      "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
       "Next hop address\n"
       "IP address of next hop\n")
 
@@ -1089,8 +1090,7 @@ DEFUN (no_set_tag,
        return eigrp_route_set_delete(vty, vty->index, "tag", argv[0]);
 }
 
-ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag <0-65535>",
-      NO_STR SET_STR
+ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag <0-65535>", NO_STR SET_STR
       "Tag value for routing protocol\n"
       "Tag value\n")