diff options
Diffstat (limited to 'lib/if_rmap.c')
| -rw-r--r-- | lib/if_rmap.c | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 736f2e237d..fa9b17f2ae 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -13,10 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <zebra.h> @@ -211,18 +210,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 +232,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 +247,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 +263,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 +320,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); |
