summaryrefslogtreecommitdiff
path: root/lib/if_rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if_rmap.c')
-rw-r--r--lib/if_rmap.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 736f2e237d..2afb08c7ca 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -211,18 +211,21 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type,
DEFUN (if_rmap,
if_rmap_cmd,
- "route-map RMAP_NAME (in|out) IFNAME",
+ "route-map RMAP_NAME <in|out> IFNAME",
"Route map set\n"
"Route map name\n"
"Route map set for input filtering\n"
"Route map set for output filtering\n"
"Route map interface name\n")
{
+ int idx_rmap_name = 1;
+ int idx_in_out = 2;
+ int idx_ifname = 3;
enum if_rmap_type type;
- if (strncmp (argv[1], "i", 1) == 0)
+ if (strncmp (argv[idx_in_out]->text, "in", 1) == 0)
type = IF_RMAP_IN;
- else if (strncmp (argv[1], "o", 1) == 0)
+ else if (strncmp (argv[idx_in_out]->text, "out", 1) == 0)
type = IF_RMAP_OUT;
else
{
@@ -230,23 +233,14 @@ DEFUN (if_rmap,
return CMD_WARNING;
}
- if_rmap_set (argv[2], type, argv[0]);
+ if_rmap_set (argv[idx_ifname]->arg, type, argv[idx_rmap_name]->arg);
return CMD_SUCCESS;
-}
-
-ALIAS (if_rmap,
- if_ipv6_rmap_cmd,
- "route-map RMAP_NAME (in|out) IFNAME",
- "Route map set\n"
- "Route map name\n"
- "Route map set for input filtering\n"
- "Route map set for output filtering\n"
- "Route map interface name\n")
+}
DEFUN (no_if_rmap,
no_if_rmap_cmd,
- "no route-map ROUTEMAP_NAME (in|out) IFNAME",
+ "no route-map ROUTEMAP_NAME <in|out> IFNAME",
NO_STR
"Route map unset\n"
"Route map name\n"
@@ -254,12 +248,15 @@ DEFUN (no_if_rmap,
"Route map for output filtering\n"
"Route map interface name\n")
{
+ int idx_routemap_name = 2;
+ int idx_in_out = 3;
+ int idx_ifname = 4;
int ret;
enum if_rmap_type type;
- if (strncmp (argv[1], "i", 1) == 0)
+ if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0)
type = IF_RMAP_IN;
- else if (strncmp (argv[1], "o", 1) == 0)
+ else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0)
type = IF_RMAP_OUT;
else
{
@@ -267,24 +264,15 @@ DEFUN (no_if_rmap,
return CMD_WARNING;
}
- ret = if_rmap_unset (argv[2], type, argv[0]);
+ ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg);
if (! ret)
{
vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
-}
+}
-ALIAS (no_if_rmap,
- no_if_ipv6_rmap_cmd,
- "no route-map ROUTEMAP_NAME (in|out) IFNAME",
- NO_STR
- "Route map unset\n"
- "Route map name\n"
- "Route map for input filtering\n"
- "Route map for output filtering\n"
- "Route map interface name\n")
/* Configuration write function. */
int
@@ -333,8 +321,6 @@ if_rmap_init (int node)
{
ifrmaphash = hash_create (if_rmap_hash_make, if_rmap_hash_cmp);
if (node == RIPNG_NODE) {
- install_element (RIPNG_NODE, &if_ipv6_rmap_cmd);
- install_element (RIPNG_NODE, &no_if_ipv6_rmap_cmd);
} else if (node == RIP_NODE) {
install_element (RIP_NODE, &if_rmap_cmd);
install_element (RIP_NODE, &no_if_rmap_cmd);