From 5e3edbf561e73db47366efcfe743fec4916c2fa2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 19 May 2015 17:47:22 -0700 Subject: [PATCH] 'set metric -12' is broken in the parser Signed-off-by: Daniel Walton --- bgpd/bgp_routemap.c | 22 +++++++++++----------- ospf6d/ospf6_asbr.c | 6 +++--- ospfd/ospf_routemap.c | 29 +++++++++++++++++++++-------- ripd/rip_routemap.c | 16 ++++++++-------- ripngd/ripng_routemap.c | 16 ++++++++-------- zebra/zebra_routemap.c | 16 ++++++++-------- 6 files changed, 59 insertions(+), 46 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 2d821cac52..e9a19f93d0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1379,7 +1379,7 @@ route_set_metric_compile (const char *arg) } else { - /* set metric +/-value check */ + /* set metric <+/-metric> check */ if ((strncmp (arg, "+", 1) != 0 && strncmp (arg, "-", 1) != 0) || (! all_digit (arg+1))) @@ -2504,10 +2504,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; } } @@ -2548,10 +2548,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); break; case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); + vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE); break; } if (arg == NULL && dep_name) @@ -2585,10 +2585,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; } } @@ -2608,10 +2608,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; } } @@ -4010,7 +4010,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") { @@ -4043,7 +4043,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") diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index cd2ebb0121..4d86c31e46 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -972,13 +972,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; diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 7bd6c3d961..425524d484 100644 --- a/ospfd/ospf_routemap.c +++ b/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,19 @@ 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); diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index cc0ed61fff..e04e43d487 100644 --- a/ripd/rip_routemap.c +++ b/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; } } diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index a316301ab5..eae4566a60 100644 --- a/ripngd/ripng_routemap.c +++ b/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; } } diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index d5e1bf18bb..3668448f73 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -64,10 +64,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; } } @@ -107,10 +107,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; } } @@ -139,10 +139,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; } } @@ -162,10 +162,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; } } -- 2.39.5