diff options
author | Dmitrii Turlupov <dturlupov@factor-ts.ru> | 2019-04-01 15:55:38 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-04-16 02:49:33 +0200 |
commit | ee22b196135c9ca6229f36d0d5c6dd1d725f7656 (patch) | |
tree | fc0563427e2721e83350b202f184094232fd6c47 /isisd | |
parent | isisd: allow redistribute statements with both the route-map and metric options (diff) | |
download | frr-ee22b196135c9ca6229f36d0d5c6dd1d725f7656.tar.xz frr-ee22b196135c9ca6229f36d0d5c6dd1d725f7656.zip |
fabricd: allow redistribute statements with both the route-map and metric options
Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_redist.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 3a864fb35..9047707bf 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -516,7 +516,7 @@ void isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, "redistribute <ipv4|ipv6> " PROTO_REDIST_STR - " [<metric (0-16777215)|route-map WORD>]", + " [{metric (0-16777215)|route-map WORD}]", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" @@ -528,7 +528,7 @@ DEFUN (isis_redistribute, { int idx_afi = 1; int idx_protocol = 2; - int idx_metric_rmap = fabricd ? 3 : 4; + int idx_metric_rmap = 1; VTY_DECLVAR_CONTEXT(isis_area, area); int family; int afi; @@ -556,20 +556,13 @@ DEFUN (isis_redistribute, return CMD_WARNING_CONFIG_FAILED; } - if (argc > idx_metric_rmap + 1) { - if (argv[idx_metric_rmap + 1]->arg[0] == '\0') - return CMD_WARNING_CONFIG_FAILED; - - if (strmatch(argv[idx_metric_rmap]->text, "metric")) { - char *endp; - metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, - 10); + if (argv_find(argv, argc, "metric", &idx_metric_rmap)) { + metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10); + } - if (*endp != '\0') - return CMD_WARNING_CONFIG_FAILED; - } else { - routemap = argv[idx_metric_rmap + 1]->arg; - } + idx_metric_rmap = 1; + if (argv_find(argv, argc, "route-map", &idx_metric_rmap)) { + routemap = argv[idx_metric_rmap + 1]->arg; } isis_redist_set(area, level, family, type, metric, routemap, 0); @@ -614,7 +607,7 @@ DEFUN (no_isis_redistribute, DEFUN (isis_default_originate, isis_default_originate_cmd, "default-information originate <ipv4|ipv6>" - " [always] [<metric (0-16777215)|route-map WORD>]", + " [always] [{metric (0-16777215)|route-map WORD}]", "Control distribution of default information\n" "Distribute a default route\n" "Distribute default route for IPv4\n" @@ -627,7 +620,7 @@ DEFUN (isis_default_originate, { int idx_afi = 2; int idx_always = fabricd ? 3 : 4; - int idx_metric_rmap = fabricd ? 3 : 4; + int idx_metric_rmap = 1; VTY_DECLVAR_CONTEXT(isis_area, area); int family; int originate_type = DEFAULT_ORIGINATE; @@ -651,12 +644,13 @@ DEFUN (isis_default_originate, idx_metric_rmap++; } - if (argc > idx_metric_rmap) { - if (strmatch(argv[idx_metric_rmap]->text, "metric")) - metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, - 10); - else - routemap = argv[idx_metric_rmap + 1]->arg; + if (argv_find(argv, argc, "metric", &idx_metric_rmap)) { + metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10); + } + + idx_metric_rmap = 1; + if (argv_find(argv, argc, "route-map", &idx_metric_rmap)) { + routemap = argv[idx_metric_rmap + 1]->arg; } if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS) { |