]> 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 b645ed198784babf9964edf5040c2e741d2a0c20..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;
@@ -710,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)
@@ -727,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;