'set metric -12' is broken in the parser

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-05-19 17:47:22 -07:00
parent 42f7e18488
commit 5e3edbf561
6 changed files with 59 additions and 46 deletions

View File

@ -1379,7 +1379,7 @@ route_set_metric_compile (const char *arg)
} }
else else
{ {
/* set metric +/-value check */ /* set metric <+/-metric> check */
if ((strncmp (arg, "+", 1) != 0 if ((strncmp (arg, "+", 1) != 0
&& strncmp (arg, "-", 1) != 0) && strncmp (arg, "-", 1) != 0)
|| (! all_digit (arg+1))) || (! all_digit (arg+1)))
@ -2504,10 +2504,10 @@ bgp_route_match_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -2548,10 +2548,10 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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);
break; break;
case RMAP_COMPILE_ERROR: case RMAP_COMPILE_ERROR:
vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
break; break;
} }
if (arg == NULL && dep_name) if (arg == NULL && dep_name)
@ -2585,10 +2585,10 @@ bgp_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -2608,10 +2608,10 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -4010,7 +4010,7 @@ DEFUN (set_community_delete,
SET_STR SET_STR
"set BGP community list (for deletion)\n" "set BGP community list (for deletion)\n"
"Community-list number (standard)\n" "Community-list number (standard)\n"
"Communitly-list number (expanded)\n" "Community-list number (expanded)\n"
"Community-list name\n" "Community-list name\n"
"Delete matching communities\n") "Delete matching communities\n")
{ {
@ -4043,7 +4043,7 @@ ALIAS (no_set_community_delete,
SET_STR SET_STR
"set BGP community list (for deletion)\n" "set BGP community list (for deletion)\n"
"Community-list number (standard)\n" "Community-list number (standard)\n"
"Communitly-list number (expanded)\n" "Community-list number (expanded)\n"
"Community-list name\n" "Community-list name\n"
"Delete matching communities\n") "Delete matching communities\n")

View File

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

View File

@ -108,10 +108,10 @@ ospf_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -131,10 +131,10 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -154,10 +154,10 @@ ospf_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -178,10 +178,10 @@ ospf_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -506,6 +506,19 @@ route_set_metric_compile (const char *arg)
u_int32_t *metric; u_int32_t *metric;
int32_t ret; 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)); metric = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
ret = atoi (arg); ret = atoi (arg);

View File

@ -58,10 +58,10 @@ rip_route_match_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -81,10 +81,10 @@ rip_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -104,7 +104,7 @@ rip_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: case RMAP_COMPILE_ERROR:
/* rip, ripng and other protocols share the set metric command /* 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 if metric is out of range for rip and ripng, it is not for
other protocols. Do not return an error */ other protocols. Do not return an error */
if (strcmp(command, "metric")) { 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; return CMD_WARNING;
} }
} }
@ -133,10 +133,10 @@ rip_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }

View File

@ -55,10 +55,10 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -77,10 +77,10 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -99,10 +99,10 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -121,10 +121,10 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }

View File

@ -64,10 +64,10 @@ zebra_route_match_add(struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -107,10 +107,10 @@ zebra_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -139,10 +139,10 @@ zebra_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }
@ -162,10 +162,10 @@ zebra_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret) switch (ret)
{ {
case RMAP_RULE_MISSING: 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; return CMD_WARNING;
case RMAP_COMPILE_ERROR: 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; return CMD_WARNING;
} }
} }