Browse Source

bgpd, ospfd, ospf6d, ripd, ripngd, zebra: 'set metric -12' is broken in the parser

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Daniel Walton 4 years ago
parent
commit
c7f25b9090
6 changed files with 60 additions and 45 deletions
  1. 10 10
      bgpd/bgp_routemap.c
  2. 3 3
      ospf6d/ospf6_asbr.c
  3. 23 8
      ospfd/ospf_routemap.c
  4. 8 8
      ripd/rip_routemap.c
  5. 8 8
      ripngd/ripng_routemap.c
  6. 8 8
      zebra/zebra_routemap.c

+ 10 - 10
bgpd/bgp_routemap.c

@@ -2397,10 +2397,10 @@ bgp_route_match_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -2420,10 +2420,10 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -2443,10 +2443,10 @@ bgp_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -2466,10 +2466,10 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -3575,7 +3575,7 @@ DEFUN (set_community_delete,
        SET_STR
        "set BGP community list (for deletion)\n"
        "Community-list number (standard)\n"
-       "Communitly-list number (expanded)\n"
+       "Community-list number (expanded)\n"
        "Community-list name\n"
        "Delete matching communities\n")
 {
@@ -3608,7 +3608,7 @@ ALIAS (no_set_community_delete,
        SET_STR
        "set BGP community list (for deletion)\n"
        "Community-list number (standard)\n"
-       "Communitly-list number (expanded)\n"
+       "Community-list number (expanded)\n"
        "Community-list name\n"
        "Delete matching communities\n")
 

+ 3 - 3
ospf6d/ospf6_asbr.c

@@ -978,13 +978,13 @@ route_map_command_status (struct vty *vty, int ret)
   switch (ret)
     {
     case RMAP_RULE_MISSING:
-      vty_out (vty, "Can't find rule.%s", VNL);
+      vty_out (vty, "OSPF6 Can't find rule.%s", VNL);
       break;
     case RMAP_COMPILE_ERROR:
-      vty_out (vty, "Argument is malformed.%s", VNL);
+      vty_out (vty, "OSPF6 Argument is malformed.%s", VNL);
       break;
     default:
-      vty_out (vty, "route-map add set failed.%s", VNL);
+      vty_out (vty, "OSPF6 route-map add set failed.%s", VNL);
       break;
     }
   return CMD_WARNING;

+ 23 - 8
ospfd/ospf_routemap.c

@@ -108,10 +108,10 @@ ospf_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
         {
         case RMAP_RULE_MISSING:
-          vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
           return CMD_WARNING;
         case RMAP_COMPILE_ERROR:
-          vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
           return CMD_WARNING;
         }
     }
@@ -131,10 +131,10 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
         {
         case RMAP_RULE_MISSING:
-          vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
           return CMD_WARNING;
         case RMAP_COMPILE_ERROR:
-          vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
           return CMD_WARNING;
         }
     }
@@ -154,10 +154,10 @@ ospf_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
         {
         case RMAP_RULE_MISSING:
-          vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
           return CMD_WARNING;
         case RMAP_COMPILE_ERROR:
-          vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
           return CMD_WARNING;
         }
     }
@@ -178,10 +178,10 @@ ospf_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
         {
         case RMAP_RULE_MISSING:
-          vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
           return CMD_WARNING;
         case RMAP_COMPILE_ERROR:
-          vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+          vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
           return CMD_WARNING;
         }
     }
@@ -506,6 +506,21 @@ route_set_metric_compile (const char *arg)
   u_int32_t *metric;
   int32_t ret;
 
+  /* OSPF doesn't support the +/- in
+     set metric <+/-metric> check
+     Ignore the +/- component */
+  if (! all_digit (arg))
+    {
+      if ((strncmp (arg, "+", 1) == 0 || strncmp (arg, "-", 1) == 0) &&
+	  all_digit (arg+1))
+	{
+	  zlog_warn ("OSPF does not support 'set metric +/-'");
+	  arg++;
+	}
+      else
+	return NULL;
+    }
+
   metric = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
   ret = atoi (arg);
 

+ 8 - 8
ripd/rip_routemap.c

@@ -58,10 +58,10 @@ rip_route_match_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -81,10 +81,10 @@ rip_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -104,7 +104,7 @@ rip_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
 	  /* rip, ripng and other protocols share the set metric command
@@ -112,7 +112,7 @@ rip_route_set_add (struct vty *vty, struct route_map_index *index,
 	     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.%s", VTY_NEWLINE);
+	     vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE);
 	     return CMD_WARNING;
 	  }
 	}
@@ -133,10 +133,10 @@ rip_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }

+ 8 - 8
ripngd/ripng_routemap.c

@@ -55,10 +55,10 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -77,10 +77,10 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -99,10 +99,10 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -121,10 +121,10 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }

+ 8 - 8
zebra/zebra_routemap.c

@@ -46,10 +46,10 @@ zebra_route_match_add(struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -69,10 +69,10 @@ zebra_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -92,10 +92,10 @@ zebra_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }
@@ -115,10 +115,10 @@ zebra_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
 	{
 	case RMAP_RULE_MISSING:
-	  vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	case RMAP_COMPILE_ERROR:
-	  vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+	  vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
 	  return CMD_WARNING;
 	}
     }