summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-11-28 17:56:29 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-11-28 17:56:29 +0100
commit82992fed8c6426f431fa92933dcf4cfe4de926d6 (patch)
treec7c3afb35248073d61d8863e635580f2969296e5 /zebra
parentlib: merge-prep lib/command.c (partial revert) (diff)
parentlib: pre-remove str.[ch] for merge, move strmatch() (diff)
downloadfrr-82992fed8c6426f431fa92933dcf4cfe4de926d6.tar.xz
frr-82992fed8c6426f431fa92933dcf4cfe4de926d6.zip
Merge branch 'vtysh-grammar'
Conflicts: isisd/isisd.c lib/Makefile.am lib/thread.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/connected.c1
-rw-r--r--zebra/debug.c86
-rw-r--r--zebra/if_netlink.c1
-rw-r--r--zebra/interface.c313
-rw-r--r--zebra/ioctl.c1
-rw-r--r--zebra/irdp_interface.c129
-rw-r--r--zebra/kernel_null.c1
-rw-r--r--zebra/redistribute_null.c1
-rw-r--r--zebra/router-id.c49
-rw-r--r--zebra/rt_netlink.c8
-rw-r--r--zebra/rtadv.c590
-rw-r--r--zebra/rtread_netlink.c1
-rw-r--r--zebra/test_main.c9
-rw-r--r--zebra/zebra_fpm.c20
-rw-r--r--zebra/zebra_fpm_netlink.c1
-rw-r--r--zebra/zebra_mpls_vty.c180
-rw-r--r--zebra/zebra_rnh_null.c1
-rw-r--r--zebra/zebra_routemap.c669
-rw-r--r--zebra/zebra_static.c11
-rw-r--r--zebra/zebra_vrf.c1
-rw-r--r--zebra/zebra_vty.c3731
-rw-r--r--zebra/zserv.c30
-rw-r--r--zebra/zserv.h2
-rw-r--r--zebra/zserv_null.c1
24 files changed, 1386 insertions, 4451 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 55c3792d4..bc54aab01 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -32,6 +32,7 @@
#include "memory.h"
#include "zebra_memory.h"
+#include "vty.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
#include "zebra/redistribute.h"
diff --git a/zebra/debug.c b/zebra/debug.c
index 93cd4dd9c..2e9fef292 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -124,52 +124,31 @@ DEFUN (debug_zebra_mpls,
DEFUN (debug_zebra_packet,
debug_zebra_packet_cmd,
- "debug zebra packet",
- DEBUG_STR
- "Zebra configuration\n"
- "Debug option set for zebra packet\n")
-{
- zebra_debug_packet = ZEBRA_DEBUG_PACKET;
- SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
- SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
- return CMD_SUCCESS;
-}
-
-DEFUN (debug_zebra_packet_direct,
- debug_zebra_packet_direct_cmd,
- "debug zebra packet (recv|send|detail)",
+ "debug zebra packet [<recv|send>] [detail]",
DEBUG_STR
"Zebra configuration\n"
"Debug option set for zebra packet\n"
"Debug option set for receive packet\n"
- "Debug option set for send packet\n")
+ "Debug option set for send packet\n"
+ "Debug option set for detailed info\n")
{
+ int idx = 0;
zebra_debug_packet = ZEBRA_DEBUG_PACKET;
- if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
+
+ if (argv_find (argv, argc, "send", &idx))
SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
- if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
+ idx = 0;
+ if (argv_find (argv, argc, "recv", &idx))
SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
- if (strncmp ("detail", argv[0], strlen (argv[0])) == 0)
+ idx = 0;
+ if (argv_find (argv, argc, "detail", &idx))
SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL);
- return CMD_SUCCESS;
-}
-DEFUN (debug_zebra_packet_detail,
- debug_zebra_packet_detail_cmd,
- "debug zebra packet (recv|send) detail",
- DEBUG_STR
- "Zebra configuration\n"
- "Debug option set for zebra packet\n"
- "Debug option set for receive packet\n"
- "Debug option set for send packet\n"
- "Debug option set detailed information\n")
-{
- zebra_debug_packet = ZEBRA_DEBUG_PACKET;
- if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
+ if (!(zebra_debug_packet & ZEBRA_DEBUG_SEND & ZEBRA_DEBUG_RECV))
+ {
SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
- if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
- SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL);
+ }
return CMD_SUCCESS;
}
@@ -186,7 +165,7 @@ DEFUN (debug_zebra_kernel,
DEFUN (debug_zebra_kernel_msgdump,
debug_zebra_kernel_msgdump_cmd,
- "debug zebra kernel msgdump {recv|send}",
+ "debug zebra kernel msgdump [<recv|send>]",
DEBUG_STR
"Zebra configuration\n"
"Debug option set for zebra between kernel interface\n"
@@ -194,9 +173,10 @@ DEFUN (debug_zebra_kernel_msgdump,
"Dump raw netlink messages received\n"
"Dump raw netlink messages sent\n")
{
- if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0))
+ int idx_recv_send = 4;
+ if (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "recv", strlen(argv[idx_recv_send]->arg)) == 0)
SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
- if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0))
+ if (!argv[idx_recv_send]->arg || strncmp(argv[idx_recv_send]->arg, "send", strlen(argv[idx_recv_send]->arg)) == 0)
SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
return CMD_SUCCESS;
}
@@ -273,19 +253,7 @@ DEFUN (no_debug_zebra_mpls,
DEFUN (no_debug_zebra_packet,
no_debug_zebra_packet_cmd,
- "no debug zebra packet",
- NO_STR
- DEBUG_STR
- "Zebra configuration\n"
- "Debug option set for zebra packet\n")
-{
- zebra_debug_packet = 0;
- return CMD_SUCCESS;
-}
-
-DEFUN (no_debug_zebra_packet_direct,
- no_debug_zebra_packet_direct_cmd,
- "no debug zebra packet (recv|send)",
+ "no debug zebra packet [<recv|send>]",
NO_STR
DEBUG_STR
"Zebra configuration\n"
@@ -293,9 +261,10 @@ DEFUN (no_debug_zebra_packet_direct,
"Debug option set for receive packet\n"
"Debug option set for send packet\n")
{
- if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
+ int idx = 0;
+ if (argc == 4 || argv_find (argv, argc, "send", &idx))
UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
- if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
+ if (argc == 4 || argv_find (argv, argc, "recv", &idx))
UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
return CMD_SUCCESS;
}
@@ -314,7 +283,8 @@ DEFUN (no_debug_zebra_kernel,
DEFUN (no_debug_zebra_kernel_msgdump,
no_debug_zebra_kernel_msgdump_cmd,
- "no debug zebra kernel msgdump {recv|send}",
+ "no debug zebra kernel msgdump [<recv|send>]",
+ NO_STR
DEBUG_STR
"Zebra configuration\n"
"Debug option set for zebra between kernel interface\n"
@@ -322,10 +292,12 @@ DEFUN (no_debug_zebra_kernel_msgdump,
"Dump raw netlink messages received\n"
"Dump raw netlink messages sent\n")
{
- if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0))
+ int idx = 0;
+ if (argc == 5 || argv_find (argv, argc, "recv", &idx))
UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
- if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0))
+ if (argc == 5 || argv_find (argv, argc, "send", &idx))
UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
+
return CMD_SUCCESS;
}
@@ -453,8 +425,6 @@ zebra_debug_init (void)
install_element (ENABLE_NODE, &debug_zebra_nht_cmd);
install_element (ENABLE_NODE, &debug_zebra_mpls_cmd);
install_element (ENABLE_NODE, &debug_zebra_packet_cmd);
- install_element (ENABLE_NODE, &debug_zebra_packet_direct_cmd);
- install_element (ENABLE_NODE, &debug_zebra_packet_detail_cmd);
install_element (ENABLE_NODE, &debug_zebra_kernel_cmd);
install_element (ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
install_element (ENABLE_NODE, &debug_zebra_rib_cmd);
@@ -474,8 +444,6 @@ zebra_debug_init (void)
install_element (CONFIG_NODE, &debug_zebra_nht_cmd);
install_element (CONFIG_NODE, &debug_zebra_mpls_cmd);
install_element (CONFIG_NODE, &debug_zebra_packet_cmd);
- install_element (CONFIG_NODE, &debug_zebra_packet_direct_cmd);
- install_element (CONFIG_NODE, &debug_zebra_packet_detail_cmd);
install_element (CONFIG_NODE, &debug_zebra_kernel_cmd);
install_element (CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
install_element (CONFIG_NODE, &debug_zebra_rib_cmd);
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index c44219a49..f7f6334a7 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -38,6 +38,7 @@
#include "vrf.h"
#include "mpls.h"
+#include "vty.h"
#include "zebra/zserv.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
diff --git a/zebra/interface.c b/zebra/interface.c
index b87f61f92..ff9c0a301 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1233,7 +1233,7 @@ DEFUN_NOSH (zebra_interface,
"Interface's name\n")
{
int ret;
-
+
/* Call lib interface() */
if ((ret = interface_cmd.func (self, vty, argc, argv)) != CMD_SUCCESS)
return ret;
@@ -1248,13 +1248,6 @@ DEFUN_NOSH (zebra_interface,
return ret;
}
-ALIAS (zebra_interface,
- zebra_interface_vrf_cmd,
- "interface IFNAME " VRF_CMD_STR,
- "Select an interface to configure\n"
- "Interface's name\n"
- VRF_CMD_HELP_STR)
-
static void
interface_update_stats (void)
{
@@ -1303,10 +1296,12 @@ struct cmd_node vrf_node =
};
/* Show all interfaces to vty. */
-DEFUN (show_interface, show_interface_cmd,
- "show interface",
+DEFUN (show_interface,
+ show_interface_cmd,
+ "show interface [vrf NAME]",
SHOW_STR
- "Interface status and configuration\n")
+ "Interface status and configuration\n"
+ VRF_CMD_HELP_STR)
{
struct listnode *node;
struct interface *ifp;
@@ -1314,8 +1309,8 @@ DEFUN (show_interface, show_interface_cmd,
interface_update_stats ();
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (argc > 2)
+ VRF_GET_ID (vrf_id, argv[3]->arg);
/* All interface print. */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
@@ -1324,16 +1319,11 @@ DEFUN (show_interface, show_interface_cmd,
return CMD_SUCCESS;
}
-ALIAS (show_interface,
- show_interface_vrf_cmd,
- "show interface " VRF_CMD_STR,
- SHOW_STR
- "Interface status and configuration\n"
- VRF_CMD_HELP_STR)
/* Show all interfaces to vty. */
-DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd,
- "show interface " VRF_ALL_CMD_STR,
+DEFUN (show_interface_vrf_all,
+ show_interface_vrf_all_cmd,
+ "show interface vrf all",
SHOW_STR
"Interface status and configuration\n"
VRF_ALL_CMD_HELP_STR)
@@ -1356,25 +1346,26 @@ DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd,
DEFUN (show_interface_name_vrf,
show_interface_name_vrf_cmd,
- "show interface IFNAME " VRF_CMD_STR,
+ "show interface IFNAME vrf NAME",
SHOW_STR
"Interface status and configuration\n"
"Interface name\n"
VRF_CMD_HELP_STR)
{
+ int idx_ifname = 2;
+ int idx_name = 4;
struct interface *ifp;
vrf_id_t vrf_id = VRF_DEFAULT;
interface_update_stats ();
- if (argc > 1)
- VRF_GET_ID (vrf_id, argv[1]);
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
/* Specified interface print. */
- ifp = if_lookup_by_name_vrf (argv[0], vrf_id);
+ ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_id);
if (ifp == NULL)
{
- vty_out (vty, "%% Can't find interface %s%s", argv[0],
+ vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -1384,13 +1375,15 @@ DEFUN (show_interface_name_vrf,
}
/* Show specified interface to vty. */
-DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd,
- "show interface IFNAME " VRF_ALL_CMD_STR,
+DEFUN (show_interface_name_vrf_all,
+ show_interface_name_vrf_all_cmd,
+ "show interface IFNAME [vrf all]",
SHOW_STR
"Interface status and configuration\n"
"Interface name\n"
VRF_ALL_CMD_HELP_STR)
{
+ int idx_ifname = 2;
struct interface *ifp;
vrf_iter_t iter;
int found = 0;
@@ -1401,7 +1394,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd,
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
{
/* Specified interface print. */
- ifp = if_lookup_by_name_vrf (argv[0], vrf_iter2id (iter));
+ ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_iter2id (iter));
if (ifp)
{
if_dump_vty (vty, ifp);
@@ -1411,18 +1404,13 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd,
if (!found)
{
- vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
-ALIAS (show_interface_name_vrf_all, show_interface_name_cmd,
- "show interface IFNAME",
- SHOW_STR
- "Interface status and configuration\n"
- "Interface name\n")
static void
if_show_description (struct vty *vty, vrf_id_t vrf_id)
@@ -1466,32 +1454,26 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id)
DEFUN (show_interface_desc,
show_interface_desc_cmd,
- "show interface description",
+ "show interface description [vrf NAME]",
SHOW_STR
"Interface status and configuration\n"
- "Interface description\n")
+ "Interface description\n"
+ VRF_CMD_HELP_STR)
{
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (argc > 3)
+ VRF_GET_ID (vrf_id, argv[4]->arg);
if_show_description (vty, vrf_id);
return CMD_SUCCESS;
}
-ALIAS (show_interface_desc,
- show_interface_desc_vrf_cmd,
- "show interface description " VRF_CMD_STR,
- SHOW_STR
- "Interface status and configuration\n"
- "Interface description\n"
- VRF_CMD_HELP_STR)
DEFUN (show_interface_desc_vrf_all,
show_interface_desc_vrf_all_cmd,
- "show interface description " VRF_ALL_CMD_STR,
+ "show interface description vrf all",
SHOW_STR
"Interface status and configuration\n"
"Interface description\n"
@@ -1569,7 +1551,7 @@ DEFUN (linkdetect,
{
VTY_DECLVAR_CONTEXT (interface, ifp);
int if_was_operative;
-
+
if_was_operative = if_is_no_ptm_operative(ifp);
SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
@@ -1662,14 +1644,15 @@ DEFUN (no_shutdown_if,
DEFUN (bandwidth_if,
bandwidth_if_cmd,
- "bandwidth <1-100000>",
+ "bandwidth (1-100000)",
"Set bandwidth informational parameter\n"
"Bandwidth in megabits\n")
{
+ int idx_number = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned int bandwidth;
-
- bandwidth = strtol(argv[0], NULL, 10);
+
+ bandwidth = strtol(argv[idx_number]->arg, NULL, 10);
/* bandwidth range is <1-100000> */
if (bandwidth < 1 || bandwidth > 100000)
@@ -1689,9 +1672,10 @@ DEFUN (bandwidth_if,
DEFUN (no_bandwidth_if,
no_bandwidth_if_cmd,
- "no bandwidth",
+ "no bandwidth [(1-100000)]",
NO_STR
- "Set bandwidth informational parameter\n")
+ "Set bandwidth informational parameter\n"
+ "Bandwidth in megabits\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
@@ -1704,12 +1688,6 @@ DEFUN (no_bandwidth_if,
return CMD_SUCCESS;
}
-ALIAS (no_bandwidth_if,
- no_bandwidth_if_val_cmd,
- "no bandwidth <1-100000>",
- NO_STR
- "Set bandwidth informational parameter\n"
- "Bandwidth in megabits\n")
struct cmd_node link_params_node =
{
@@ -1834,15 +1812,16 @@ DEFUN (no_link_params_enable,
/* STANDARD TE metrics */
DEFUN (link_params_metric,
link_params_metric_cmd,
- "metric <0-4294967295>",
+ "metric (0-4294967295)",
"Link metric for MPLS-TE purpose\n"
"Metric value in decimal\n")
{
+ int idx_number = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t metric;
- VTY_GET_ULONG("metric", metric, argv[0]);
+ VTY_GET_ULONG("metric", metric, argv[idx_number]->arg);
/* Update TE metric if needed */
link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE, metric);
@@ -1870,12 +1849,13 @@ DEFUN (link_params_maxbw,
"Maximum bandwidth that can be used\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_bandwidth = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
- if (sscanf (argv[0], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -1914,11 +1894,12 @@ DEFUN (link_params_max_rsv_bw,
"Maximum bandwidth that may be reserved\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_bandwidth = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
- if (sscanf (argv[0], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -1942,25 +1923,27 @@ DEFUN (link_params_max_rsv_bw,
DEFUN (link_params_unrsv_bw,
link_params_unrsv_bw_cmd,
- "unrsv-bw <0-7> BANDWIDTH",
+ "unrsv-bw (0-7) BANDWIDTH",
"Unreserved bandwidth at each priority level\n"
"Priority\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_number = 1;
+ int idx_bandwidth = 2;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
int priority;
float bw;
/* We don't have to consider about range check here. */
- if (sscanf (argv[0], "%d", &priority) != 1)
+ if (sscanf (argv[idx_number]->arg, "%d", &priority) != 1)
{
vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
return CMD_WARNING;
}
- if (sscanf (argv[1], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -1988,11 +1971,12 @@ DEFUN (link_params_admin_grp,
"Administrative group membership\n"
"32-bit Hexadecimal value (e.g. 0xa1)\n")
{
+ int idx_bitpattern = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
unsigned long value;
- if (sscanf (argv[0], "0x%lx", &value) != 1)
+ if (sscanf (argv[idx_bitpattern]->arg, "0x%lx", &value) != 1)
{
vty_out (vty, "link_params_admin_grp: fscanf: %s%s",
safe_strerror (errno), VTY_NEWLINE);
@@ -2022,24 +2006,27 @@ DEFUN (no_link_params_admin_grp,
/* RFC5392 & RFC5316: INTER-AS */
DEFUN (link_params_inter_as,
link_params_inter_as_cmd,
- "neighbor A.B.C.D as <1-4294967295>",
+ "neighbor A.B.C.D as (1-4294967295)",
"Configure remote ASBR information (Neighbor IP address and AS number)\n"
"Remote IP address in dot decimal A.B.C.D\n"
"Remote AS number\n"
"AS number in the range <1-4294967295>\n")
{
+ int idx_ipv4 = 1;
+ int idx_number = 3;
+
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
struct in_addr addr;
u_int32_t as;
- if (!inet_aton (argv[0], &addr))
+ if (!inet_aton (argv[idx_ipv4]->arg, &addr))
{
vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE);
return CMD_WARNING;
}
- VTY_GET_ULONG("AS number", as, argv[1]);
+ VTY_GET_ULONG("AS number", as, argv[idx_number]->arg);
/* Update Remote IP and Remote AS fields if needed */
if (IS_PARAM_UNSET(iflp, LP_RMT_AS)
@@ -2082,78 +2069,77 @@ DEFUN (no_link_params_inter_as,
/* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */
DEFUN (link_params_delay,
link_params_delay_cmd,
- "delay <0-16777215>",
+ "delay (0-16777215) [min (0-16777215) max (0-16777215)]",
"Unidirectional Average Link Delay\n"
- "Average delay in micro-second as decimal (0...16777215)\n")
+ "Average delay in micro-second as decimal (0...16777215)\n"
+ "Minimum delay\n"
+ "Minimum delay in micro-second as decimal (0...16777215)\n"
+ "Maximum delay\n"
+ "Maximum delay in micro-second as decimal (0...16777215)\n")
{
+ /* Get and Check new delay values */
+ u_int32_t delay = 0, low = 0, high = 0;
+ VTY_GET_ULONG("delay", delay, argv[1]->arg);
+ if (argc == 6)
+ {
+ VTY_GET_ULONG("minimum delay", low, argv[3]->arg);
+ VTY_GET_ULONG("maximum delay", high, argv[5]->arg);
+ }
+
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
- u_int32_t delay = 0, low = 0, high = 0;
u_int8_t update = 0;
- /* Get and Check new delay values */
- VTY_GET_ULONG("delay", delay, argv[0]);
- switch (argc)
- {
- case 1:
- /* Check new delay value against old Min and Max delays if set */
- if (IS_PARAM_SET(iflp, LP_MM_DELAY)
- && (delay <= iflp->min_delay || delay >= iflp->max_delay))
- {
- vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
- iflp->min_delay, iflp->max_delay, VTY_NEWLINE);
- return CMD_WARNING;
- }
- /* Update delay if value is not set or change */
- if (IS_PARAM_UNSET(iflp, LP_DELAY)|| iflp->av_delay != delay)
- {
- iflp->av_delay = delay;
- SET_PARAM(iflp, LP_DELAY);
- update = 1;
- }
- /* Unset Min and Max delays if already set */
- if (IS_PARAM_SET(iflp, LP_MM_DELAY))
- {
- iflp->min_delay = 0;
- iflp->max_delay = 0;
- UNSET_PARAM(iflp, LP_MM_DELAY);
- update = 1;
- }
- break;
- case 2:
- vty_out (vty, "You should specify both Minimum and Maximum delay with Average delay%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- break;
- case 3:
- VTY_GET_ULONG("minimum delay", low, argv[1]);
- VTY_GET_ULONG("maximum delay", high, argv[2]);
- /* Check new delays value coherency */
- if (delay <= low || delay >= high)
- {
- vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
- low, high, VTY_NEWLINE);
- return CMD_WARNING;
- }
- /* Update Delays if needed */
- if (IS_PARAM_UNSET(iflp, LP_DELAY)
- || IS_PARAM_UNSET(iflp, LP_MM_DELAY)
- || iflp->av_delay != delay
- || iflp->min_delay != low
- || iflp->max_delay != high)
- {
- iflp->av_delay = delay;
- SET_PARAM(iflp, LP_DELAY);
- iflp->min_delay = low;
- iflp->max_delay = high;
- SET_PARAM(iflp, LP_MM_DELAY);
- update = 1;
- }
- break;
- default:
- return CMD_WARNING;
- break;
- }
+ if (argc == 2)
+ {
+ /* Check new delay value against old Min and Max delays if set */
+ if (IS_PARAM_SET(iflp, LP_MM_DELAY)
+ && (delay <= iflp->min_delay || delay >= iflp->max_delay))
+ {
+ vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
+ iflp->min_delay, iflp->max_delay, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ /* Update delay if value is not set or change */
+ if (IS_PARAM_UNSET(iflp, LP_DELAY)|| iflp->av_delay != delay)
+ {
+ iflp->av_delay = delay;
+ SET_PARAM(iflp, LP_DELAY);
+ update = 1;
+ }
+ /* Unset Min and Max delays if already set */
+ if (IS_PARAM_SET(iflp, LP_MM_DELAY))
+ {
+ iflp->min_delay = 0;
+ iflp->max_delay = 0;
+ UNSET_PARAM(iflp, LP_MM_DELAY);
+ update = 1;
+ }
+ }
+ else
+ {
+ /* Check new delays value coherency */
+ if (delay <= low || delay >= high)
+ {
+ vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
+ low, high, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ /* Update Delays if needed */
+ if (IS_PARAM_UNSET(iflp, LP_DELAY)
+ || IS_PARAM_UNSET(iflp, LP_MM_DELAY)
+ || iflp->av_delay != delay
+ || iflp->min_delay != low
+ || iflp->max_delay != high)
+ {
+ iflp->av_delay = delay;
+ SET_PARAM(iflp, LP_DELAY);
+ iflp->min_delay = low;
+ iflp->max_delay = high;
+ SET_PARAM(iflp, LP_MM_DELAY);
+ update = 1;
+ }
+ }
/* force protocols to update LINK STATE due to parameters change */
if (update == 1 && if_is_operative (ifp))
@@ -2162,16 +2148,6 @@ DEFUN (link_params_delay,
return CMD_SUCCESS;
}
-ALIAS (link_params_delay,
- link_params_delay_mm_cmd,
- "delay <0-16777215> min <0-16777215> max <0-16777215>",
- "Unidirectional Average Link Delay (optionally Minimum and Maximum delays)\n"
- "Average delay in micro-second as decimal (0...16777215)\n"
- "Minimum delay\n"
- "Minimum delay in micro-second as decimal (0...16777215)\n"
- "Maximum delay\n"
- "Maximum delay in micro-second as decimal (0...16777215)\n")
-
DEFUN (no_link_params_delay,
no_link_params_delay_cmd,
"no delay",
@@ -2197,15 +2173,16 @@ DEFUN (no_link_params_delay,
DEFUN (link_params_delay_var,
link_params_delay_var_cmd,
- "delay-variation <0-16777215>",
+ "delay-variation (0-16777215)",
"Unidirectional Link Delay Variation\n"
"delay variation in micro-second as decimal (0...16777215)\n")
{
+ int idx_number = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t value;
- VTY_GET_ULONG("delay variation", value, argv[0]);
+ VTY_GET_ULONG("delay variation", value, argv[idx_number]->arg);
/* Update Delay Variation if needed */
link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value);
@@ -2233,11 +2210,12 @@ DEFUN (link_params_pkt_loss,
"Unidirectional Link Packet Loss\n"
"percentage of total traffic by 0.000003% step and less than 50.331642%\n")
{
+ int idx_percentage = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float fval;
- if (sscanf (argv[0], "%g", &fval) != 1)
+ if (sscanf (argv[idx_percentage]->arg, "%g", &fval) != 1)
{
vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -2273,11 +2251,12 @@ DEFUN (link_params_res_bw,
"Unidirectional Residual Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_bandwidth = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
- if (sscanf (argv[0], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -2319,11 +2298,12 @@ DEFUN (link_params_ava_bw,
"Unidirectional Available Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_bandwidth = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
- if (sscanf (argv[0], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -2365,11 +2345,12 @@ DEFUN (link_params_use_bw,
"Unidirectional Utilised Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
+ int idx_bandwidth = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
- if (sscanf (argv[0], "%g", &bw) != 1)
+ if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno),
VTY_NEWLINE);
@@ -2553,8 +2534,9 @@ DEFUN (ip_address,
"Set the IP address of an interface\n"
"IP address (e.g. 10.0.0.1/8)\n")
{
+ int idx_ipv4_prefixlen = 2;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ip_address_install (vty, ifp, argv[0], NULL, NULL);
+ return ip_address_install (vty, ifp, argv[idx_ipv4_prefixlen]->arg, NULL, NULL);
}
DEFUN (no_ip_address,
@@ -2565,8 +2547,9 @@ DEFUN (no_ip_address,
"Set the IP address of an interface\n"
"IP Address (e.g. 10.0.0.1/8)")
{
+ int idx_ipv4_prefixlen = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ip_address_uninstall (vty, ifp, argv[0], NULL, NULL);
+ return ip_address_uninstall (vty, ifp, argv[idx_ipv4_prefixlen]->arg, NULL, NULL);
}
@@ -2580,8 +2563,10 @@ DEFUN (ip_address_label,
"Label of this address\n"
"Label\n")
{
+ int idx_ipv4_prefixlen = 2;
+ int idx_line = 4;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ip_address_install (vty, ifp, argv[0], NULL, argv[1]);
+ return ip_address_install (vty, ifp, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_line]->arg);
}
DEFUN (no_ip_address_label,
@@ -2594,8 +2579,10 @@ DEFUN (no_ip_address_label,
"Label of this address\n"
"Label\n")
{
+ int idx_ipv4_prefixlen = 3;
+ int idx_line = 5;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ip_address_uninstall (vty, ifp, argv[0], NULL, argv[1]);
+ return ip_address_uninstall (vty, ifp, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_line]->arg);
}
#endif /* HAVE_NETLINK */
@@ -2758,8 +2745,9 @@ DEFUN (ipv6_address,
"Set the IP address of an interface\n"
"IPv6 address (e.g. 3ffe:506::1/48)\n")
{
+ int idx_ipv6_prefixlen = 2;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ipv6_address_install (vty, ifp, argv[0], NULL, NULL, 0);
+ return ipv6_address_install (vty, ifp, argv[idx_ipv6_prefixlen]->arg, NULL, NULL, 0);
}
DEFUN (no_ipv6_address,
@@ -2770,8 +2758,9 @@ DEFUN (no_ipv6_address,
"Set the IP address of an interface\n"
"IPv6 address (e.g. 3ffe:506::1/48)\n")
{
+ int idx_ipv6_prefixlen = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
- return ipv6_address_uninstall (vty, ifp, argv[0], NULL, NULL, 0);
+ return ipv6_address_uninstall (vty, ifp, argv[idx_ipv6_prefixlen]->arg, NULL, NULL, 0);
}
#endif /* HAVE_IPV6 */
@@ -2946,18 +2935,14 @@ zebra_if_init (void)
install_node (&vrf_node, vrf_config_write);
install_element (VIEW_NODE, &show_interface_cmd);
- install_element (VIEW_NODE, &show_interface_vrf_cmd);
install_element (VIEW_NODE, &show_interface_vrf_all_cmd);
- install_element (VIEW_NODE, &show_interface_name_cmd);
install_element (VIEW_NODE, &show_interface_name_vrf_cmd);
install_element (VIEW_NODE, &show_interface_name_vrf_all_cmd);
+
install_element (ENABLE_NODE, &show_interface_desc_cmd);
- install_element (ENABLE_NODE, &show_interface_desc_vrf_cmd);
install_element (ENABLE_NODE, &show_interface_desc_vrf_all_cmd);
install_element (CONFIG_NODE, &zebra_interface_cmd);
- install_element (CONFIG_NODE, &zebra_interface_vrf_cmd);
install_element (CONFIG_NODE, &no_interface_cmd);
- install_element (CONFIG_NODE, &no_interface_vrf_cmd);
install_default (INTERFACE_NODE);
install_element (INTERFACE_NODE, &interface_desc_cmd);
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
@@ -2969,7 +2954,6 @@ zebra_if_init (void)
install_element (INTERFACE_NODE, &no_shutdown_if_cmd);
install_element (INTERFACE_NODE, &bandwidth_if_cmd);
install_element (INTERFACE_NODE, &no_bandwidth_if_cmd);
- install_element (INTERFACE_NODE, &no_bandwidth_if_val_cmd);
install_element (INTERFACE_NODE, &ip_address_cmd);
install_element (INTERFACE_NODE, &no_ip_address_cmd);
#ifdef HAVE_IPV6
@@ -2994,7 +2978,6 @@ zebra_if_init (void)
install_element(LINK_PARAMS_NODE, &no_link_params_inter_as_cmd);
install_element(LINK_PARAMS_NODE, &link_params_delay_cmd);
install_element(LINK_PARAMS_NODE, &no_link_params_delay_cmd);
- install_element(LINK_PARAMS_NODE, &link_params_delay_mm_cmd);
install_element(LINK_PARAMS_NODE, &link_params_delay_var_cmd);
install_element(LINK_PARAMS_NODE, &no_link_params_delay_var_cmd);
install_element(LINK_PARAMS_NODE, &link_params_pkt_loss_cmd);
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index f91ee2438..1835fb310 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -29,6 +29,7 @@
#include "log.h"
#include "privs.h"
+#include "vty.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/interface.h"
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index 9d8c2e67b..fde759df9 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -18,17 +18,17 @@
* 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.
+ * 02111-1307, USA.
*/
-/*
+/*
* This work includes work with the following copywrite:
*
* Copyright (C) 1997, 2000 Kunihiro Ishiguro
*
*/
-/*
+/*
* Thanks to Jens Låås at Swedish University of Agricultural Sciences
* for reviewing and tests.
*/
@@ -36,7 +36,7 @@
#include <zebra.h>
-#ifdef HAVE_IRDP
+#ifdef HAVE_IRDP
#include "if.h"
#include "vty.h"
@@ -81,7 +81,7 @@ irdp_get_prefix(struct interface *ifp)
{
struct listnode *node;
struct connected *ifc;
-
+
if (ifp->connected)
for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, ifc))
return ifc->address;
@@ -91,9 +91,9 @@ irdp_get_prefix(struct interface *ifp)
/* Join to the add/leave multicast group. */
static int
-if_group (struct interface *ifp,
- int sock,
- u_int32_t group,
+if_group (struct interface *ifp,
+ int sock,
+ u_int32_t group,
int add_leave)
{
struct ip_mreq m;
@@ -116,7 +116,7 @@ if_group (struct interface *ifp,
(char *) &m, sizeof (struct ip_mreq));
if (ret < 0)
zlog_warn ("IRDP: %s can't setsockopt %s: %s",
- add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group",
+ add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group",
inet_2a(group, b1),
safe_strerror (errno));
@@ -137,7 +137,7 @@ if_add_group (struct interface *ifp)
}
if(irdp->flags & IF_DEBUG_MISC )
- zlog_debug("IRDP: Adding group %s for %s",
+ zlog_debug("IRDP: Adding group %s for %s",
inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1),
ifp->name);
return 0;
@@ -156,7 +156,7 @@ if_drop_group (struct interface *ifp)
return ret;
if(irdp->flags & IF_DEBUG_MISC)
- zlog_debug("IRDP: Leaving group %s for %s",
+ zlog_debug("IRDP: Leaving group %s for %s",
inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1),
ifp->name);
return 0;
@@ -206,7 +206,7 @@ irdp_if_start(struct interface *ifp, int multicast, int set_defaults)
}
irdp->flags |= IF_ACTIVE;
- if(!multicast)
+ if(!multicast)
irdp->flags |= IF_BROADCAST;
if_add_update(ifp);
@@ -219,13 +219,13 @@ irdp_if_start(struct interface *ifp, int multicast, int set_defaults)
if( multicast) {
if_add_group(ifp);
-
+
if (! (ifp->flags & (IFF_MULTICAST|IFF_ALLMULTI))) {
zlog_warn("IRDP: Interface not multicast enabled %s", ifp->name);
}
}
- if(set_defaults)
+ if(set_defaults)
if_set_defaults(ifp);
irdp->irdp_sent = 0;
@@ -239,9 +239,9 @@ irdp_if_start(struct interface *ifp, int multicast, int set_defaults)
seed = ifc->address->u.prefix4.s_addr;
break;
}
-
+
srandom(seed);
- timer = (random () % IRDP_DEFAULT_INTERVAL) + 1;
+ timer = (random () % IRDP_DEFAULT_INTERVAL) + 1;
irdp->AdvPrefList = list_new();
irdp->AdvPrefList->del = (void (*)(void *)) Adv_free; /* Destructor */
@@ -250,18 +250,18 @@ irdp_if_start(struct interface *ifp, int multicast, int set_defaults)
/* And this for startup. Speed limit from 1991 :-). But it's OK*/
if(irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS &&
- timer > MAX_INITIAL_ADVERT_INTERVAL )
+ timer > MAX_INITIAL_ADVERT_INTERVAL )
timer= MAX_INITIAL_ADVERT_INTERVAL;
-
+
if(irdp->flags & IF_DEBUG_MISC)
- zlog_debug("IRDP: Init timer for %s set to %u",
- ifp->name,
+ zlog_debug("IRDP: Init timer for %s set to %u",
+ ifp->name,
timer);
- irdp->t_advertise = thread_add_timer(zebrad.master,
- irdp_send_thread,
- ifp,
+ irdp->t_advertise = thread_add_timer(zebrad.master,
+ irdp_send_thread,
+ ifp,
timer);
}
@@ -270,7 +270,7 @@ irdp_if_stop(struct interface *ifp)
{
struct zebra_if *zi=ifp->info;
struct irdp_interface *irdp=&zi->irdp;
-
+
if (irdp == NULL) {
zlog_warn ("Interface %s structure is NULL", ifp->name);
return;
@@ -281,7 +281,7 @@ irdp_if_stop(struct interface *ifp)
return;
}
- if(! (irdp->flags & IF_BROADCAST))
+ if(! (irdp->flags & IF_BROADCAST))
if_drop_group(ifp);
irdp_advert_off(ifp);
@@ -307,9 +307,9 @@ irdp_if_shutdown(struct interface *ifp)
irdp->flags |= IF_SHUTDOWN;
irdp->flags &= ~IF_ACTIVE;
- if(! (irdp->flags & IF_BROADCAST))
+ if(! (irdp->flags & IF_BROADCAST))
if_drop_group(ifp);
-
+
/* Tell the hosts we are out of service */
irdp_advert_off(ifp);
}
@@ -327,7 +327,7 @@ irdp_if_no_shutdown(struct interface *ifp)
irdp->flags &= ~IF_SHUTDOWN;
- irdp_if_start(ifp, irdp->flags & IF_BROADCAST? FALSE : TRUE, FALSE);
+ irdp_if_start(ifp, irdp->flags & IF_BROADCAST? FALSE : TRUE, FALSE);
}
@@ -344,30 +344,30 @@ void irdp_config_write (struct vty *vty, struct interface *ifp)
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
- if( irdp->flags & IF_SHUTDOWN)
+ if( irdp->flags & IF_SHUTDOWN)
vty_out (vty, " ip irdp shutdown %s", VTY_NEWLINE);
- if( irdp->flags & IF_BROADCAST)
+ if( irdp->flags & IF_BROADCAST)
vty_out (vty, " ip irdp broadcast%s", VTY_NEWLINE);
- else
+ else
vty_out (vty, " ip irdp multicast%s", VTY_NEWLINE);
- vty_out (vty, " ip irdp preference %ld%s",
+ vty_out (vty, " ip irdp preference %ld%s",
irdp->Preference, VTY_NEWLINE);
for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv))
vty_out (vty, " ip irdp address %s preference %d%s",
inet_2a(adv->ip.s_addr, b1),
- adv->pref,
+ adv->pref,
VTY_NEWLINE);
- vty_out (vty, " ip irdp holdtime %d%s",
+ vty_out (vty, " ip irdp holdtime %d%s",
irdp->Lifetime, VTY_NEWLINE);
- vty_out (vty, " ip irdp minadvertinterval %ld%s",
+ vty_out (vty, " ip irdp minadvertinterval %ld%s",
irdp->MinAdvertInterval, VTY_NEWLINE);
- vty_out (vty, " ip irdp maxadvertinterval %ld%s",
+ vty_out (vty, " ip irdp maxadvertinterval %ld%s",
irdp->MaxAdvertInterval, VTY_NEWLINE);
}
@@ -415,6 +415,7 @@ DEFUN (ip_irdp_shutdown,
ip_irdp_shutdown_cmd,
"ip irdp shutdown",
IP_STR
+ "ICMP Router discovery on this interface\n"
"ICMP Router discovery shutdown on this interface\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
@@ -428,6 +429,7 @@ DEFUN (no_ip_irdp_shutdown,
"no ip irdp shutdown",
NO_STR
IP_STR
+ "ICMP Router discovery on this interface\n"
"ICMP Router discovery no shutdown on this interface\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
@@ -438,12 +440,13 @@ DEFUN (no_ip_irdp_shutdown,
DEFUN (ip_irdp_holdtime,
ip_irdp_holdtime_cmd,
- "ip irdp holdtime <0-9000>",
+ "ip irdp holdtime (0-9000)",
IP_STR
"ICMP Router discovery on this interface\n"
"Set holdtime value\n"
"Holdtime value in seconds. Default is 1800 seconds\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -451,18 +454,19 @@ DEFUN (ip_irdp_holdtime,
zi=ifp->info;
irdp=&zi->irdp;
- irdp->Lifetime = atoi(argv[0]);
+ irdp->Lifetime = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
DEFUN (ip_irdp_minadvertinterval,
ip_irdp_minadvertinterval_cmd,
- "ip irdp minadvertinterval <3-1800>",
+ "ip irdp minadvertinterval (3-1800)",
IP_STR
"ICMP Router discovery on this interface\n"
"Set minimum time between advertisement\n"
"Minimum advertisement interval in seconds\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -470,28 +474,29 @@ DEFUN (ip_irdp_minadvertinterval,
zi=ifp->info;
irdp=&zi->irdp;
- if( (unsigned) atoi(argv[0]) <= irdp->MaxAdvertInterval) {
- irdp->MinAdvertInterval = atoi(argv[0]);
+ if( (unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
+ irdp->MinAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
+ vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
VTY_NEWLINE);
- vty_out (vty, "Please correct!%s",
+ vty_out (vty, "Please correct!%s",
VTY_NEWLINE);
return CMD_WARNING;
}
DEFUN (ip_irdp_maxadvertinterval,
ip_irdp_maxadvertinterval_cmd,
- "ip irdp maxadvertinterval <4-1800>",
+ "ip irdp maxadvertinterval (4-1800)",
IP_STR
"ICMP Router discovery on this interface\n"
"Set maximum time between advertisement\n"
"Maximum advertisement interval in seconds\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -500,16 +505,16 @@ DEFUN (ip_irdp_maxadvertinterval,
irdp=&zi->irdp;
- if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]) ) {
- irdp->MaxAdvertInterval = atoi(argv[0]);
+ if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) {
+ irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
+ vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
VTY_NEWLINE);
- vty_out (vty, "Please correct!%s",
+ vty_out (vty, "Please correct!%s",
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -521,12 +526,13 @@ DEFUN (ip_irdp_maxadvertinterval,
DEFUN (ip_irdp_preference,
ip_irdp_preference_cmd,
- "ip irdp preference <0-2147483647>",
+ "ip irdp preference (0-2147483647)",
IP_STR
"ICMP Router discovery on this interface\n"
"Set default preference level for this interface\n"
"Preference level\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -534,22 +540,24 @@ DEFUN (ip_irdp_preference,
zi=ifp->info;
irdp=&zi->irdp;
- irdp->Preference = atoi(argv[0]);
+ irdp->Preference = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
DEFUN (ip_irdp_address_preference,
ip_irdp_address_preference_cmd,
- "ip irdp address A.B.C.D preference <0-2147483647>",
+ "ip irdp address A.B.C.D preference (0-2147483647)",
IP_STR
"Alter ICMP Router discovery preference this interface\n"
"Specify IRDP non-default preference to advertise\n"
"Set IRDP address for advertise\n"
"Preference level\n")
{
+ int idx_ipv4 = 3;
+ int idx_number = 5;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct listnode *node;
- struct in_addr ip;
+ struct in_addr ip;
int pref;
int ret;
struct zebra_if *zi;
@@ -559,13 +567,13 @@ DEFUN (ip_irdp_address_preference,
zi=ifp->info;
irdp=&zi->irdp;
- ret = inet_aton(argv[0], &ip);
+ ret = inet_aton(argv[idx_ipv4]->arg, &ip);
if(!ret) return CMD_WARNING;
- pref = atoi(argv[1]);
+ pref = atoi(argv[idx_number]->arg);
for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv))
- if(adv->ip.s_addr == ip.s_addr)
+ if(adv->ip.s_addr == ip.s_addr)
return CMD_SUCCESS;
adv = Adv_new();
@@ -579,7 +587,7 @@ DEFUN (ip_irdp_address_preference,
DEFUN (no_ip_irdp_address_preference,
no_ip_irdp_address_preference_cmd,
- "no ip irdp address A.B.C.D preference <0-2147483647>",
+ "no ip irdp address A.B.C.D preference (0-2147483647)",
NO_STR
IP_STR
"Alter ICMP Router discovery preference this interface\n"
@@ -587,9 +595,10 @@ DEFUN (no_ip_irdp_address_preference,
"Select IRDP address\n"
"Old preference level\n")
{
+ int idx_ipv4 = 4;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct listnode *node, *nnode;
- struct in_addr ip;
+ struct in_addr ip;
int ret;
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -598,8 +607,8 @@ DEFUN (no_ip_irdp_address_preference,
zi=ifp->info;
irdp=&zi->irdp;
- ret = inet_aton(argv[0], &ip);
- if (!ret)
+ ret = inet_aton(argv[idx_ipv4]->arg, &ip);
+ if (!ret)
return CMD_WARNING;
for (ALL_LIST_ELEMENTS (irdp->AdvPrefList, node, nnode, adv))
@@ -610,7 +619,7 @@ DEFUN (no_ip_irdp_address_preference,
break;
}
}
-
+
return CMD_SUCCESS;
}
diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c
index d02939882..a20597882 100644
--- a/zebra/kernel_null.c
+++ b/zebra/kernel_null.c
@@ -24,6 +24,7 @@
#include <zebra.h>
#include <log.h>
+#include "vty.h"
#include "zebra/zserv.h"
#include "zebra/rt.h"
#include "zebra/redistribute.h"
diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c
index 85d3bd2f1..4446627dd 100644
--- a/zebra/redistribute_null.c
+++ b/zebra/redistribute_null.c
@@ -20,6 +20,7 @@
*/
#include <zebra.h>
+#include "vty.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
diff --git a/zebra/router-id.c b/zebra/router-id.c
index d5d9652c5..23b8cc743 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -216,41 +216,42 @@ router_id_write (struct vty *vty)
DEFUN (router_id,
router_id_cmd,
- "router-id A.B.C.D",
+ "router-id A.B.C.D [vrf NAME]",
"Manually set the router-id\n"
- "IP address to use for router-id\n")
+ "IP address to use for router-id\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_ipv4 = 1;
+ int idx_name = 3;
+
struct prefix rid;
vrf_id_t vrf_id = VRF_DEFAULT;
- rid.u.prefix4.s_addr = inet_addr (argv[0]);
+ rid.u.prefix4.s_addr = inet_addr (argv[idx_ipv4]->arg);
if (!rid.u.prefix4.s_addr)
return CMD_WARNING;
rid.prefixlen = 32;
rid.family = AF_INET;
- if (argc > 1)
- VRF_GET_ID (vrf_id, argv[1]);
+ if (argc > 2)
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
router_id_set (&rid, vrf_id);
return CMD_SUCCESS;
}
-ALIAS (router_id,
- router_id_vrf_cmd,
- "router-id A.B.C.D " VRF_CMD_STR,
- "Manually set the router-id\n"
- "IP address to use for router-id\n"
- VRF_CMD_HELP_STR)
-
DEFUN (no_router_id,
no_router_id_cmd,
- "no router-id",
+ "no router-id [A.B.C.D [vrf NAME]]",
NO_STR
- "Remove the manually configured router-id\n")
+ "Remove the manually configured router-id\n"
+ "IP address to use for router-id\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_name = 4;
+
struct prefix rid;
vrf_id_t vrf_id = VRF_DEFAULT;
@@ -258,28 +259,15 @@ DEFUN (no_router_id,
rid.prefixlen = 0;
rid.family = AF_INET;
- if (argc > 1)
- VRF_GET_ID (vrf_id, argv[1]);
+ if (argc > 3)
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
router_id_set (&rid, vrf_id);
return CMD_SUCCESS;
}
-ALIAS (no_router_id,
- no_router_id_val_cmd,
- "no router-id A.B.C.D",
- NO_STR
- "Remove the manually configured router-id\n"
- "IP address to use for router-id\n")
-ALIAS (no_router_id,
- no_router_id_vrf_cmd,
- "no router-id A.B.C.D " VRF_CMD_STR,
- NO_STR
- "Remove the manually configured router-id\n"
- "IP address to use for router-id\n"
- VRF_CMD_HELP_STR)
static int
router_id_cmp (void *a, void *b)
@@ -295,9 +283,6 @@ router_id_cmd_init (void)
{
install_element (CONFIG_NODE, &router_id_cmd);
install_element (CONFIG_NODE, &no_router_id_cmd);
- install_element (CONFIG_NODE, &router_id_vrf_cmd);
- install_element (CONFIG_NODE, &no_router_id_val_cmd);
- install_element (CONFIG_NODE, &no_router_id_vrf_cmd);
}
void
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index f16fd55c9..90d71e635 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -16,7 +16,7 @@
* 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.
+ * 02111-1307, USA.
*/
#include <zebra.h>
@@ -40,6 +40,7 @@
#include "privs.h"
#include "nexthop.h"
#include "vrf.h"
+#include "vty.h"
#include "mpls.h"
#include "zebra/zserv.h"
@@ -313,7 +314,6 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
u_char zebra_flags = 0;
struct prefix p;
vrf_id_t vrf_id = VRF_DEFAULT;
-
char anyaddr[16] = { 0 };
int index;
@@ -693,7 +693,7 @@ _netlink_route_build_singlepath(
int i, num_labels = 0;
u_int32_t bos;
char label_buf1[20];
-
+
for (i = 0; i < nh_label->num_labels; i++)
{
if (nh_label->label[i] != MPLS_IMP_NULL_LABEL)
@@ -1072,7 +1072,7 @@ _netlink_route_debug(
prefix2str (p, buf, sizeof(buf)), zvrf->vrf_id,
(nexthop) ? nexthop_type_to_str (nexthop->type) : "UNK");
}
-}
+ }
static void
_netlink_mpls_debug(
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 3e0a19870..dcf31ff45 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -1,4 +1,5 @@
/* Router advertisement
+ * Copyright (C) 2016 Cumulus Networks
* Copyright (C) 2005 6WIND <jean-mickael.guerin@6wind.com>
* Copyright (C) 1999 Kunihiro Ishiguro
*
@@ -911,12 +912,13 @@ DEFUN (no_ipv6_nd_suppress_ra,
DEFUN (ipv6_nd_ra_interval_msec,
ipv6_nd_ra_interval_msec_cmd,
- "ipv6 nd ra-interval msec <70-1800000>",
+ "ipv6 nd ra-interval msec (70-1800000)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router Advertisement interval\n"
"Router Advertisement interval in milliseconds\n")
{
+ int idx_number = 4;
VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned interval;
struct zebra_if *zif = ifp->info;
@@ -924,7 +926,7 @@ DEFUN (ipv6_nd_ra_interval_msec,
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 70, 1800000);
+ VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 70, 1800000);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000))
{
vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
@@ -946,12 +948,13 @@ DEFUN (ipv6_nd_ra_interval_msec,
DEFUN (ipv6_nd_ra_interval,
ipv6_nd_ra_interval_cmd,
- "ipv6 nd ra-interval <1-1800>",
+ "ipv6 nd ra-interval (1-1800)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router Advertisement interval\n"
"Router Advertisement interval in seconds\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned interval;
struct zebra_if *zif = ifp->info;
@@ -959,7 +962,7 @@ DEFUN (ipv6_nd_ra_interval,
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 1, 1800);
+ VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 1, 1800);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime))
{
vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
@@ -981,11 +984,14 @@ DEFUN (ipv6_nd_ra_interval,
DEFUN (no_ipv6_nd_ra_interval,
no_ipv6_nd_ra_interval_cmd,
- "no ipv6 nd ra-interval",
+ "no ipv6 nd ra-interval [<(1-1800)|msec (1-1800000)>]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Router Advertisement interval\n")
+ "Router Advertisement interval\n"
+ "Router Advertisement interval in seconds\n"
+ "Specify millisecond router advertisement interval\n"
+ "Router Advertisement interval in milliseconds\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1005,36 +1011,20 @@ DEFUN (no_ipv6_nd_ra_interval,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_ra_interval,
- no_ipv6_nd_ra_interval_val_cmd,
- "no ipv6 nd ra-interval <1-1800>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Router Advertisement interval\n")
-
-ALIAS (no_ipv6_nd_ra_interval,
- no_ipv6_nd_ra_interval_msec_val_cmd,
- "no ipv6 nd ra-interval msec <1-1800000>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Router Advertisement interval\n"
- "Router Advertisement interval in milliseconds\n")
-
DEFUN (ipv6_nd_ra_lifetime,
ipv6_nd_ra_lifetime_cmd,
- "ipv6 nd ra-lifetime <0-9000>",
+ "ipv6 nd ra-lifetime (0-9000)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router lifetime\n"
"Router lifetime in seconds (0 stands for a non-default gw)\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
int lifetime;
- VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000);
+ VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[idx_number]->arg, 0, 9000);
/* The value to be placed in the Router Lifetime field
* of Router Advertisements sent from the interface,
@@ -1053,11 +1043,12 @@ DEFUN (ipv6_nd_ra_lifetime,
DEFUN (no_ipv6_nd_ra_lifetime,
no_ipv6_nd_ra_lifetime_cmd,
- "no ipv6 nd ra-lifetime",
+ "no ipv6 nd ra-lifetime [(0-9000)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Router lifetime\n")
+ "Router lifetime\n"
+ "Router lifetime in seconds (0 stands for a non-default gw)\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1067,36 +1058,29 @@ DEFUN (no_ipv6_nd_ra_lifetime,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_ra_lifetime,
- no_ipv6_nd_ra_lifetime_val_cmd,
- "no ipv6 nd ra-lifetime <0-9000>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Router lifetime\n"
- "Router lifetime in seconds (0 stands for a non-default gw)\n")
-
DEFUN (ipv6_nd_reachable_time,
ipv6_nd_reachable_time_cmd,
- "ipv6 nd reachable-time <1-3600000>",
+ "ipv6 nd reachable-time (1-3600000)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Reachable time\n"
"Reachable time in milliseconds\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME);
+ VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[idx_number]->arg, 1, RTADV_MAX_REACHABLE_TIME);
return CMD_SUCCESS;
}
DEFUN (no_ipv6_nd_reachable_time,
no_ipv6_nd_reachable_time_cmd,
- "no ipv6 nd reachable-time",
+ "no ipv6 nd reachable-time [(1-3600000)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Reachable time\n")
+ "Reachable time\n"
+ "Reachable time in milliseconds\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1106,36 +1090,29 @@ DEFUN (no_ipv6_nd_reachable_time,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_reachable_time,
- no_ipv6_nd_reachable_time_val_cmd,
- "no ipv6 nd reachable-time <1-3600000>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Reachable time\n"
- "Reachable time in milliseconds\n")
-
DEFUN (ipv6_nd_homeagent_preference,
ipv6_nd_homeagent_preference_cmd,
- "ipv6 nd home-agent-preference <0-65535>",
+ "ipv6 nd home-agent-preference (0-65535)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Home Agent preference\n"
"preference value (default is 0, least preferred)\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535);
+ VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[idx_number]->arg, 0, 65535);
return CMD_SUCCESS;
}
DEFUN (no_ipv6_nd_homeagent_preference,
no_ipv6_nd_homeagent_preference_cmd,
- "no ipv6 nd home-agent-preference",
+ "no ipv6 nd home-agent-preference [(0-65535)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Home Agent preference\n")
+ "Home Agent preference\n"
+ "preference value (default is 0, least preferred)\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1145,36 +1122,29 @@ DEFUN (no_ipv6_nd_homeagent_preference,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_homeagent_preference,
- no_ipv6_nd_homeagent_preference_val_cmd,
- "no ipv6 nd home-agent-preference <0-65535>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Home Agent preference\n"
- "preference value (default is 0, least preferred)\n")
-
DEFUN (ipv6_nd_homeagent_lifetime,
ipv6_nd_homeagent_lifetime_cmd,
- "ipv6 nd home-agent-lifetime <0-65520>",
+ "ipv6 nd home-agent-lifetime (0-65520)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Home Agent lifetime\n"
"Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME);
+ VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[idx_number]->arg, 0, RTADV_MAX_HALIFETIME);
return CMD_SUCCESS;
}
DEFUN (no_ipv6_nd_homeagent_lifetime,
no_ipv6_nd_homeagent_lifetime_cmd,
- "no ipv6 nd home-agent-lifetime",
+ "no ipv6 nd home-agent-lifetime [(0-65520)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Home Agent lifetime\n")
+ "Home Agent lifetime\n"
+ "Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1184,15 +1154,6 @@ DEFUN (no_ipv6_nd_homeagent_lifetime,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_homeagent_lifetime,
- no_ipv6_nd_homeagent_lifetime_val_cmd,
- "no ipv6 nd home-agent-lifetime <0-65520>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Home Agent lifetime\n"
- "Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
-
DEFUN (ipv6_nd_managed_config_flag,
ipv6_nd_managed_config_flag_cmd,
"ipv6 nd managed-config-flag",
@@ -1319,8 +1280,7 @@ DEFUN (no_ipv6_nd_other_config_flag,
DEFUN (ipv6_nd_prefix,
ipv6_nd_prefix_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)",
+ "ipv6 nd prefix X:X::X:X/M [<(0-4294967295)|infinite> <(0-4294967295)|infinite>] [<router-address|off-link [no-autoconfig]|no-autoconfig [off-link]>]",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
@@ -1329,77 +1289,75 @@ DEFUN (ipv6_nd_prefix,
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n"
+ "Set Router Address flag\n"
"Do not use prefix for onlink determination\n"
"Do not use prefix for autoconfiguration\n"
- "Set Router Address flag\n")
+ "Do not use prefix for autoconfiguration\n"
+ "Do not use prefix for onlink determination\n")
{
+ /* prelude */
+ char *prefix = argv[3]->arg;
+ int lifetimes = (argc > 4) && (argv[4]->type == RANGE_TKN || strmatch (argv[4]->text, "infinite"));
+ int routeropts = lifetimes ? argc > 6 : argc > 4;
+
+ int idx_routeropts = routeropts ? (lifetimes ? 6 : 4) : 0;
+
+ char *lifetime = NULL, *preflifetime = NULL;
+ int routeraddr = 0, offlink = 0, noautoconf = 0;
+ if (lifetimes)
+ {
+ lifetime = argv[4]->type == RANGE_TKN ? argv[4]->arg : argv[4]->text;
+ preflifetime = argv[5]->type == RANGE_TKN ? argv[5]->arg : argv[5]->text;
+ }
+ if (routeropts)
+ {
+ routeraddr = strmatch (argv[idx_routeropts]->text, "router-address");
+ if (!routeraddr)
+ {
+ offlink = (argc > idx_routeropts + 1 || strmatch (argv[idx_routeropts]->text, "off-link"));
+ noautoconf = (argc > idx_routeropts + 1 || strmatch (argv[idx_routeropts]->text, "no-autoconfig"));
+ }
+ }
+
+ /* business */
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zebra_if = ifp->info;
- int i;
int ret;
- int cursor = 1;
struct rtadv_prefix rp;
- ret = str2prefix_ipv6 (argv[0], &rp.prefix);
+ ret = str2prefix_ipv6 (prefix, &rp.prefix);
if (!ret)
{
vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */
- rp.AdvOnLinkFlag = 1;
- rp.AdvAutonomousFlag = 1;
- rp.AdvRouterAddressFlag = 0;
+ rp.AdvOnLinkFlag = !offlink;
+ rp.AdvAutonomousFlag = !noautoconf;
+ rp.AdvRouterAddressFlag = routeraddr;
rp.AdvValidLifetime = RTADV_VALID_LIFETIME;
rp.AdvPreferredLifetime = RTADV_PREFERRED_LIFETIME;
- if (argc > 1)
- {
- if ((isdigit((unsigned char)argv[1][0]))
- || strncmp (argv[1], "i", 1) == 0)
- {
- if ( strncmp (argv[1], "i", 1) == 0)
- rp.AdvValidLifetime = UINT32_MAX;
- else
- rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1],
- (char **)NULL, 10);
-
- if ( strncmp (argv[2], "i", 1) == 0)
- rp.AdvPreferredLifetime = UINT32_MAX;
- else
- rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2],
- (char **)NULL, 10);
-
- if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
- {
- vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- cursor = cursor + 2;
- }
- if (argc > cursor)
- {
- for (i = cursor; i < argc; i++)
- {
- if (strncmp (argv[i], "of", 2) == 0)
- rp.AdvOnLinkFlag = 0;
- if (strncmp (argv[i], "no", 2) == 0)
- rp.AdvAutonomousFlag = 0;
- if (strncmp (argv[i], "ro", 2) == 0)
- rp.AdvRouterAddressFlag = 1;
- }
- }
- }
+ if (lifetimes)
+ {
+ rp.AdvValidLifetime = strmatch (lifetime, "infinite") ? UINT32_MAX : strtoll (lifetime, NULL, 10);
+ rp.AdvPreferredLifetime = strmatch (preflifetime, "infinite") ? UINT32_MAX : strtoll (preflifetime, NULL, 10);
+ if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
+ {
+ vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
rtadv_prefix_set (zebra_if, &rp);
return CMD_SUCCESS;
}
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_nortaddr_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|)",
+DEFUN (no_ipv6_nd_prefix,
+ no_ipv6_nd_prefix_cmd,
+ "no ipv6 nd prefix X:X::X:X/M [<(0-4294967295)|infinite> <(0-4294967295)|infinite>] [<router-address|off-link [no-autoconfig]|no-autoconfig [off-link]>]",
+ NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
@@ -1408,165 +1366,19 @@ ALIAS (ipv6_nd_prefix,
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n"
+ "Set Router Address flag\n"
"Do not use prefix for onlink determination\n"
- "Do not use prefix for autoconfiguration\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_rev_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
"Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_rev_rtaddr_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
"Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n"
- "Set Router Address flag\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_noauto_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (no-autoconfig|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for autoconfiguration")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_offlink_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (off-link|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
"Do not use prefix for onlink determination\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_rtaddr_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite) (router-address|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Set Router Address flag\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_val_cmd,
- "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
- "(<0-4294967295>|infinite)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_noval_cmd,
- "ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_noval_rev_cmd,
- "ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for onlink determination\n"
- "Do not use prefix for autoconfiguration\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_noval_noauto_cmd,
- "ipv6 nd prefix X:X::X:X/M (no-autoconfig|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for autoconfiguration\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_noval_offlink_cmd,
- "ipv6 nd prefix X:X::X:X/M (off-link|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_noval_rtaddr_cmd,
- "ipv6 nd prefix X:X::X:X/M (router-address|)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Set Router Address flag\n")
-
-ALIAS (ipv6_nd_prefix,
- ipv6_nd_prefix_prefix_cmd,
- "ipv6 nd prefix X:X::X:X/M",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n")
-
-DEFUN (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_cmd,
- "no ipv6 nd prefix IPV6PREFIX",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zebra_if = ifp->info;
int ret;
struct rtadv_prefix rp;
+ char *prefix = argv[4]->arg;
- ret = str2prefix_ipv6 (argv[0], &rp.prefix);
+ ret = str2prefix_ipv6 (prefix, &rp.prefix);
if (!ret)
{
vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
@@ -1577,170 +1389,16 @@ DEFUN (no_ipv6_nd_prefix,
ret = rtadv_prefix_reset (zebra_if, &rp);
if (!ret)
{
- vty_out (vty, "Non-exist IPv6 prefix%s", VTY_NEWLINE);
+ vty_out (vty, "Non-existant IPv6 prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_nortaddr_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for onlink determination\n"
- "Do not use prefix for autoconfiguration\n"
- "Set Router Address flag\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_rev_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_rev_rtaddr_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n"
- "Set Router Address flag\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_noauto_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for autoconfiguration")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_offlink_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_rtaddr_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (router-address|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n"
- "Set Router Address flag\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_val_cmd,
- "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Valid lifetime in seconds\n"
- "Infinite valid lifetime\n"
- "Preferred lifetime in seconds\n"
- "Infinite preferred lifetime\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_noval_cmd,
- "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for autoconfiguration\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_noval_rev_cmd,
- "no ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for onlink determination\n"
- "Do not use prefix for autoconfiguration\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_noval_noauto_cmd,
- "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for autoconfiguration\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_noval_offlink_cmd,
- "no ipv6 nd prefix X:X::X:X/M (off-link|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Do not use prefix for onlink determination\n")
-
-ALIAS (no_ipv6_nd_prefix,
- no_ipv6_nd_prefix_noval_rtaddr_cmd,
- "no ipv6 nd prefix X:X::X:X/M (router-address|)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Prefix information\n"
- "IPv6 prefix\n"
- "Set Router Address flag\n")
-
DEFUN (ipv6_nd_router_preference,
ipv6_nd_router_preference_cmd,
- "ipv6 nd router-preference (high|medium|low)",
+ "ipv6 nd router-preference <high|medium|low>",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Default router preference\n"
@@ -1748,13 +1406,14 @@ DEFUN (ipv6_nd_router_preference,
"Low default router preference\n"
"Medium default router preference (default)\n")
{
+ int idx_high_medium_low = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
int i = 0;
while (0 != rtadv_pref_strs[i])
{
- if (strncmp (argv[0], rtadv_pref_strs[i], 1) == 0)
+ if (strncmp (argv[idx_high_medium_low]->arg, rtadv_pref_strs[i], 1) == 0)
{
zif->rtadv.DefaultPreference = i;
return CMD_SUCCESS;
@@ -1767,11 +1426,14 @@ DEFUN (ipv6_nd_router_preference,
DEFUN (no_ipv6_nd_router_preference,
no_ipv6_nd_router_preference_cmd,
- "no ipv6 nd router-preference",
+ "no ipv6 nd router-preference [<high|medium|low>]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Default router preference\n")
+ "Default router preference\n"
+ "High default router preference\n"
+ "Medium default router preference (default)\n"
+ "Low default router preference\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1781,38 +1443,29 @@ DEFUN (no_ipv6_nd_router_preference,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_router_preference,
- no_ipv6_nd_router_preference_val_cmd,
- "no ipv6 nd router-preference (high|medium|low)",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Default router preference\n"
- "High default router preference\n"
- "Low default router preference\n"
- "Medium default router preference (default)\n")
-
DEFUN (ipv6_nd_mtu,
ipv6_nd_mtu_cmd,
- "ipv6 nd mtu <1-65535>",
+ "ipv6 nd mtu (1-65535)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Advertised MTU\n"
"MTU in bytes\n")
{
+ int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535);
+ VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[idx_number]->arg, 1, 65535);
return CMD_SUCCESS;
}
DEFUN (no_ipv6_nd_mtu,
no_ipv6_nd_mtu_cmd,
- "no ipv6 nd mtu",
+ "no ipv6 nd mtu [(1-65535)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
- "Advertised MTU\n")
+ "Advertised MTU\n"
+ "MTU in bytes\n")
{
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
@@ -1820,14 +1473,6 @@ DEFUN (no_ipv6_nd_mtu,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_nd_mtu,
- no_ipv6_nd_mtu_val_cmd,
- "no ipv6 nd mtu <1-65535>",
- NO_STR
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Advertised MTU\n"
- "MTU in bytes\n")
/* Write configuration about router advertisement. */
void
@@ -1994,14 +1639,10 @@ rtadv_cmd_init (void)
install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_msec_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_val_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_msec_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_reachable_time_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd);
@@ -2010,45 +1651,16 @@ rtadv_cmd_init (void)
install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_config_flag_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_homeagent_preference_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_adv_interval_config_option_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_adv_interval_config_option_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rev_rtaddr_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_nortaddr_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rev_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_noauto_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_offlink_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rtaddr_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_rev_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_noauto_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_offlink_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_rtaddr_cmd);
- install_element (INTERFACE_NODE, &ipv6_nd_prefix_prefix_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rev_rtaddr_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_nortaddr_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rev_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_noauto_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_offlink_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rtaddr_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_rev_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_noauto_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_offlink_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_rtaddr_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_router_preference_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_mtu_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_val_cmd);
}
static int
diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c
index c27e6e97f..1d41861bb 100644
--- a/zebra/rtread_netlink.c
+++ b/zebra/rtread_netlink.c
@@ -22,6 +22,7 @@
#include <zebra.h>
+#include "vty.h"
#include "zebra/zserv.h"
#include "zebra/rt_netlink.h"
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 828b61af9..282932854 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -119,15 +119,14 @@ static ifindex_t test_ifindex = 0;
/* testrib commands */
DEFUN (test_interface_state,
test_interface_state_cmd,
- "state (up|down)",
+ "state <up|down>",
"configure interface\n"
"up\n"
"down\n")
{
+ int idx_up_down = 1;
VTY_DECLVAR_CONTEXT (interface, ifp);
- if (argc < 1)
- return CMD_WARNING;
-
+
if (ifp->ifindex == IFINDEX_INTERNAL)
{
ifp->ifindex = ++test_ifindex;
@@ -135,7 +134,7 @@ DEFUN (test_interface_state,
ifp->flags = IFF_BROADCAST|IFF_MULTICAST;
}
- switch (argv[0][0])
+ switch (argv[idx_up_down]->arg[0])
{
case 'u':
SET_FLAG (ifp->flags, IFF_UP);
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 343ce1776..7e8b8682d 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1569,9 +1569,9 @@ DEFUN (clear_zebra_fpm_stats,
/*
* update fpm connection information
*/
-DEFUN ( fpm_remote_ip,
- fpm_remote_ip_cmd,
- "fpm connection ip A.B.C.D port <1-65535>",
+DEFUN ( fpm_remote_ip,
+ fpm_remote_ip_cmd,
+ "fpm connection ip A.B.C.D port (1-65535)",
"fpm connection remote ip and port\n"
"Remote fpm server ip A.B.C.D\n"
"Enter ip ")
@@ -1580,11 +1580,11 @@ DEFUN ( fpm_remote_ip,
in_addr_t fpm_server;
uint32_t port_no;
- fpm_server = inet_addr (argv[0]);
+ fpm_server = inet_addr (argv[3]->arg);
if (fpm_server == INADDR_NONE)
return CMD_ERR_INCOMPLETE;
- port_no = atoi (argv[1]);
+ port_no = atoi (argv[5]->arg);
if (port_no < TCP_MIN_PORT || port_no > TCP_MAX_PORT)
return CMD_ERR_INCOMPLETE;
@@ -1595,16 +1595,16 @@ DEFUN ( fpm_remote_ip,
return CMD_SUCCESS;
}
-DEFUN ( no_fpm_remote_ip,
- no_fpm_remote_ip_cmd,
- "no fpm connection ip A.B.C.D port <1-65535>",
+DEFUN ( no_fpm_remote_ip,
+ no_fpm_remote_ip_cmd,
+ "no fpm connection ip A.B.C.D port (1-65535)",
"fpm connection remote ip and port\n"
"Connection\n"
"Remote fpm server ip A.B.C.D\n"
"Enter ip ")
{
- if (zfpm_g->fpm_server != inet_addr (argv[0]) ||
- zfpm_g->fpm_port != atoi (argv[1]))
+ if (zfpm_g->fpm_server != inet_addr (argv[4]->arg) ||
+ zfpm_g->fpm_port != atoi (argv[6]->arg))
return CMD_ERR_NO_MATCH;
zfpm_g->fpm_server = FPM_DEFAULT_IP;
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 654329860..f2cba1094 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -27,6 +27,7 @@
#include "log.h"
#include "rib.h"
+#include "vty.h"
#include "zebra/zserv.h"
#include "zebra/zebra_ns.h"
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index 8b967c3af..ff84c5943 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -159,7 +159,7 @@ zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
DEFUN (mpls_transit_lsp,
mpls_transit_lsp_cmd,
- "mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|explicit-null|implicit-null)",
+ "mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n"
@@ -169,12 +169,12 @@ DEFUN (mpls_transit_lsp,
"Use Explicit-Null label\n"
"Use Implicit-Null label\n")
{
- return zebra_mpls_transit_lsp (vty, 1, argv[0], argv[1], argv[2], NULL);
+ return zebra_mpls_transit_lsp (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL);
}
DEFUN (no_mpls_transit_lsp,
no_mpls_transit_lsp_cmd,
- "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X)",
+ "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X>",
NO_STR
MPLS_STR
"Establish label switched path\n"
@@ -182,12 +182,12 @@ DEFUN (no_mpls_transit_lsp,
"IPv4 gateway address\n"
"IPv6 gateway address\n")
{
- return zebra_mpls_transit_lsp (vty, 0, argv[0], argv[1], NULL, NULL);
+ return zebra_mpls_transit_lsp (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL);
}
ALIAS (no_mpls_transit_lsp,
no_mpls_transit_lsp_out_label_cmd,
- "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|explicit-null|implicit-null)",
+ "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
NO_STR
MPLS_STR
"Establish label switched path\n"
@@ -200,19 +200,19 @@ ALIAS (no_mpls_transit_lsp,
DEFUN (no_mpls_transit_lsp_all,
no_mpls_transit_lsp_all_cmd,
- "no mpls lsp <16-1048575>",
+ "no mpls lsp (16-1048575)",
NO_STR
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n")
{
- return zebra_mpls_transit_lsp (vty, 0, argv[0], NULL, NULL, NULL);
+ return zebra_mpls_transit_lsp (vty, 0, argv[3]->arg, NULL, NULL, NULL);
}
/* Static route configuration. */
DEFUN (ip_route_label,
ip_route_label_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -222,13 +222,13 @@ DEFUN (ip_route_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
- NULL, NULL, argv[2]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL,
+ NULL, NULL, argv[5]->arg);
}
DEFUN (ip_route_tag_label,
ip_route_tag_label_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> label WORD",
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -240,14 +240,14 @@ DEFUN (ip_route_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
- NULL, NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg,
+ NULL, NULL, argv[7]->arg);
}
/* Mask as A.B.C.D format. */
DEFUN (ip_route_mask_label,
ip_route_mask_label_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -258,13 +258,13 @@ DEFUN (ip_route_mask_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
- NULL, NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL,
+ NULL, NULL, argv[6]->arg);
}
DEFUN (ip_route_mask_tag_label,
ip_route_mask_tag_label_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> label WORD",
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -278,14 +278,14 @@ DEFUN (ip_route_mask_tag_label,
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
- NULL, NULL, argv[4]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg,
+ NULL, NULL, argv[8]->arg);
}
/* Distance option value. */
DEFUN (ip_route_distance_label,
ip_route_distance_label_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -296,13 +296,13 @@ DEFUN (ip_route_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
- argv[2], NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL,
+ argv[4]->arg, NULL, argv[6]->arg);
}
DEFUN (ip_route_tag_distance_label,
ip_route_tag_distance_label_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> label WORD",
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -316,13 +316,13 @@ DEFUN (ip_route_tag_distance_label,
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
- argv[3], NULL, argv[4]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg,
+ argv[6]->arg, NULL, argv[8]->arg);
}
DEFUN (ip_route_mask_distance_label,
ip_route_mask_distance_label_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -334,13 +334,13 @@ DEFUN (ip_route_mask_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
- argv[3], NULL, argv[4]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL,
+ argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (ip_route_mask_tag_distance_label,
ip_route_mask_tag_distance_label_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> label WORD",
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -354,13 +354,13 @@ DEFUN (ip_route_mask_tag_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
- argv[4], NULL, argv[5]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg,
+ argv[7]->arg, NULL, argv[9]->arg);
}
DEFUN (no_ip_route_label,
no_ip_route_label_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -371,13 +371,13 @@ DEFUN (no_ip_route_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
- NULL, NULL, argv[2]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL,
+ NULL, NULL, argv[6]->arg);
}
DEFUN (no_ip_route_tag_label,
no_ip_route_tag_label_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> label WORD",
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -390,13 +390,13 @@ DEFUN (no_ip_route_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
- NULL, NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg,
+ NULL, NULL, argv[8]->arg);
}
DEFUN (no_ip_route_mask_label,
no_ip_route_mask_label_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -408,13 +408,13 @@ DEFUN (no_ip_route_mask_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
- NULL, NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL,
+ NULL, NULL, argv[7]->arg);
}
DEFUN (no_ip_route_mask_tag_label,
no_ip_route_mask_tag_label_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> label WORD",
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -428,13 +428,13 @@ DEFUN (no_ip_route_mask_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
- NULL, NULL, argv[4]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg,
+ NULL, NULL, argv[9]->arg);
}
DEFUN (no_ip_route_distance_label,
no_ip_route_distance_label_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -446,13 +446,13 @@ DEFUN (no_ip_route_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
- argv[2], NULL, argv[3]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL,
+ argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (no_ip_route_tag_distance_label,
no_ip_route_tag_distance_label_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> label WORD",
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -466,13 +466,13 @@ DEFUN (no_ip_route_tag_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
- argv[3], NULL, argv[4]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg,
+ argv[7]->arg, NULL, argv[9]->arg);
}
DEFUN (no_ip_route_mask_distance_label,
no_ip_route_mask_distance_label_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255)",
NO_STR
IP_STR
"Establish static routes\n"
@@ -485,13 +485,13 @@ DEFUN (no_ip_route_mask_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
- argv[3], NULL, argv[5]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL,
+ argv[6]->arg, NULL, NULL);
}
DEFUN (no_ip_route_mask_tag_distance_label,
no_ip_route_mask_tag_distance_label_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> label WORD",
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -506,13 +506,13 @@ DEFUN (no_ip_route_mask_tag_distance_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
- argv[4], NULL, argv[5]);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg,
+ argv[8]->arg, NULL, argv[10]->arg);
}
DEFUN (ipv6_route_label,
ipv6_route_label_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -521,12 +521,12 @@ DEFUN (ipv6_route_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, NULL, argv[5]->arg);
}
DEFUN (ipv6_route_tag_label,
ipv6_route_tag_label_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> label WORD",
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -537,7 +537,7 @@ DEFUN (ipv6_route_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, NULL, argv[7]->arg);
}
DEFUN (ipv6_route_ifname_label,
@@ -551,11 +551,11 @@ DEFUN (ipv6_route_ifname_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, argv[6]->arg);
}
DEFUN (ipv6_route_ifname_tag_label,
ipv6_route_ifname_tag_label_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> label WORD",
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -566,12 +566,12 @@ DEFUN (ipv6_route_ifname_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, NULL, argv[8]->arg);
}
DEFUN (ipv6_route_pref_label,
ipv6_route_pref_label_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -581,12 +581,12 @@ DEFUN (ipv6_route_pref_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, NULL, argv[6]->arg);
}
DEFUN (ipv6_route_pref_tag_label,
ipv6_route_pref_tag_label_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255> label WORD",
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -598,12 +598,12 @@ DEFUN (ipv6_route_pref_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, NULL, argv[8]->arg);
}
DEFUN (ipv6_route_ifname_pref_label,
ipv6_route_ifname_pref_label_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -613,12 +613,12 @@ DEFUN (ipv6_route_ifname_pref_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (ipv6_route_ifname_pref_tag_label,
ipv6_route_ifname_pref_tag_label_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255> label WORD",
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -630,12 +630,12 @@ DEFUN (ipv6_route_ifname_pref_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+ return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, NULL, argv[9]->arg);
}
DEFUN (no_ipv6_route_label,
no_ipv6_route_label_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -645,12 +645,12 @@ DEFUN (no_ipv6_route_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, NULL, argv[6]->arg);
}
DEFUN (no_ipv6_route_tag_label,
no_ipv6_route_tag_label_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> label WORD",
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -662,7 +662,7 @@ DEFUN (no_ipv6_route_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, NULL, argv[8]->arg);
}
DEFUN (no_ipv6_route_ifname_label,
@@ -677,12 +677,12 @@ DEFUN (no_ipv6_route_ifname_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, NULL, argv[7]->arg);
}
DEFUN (no_ipv6_route_ifname_tag_label,
no_ipv6_route_ifname_tag_label_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> label WORD",
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -694,12 +694,12 @@ DEFUN (no_ipv6_route_ifname_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, NULL, argv[9]->arg);
}
DEFUN (no_ipv6_route_pref_label,
no_ipv6_route_pref_label_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -710,12 +710,12 @@ DEFUN (no_ipv6_route_pref_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (no_ipv6_route_pref_tag_label,
no_ipv6_route_pref_tag_label_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255> label WORD",
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -728,12 +728,12 @@ DEFUN (no_ipv6_route_pref_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, NULL, argv[9]->arg);
}
DEFUN (no_ipv6_route_ifname_pref_label,
no_ipv6_route_ifname_pref_label_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -744,12 +744,12 @@ DEFUN (no_ipv6_route_ifname_pref_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, NULL, argv[8]->arg);
}
DEFUN (no_ipv6_route_ifname_pref_tag_label,
no_ipv6_route_ifname_pref_tag_label_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255> label WORD",
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
@@ -762,7 +762,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_label,
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+ return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, NULL, argv[10]->arg);
}
/* MPLS LSP configuration write function. */
@@ -782,14 +782,14 @@ zebra_mpls_config (struct vty *vty)
DEFUN (show_mpls_table,
show_mpls_table_cmd,
- "show mpls table {json}",
+ "show mpls table [json]",
SHOW_STR
MPLS_STR
"MPLS table\n"
"JavaScript Object Notation\n")
{
struct zebra_vrf *zvrf;
- u_char use_json = (argv[0] != NULL);
+ u_char use_json = (argv[3]->arg != NULL);
zvrf = vrf_info_lookup(VRF_DEFAULT);
zebra_mpls_print_lsp_table(vty, zvrf, use_json);
@@ -798,7 +798,7 @@ DEFUN (show_mpls_table,
DEFUN (show_mpls_table_lsp,
show_mpls_table_lsp_cmd,
- "show mpls table <16-1048575> {json}",
+ "show mpls table (16-1048575) [json]",
SHOW_STR
MPLS_STR
"MPLS table\n"
@@ -807,10 +807,10 @@ DEFUN (show_mpls_table_lsp,
{
u_int32_t label;
struct zebra_vrf *zvrf;
- u_char use_json = (argv[1] != NULL);
+ u_char use_json = (argv[4]->arg != NULL);
zvrf = vrf_info_lookup(VRF_DEFAULT);
- label = atoi(argv[0]);
+ label = atoi(argv[3]->arg);
zebra_mpls_print_lsp (vty, zvrf, label, use_json);
return CMD_SUCCESS;
}
diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c
index eecb8519d..a5e6b3562 100644
--- a/zebra/zebra_rnh_null.c
+++ b/zebra/zebra_rnh_null.c
@@ -19,6 +19,7 @@
* 02111-1307, USA.
*/
#include <zebra.h>
+#include "vty.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
#include "zebra/zebra_rnh.h"
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 25091a3ea..28f09fea0 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -25,6 +25,7 @@
#include "zebra_memory.h"
#include "prefix.h"
#include "rib.h"
+#include "vty.h"
#include "routemap.h"
#include "command.h"
#include "filter.h"
@@ -56,6 +57,8 @@ struct nh_rmap_obj
static void zebra_route_map_set_delay_timer(u_int32_t value);
+
+
/* Add zebra route map rule */
static int
zebra_route_match_add(struct vty *vty,
@@ -138,54 +141,6 @@ zebra_route_match_delete (struct vty *vty,
return CMD_SUCCESS;
}
-/* Add zebra route map rule. */
-static int
-zebra_route_set_add (struct vty *vty,
- const char *command, const char *arg)
-{
- VTY_DECLVAR_CONTEXT (route_map_index, index);
- int ret;
-
- ret = route_map_add_set (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return CMD_SUCCESS;
-}
-
-/* Delete zebra route map rule. */
-static int
-zebra_route_set_delete (struct vty *vty,
- const char *command, const char *arg)
-{
- VTY_DECLVAR_CONTEXT (route_map_index, index);
- int ret;
-
- ret = route_map_delete_set (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return CMD_SUCCESS;
-}
-
/* 'match tag TAG'
* Match function return 1 if match is success else return 0
*/
@@ -210,8 +165,8 @@ route_match_tag (void *rule, struct prefix *prefix,
/* Route map commands for tag matching */
static struct route_map_rule_cmd route_match_tag_cmd =
{
- "tag",
- route_match_tag,
+ "tag",
+ route_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free,
};
@@ -266,240 +221,9 @@ struct route_map_rule_cmd route_match_interface_cmd =
route_match_interface_free
};
-DEFUN (match_interface,
- match_interface_cmd,
- "match interface WORD",
- MATCH_STR
- "match first hop interface of route\n"
- "Interface name\n")
-{
- return zebra_route_match_add (vty, "interface", argv[0],
- RMAP_EVENT_MATCH_ADDED);
-}
-
-DEFUN (no_match_interface,
- no_match_interface_cmd,
- "no match interface",
- NO_STR
- MATCH_STR
- "Match first hop interface of route\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty, "interface", NULL, RMAP_EVENT_MATCH_DELETED);
-
- return zebra_route_match_delete (vty, "interface", argv[0], RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_interface,
- no_match_interface_val_cmd,
- "no match interface WORD",
- NO_STR
- MATCH_STR
- "Match first hop interface of route\n"
- "Interface name\n")
-
-DEFUN (match_tag,
- match_tag_cmd,
- "match tag <1-4294967295>",
- MATCH_STR
- "Match tag of route\n"
- "Tag value\n")
-{
- return zebra_route_match_add (vty, "tag", argv[0],
- RMAP_EVENT_MATCH_ADDED);
-}
-
-DEFUN (no_match_tag,
- no_match_tag_cmd,
- "no match tag",
- NO_STR
- MATCH_STR
- "Match tag of route\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty, "tag", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
- return zebra_route_match_delete (vty, "tag", argv[0],
- RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_tag,
- no_match_tag_val_cmd,
- "no match tag <1-4294967295>",
- NO_STR
- MATCH_STR
- "Match tag of route\n")
-
-DEFUN (match_ip_next_hop,
- match_ip_next_hop_cmd,
- "match ip next-hop (<1-199>|<1300-2699>|WORD)",
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-{
- return zebra_route_match_add (vty, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED);
-}
-
-DEFUN (no_match_ip_next_hop,
- no_match_ip_next_hop_cmd,
- "no match ip next-hop",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty, "ip next-hop", NULL,
- RMAP_EVENT_FILTER_DELETED);
-
- return zebra_route_match_delete (vty, "ip next-hop", argv[0],
- RMAP_EVENT_FILTER_DELETED);
-}
-
-ALIAS (no_match_ip_next_hop,
- no_match_ip_next_hop_val_cmd,
- "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-
-DEFUN (match_ip_next_hop_prefix_list,
- match_ip_next_hop_prefix_list_cmd,
- "match ip next-hop prefix-list WORD",
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- return zebra_route_match_add (vty, "ip next-hop prefix-list",
- argv[0], RMAP_EVENT_PLIST_ADDED);
-}
-
-DEFUN (no_match_ip_next_hop_prefix_list,
- no_match_ip_next_hop_prefix_list_cmd,
- "no match ip next-hop prefix-list",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty,
- "ip next-hop prefix-list", NULL,
- RMAP_EVENT_PLIST_DELETED);
-
- return zebra_route_match_delete (vty,
- "ip next-hop prefix-list", argv[0],
- RMAP_EVENT_PLIST_DELETED);
-}
-
-ALIAS (no_match_ip_next_hop_prefix_list,
- no_match_ip_next_hop_prefix_list_val_cmd,
- "no match ip next-hop prefix-list WORD",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-
-DEFUN (match_ip_address,
- match_ip_address_cmd,
- "match ip address (<1-199>|<1300-2699>|WORD)",
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-
-{
- return zebra_route_match_add (vty, "ip address", argv[0],
- RMAP_EVENT_FILTER_ADDED);
-}
-
-DEFUN (no_match_ip_address,
- no_match_ip_address_cmd,
- "no match ip address",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty, "ip address", NULL,
- RMAP_EVENT_FILTER_DELETED);
-
- return zebra_route_match_delete (vty, "ip address", argv[0],
- RMAP_EVENT_FILTER_DELETED);
-}
-
-ALIAS (no_match_ip_address,
- no_match_ip_address_val_cmd,
- "no match ip address (<1-199>|<1300-2699>|WORD)",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-
-DEFUN (match_ip_address_prefix_list,
- match_ip_address_prefix_list_cmd,
- "match ip address prefix-list WORD",
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- return zebra_route_match_add (vty, "ip address prefix-list",
- argv[0], RMAP_EVENT_PLIST_ADDED);
-}
-
-DEFUN (no_match_ip_address_prefix_list,
- no_match_ip_address_prefix_list_cmd,
- "no match ip address prefix-list",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n")
-{
- if (argc == 0)
- return zebra_route_match_delete (vty,
- "ip address prefix-list", NULL,
- RMAP_EVENT_PLIST_DELETED);
-
- return zebra_route_match_delete (vty,
- "ip address prefix-list", argv[0],
- RMAP_EVENT_PLIST_DELETED);
-}
-
-ALIAS (no_match_ip_address_prefix_list,
- no_match_ip_address_prefix_list_val_cmd,
- "no match ip address prefix-list WORD",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-
DEFUN (match_ip_address_prefix_len,
match_ip_address_prefix_len_cmd,
- "match ip address prefix-len NUMBER",
+ "match ip address prefix-len (0-32)",
MATCH_STR
IP_STR
"Match prefix length of ip address\n"
@@ -507,40 +231,29 @@ DEFUN (match_ip_address_prefix_len,
"Prefix length\n")
{
return zebra_route_match_add (vty, "ip address prefix-len",
- argv[0], RMAP_EVENT_MATCH_ADDED);
+ argv[4]->arg, RMAP_EVENT_MATCH_ADDED);
}
DEFUN (no_match_ip_address_prefix_len,
no_match_ip_address_prefix_len_cmd,
- "no match ip address prefix-len",
+ "no match ip address prefix-len [(0-32)]",
NO_STR
MATCH_STR
IP_STR
- "Match prefixlen of ip address of route\n"
- "prefix length of ip address\n")
+ "Match prefix length of ip address\n"
+ "Match prefix length of ip address\n"
+ "Prefix length\n")
{
- if (argc == 0)
- return zebra_route_match_delete (vty,
- "ip address prefix-len", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
+ char *plen = (argc == 6) ? argv[5]->arg : NULL;
return zebra_route_match_delete (vty,
- "ip address prefix-len", argv[0],
+ "ip address prefix-len", plen,
RMAP_EVENT_MATCH_DELETED);
}
-ALIAS (no_match_ip_address_prefix_len,
- no_match_ip_address_prefix_len_val_cmd,
- "no match ip address prefix-len NUMBER",
- NO_STR
- MATCH_STR
- IP_STR
- "Match prefixlen of ip address of route\n"
- "prefix length of ip address\n")
DEFUN (match_ip_nexthop_prefix_len,
match_ip_nexthop_prefix_len_cmd,
- "match ip next-hop prefix-len NUMBER",
+ "match ip next-hop prefix-len (0-32)",
MATCH_STR
IP_STR
"Match prefixlen of nexthop ip address\n"
@@ -548,96 +261,95 @@ DEFUN (match_ip_nexthop_prefix_len,
"Prefix length\n")
{
return zebra_route_match_add (vty, "ip next-hop prefix-len",
- argv[0], RMAP_EVENT_MATCH_ADDED);
+ argv[4]->arg, RMAP_EVENT_MATCH_ADDED);
}
DEFUN (no_match_ip_nexthop_prefix_len,
no_match_ip_nexthop_prefix_len_cmd,
- "no match ip next-hop prefix-len",
+ "no match ip next-hop prefix-len [(0-32)]",
NO_STR
MATCH_STR
IP_STR
"Match prefixlen of nexthop ip address\n"
- "Match prefix length of nexthop\n")
+ "Match prefix length of nexthop\n"
+ "Prefix length\n")
{
- if (argc == 0)
- return zebra_route_match_delete (vty,
- "ip next-hop prefix-len", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
+ char *plen = (argc == 6) ? argv[5]->arg : NULL;
return zebra_route_match_delete (vty,
- "ip next-hop prefix-len", argv[0],
+ "ip next-hop prefix-len", plen,
RMAP_EVENT_MATCH_DELETED);
}
-ALIAS (no_match_ip_nexthop_prefix_len,
- no_match_ip_nexthop_prefix_len_val_cmd,
- "no match ip next-hop prefix-len NUMBER",
- MATCH_STR
- "Match prefixlen of ip address of route\n"
- "prefix length of ip address\n")
DEFUN (match_source_protocol,
match_source_protocol_cmd,
- "match source-protocol (bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static)",
+ "match source-protocol <bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>",
MATCH_STR
- "Match protocol via which the route was learnt\n")
-{
+ "Match protocol via which the route was learnt\n"
+ "BGP protocol\n"
+ "OSPF protocol\n"
+ "RIP protocol\n"
+ "RIPNG protocol\n"
+ "ISIS protocol\n"
+ "OSPF6 protocol\n"
+ "Routes from directly connected peer\n"
+ "Routes from system configuration\n"
+ "Routes from kernel\n"
+ "Statically configured routes\n")
+{
+ char *proto = argv[2]->text;
int i;
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
- return zebra_route_match_add (vty, "source-protocol",
- argv[0], RMAP_EVENT_MATCH_ADDED);
+ return zebra_route_match_add (vty, "source-protocol", proto, RMAP_EVENT_MATCH_ADDED);
}
DEFUN (no_match_source_protocol,
no_match_source_protocol_cmd,
- "no match source-protocol (bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static)",
+ "no match source-protocol [<bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static>]",
NO_STR
MATCH_STR
- "No match protocol via which the route was learnt\n")
-{
- int i;
-
- if (argc >= 1)
- {
- i = proto_name2num(argv[0]);
- if (i < 0)
- {
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return zebra_route_match_delete (vty,
- "source-protocol", argv[0] ? argv[0] : NULL,
- RMAP_EVENT_MATCH_DELETED);
+ "No match protocol via which the route was learnt\n"
+ "BGP protocol\n"
+ "OSPF protocol\n"
+ "RIP protocol\n"
+ "RIPNG protocol\n"
+ "ISIS protocol\n"
+ "OSPF6 protocol\n"
+ "Routes from directly connected peer\n"
+ "Routes from system configuration\n"
+ "Routes from kernel\n"
+ "Statically configured routes\n")
+{
+ char *proto = (argc == 4) ? argv[3]->text : NULL;
+ return zebra_route_match_delete (vty, "source-protocol", proto, RMAP_EVENT_MATCH_DELETED);
}
/* set functions */
DEFUN (set_src,
set_src_cmd,
- "set src (A.B.C.D|X:X::X:X)",
+ "set src <A.B.C.D|X:X::X:X>",
SET_STR
"src address for route\n"
- "src address\n")
+ "IPv4 src address\n"
+ "IPv6 src address\n")
{
+ int idx_ip = 2;
union g_addr src;
struct interface *pif = NULL;
int family;
struct prefix p;
vrf_iter_t iter;
- if (inet_pton(AF_INET, argv[0], &src.ipv4) != 1)
+ if (inet_pton(AF_INET, argv[idx_ip]->arg, &src.ipv4) != 1)
{
- if (inet_pton(AF_INET6, argv[0], &src.ipv6) != 1)
+ if (inet_pton(AF_INET6, argv[idx_ip]->arg, &src.ipv6) != 1)
{
vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -656,8 +368,8 @@ DEFUN (set_src,
if (!zebra_check_addr(&p))
{
- vty_out (vty, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE);
- return CMD_WARNING;
+ vty_out (vty, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE);
+ return CMD_WARNING;
}
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
@@ -678,31 +390,35 @@ DEFUN (set_src,
vty_out (vty, "%% not a local address%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return zebra_route_set_add (vty, "src", argv[0]);
+
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
+ return generic_set_add (vty, index, "src", argv[idx_ip]->arg);
}
DEFUN (no_set_src,
no_set_src_cmd,
- "no set src {A.B.C.D|X:X::X:X}",
+ "no set src [<A.B.C.D|X:X::X:X>]",
NO_STR
SET_STR
"Source address for route\n")
{
- if (argc == 0)
- return zebra_route_set_delete (vty, "src", NULL);
-
- return zebra_route_set_delete (vty, "src", argv[0]);
+ char *ip = (argc == 4) ? argv[3]->arg : NULL;
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
+ return generic_set_delete (vty, index, "src", ip);
}
DEFUN (zebra_route_map_timer,
zebra_route_map_timer_cmd,
- "zebra route-map delay-timer <0-600>",
+ "zebra route-map delay-timer (0-600)",
+ "Zebra information\n"
+ "Set route-map parameters\n"
"Time to wait before route-map updates are processed\n"
"0 means event-driven updates are disabled\n")
{
+ int idx_number = 3;
u_int32_t rmap_delay_timer;
- VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600);
+ VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[idx_number]->arg, 0, 600);
zebra_route_map_set_delay_timer(rmap_delay_timer);
return (CMD_SUCCESS);
@@ -710,56 +426,53 @@ DEFUN (zebra_route_map_timer,
DEFUN (no_zebra_route_map_timer,
no_zebra_route_map_timer_cmd,
- "no zebra route-map delay-timer",
+ "no zebra route-map delay-timer [(0-600)]",
NO_STR
- "Time to wait before route-map updates are processed\n"
- "Reset delay-timer to default value, 30 secs\n")
+ "Zebra information\n"
+ "Set route-map parameters\n"
+ "Reset delay-timer to default value, 30 secs\n"
+ "0 means event-driven updates are disabled\n")
{
zebra_route_map_set_delay_timer(ZEBRA_RMAP_DEFAULT_UPDATE_TIMER);
return (CMD_SUCCESS);
}
-ALIAS (no_zebra_route_map_timer,
- no_zebra_route_map_timer_val_cmd,
- "no zebra route-map delay-timer <0-600>",
- NO_STR
- "Time to wait before route-map updates are processed\n"
- "Reset delay-timer to default value, 30 secs\n"
- "0 means event-driven updates are disabled\n")
DEFUN (ip_protocol,
ip_protocol_cmd,
- "ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ip protocol <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> route-map ROUTE-MAP",
IP_STR
"Filter routing info exchanged between zebra and protocol\n"
QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route-map\n"
"Route map name\n")
{
+ char *proto = argv[2]->text;
+ char *rmap = argv[4]->arg;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
if (proto_rm[AFI_IP][i])
{
- if (strcmp(proto_rm[AFI_IP][i], argv[1]) == 0)
+ if (strcmp(proto_rm[AFI_IP][i], rmap) == 0)
return CMD_SUCCESS;
XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
}
- proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
+ proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, argv[0]);
+ VRF_DEFAULT, proto);
rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
return CMD_SUCCESS;
@@ -767,50 +480,45 @@ DEFUN (ip_protocol,
DEFUN (no_ip_protocol,
no_ip_protocol_cmd,
- "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,
+ "no ip protocol <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> [route-map ROUTE-MAP]",
NO_STR
IP_STR
"Stop filtering routing info between zebra and protocol\n"
QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Protocol from which to stop filtering routes\n")
+ "Specify route map\n"
+ "Route map name\n")
{
+ char *proto = argv[3]->text;
+ char *rmap = (argc == 6) ? argv[5]->arg : NULL;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
+
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
+
if (!proto_rm[AFI_IP][i])
return CMD_SUCCESS;
- if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP][i]) == 0) ||
- (argc < 2))
+ if (!rmap || strcmp (rmap, proto_rm[AFI_IP][i]) == 0)
{
XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
proto_rm[AFI_IP][i] = NULL;
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, argv[0]);
+ VRF_DEFAULT, proto);
rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
}
return CMD_SUCCESS;
}
-ALIAS (no_ip_protocol,
- no_ip_protocol_val_cmd,
- "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
- NO_STR
- IP_STR
- "Stop filtering routing info between zebra and protocol\n"
- QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
- "route map name")
DEFUN (show_ip_protocol,
show_ip_protocol_cmd,
@@ -843,36 +551,38 @@ DEFUN (show_ip_protocol,
DEFUN (ipv6_protocol,
ipv6_protocol_cmd,
- "ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ipv6 protocol <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> route-map ROUTE-MAP",
IP6_STR
"Filter IPv6 routing info exchanged between zebra and protocol\n"
QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route map\n"
"Route map name\n")
{
+ char *proto = argv[2]->text;
+ char *rmap = argv[4]->arg;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
if (proto_rm[AFI_IP6][i])
{
- if (strcmp(proto_rm[AFI_IP6][i], argv[1]) == 0)
+ if (strcmp(proto_rm[AFI_IP6][i], rmap) == 0)
return CMD_SUCCESS;
XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]);
}
- proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
+ proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, argv[0]);
+ VRF_DEFAULT, proto);
rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
return CMD_SUCCESS;
@@ -880,51 +590,44 @@ DEFUN (ipv6_protocol,
DEFUN (no_ipv6_protocol,
no_ipv6_protocol_cmd,
- "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,
+ "no ipv6 protocol <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> [route-map ROUTE-MAP]",
NO_STR
IP6_STR
"Stop filtering IPv6 routing info between zebra and protocol\n"
QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Protocol from which to stop filtering routes\n")
+ "Specify route map\n"
+ "Route map name\n")
{
+ const char *proto = argv[3]->text;
+ const char *rmap = (argc == 6) ? argv[5]->arg : NULL;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
if (!proto_rm[AFI_IP6][i])
return CMD_SUCCESS;
- if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP6][i]) == 0) ||
- (argc < 2))
+ if (!rmap || strcmp(rmap, proto_rm[AFI_IP6][i]) == 0)
{
XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]);
proto_rm[AFI_IP6][i] = NULL;
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, argv[0]);
+ VRF_DEFAULT, proto);
rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
}
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_protocol,
- no_ipv6_protocol_val_cmd,
- "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
- NO_STR
- IP6_STR
- "Stop filtering IPv6 routing info between zebra and protocol\n"
- QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
- "route map name")
DEFUN (show_ipv6_protocol,
show_ipv6_protocol_cmd,
@@ -957,33 +660,35 @@ DEFUN (show_ipv6_protocol,
DEFUN (ip_protocol_nht_rmap,
ip_protocol_nht_rmap_cmd,
- "ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ip nht <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> route-map ROUTE-MAP",
IP_STR
"Filter Next Hop tracking route resolution\n"
QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route map\n"
"Route map name\n")
{
+ char *proto = argv[2]->text;
+ char *rmap = argv[4]->arg;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
if (nht_rm[AFI_IP][i])
{
- if (strcmp(nht_rm[AFI_IP][i], argv[1]) == 0)
+ if (strcmp(nht_rm[AFI_IP][i], rmap) == 0)
return CMD_SUCCESS;
XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]);
}
- nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
+ nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap);
zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
@@ -991,29 +696,30 @@ DEFUN (ip_protocol_nht_rmap,
DEFUN (no_ip_protocol_nht_rmap,
no_ip_protocol_nht_rmap_cmd,
- "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,
+ "no ip nht <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any> [route-map ROUTE-MAP]",
NO_STR
IP_STR
"Filter Next Hop tracking route resolution\n"
- QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA)
+ QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route map\n"
+ "Route map name\n")
{
- int i;
+ int idx = 0;
+ char *proto = argv[3]->text;
+ char *rmap = argv_find (argv, argc, "ROUTE-MAP", &idx) ? argv[idx]->arg : NULL;
+
+ int i = strmatch(proto, "any") ? ZEBRA_ROUTE_MAX : proto_name2num(proto);
- if (strcasecmp(argv[0], "any") == 0)
- i = ZEBRA_ROUTE_MAX;
- else
- i = proto_name2num(argv[0]);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
- return CMD_WARNING;
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ return CMD_WARNING;
}
+
if (!nht_rm[AFI_IP][i])
return CMD_SUCCESS;
- if ((argc == 2 && strcmp(argv[1], nht_rm[AFI_IP][i]) == 0) ||
- (argc < 2))
+ if (!rmap || strcmp(rmap, nht_rm[AFI_IP][i]) == 0)
{
XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]);
nht_rm[AFI_IP][i] = NULL;
@@ -1022,13 +728,6 @@ DEFUN (no_ip_protocol_nht_rmap,
return CMD_SUCCESS;
}
-ALIAS (no_ip_protocol_nht_rmap,
- no_ip_protocol_nht_rmap_val_cmd,
- "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
- IP_STR
- "Filter Next Hop tracking route resolution\n"
- QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Route map name\n")
DEFUN (show_ip_protocol_nht,
show_ip_protocol_nht_cmd,
@@ -1061,27 +760,29 @@ DEFUN (show_ip_protocol_nht,
DEFUN (ipv6_protocol_nht_rmap,
ipv6_protocol_nht_rmap_cmd,
- "ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ipv6 nht <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> route-map ROUTE-MAP",
IP6_STR
"Filter Next Hop tracking route resolution\n"
QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route map\n"
"Route map name\n")
{
+ char *proto = argv[2]->text;
+ char *rmap = argv[4]->arg;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
return CMD_WARNING;
}
if (nht_rm[AFI_IP6][i])
XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]);
- nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
+ nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap);
zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
@@ -1089,28 +790,31 @@ DEFUN (ipv6_protocol_nht_rmap,
DEFUN (no_ipv6_protocol_nht_rmap,
no_ipv6_protocol_nht_rmap_cmd,
- "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,
+ "no ipv6 nht <kernel|connected|static|ripng|ospf6|isis|bgp|table|any> [route-map ROUTE-MAP]",
NO_STR
IP6_STR
"Filter Next Hop tracking route resolution\n"
- QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA)
+ QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
+ "Specify route map\n"
+ "Route map name\n")
{
+ char *proto = argv[3]->text;
+ char *rmap = (argc == 6) ? argv[5]->arg : NULL;
int i;
- if (strcasecmp(argv[0], "any") == 0)
+ if (strcasecmp(proto, "any") == 0)
i = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(argv[0]);
+ i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
- VTY_NEWLINE);
- return CMD_WARNING;
+ vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ return CMD_WARNING;
}
- if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1], nht_rm[AFI_IP6][i]))
+ if (nht_rm[AFI_IP6][i] && rmap && strcmp(rmap, nht_rm[AFI_IP6][i]))
{
- vty_out (vty, "invalid route-map \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "invalid route-map \"%s\"%s", rmap, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -1125,14 +829,6 @@ DEFUN (no_ipv6_protocol_nht_rmap,
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_protocol_nht_rmap,
- no_ipv6_protocol_nht_rmap_val_cmd,
- "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
- NO_STR
- IP6_STR
- "Filter Next Hop tracking route resolution\n"
- QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Route map name\n")
DEFUN (show_ipv6_protocol_nht,
show_ipv6_protocol_nht_cmd,
@@ -1788,23 +1484,18 @@ zebra_route_map_init ()
{
install_element (CONFIG_NODE, &ip_protocol_cmd);
install_element (CONFIG_NODE, &no_ip_protocol_cmd);
- install_element (CONFIG_NODE, &no_ip_protocol_val_cmd);
install_element (VIEW_NODE, &show_ip_protocol_cmd);
install_element (CONFIG_NODE, &ipv6_protocol_cmd);
install_element (CONFIG_NODE, &no_ipv6_protocol_cmd);
- install_element (CONFIG_NODE, &no_ipv6_protocol_val_cmd);
install_element (VIEW_NODE, &show_ipv6_protocol_cmd);
install_element (CONFIG_NODE, &ip_protocol_nht_rmap_cmd);
install_element (CONFIG_NODE, &no_ip_protocol_nht_rmap_cmd);
- install_element (CONFIG_NODE, &no_ip_protocol_nht_rmap_val_cmd);
install_element (VIEW_NODE, &show_ip_protocol_nht_cmd);
install_element (CONFIG_NODE, &ipv6_protocol_nht_rmap_cmd);
install_element (CONFIG_NODE, &no_ipv6_protocol_nht_rmap_cmd);
- install_element (CONFIG_NODE, &no_ipv6_protocol_nht_rmap_val_cmd);
install_element (VIEW_NODE, &show_ipv6_protocol_nht_cmd);
install_element (CONFIG_NODE, &zebra_route_map_timer_cmd);
install_element (CONFIG_NODE, &no_zebra_route_map_timer_cmd);
- install_element (CONFIG_NODE, &no_zebra_route_map_timer_val_cmd);
route_map_init ();
@@ -1812,6 +1503,24 @@ zebra_route_map_init ()
route_map_delete_hook (zebra_route_map_delete);
route_map_event_hook (zebra_route_map_event);
+ route_map_match_interface_hook (generic_match_add);
+ route_map_no_match_interface_hook (generic_match_delete);
+
+ route_map_match_ip_address_hook (generic_match_add);
+ route_map_no_match_ip_address_hook (generic_match_delete);
+
+ route_map_match_ip_address_prefix_list_hook (generic_match_add);
+ route_map_no_match_ip_address_prefix_list_hook (generic_match_delete);
+
+ route_map_match_ip_next_hop_hook (generic_match_add);
+ route_map_no_match_ip_next_hop_hook (generic_match_delete);
+
+ route_map_match_ip_next_hop_prefix_list_hook (generic_match_add);
+ route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete);
+
+ route_map_match_tag_hook (generic_match_add);
+ route_map_no_match_tag_hook (generic_match_delete);
+
route_map_install_match (&route_match_tag_cmd);
route_map_install_match (&route_match_interface_cmd);
route_map_install_match (&route_match_ip_next_hop_cmd);
@@ -1824,30 +1533,10 @@ zebra_route_map_init ()
/* */
route_map_install_set (&route_set_src_cmd);
/* */
- install_element (RMAP_NODE, &match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_val_cmd);
- install_element (RMAP_NODE, &match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_val_cmd);
- install_element (RMAP_NODE, &match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
- install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd);
- install_element (RMAP_NODE, &match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
- install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd);
install_element (RMAP_NODE, &match_ip_nexthop_prefix_len_cmd);
install_element (RMAP_NODE, &no_match_ip_nexthop_prefix_len_cmd);
- install_element (RMAP_NODE, &no_match_ip_nexthop_prefix_len_val_cmd);
install_element (RMAP_NODE, &match_ip_address_prefix_len_cmd);
install_element (RMAP_NODE, &no_match_ip_address_prefix_len_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_len_val_cmd);
install_element (RMAP_NODE, &match_source_protocol_cmd);
install_element (RMAP_NODE, &no_match_source_protocol_cmd);
/* */
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 298fc4e09..7dc6cbaaa 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -25,6 +25,7 @@
#include <lib/nexthop.h>
#include <lib/memory.h>
+#include "vty.h"
#include "zebra/debug.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
@@ -241,7 +242,7 @@ static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
gw_match = 1;
if (!gw_match)
- return 0;
+ return 0;
/* Check match on label(s), if any */
return static_nexthop_label_same (nexthop, &si->snh_label);
@@ -322,19 +323,19 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_
{
/* Update route in kernel if it's in fib */
if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- rib_install_kernel (rn, rib, 1);
+ rib_install_kernel (rn, rib, 1);
/* Update redistribution if it's selected */
if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
- redistribute_update (&rn->p, rib, NULL);
+ redistribute_update (&rn->p, rib, NULL);
}
else
{
/* Remove from redistribute if selected route becomes inactive */
if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
- redistribute_delete (&rn->p, rib);
+ redistribute_delete (&rn->p, rib);
/* Remove from kernel if fib route becomes inactive */
if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- rib_uninstall_kernel (rn, rib);
+ rib_uninstall_kernel (rn, rib);
}
}
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index ab825281e..8db89b1e4 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -25,6 +25,7 @@
#include "linklist.h"
#include "memory.h"
+#include "vty.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
#include "zebra/rib.h"
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 9b0fad93e..05356b3d0 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -14,9 +14,9 @@
* 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.
+ * 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.
*/
#include <zebra.h>
@@ -177,7 +177,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
return CMD_SUCCESS;
}
-
+
/* When gateway is A.B.C.D format, gate is treated as nexthop
address other case gate is treated as interface name. */
ret = inet_aton (gate_str, &gate);
@@ -212,7 +212,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
/* Static unicast routes for multicast RPF lookup. */
DEFUN (ip_mroute_dist,
ip_mroute_dist_cmd,
- "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
+ "ip mroute A.B.C.D/M <A.B.C.D|INTERFACE> [(1-255)]",
IP_STR
"Configure static unicast route into MRIB for multicast RPF lookup\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -220,22 +220,17 @@ DEFUN (ip_mroute_dist,
"Nexthop interface name\n"
"Distance\n")
{
- return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
- NULL, NULL, argc > 2 ? argv[2] : NULL, NULL, NULL);
-}
+ char *destprefix = argv[2]->arg;
+ char *nexthop = argv[3]->arg;
+ char *distance = (argc == 5) ? argv[4]->arg : NULL;
-ALIAS (ip_mroute_dist,
- ip_mroute_cmd,
- "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
- IP_STR
- "Configure static unicast route into MRIB for multicast RPF lookup\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Nexthop address\n"
- "Nexthop interface name\n")
+ return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, destprefix, NULL, nexthop, NULL, NULL, distance, NULL, NULL);
+}
DEFUN (no_ip_mroute_dist,
no_ip_mroute_dist_cmd,
- "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
+ "no ip mroute A.B.C.D/M <A.B.C.D|INTERFACE> [(1-255)]",
+ NO_STR
IP_STR
"Configure static unicast route into MRIB for multicast RPF lookup\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -243,23 +238,16 @@ DEFUN (no_ip_mroute_dist,
"Nexthop interface name\n"
"Distance\n")
{
- return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
- NULL, NULL, argc > 2 ? argv[2] : NULL, NULL, NULL);
-}
+ char *destprefix = argv[3]->arg;
+ char *nexthop = argv[4]->arg;
+ char *distance = (argc == 6) ? argv[5]->arg : NULL;
-ALIAS (no_ip_mroute_dist,
- no_ip_mroute_cmd,
- "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
- NO_STR
- IP_STR
- "Configure static unicast route into MRIB for multicast RPF lookup\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Nexthop address\n"
- "Nexthop interface name\n")
+ return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, destprefix, NULL, nexthop, NULL, NULL, distance, NULL, NULL);
+}
DEFUN (ip_multicast_mode,
ip_multicast_mode_cmd,
- "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
+ "ip multicast rpf-lookup-mode <urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix>",
IP_STR
"Multicast options\n"
"RPF lookup behavior\n"
@@ -269,16 +257,17 @@ DEFUN (ip_multicast_mode,
"Lookup both, use entry with lower distance\n"
"Lookup both, use entry with longer prefix\n")
{
+ char *mode = argv[3]->text;
- if (!strncmp (argv[0], "u", 1))
+ if (strmatch (mode, "urib-only"))
multicast_mode_ipv4_set (MCAST_URIB_ONLY);
- else if (!strncmp (argv[0], "mrib-o", 6))
+ else if (strmatch (mode, "mrib-only"))
multicast_mode_ipv4_set (MCAST_MRIB_ONLY);
- else if (!strncmp (argv[0], "mrib-t", 6))
+ else if (strmatch (mode, "mrib-then-urib"))
multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST);
- else if (!strncmp (argv[0], "low", 3))
+ else if (strmatch (mode, "lower-distance"))
multicast_mode_ipv4_set (MCAST_MIX_DISTANCE);
- else if (!strncmp (argv[0], "lon", 3))
+ else if (strmatch (mode, "longer-prefix"))
multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
else
{
@@ -291,7 +280,7 @@ DEFUN (ip_multicast_mode,
DEFUN (no_ip_multicast_mode,
no_ip_multicast_mode_cmd,
- "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
+ "no ip multicast rpf-lookup-mode [<urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix>]",
NO_STR
IP_STR
"Multicast options\n"
@@ -306,13 +295,6 @@ DEFUN (no_ip_multicast_mode,
return CMD_SUCCESS;
}
-ALIAS (no_ip_multicast_mode,
- no_ip_multicast_mode_noarg_cmd,
- "no ip multicast rpf-lookup-mode",
- NO_STR
- IP_STR
- "Multicast options\n"
- "RPF lookup behavior\n")
DEFUN (show_ip_rpf,
show_ip_rpf_cmd,
@@ -332,12 +314,13 @@ DEFUN (show_ip_rpf_addr,
"Display RPF information for multicast source\n"
"IP multicast source address (e.g. 10.0.0.0)\n")
{
+ int idx_ipv4 = 3;
struct in_addr addr;
struct route_node *rn;
struct rib *rib;
int ret;
- ret = inet_aton (argv[0], &addr);
+ ret = inet_aton (argv[idx_ipv4]->arg, &addr);
if (ret == 0)
{
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
@@ -354,217 +337,47 @@ DEFUN (show_ip_rpf_addr,
return CMD_SUCCESS;
}
-/* Static route configuration. */
-DEFUN (ip_route,
- ip_route_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_tag,
- ip_route_tag_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "One or more labels separated by '/'\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_flags,
- ip_route_flags_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_flags_tag,
- ip_route_flags_tag_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3],
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_flags2,
- ip_route_flags2_cmd,
- "ip route A.B.C.D/M (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_flags2_tag,
- ip_route_flags2_tag_cmd,
- "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2],
- NULL, NULL, NULL);
-}
-
-/* Mask as A.B.C.D format. */
-DEFUN (ip_route_mask,
- ip_route_mask_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_mask_tag,
- ip_route_mask_tag_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n")
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags,
- ip_route_mask_flags_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags_tag,
- ip_route_mask_flags_tag_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags2,
- ip_route_mask_flags2_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags2_tag,
- ip_route_mask_flags2_tag_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
+static void
+zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[],
+ int idx_curr, char **tag,
+ char **distance, char **vrf, char **labels)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3],
- NULL, NULL, NULL);
-}
+ *distance = NULL;
+ while (idx_curr < argc)
+ {
+ if (strmatch (argv[idx_curr]->text, "tag"))
+ {
+ if (tag)
+ *tag = argv[idx_curr+1]->arg;
+ idx_curr += 2;
+ }
+ else if (strmatch (argv[idx_curr]->text, "vrf"))
+ {
+ if (vrf)
+ *vrf = argv[idx_curr+1]->arg;
+ idx_curr += 2;
+ }
+ else if (strmatch (argv[idx_curr]->text, "label"))
+ {
+ if (labels)
+ *labels = argv[idx_curr+1]->arg;
+ idx_curr += 2;
+ }
+ else
+ {
+ if (distance)
+ *distance = argv[idx_curr]->arg;
+ idx_curr++;
+ }
+ }
-/* Distance option value. */
-DEFUN (ip_route_distance,
- ip_route_distance_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
- argv[2], NULL, NULL);
+ return;
}
-DEFUN (ip_route_tag_distance,
- ip_route_tag_distance_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
+/* Static route configuration. */
+DEFUN (ip_route,
+ ip_route_cmd,
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -573,691 +386,94 @@ DEFUN (ip_route_tag_distance,
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
- "Distance value for this route\n")
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
- argv[3], NULL, NULL);
-}
-
-DEFUN (ip_route_flags_distance,
- ip_route_flags_distance_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL,
- argv[3], NULL, NULL);
-}
+ int idx_ipv4_prefixlen = 2;
+ int idx_ipv4_ifname_null = 3;
+ int idx_curr = 4;
+ char *tag, *distance, *vrf;
-DEFUN (ip_route_flags_tag_distance,
- ip_route_flags_tag_distance_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3],
- argv[4], NULL, NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ip_route_flags_distance2,
- ip_route_flags_distance2_cmd,
- "ip route A.B.C.D/M (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL,
- argv[2], NULL, NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ argv[idx_ipv4_ifname_null]->arg,
+ NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (ip_route_flags_tag_distance2,
- ip_route_flags_tag_distance2_cmd,
- "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>",
+DEFUN (ip_route_flags,
+ ip_route_flags_cmd,
+ "ip route A.B.C.D/M <A.B.C.D|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2],
- argv[3], NULL, NULL);
-}
-
-DEFUN (ip_route_mask_distance,
- ip_route_mask_distance_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
- argv[3], NULL, NULL);
-}
-
-DEFUN (ip_route_mask_tag_distance,
- ip_route_mask_tag_distance_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
- argv[4], NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags_tag_distance,
- ip_route_mask_flags_tag_distance_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
- argv[5], NULL, NULL);
-}
-
-
-DEFUN (ip_route_mask_flags_distance,
- ip_route_mask_flags_distance_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL,
- argv[4], NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags_distance2,
- ip_route_mask_flags_distance2_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL,
- argv[3], NULL, NULL);
-}
-
-DEFUN (ip_route_mask_flags_tag_distance2,
- ip_route_mask_flags_tag_distance2_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3],
- argv[4], NULL, NULL);
-}
-
-DEFUN (no_ip_route,
- no_ip_route_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_tag,
- no_ip_route_tag_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
- NULL, NULL, NULL);
-}
-
-ALIAS (no_ip_route,
- no_ip_route_flags_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-
-ALIAS (no_ip_route_tag,
- no_ip_route_flags_tag_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n")
-
-DEFUN (no_ip_route_flags2,
- no_ip_route_flags2_cmd,
- "no ip route A.B.C.D/M (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_flags2_tag,
- no_ip_route_flags2_tag_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[1],
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask,
- no_ip_route_mask_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_tag,
- no_ip_route_mask_tag_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
- NULL, NULL, NULL);
-}
-
-ALIAS (no_ip_route_mask,
- no_ip_route_mask_flags_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-
-ALIAS (no_ip_route_mask_tag,
- no_ip_route_mask_flags_tag_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n")
-
-DEFUN (no_ip_route_mask_flags2,
- no_ip_route_mask_flags2_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_flags2_tag,
- no_ip_route_mask_flags2_tag_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[2],
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_route_distance,
- no_ip_route_distance_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
- argv[2], NULL, NULL);
-}
-
-DEFUN (no_ip_route_tag_distance,
- no_ip_route_tag_distance_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
- argv[3], NULL, NULL);
-}
-
-DEFUN (no_ip_route_flags_distance,
- no_ip_route_flags_distance_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL,
- argv[3], NULL, NULL);
-}
-
-DEFUN (no_ip_route_flags_tag_distance,
- no_ip_route_flags_tag_distance_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3],
- argv[4], NULL, NULL);
-}
-
-DEFUN (no_ip_route_flags_distance2,
- no_ip_route_flags_distance2_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL,
- argv[2], NULL, NULL);
-}
-
-DEFUN (no_ip_route_flags_tag_distance2,
- no_ip_route_flags_tag_distance2_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2],
- argv[3], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_distance,
- no_ip_route_mask_distance_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
- argv[3], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_tag_distance,
- no_ip_route_mask_tag_distance_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
- argv[4], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_flags_distance,
- no_ip_route_mask_flags_distance_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL,
- argv[4], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_flags_tag_distance,
- no_ip_route_mask_flags_tag_distance_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
- argv[5], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_flags_distance2,
- no_ip_route_mask_flags_distance2_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL,
- argv[3], NULL, NULL);
-}
-
-DEFUN (no_ip_route_mask_flags_tag_distance2,
- no_ip_route_mask_flags_tag_distance2_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3],
- argv[4], NULL, NULL);
-}
-
-/* Static route configuration. */
-DEFUN (ip_route_vrf,
- ip_route_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL,
- NULL, NULL, argv[2], NULL);
-}
+ int idx_ipv4_prefixlen = 2;
+ int idx_ipv4_ifname = 3;
+ int idx_reject_blackhole = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (ip_route_tag_vrf,
- ip_route_tag_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL,
- argv[2], NULL, argv[3], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ip_route_flags_vrf,
- ip_route_flags_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
- argv[2], NULL, NULL, argv[3], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ argv[idx_ipv4_ifname]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (ip_route_flags_tag_vrf,
- ip_route_flags_tag_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (ip_route_flags2,
+ ip_route_flags2_cmd,
+ "ip route A.B.C.D/M <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
- argv[2], argv[3], NULL, argv[4], NULL);
-}
-
-DEFUN (ip_route_flags2_vrf,
- ip_route_flags2_vrf_cmd,
- "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1],
- NULL, NULL, argv[2], NULL);
-}
+ int idx_ipv4_prefixlen = 2;
+ int idx_reject_blackhole = 3;
+ int idx_curr = 4;
+ char *tag, *distance, *vrf;
-DEFUN (ip_route_flags2_tag_vrf,
- ip_route_flags2_tag_vrf_cmd,
- "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1],
- argv[2], NULL, argv[3], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
/* Mask as A.B.C.D format. */
-DEFUN (ip_route_mask_vrf,
- ip_route_mask_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, NULL, NULL, argv[3], NULL);
-}
-
-DEFUN (ip_route_mask_tag_vrf,
- ip_route_mask_tag_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (ip_route_mask,
+ ip_route_mask_cmd,
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -1267,141 +483,34 @@ DEFUN (ip_route_mask_tag_vrf,
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
-
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, argv[3], NULL, argv[4], NULL);
-}
+ int idx_ipv4 = 2;
+ int idx_ipv4_2 = 3;
+ int idx_ipv4_ifname_null = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (ip_route_mask_flags_vrf,
- ip_route_mask_flags_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- argv[3], NULL, NULL, argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ip_route_mask_flags_tag_vrf,
- ip_route_mask_flags_tag_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- argv[3], argv[4], NULL, argv[5], NULL);
-}
-
-DEFUN (ip_route_mask_flags2_vrf,
- ip_route_mask_flags2_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
- argv[2], NULL, NULL, argv[3], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ argv[idx_ipv4_ifname_null]->arg,
+ NULL, tag, distance, vrf, NULL);
}
-DEFUN (ip_route_mask_flags2_tag_vrf,
- ip_route_mask_flags2_tag_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (ip_route_mask_flags,
+ ip_route_mask_flags_cmd,
+ "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
- argv[2], argv[3], NULL, argv[4], NULL);
-}
-
-/* Distance option value. */
-DEFUN (ip_route_distance_vrf,
- ip_route_distance_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL,
- NULL, argv[2], argv[3], NULL);
-}
-
-DEFUN (ip_route_tag_distance_vrf,
- ip_route_tag_distance_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL,
- argv[2], argv[3], argv[4], NULL);
-}
-
-DEFUN (ip_route_flags_distance_vrf,
- ip_route_flags_distance_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
- argv[2], NULL, argv[3], argv[4], NULL);
-}
-
-DEFUN (ip_route_flags_tag_distance_vrf,
- ip_route_flags_tag_distance_vrf_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
@@ -1409,189 +518,65 @@ DEFUN (ip_route_flags_tag_distance_vrf,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
- argv[2], argv[3], argv[4],argv[5], NULL);
-}
-
-DEFUN (ip_route_flags_distance2_vrf,
- ip_route_flags_distance2_vrf_cmd,
- "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1],
- NULL, argv[2], argv[3], NULL);
-}
-
-DEFUN (ip_route_flags_tag_distance2_vrf,
- ip_route_flags_tag_distance2_vrf_cmd,
- "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1],
- argv[2], argv[3], argv[4], NULL);
-}
-
-DEFUN (ip_route_mask_distance_vrf,
- ip_route_mask_distance_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, NULL, argv[3], argv[4], NULL);
-}
+ int idx_ipv4 = 2;
+ int idx_ipv4_2 = 3;
+ int idx_ipv4_ifname = 4;
+ int idx_reject_blackhole = 5;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (ip_route_mask_tag_distance_vrf,
- ip_route_mask_tag_distance_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, argv[3], argv[4], argv[5], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ip_route_mask_flags_tag_distance_vrf,
- ip_route_mask_flags_tag_distance_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5], argv[6], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ argv[idx_ipv4_ifname]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (ip_route_mask_flags_distance_vrf,
- ip_route_mask_flags_distance_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- argv[3], NULL, argv[4], argv[5], NULL);
-}
-
-DEFUN (ip_route_mask_flags_distance2_vrf,
- ip_route_mask_flags_distance2_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
+DEFUN (ip_route_mask_flags2,
+ ip_route_mask_flags2_cmd,
+ "ip route A.B.C.D A.B.C.D <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
- argv[2], NULL, argv[3], argv[4], NULL);
-}
-
-DEFUN (ip_route_mask_flags_tag_distance2_vrf,
- ip_route_mask_flags_tag_distance2_vrf_cmd,
- "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
- argv[2], argv[3], argv[4], argv[5], NULL);
-}
+ int idx_ipv4 = 2;
+ int idx_ipv4_2 = 3;
+ int idx_reject_blackhole = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_vrf,
- no_ip_route_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- NULL, NULL, argv[2], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_flags_vrf,
- no_ip_route_flags_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
- argv[2], NULL, NULL, argv[3], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_tag_vrf,
- no_ip_route_tag_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ip_route,
+ no_ip_route_cmd,
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1601,49 +586,30 @@ DEFUN (no_ip_route_tag_vrf,
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- argv[2], NULL, argv[3], NULL);
-}
+ int idx_ipv4_prefixlen = 3;
+ int idx_ipv4_ifname_null = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_flags_tag_vrf,
- no_ip_route_flags_tag_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
- argv[2], argv[3], NULL, argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_flags2_vrf,
- no_ip_route_flags2_vrf_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- NULL, NULL, argv[2], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ argv[idx_ipv4_ifname_null]->arg,
+ NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_flags2_tag_vrf,
- no_ip_route_flags2_tag_vrf_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ip_route_flags2,
+ no_ip_route_flags2_cmd,
+ "no ip route A.B.C.D/M <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1652,50 +618,27 @@ DEFUN (no_ip_route_flags2_tag_vrf,
"Silently discard pkts when matched\n"
"Tag of this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- argv[2], NULL, argv[3], NULL);
-}
+ int idx_ipv4_prefixlen = 3;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_mask_vrf,
- no_ip_route_mask_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, NULL, NULL, argv[3], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_mask_flags_vrf,
- no_ip_route_mask_flags_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- argv[3], NULL, NULL, argv[4], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL, NULL, NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_mask_tag_vrf,
- no_ip_route_mask_tag_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ip_route_mask,
+ no_ip_route_mask_cmd,
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1706,51 +649,31 @@ DEFUN (no_ip_route_mask_tag_vrf,
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, argv[3], NULL, argv[4], NULL);
-}
+ int idx_ipv4 = 3;
+ int idx_ipv4_2 = 4;
+ int idx_ipv4_ifname_null = 5;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_mask_flags_tag_vrf,
- no_ip_route_mask_flags_tag_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- argv[3], argv[4], NULL, argv[5], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_mask_flags2_vrf,
- no_ip_route_mask_flags2_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
- argv[2], NULL, NULL, argv[3], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ argv[idx_ipv4_ifname_null]->arg,
+ NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_mask_flags2_tag_vrf,
- no_ip_route_mask_flags2_tag_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ip_route_mask_flags2,
+ no_ip_route_mask_flags2_cmd,
+ "no ip route A.B.C.D A.B.C.D <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1760,70 +683,29 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf,
"Silently discard pkts when matched\n"
"Tag of this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
- argv[2], argv[3], NULL, argv[4], NULL);
-}
-
-
-DEFUN (no_ip_route_distance_vrf,
- no_ip_route_distance_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
"Distance value for this route\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- NULL, argv[2], argv[3], NULL);
-}
+ int idx_ipv4 = 3;
+ int idx_ipv4_2 = 4;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_tag_distance_vrf,
- no_ip_route_tag_distance_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- argv[2], argv[3], argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_flags_distance_vrf,
- no_ip_route_flags_distance_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
- argv[2], NULL, argv[3], argv[4], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ NULL, NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_flags_tag_distance_vrf,
- no_ip_route_flags_tag_distance_vrf_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (no_ip_route_flags,
+ no_ip_route_flags_cmd,
+ "no ip route A.B.C.D/M <A.B.C.D|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1835,106 +717,30 @@ DEFUN (no_ip_route_flags_tag_distance_vrf,
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
- argv[2], argv[3], argv[4],argv[5], NULL);
-}
-
-DEFUN (no_ip_route_flags_distance2_vrf,
- no_ip_route_flags_distance2_vrf_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- NULL, argv[2], argv[3], NULL);
-}
-
-DEFUN (no_ip_route_flags_tag_distance2_vrf,
- no_ip_route_flags_tag_distance2_vrf_cmd,
- "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- argv[2] , argv[3], argv[4], NULL);
-}
-
-DEFUN (no_ip_route_mask_distance_vrf,
- no_ip_route_mask_distance_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, NULL, argv[3], argv[4], NULL);
-}
+ int idx_ipv4_prefixlen = 3;
+ int idx_ipv4_ifname = 4;
+ int idx_reject_blackhole = 5;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_mask_tag_distance_vrf,
- no_ip_route_mask_tag_distance_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, argv[3], argv[4], argv[5], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_mask_flags_distance_vrf,
- no_ip_route_mask_flags_distance_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- argv[3], NULL, argv[4], argv[5], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ argv[idx_ipv4_ifname]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ip_route_mask_flags_tag_distance_vrf,
- no_ip_route_mask_flags_tag_distance_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (no_ip_route_mask_flags,
+ no_ip_route_mask_flags_cmd,
+ "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -1947,46 +753,26 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf,
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5], argv[6], NULL);
-}
+ int idx_ipv4 = 3;
+ int idx_ipv4_2 = 4;
+ int idx_ipv4_ifname = 5;
+ int idx_reject_blackhole = 6;
+ int idx_curr = 7;
+ char *tag, *distance, *vrf;
-DEFUN (no_ip_route_mask_flags_distance2_vrf,
- no_ip_route_mask_flags_distance2_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
- argv[2], NULL, argv[3], argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ip_route_mask_flags_tag_distance2_vrf,
- no_ip_route_mask_flags_tag_distance2_vrf_cmd,
- "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Tag of this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
- argv[2], argv[3], argv[4], argv[5], NULL);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 0,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ argv[idx_ipv4_ifname]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
/* New RIB. Detailed information for IPv4 route. */
@@ -2009,7 +795,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
? " using Multicast RIB"
: " using Unicast RIB";
}
-
+
vty_out (vty, "Routing entry for %s%s%s",
prefix2str (&rn->p, buf, sizeof(buf)), mcast_info,
VTY_NEWLINE);
@@ -2019,7 +805,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, "\"");
vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
if (rib->tag)
- vty_out (vty, ", tag %"ROUTE_TAG_PRI, rib->tag);
+ vty_out (vty, ", tag %d", rib->tag);
if (rib->mtu)
vty_out (vty, ", mtu %u", rib->mtu);
if (rib->vrf_id != VRF_DEFAULT)
@@ -2029,10 +815,6 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
}
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
vty_out (vty, ", best");
- else if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
- vty_out (vty, ", fib");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE))
- vty_out (vty, ", fib-override");
if (rib->refcnt)
vty_out (vty, ", refcnt %ld", rib->refcnt);
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
@@ -2057,13 +839,13 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, " Last update ");
if (uptime < ONE_DAY_SECOND)
- vty_out (vty, "%02d:%02d:%02d",
+ vty_out (vty, "%02d:%02d:%02d",
tm->tm_hour, tm->tm_min, tm->tm_sec);
else if (uptime < ONE_WEEK_SECOND)
- vty_out (vty, "%dd%02dh%02dm",
+ vty_out (vty, "%dd%02dh%02dm",
tm->tm_yday, tm->tm_hour, tm->tm_min);
else
- vty_out (vty, "%02dw%dd%02dh",
+ vty_out (vty, "%02dw%dd%02dh",
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
vty_out (vty, " ago%s", VTY_NEWLINE);
@@ -2136,15 +918,6 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
default:
break;
}
-
- /* Label information */
- if (nexthop->nh_label && nexthop->nh_label->num_labels)
- {
- vty_out (vty, " label %s",
- mpls_label2str (nexthop->nh_label->num_labels,
- nexthop->nh_label->label, buf, BUFSIZ));
- }
-
vty_out (vty, "%s", VTY_NEWLINE);
}
vty_out (vty, "%s", VTY_NEWLINE);
@@ -2309,14 +1082,13 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
len += vty_out (vty, "[%d]", rib->instance);
len += vty_out (vty, "%c%c %s",
CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
- ? '>' : CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB)
- ? '!' : ' ',
+ ? '>' : ' ',
CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
? '*' : ' ',
prefix2str (&rn->p, buf, sizeof buf));
/* Distance and metric display. */
- if (rib->type != ZEBRA_ROUTE_CONNECT
+ if (rib->type != ZEBRA_ROUTE_CONNECT
&& rib->type != ZEBRA_ROUTE_KERNEL)
len += vty_out (vty, " [%d/%d]", rib->distance,
rib->metric);
@@ -2386,14 +1158,6 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
break;
}
- /* Label information */
- if (nexthop->nh_label && nexthop->nh_label->num_labels)
- {
- vty_out (vty, " label %s",
- mpls_label2str (nexthop->nh_label->num_labels,
- nexthop->nh_label->label, buf, BUFSIZ));
- }
-
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
vty_out (vty, ", bh");
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
@@ -2413,13 +1177,13 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
tm = gmtime (&uptime);
if (uptime < ONE_DAY_SECOND)
- vty_out (vty, ", %02d:%02d:%02d",
+ vty_out (vty, ", %02d:%02d:%02d",
tm->tm_hour, tm->tm_min, tm->tm_sec);
else if (uptime < ONE_WEEK_SECOND)
- vty_out (vty, ", %dd%02dh%02dm",
+ vty_out (vty, ", %dd%02dh%02dm",
tm->tm_yday, tm->tm_hour, tm->tm_min);
else
- vty_out (vty, ", %02dw%dd%02dh",
+ vty_out (vty, ", %02dw%dd%02dh",
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
}
@@ -2429,10 +1193,11 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
DEFUN (show_ip_route,
show_ip_route_cmd,
- "show ip route {json}",
+ "show ip route [json]",
SHOW_STR
IP_STR
- "IP routing table\n")
+ "IP routing table\n"
+ "JavaScript Object Notation\n")
{
return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv));
}
@@ -2523,47 +1288,41 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
DEFUN (show_ip_route_vrf,
show_ip_route_vrf_cmd,
- "show ip route " VRF_CMD_STR " {json}",
+ "show ip route vrf NAME [json]",
SHOW_STR
IP_STR
"IP routing table\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "JavaScript Object Notation\n")
{
+ int idx_vrf = 4;
u_char uj = use_json(argc, argv);
- if (argc == 1 && uj)
- return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj);
- else
- return do_show_ip_route (vty, argv[0], SAFI_UNICAST, uj);
+ return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uj);
}
DEFUN (show_ip_nht,
show_ip_nht_cmd,
- "show ip nht",
+ "show ip nht [vrf NAME]",
SHOW_STR
IP_STR
- "IP nexthop tracking table\n")
+ "IP nexthop tracking table\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_vrf = 4;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (argc == 5)
+ VRF_GET_ID (vrf_id, argv[idx_vrf]->arg);
zebra_print_rnh_table(vrf_id, AF_INET, vty, RNH_NEXTHOP_TYPE);
return CMD_SUCCESS;
}
-ALIAS (show_ip_nht,
- show_ip_nht_vrf_cmd,
- "show ip nht " VRF_CMD_STR,
- SHOW_STR
- IP_STR
- "IP nexthop tracking table\n"
- VRF_CMD_HELP_STR)
DEFUN (show_ip_nht_vrf_all,
show_ip_nht_vrf_all_cmd,
- "show ip nht " VRF_ALL_CMD_STR,
+ "show ip nht vrf all",
SHOW_STR
IP_STR
"IP nexthop tracking table\n"
@@ -2584,31 +1343,26 @@ DEFUN (show_ip_nht_vrf_all,
DEFUN (show_ipv6_nht,
show_ipv6_nht_cmd,
- "show ipv6 nht",
+ "show ipv6 nht [vrf NAME]",
SHOW_STR
IPV6_STR
- "IPv6 nexthop tracking table\n")
+ "IPv6 nexthop tracking table\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_vrf = 4;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (argc == 5)
+ VRF_GET_ID (vrf_id, argv[idx_vrf]->arg);
zebra_print_rnh_table(vrf_id, AF_INET6, vty, RNH_NEXTHOP_TYPE);
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_nht,
- show_ipv6_nht_vrf_cmd,
- "show ipv6 nht " VRF_CMD_STR,
- SHOW_STR
- IPV6_STR
- "IPv6 nexthop tracking table\n"
- VRF_CMD_HELP_STR)
DEFUN (show_ipv6_nht_vrf_all,
show_ipv6_nht_vrf_all_cmd,
- "show ipv6 nht " VRF_ALL_CMD_STR,
+ "show ipv6 nht vrf all",
SHOW_STR
IP_STR
"IPv6 nexthop tracking table\n"
@@ -2691,13 +1445,17 @@ DEFUN (no_ipv6_nht_default_route,
DEFUN (show_ip_route_tag,
show_ip_route_tag_cmd,
- "show ip route tag <1-4294967295>",
+ "show ip route [vrf NAME] tag (1-4294967295)",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_vrf = 3;
+ int idx_name = 4;
+ int idx_tag = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -2705,13 +1463,16 @@ DEFUN (show_ip_route_tag,
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[idx_vrf]->text, "vrf"))
{
- tag = atol(argv[1]);
- VRF_GET_ID (vrf_id, argv[0]);
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
+ tag = atol(argv[idx_tag]->arg);
}
else
- tag = atol(argv[0]);
+ {
+ idx_tag -= 2;
+ tag = atol(argv[idx_tag]->arg);
+ }
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
if (! table)
@@ -2734,22 +1495,13 @@ DEFUN (show_ip_route_tag,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_tag,
- show_ip_route_vrf_tag_cmd,
- "show ip route " VRF_CMD_STR " tag <1-4294967295>",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-
DEFUN (show_ip_route_prefix_longer,
show_ip_route_prefix_longer_cmd,
- "show ip route A.B.C.D/M longer-prefixes",
+ "show ip route [vrf NAME] A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Show route matching the specified Network/Mask pair only\n")
{
@@ -2761,13 +1513,15 @@ DEFUN (show_ip_route_prefix_longer,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- ret = str2prefix (argv[1], &p);
- VRF_GET_ID (vrf_id, argv[0]);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix (argv[5]->arg, &p);
}
else
- ret = str2prefix (argv[0], &p);
+ {
+ ret = str2prefix (argv[3]->arg, &p);
+ }
if (! ret)
{
@@ -2794,22 +1548,13 @@ DEFUN (show_ip_route_prefix_longer,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_prefix_longer,
- show_ip_route_vrf_prefix_longer_cmd,
- "show ip route " VRF_CMD_STR " A.B.C.D/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Show route matching the specified Network/Mask pair only\n")
-
DEFUN (show_ip_route_supernets,
show_ip_route_supernets_cmd,
- "show ip route supernets-only",
+ "show ip route [vrf NAME] supernets-only",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Show supernet entries only\n")
{
struct route_table *table;
@@ -2819,8 +1564,8 @@ DEFUN (show_ip_route_supernets,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
if (! table)
@@ -2847,21 +1592,13 @@ DEFUN (show_ip_route_supernets,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_supernets,
- show_ip_route_vrf_supernets_cmd,
- "show ip route " VRF_CMD_STR " supernets-only",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Show supernet entries only\n")
-
DEFUN (show_ip_route_protocol,
show_ip_route_protocol_cmd,
- "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
+ "show ip route [vrf NAME] <kernel|connected|static|rip|ospf|isis|bgp|pim|table>",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
{
int type;
@@ -2871,13 +1608,15 @@ DEFUN (show_ip_route_protocol,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- type = proto_redistnum (AFI_IP, argv[1]);
- VRF_GET_ID (vrf_id, argv[0]);
- }
+ type = proto_redistnum (AFI_IP, argv[5]->arg);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ }
else
- type = proto_redistnum (AFI_IP, argv[0]);
+ {
+ type = proto_redistnum (AFI_IP, argv[3]->arg);
+ }
if (type < 0)
{
@@ -2904,31 +1643,24 @@ DEFUN (show_ip_route_protocol,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_protocol,
- show_ip_route_vrf_protocol_cmd,
- "show ip route " VRF_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
DEFUN (show_ip_route_ospf_instance,
show_ip_route_ospf_instance_cmd,
- "show ip route ospf <1-65535>",
+ "show ip route ospf (1-65535)",
SHOW_STR
IP_STR
"IP routing table\n"
"Open Shortest Path First (OSPFv2)\n"
"Instance ID\n")
{
+ int idx_number = 4;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
int first = 1;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[0]);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
@@ -2951,10 +1683,11 @@ DEFUN (show_ip_route_ospf_instance,
DEFUN (show_ip_route_addr,
show_ip_route_addr_cmd,
- "show ip route A.B.C.D",
+ "show ip route [vrf NAME] A.B.C.D",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Network in the IP routing table to display\n")
{
int ret;
@@ -2963,13 +1696,15 @@ DEFUN (show_ip_route_addr,
struct route_node *rn;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix_ipv4 (argv[1], &p);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix_ipv4 (argv[5]->arg, &p);
}
else
- ret = str2prefix_ipv4 (argv[0], &p);
+ {
+ ret = str2prefix_ipv4 (argv[3]->arg, &p);
+ }
if (ret <= 0)
{
@@ -2995,21 +1730,13 @@ DEFUN (show_ip_route_addr,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_addr,
- show_ip_route_vrf_addr_cmd,
- "show ip route " VRF_CMD_STR " A.B.C.D",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Network in the IP routing table to display\n")
-
DEFUN (show_ip_route_prefix,
show_ip_route_prefix_cmd,
- "show ip route A.B.C.D/M",
+ "show ip route [vrf NAME] A.B.C.D/M",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
int ret;
@@ -3018,13 +1745,15 @@ DEFUN (show_ip_route_prefix,
struct route_node *rn;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix_ipv4 (argv[1], &p);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix_ipv4 (argv[5]->arg, &p);
}
else
- ret = str2prefix_ipv4 (argv[0], &p);
+ {
+ ret = str2prefix_ipv4 (argv[3]->arg, &p);
+ }
if (ret <= 0)
{
@@ -3050,14 +1779,6 @@ DEFUN (show_ip_route_prefix,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_prefix,
- show_ip_route_vrf_prefix_cmd,
- "show ip route " VRF_CMD_STR " A.B.C.D/M",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
static void
vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
@@ -3211,17 +1932,18 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
/* Show route summary. */
DEFUN (show_ip_route_summary,
show_ip_route_summary_cmd,
- "show ip route summary",
+ "show ip route [vrf NAME] summary",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Summary of all routes\n")
{
struct route_table *table;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
if (! table)
@@ -3232,30 +1954,22 @@ DEFUN (show_ip_route_summary,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_summary,
- show_ip_route_vrf_summary_cmd,
- "show ip route " VRF_CMD_STR " summary",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Summary of all routes\n")
-
/* Show route summary prefix. */
DEFUN (show_ip_route_summary_prefix,
show_ip_route_summary_prefix_cmd,
- "show ip route summary prefix",
+ "show ip route [vrf NAME] summary prefix",
SHOW_STR
IP_STR
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Summary of all routes\n"
"Prefix routes\n")
{
struct route_table *table;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
if (! table)
@@ -3266,19 +1980,10 @@ DEFUN (show_ip_route_summary_prefix,
return CMD_SUCCESS;
}
-ALIAS (show_ip_route_summary_prefix,
- show_ip_route_vrf_summary_prefix_cmd,
- "show ip route " VRF_CMD_STR " summary prefix",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Summary of all routes\n"
- "Prefix routes\n")
DEFUN (show_ip_route_vrf_all,
show_ip_route_vrf_all_cmd,
- "show ip route " VRF_ALL_CMD_STR,
+ "show ip route vrf all",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3323,7 +2028,7 @@ DEFUN (show_ip_route_vrf_all,
DEFUN (show_ip_route_vrf_all_tag,
show_ip_route_vrf_all_tag_cmd,
- "show ip route " VRF_ALL_CMD_STR " tag <1-4294967295>",
+ "show ip route vrf all tag (1-4294967295)",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3331,6 +2036,7 @@ DEFUN (show_ip_route_vrf_all_tag,
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_number = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -3340,8 +2046,8 @@ DEFUN (show_ip_route_vrf_all_tag,
int vrf_header = 1;
route_tag_t tag = 0;
- if (argv[0])
- tag = atol(argv[0]);
+ if (argv[idx_number]->arg)
+ tag = atol(argv[idx_number]->arg);
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
{
@@ -3376,7 +2082,7 @@ DEFUN (show_ip_route_vrf_all_tag,
DEFUN (show_ip_route_vrf_all_prefix_longer,
show_ip_route_vrf_all_prefix_longer_cmd,
- "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes",
+ "show ip route vrf all A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3384,6 +2090,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer,
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Show route matching the specified Network/Mask pair only\n")
{
+ int idx_ipv4_prefixlen = 5;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -3394,7 +2101,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer,
int first = 1;
int vrf_header = 1;
- ret = str2prefix (argv[0], &p);
+ ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p);
if (! ret)
{
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
@@ -3433,7 +2140,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer,
DEFUN (show_ip_route_vrf_all_supernets,
show_ip_route_vrf_all_supernets_cmd,
- "show ip route " VRF_ALL_CMD_STR " supernets-only",
+ "show ip route vrf all supernets-only",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3470,7 +2177,6 @@ DEFUN (show_ip_route_vrf_all_supernets,
vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
-
if (vrf_header)
{
vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf->name, VTY_NEWLINE);
@@ -3487,7 +2193,7 @@ DEFUN (show_ip_route_vrf_all_supernets,
DEFUN (show_ip_route_vrf_all_protocol,
show_ip_route_vrf_all_protocol_cmd,
- "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA,
+ "show ip route vrf all <kernel|connected|static|rip|ospf|isis|bgp|pim|table>",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3503,7 +2209,7 @@ DEFUN (show_ip_route_vrf_all_protocol,
int first = 1;
int vrf_header = 1;
- type = proto_redistnum (AFI_IP, argv[0]);
+ type = proto_redistnum (AFI_IP, argv[6]->arg);
if (type < 0)
{
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
@@ -3542,13 +2248,14 @@ DEFUN (show_ip_route_vrf_all_protocol,
DEFUN (show_ip_route_vrf_all_addr,
show_ip_route_vrf_all_addr_cmd,
- "show ip route " VRF_ALL_CMD_STR " A.B.C.D",
+ "show ip route vrf all A.B.C.D",
SHOW_STR
IP_STR
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"Network in the IP routing table to display\n")
{
+ int idx_ipv4 = 5;
int ret;
struct prefix_ipv4 p;
struct route_table *table;
@@ -3556,7 +2263,7 @@ DEFUN (show_ip_route_vrf_all_addr,
struct zebra_vrf *zvrf;
vrf_iter_t iter;
- ret = str2prefix_ipv4 (argv[0], &p);
+ ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p);
if (ret <= 0)
{
vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
@@ -3583,13 +2290,14 @@ DEFUN (show_ip_route_vrf_all_addr,
DEFUN (show_ip_route_vrf_all_prefix,
show_ip_route_vrf_all_prefix_cmd,
- "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M",
+ "show ip route vrf all A.B.C.D/M",
SHOW_STR
IP_STR
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
+ int idx_ipv4_prefixlen = 5;
int ret;
struct prefix_ipv4 p;
struct route_table *table;
@@ -3597,7 +2305,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
struct zebra_vrf *zvrf;
vrf_iter_t iter;
- ret = str2prefix_ipv4 (argv[0], &p);
+ ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p);
if (ret <= 0)
{
vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
@@ -3629,7 +2337,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
DEFUN (show_ip_route_vrf_all_summary,
show_ip_route_vrf_all_summary_cmd,
- "show ip route " VRF_ALL_CMD_STR " summary ",
+ "show ip route vrf all summary ",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3648,7 +2356,7 @@ DEFUN (show_ip_route_vrf_all_summary,
DEFUN (show_ip_route_vrf_all_summary_prefix,
show_ip_route_vrf_all_summary_prefix_cmd,
- "show ip route " VRF_ALL_CMD_STR " summary prefix",
+ "show ip route vrf all summary prefix",
SHOW_STR
IP_STR
"IP routing table\n"
@@ -3737,10 +2445,10 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
/* General fucntion for IPv6 static route. */
int
static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
- const char *gate_str, const char *ifname,
- const char *flag_str, const char *tag_str,
+ const char *gate_str, const char *ifname,
+ const char *flag_str, const char *tag_str,
const char *distance_str, const char *vrf_id_str,
- const char *label_str)
+ const char *label_str)
{
int ret;
u_char distance;
@@ -3754,7 +2462,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
struct interface *ifp = NULL;
struct zebra_vrf *zvrf;
struct static_nh_label snh_label;
-
+
ret = str2prefix (dest_str, &p);
if (ret <= 0)
{
@@ -3793,11 +2501,11 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
if (label_str)
{
if (!mpls_enabled)
- {
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
if (mpls_str2label (label_str, &snh_label.num_labels,
snh_label.label))
{
@@ -3816,10 +2524,10 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
}
if (add_cmd)
static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, ifindex, ifname,
- ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
+ ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, ifindex, tag,
- distance, zvrf, &snh_label);
+ distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -3845,633 +2553,87 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
/* When ifname is specified. It must be come with gateway
address. */
if (ret != 1)
- {
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
type = STATIC_IPV6_GATEWAY_IFINDEX;
gate = &gate_addr;
ifp = if_lookup_by_name_vrf (ifname, zvrf->vrf_id);
if (!ifp)
- {
- vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
ifindex = ifp->ifindex;
}
else
{
if (ret == 1)
- {
- type = STATIC_IPV6_GATEWAY;
- gate = &gate_addr;
- }
+ {
+ type = STATIC_IPV6_GATEWAY;
+ gate = &gate_addr;
+ }
else
- {
- type = STATIC_IFINDEX;
- ifp = if_lookup_by_name_vrf (gate_str, zvrf->vrf_id);
- if (!ifp)
- {
- vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
+ {
+ type = STATIC_IFINDEX;
+ ifp = if_lookup_by_name_vrf (gate_str, zvrf->vrf_id);
+ if (!ifp)
+ {
+ vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
ifindex = IFINDEX_DELETED;
- }
+ }
else
- ifindex = ifp->ifindex;
- ifname = gate_str;
- }
+ ifindex = ifp->ifindex;
+ ifname = gate_str;
+ }
}
if (add_cmd)
static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, (union g_addr *)gate,
- ifindex, ifname, flag, tag, distance, zvrf, &snh_label);
+ ifindex, ifname, flag, tag, distance, zvrf, &snh_label);
else
static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, (union g_addr *)gate,
- ifindex, tag, distance, zvrf, &snh_label);
+ ifindex, tag, distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
DEFUN (ipv6_route,
ipv6_route_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0)",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_tag,
- ipv6_route_tag_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_flags,
- ipv6_route_flags_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_flags_tag,
- ipv6_route_flags_tag_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname,
- ipv6_route_ifname_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, NULL);
-}
-DEFUN (ipv6_route_ifname_tag,
- ipv6_route_ifname_tag_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_flags,
- ipv6_route_ifname_flags_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_flags_tag,
- ipv6_route_ifname_flags_tag_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL, NULL);
-}
-
-DEFUN (ipv6_route_pref,
- ipv6_route_pref_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) <1-255>",
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Null interface\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, NULL);
-}
-
-DEFUN (ipv6_route_pref_tag,
- ipv6_route_pref_tag_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, NULL);
-}
-
-DEFUN (ipv6_route_flags_pref,
- ipv6_route_flags_pref_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL, NULL);
-}
-
-DEFUN (ipv6_route_flags_pref_tag,
- ipv6_route_flags_pref_tag_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_pref,
- ipv6_route_ifname_pref_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_pref_tag,
- ipv6_route_ifname_pref_tag_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_flags_pref,
- ipv6_route_ifname_flags_pref_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL, NULL);
-}
-
-DEFUN (ipv6_route_ifname_flags_pref_tag,
- ipv6_route_ifname_flags_pref_tag_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>",
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route,
- no_ipv6_route_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null Interface\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_tag,
- no_ipv6_route_tag_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_flags,
- no_ipv6_route_flags_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_flags_tag,
- no_ipv6_route_flags_tag_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname,
- no_ipv6_route_ifname_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_tag,
- no_ipv6_route_ifname_tag_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags,
- no_ipv6_route_ifname_flags_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags_tag,
- no_ipv6_route_ifname_flags_tag_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_pref,
- no_ipv6_route_pref_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_pref_tag,
- no_ipv6_route_pref_tag_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_flags_pref,
- no_ipv6_route_flags_pref_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n")
-{
- /* We do not care about argv[2] */
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_flags_pref_tag,
- no_ipv6_route_flags_pref_tag_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- /* We do not care about argv[2] */
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_pref,
- no_ipv6_route_ifname_pref_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_pref_tag,
- no_ipv6_route_ifname_pref_tag_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags_pref,
- no_ipv6_route_ifname_flags_pref_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL, NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags_pref_tag,
- no_ipv6_route_ifname_flags_pref_tag_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n")
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL, NULL);
-}
-
-DEFUN (ipv6_route_vrf,
- ipv6_route_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2], NULL);
-}
-
-DEFUN (ipv6_route_tag_vrf,
- ipv6_route_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3], NULL);
-}
-
-DEFUN (ipv6_route_flags_vrf,
- ipv6_route_flags_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this prefix\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6_ifname = 3;
+ int idx_curr = 4;
+ char *tag, *distance, *vrf;
-DEFUN (ipv6_route_flags_tag_vrf,
- ipv6_route_flags_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ipv6_route_ifname_vrf,
- ipv6_route_ifname_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3], NULL);
-}
-DEFUN (ipv6_route_ifname_tag_vrf,
- ipv6_route_ifname_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4], NULL);
+ return static_ipv6_func (vty, 1,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6_ifname]->arg,
+ NULL, NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (ipv6_route_ifname_flags_vrf,
- ipv6_route_ifname_flags_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
+DEFUN (ipv6_route_flags,
+ ipv6_route_flags_cmd,
+ "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -4479,143 +2641,66 @@ DEFUN (ipv6_route_ifname_flags_vrf,
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4], NULL);
-}
-
-DEFUN (ipv6_route_ifname_flags_tag_vrf,
- ipv6_route_ifname_flags_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5], NULL);
-}
-
-DEFUN (ipv6_route_pref_vrf,
- ipv6_route_pref_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6_ifname = 3;
+ int idx_reject_blackhole = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (ipv6_route_pref_tag_vrf,
- ipv6_route_pref_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ipv6_route_flags_pref_vrf,
- ipv6_route_flags_pref_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4], NULL);
+ return static_ipv6_func (vty, 1,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6_ifname]->arg,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (ipv6_route_flags_pref_tag_vrf,
- ipv6_route_flags_pref_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (ipv6_route_ifname,
+ ipv6_route_ifname_cmd,
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5], NULL);
-}
-
-DEFUN (ipv6_route_ifname_pref_vrf,
- ipv6_route_ifname_pref_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6 = 3;
+ int idx_interface = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (ipv6_route_ifname_pref_tag_vrf,
- ipv6_route_ifname_pref_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (ipv6_route_ifname_flags_pref_vrf,
- ipv6_route_ifname_flags_pref_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5], NULL);
+ return static_ipv6_func (vty, 1,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (ipv6_route_ifname_flags_pref_tag_vrf,
- ipv6_route_ifname_flags_pref_tag_vrf_cmd,
- "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (ipv6_route_ifname_flags,
+ ipv6_route_ifname_flags_cmd,
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -4626,29 +2711,31 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6 = 3;
+ int idx_interface = 4;
+ int idx_reject_blackhole = 5;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (no_ipv6_route_vrf,
- no_ipv6_route_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2], NULL);
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
+
+ return static_ipv6_func (vty, 1,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ipv6_route_tag_vrf,
- no_ipv6_route_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ipv6_route,
+ no_ipv6_route_cmd,
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE|null0> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -4658,94 +2745,29 @@ DEFUN (no_ipv6_route_tag_vrf,
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
+ "Distance value for this prefix\n"
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3], NULL);
-}
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6_ifname = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (no_ipv6_route_flags_vrf,
- no_ipv6_route_flags_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ipv6_route_flags_tag_vrf,
- no_ipv6_route_flags_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4], NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_vrf,
- no_ipv6_route_ifname_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3], NULL);
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6_ifname]->arg,
+ NULL, NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ipv6_route_ifname_tag_vrf,
- no_ipv6_route_ifname_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4], NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags_vrf,
- no_ipv6_route_ifname_flags_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4], NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_flags_tag_vrf,
- no_ipv6_route_ifname_flags_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> " VRF_CMD_STR,
+DEFUN (no_ipv6_route_flags,
+ no_ipv6_route_flags_cmd,
+ "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -4756,135 +2778,64 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf,
"Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5], NULL);
-}
-
-DEFUN (no_ipv6_route_pref_vrf,
- no_ipv6_route_pref_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3], NULL);
-}
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6_ifname = 4;
+ int idx_reject_blackhole = 5;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-DEFUN (no_ipv6_route_pref_tag_vrf,
- no_ipv6_route_pref_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE|null0) tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ipv6_route_flags_pref_vrf,
- no_ipv6_route_flags_pref_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- /* We do not care about argv[2] */
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4], NULL);
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6_ifname]->arg,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ipv6_route_flags_pref_tag_vrf,
- no_ipv6_route_flags_pref_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (no_ipv6_route_ifname,
+ no_ipv6_route_ifname_cmd,
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- /* We do not care about argv[2] */
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5], NULL);
-}
-
-DEFUN (no_ipv6_route_ifname_pref_vrf,
- no_ipv6_route_ifname_pref_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4], NULL);
-}
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6 = 4;
+ int idx_interface = 5;
+ int idx_curr = 6;
+ char *tag, *distance, *vrf;
-DEFUN (no_ipv6_route_ifname_pref_tag_vrf,
- no_ipv6_route_ifname_pref_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5], NULL);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-DEFUN (no_ipv6_route_ifname_flags_pref_vrf,
- no_ipv6_route_ifname_flags_pref_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5], NULL);
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ NULL,
+ tag, distance, vrf, NULL);
}
-DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf,
- no_ipv6_route_ifname_flags_pref_tag_vrf_cmd,
- "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255> " VRF_CMD_STR,
+DEFUN (no_ipv6_route_ifname_flags,
+ no_ipv6_route_ifname_flags_cmd,
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
NO_STR
IP_STR
"Establish static routes\n"
@@ -4896,17 +2847,36 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "Specify labels for this route\n"
+ "One or more labels separated by '/'\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], NULL);
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6 = 4;
+ int idx_interface = 5;
+ int idx_reject_blackhole = 6;
+ int idx_curr = 7;
+ char *tag, *distance, *vrf;
+
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
+
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
}
DEFUN (show_ipv6_route,
show_ipv6_route_cmd,
- "show ipv6 route {json}",
+ "show ipv6 route [vrf NAME] [json]",
SHOW_STR
IP_STR
- "IPv6 routing table\n")
+ "IPv6 routing table\n"
+ VRF_CMD_HELP_STR
+ "Output JSON\n")
{
struct route_table *table;
struct route_node *rn;
@@ -4917,33 +2887,36 @@ DEFUN (show_ipv6_route,
char buf[BUFSIZ];
json_object *json = NULL;
json_object *json_prefix = NULL;
- u_char uj = use_json(argc, argv);
- if (argc > 0 && argv[0] && strcmp(argv[0], "json") != 0)
- {
- if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0])))
- {
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- else
- vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE);
- return CMD_SUCCESS;
- }
+ int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf"));
+ int uj = vrf ? argc == 6 : argc == 4;
+ char *vrfname = vrf ? argv[4]->arg : NULL;
- if (zvrf->vrf_id == VRF_UNKNOWN)
- {
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- else
- vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- else
- vrf_id = zvrf->vrf_id;
- }
+ if (vrf)
+ {
+ if (!(zvrf = zebra_vrf_list_lookup_by_name (vrfname)))
+ {
+ if (uj)
+ vty_out (vty, "{}%s", VTY_NEWLINE);
+ else
+ vty_out (vty, "vrf %s not defined%s", vrfname, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ if (zvrf->vrf_id == VRF_UNKNOWN)
+ {
+ if (uj)
+ vty_out (vty, "{}%s", VTY_NEWLINE);
+ else
+ vty_out (vty, "vrf %s inactive%s", vrfname, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+ else
+ vrf_id = zvrf->vrf_id;
+ }
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
+ if (!table)
{
if (uj)
vty_out (vty, "{}%s", VTY_NEWLINE);
@@ -4995,23 +2968,19 @@ DEFUN (show_ipv6_route,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route,
- show_ipv6_route_vrf_cmd,
- "show ipv6 route " VRF_CMD_STR " {json}",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR)
-
DEFUN (show_ipv6_route_tag,
show_ipv6_route_tag_cmd,
- "show ipv6 route tag <1-4294967295>",
+ "show ipv6 route [vrf NAME] tag (1-4294967295)",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_vrf = 3;
+ int idx_name = 4;
+ int idx_tag = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -5019,13 +2988,16 @@ DEFUN (show_ipv6_route_tag,
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[idx_vrf]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- tag = atol(argv[1]);
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
+ tag = atol(argv[idx_tag]->arg);
}
else
- tag = atol(argv[0]);
+ {
+ idx_tag -= 2;
+ tag = atol(argv[idx_tag]->arg);
+ }
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
if (! table)
@@ -5048,22 +3020,13 @@ DEFUN (show_ipv6_route_tag,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_tag,
- show_ipv6_route_vrf_tag_cmd,
- "show ipv6 route " VRF_CMD_STR " tag <1-4294967295>",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-
DEFUN (show_ipv6_route_prefix_longer,
show_ipv6_route_prefix_longer_cmd,
- "show ipv6 route X:X::X:X/M longer-prefixes",
+ "show ipv6 route [vrf NAME] X:X::X:X/M longer-prefixes",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"IPv6 prefix\n"
"Show route matching the specified Network/Mask pair only\n")
{
@@ -5075,13 +3038,15 @@ DEFUN (show_ipv6_route_prefix_longer,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix (argv[1], &p);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix (argv[5]->arg, &p);
}
else
- ret = str2prefix (argv[0], &p);
+ {
+ ret = str2prefix (argv[3]->arg, &p);
+ }
if (! ret)
{
@@ -5108,23 +3073,14 @@ DEFUN (show_ipv6_route_prefix_longer,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_prefix_longer,
- show_ipv6_route_vrf_prefix_longer_cmd,
- "show ipv6 route " VRF_CMD_STR " X:X::X:X/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "IPv6 prefix\n"
- "Show route matching the specified Network/Mask pair only\n")
-
DEFUN (show_ipv6_route_protocol,
show_ipv6_route_protocol_cmd,
- "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
+ "show ipv6 route [vrf NAME] <kernel|connected|static|ripng|ospf6|isis|bgp|table>",
SHOW_STR
IP_STR
"IP routing table\n"
- QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
+ VRF_CMD_HELP_STR
+ QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
{
int type;
struct route_table *table;
@@ -5133,13 +3089,16 @@ DEFUN (show_ipv6_route_protocol,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if ( argc >1 )
+ char *vrfname = (argc == 6) ? argv[4]->arg : NULL;
+ char *proto = argv[argc - 1]->text;
+
+ if (vrfname)
{
- VRF_GET_ID (vrf_id, argv[0]);
- type = proto_redistnum (AFI_IP6, argv[1]);
+ VRF_GET_ID (vrf_id, vrfname);
+ type = proto_redistnum (AFI_IP6, proto);
}
else
- type = proto_redistnum (AFI_IP6, argv[0]);
+ type = proto_redistnum (AFI_IP6, proto);
if (type < 0)
{
@@ -5166,21 +3125,13 @@ DEFUN (show_ipv6_route_protocol,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_protocol,
- show_ipv6_route_vrf_protocol_cmd,
- "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
-
DEFUN (show_ipv6_route_addr,
show_ipv6_route_addr_cmd,
- "show ipv6 route X:X::X:X",
+ "show ipv6 route [vrf NAME] X:X::X:X",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"IPv6 Address\n")
{
int ret;
@@ -5189,13 +3140,15 @@ DEFUN (show_ipv6_route_addr,
struct route_node *rn;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1 )
+ if (strmatch(argv[3]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix_ipv6 (argv[1], &p);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix_ipv6 (argv[5]->arg, &p);
}
else
- ret = str2prefix_ipv6 (argv[0], &p);
+ {
+ ret = str2prefix_ipv6 (argv[3]->arg, &p);
+ }
if (ret <= 0)
{
@@ -5221,21 +3174,13 @@ DEFUN (show_ipv6_route_addr,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_addr,
- show_ipv6_route_vrf_addr_cmd,
- "show ipv6 route " VRF_CMD_STR " X:X::X:X",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "IPv6 Address\n")
-
DEFUN (show_ipv6_route_prefix,
show_ipv6_route_prefix_cmd,
- "show ipv6 route X:X::X:X/M",
+ "show ipv6 route [vrf NAME] X:X::X:X/M",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"IPv6 prefix\n")
{
int ret;
@@ -5244,13 +3189,13 @@ DEFUN (show_ipv6_route_prefix,
struct route_node *rn;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 1)
+ if (strmatch(argv[3]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix_ipv6 (argv[1], &p);
+ VRF_GET_ID (vrf_id, argv[4]->arg);
+ ret = str2prefix_ipv6 (argv[5]->arg, &p);
}
else
- ret = str2prefix_ipv6 (argv[0], &p);
+ ret = str2prefix_ipv6 (argv[3]->arg, &p);
if (ret <= 0)
{
@@ -5276,29 +3221,22 @@ DEFUN (show_ipv6_route_prefix,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_prefix,
- show_ipv6_route_vrf_prefix_cmd,
- "show ipv6 route " VRF_CMD_STR " X:X::X:X/M ",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "IPv6 prefix\n")
/* Show route summary. */
DEFUN (show_ipv6_route_summary,
show_ipv6_route_summary_cmd,
- "show ipv6 route summary",
+ "show ipv6 route [vrf NAME] summary",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"Summary of all IPv6 routes\n")
{
struct route_table *table;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
if (! table)
@@ -5309,30 +3247,23 @@ DEFUN (show_ipv6_route_summary,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_summary,
- show_ipv6_route_vrf_summary_cmd,
- "show ipv6 route " VRF_CMD_STR " summary",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "Summary of all IPv6 routes\n")
/* Show ipv6 route summary prefix. */
DEFUN (show_ipv6_route_summary_prefix,
show_ipv6_route_summary_prefix_cmd,
- "show ipv6 route summary prefix",
+ "show ipv6 route [vrf NAME] summary prefix",
SHOW_STR
IP_STR
"IPv6 routing table\n"
+ VRF_CMD_HELP_STR
"Summary of all IPv6 routes\n"
"Prefix routes\n")
{
struct route_table *table;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
if (! table)
@@ -5343,27 +3274,18 @@ DEFUN (show_ipv6_route_summary_prefix,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_summary_prefix,
- show_ipv6_route_vrf_summary_prefix_cmd,
- "show ipv6 route " VRF_CMD_STR " summary prefix",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "Summary of all IPv6 routes\n"
- "Prefix routes\n")
/*
* Show IPv6 mroute command.Used to dump
* the Multicast routing table.
*/
-
DEFUN (show_ipv6_mroute,
show_ipv6_mroute_cmd,
- "show ipv6 mroute",
+ "show ipv6 mroute [vrf NAME]",
SHOW_STR
IP_STR
- "IPv6 Multicast routing table\n")
+ "IPv6 Multicast routing table\n"
+ VRF_CMD_HELP_STR)
{
struct route_table *table;
struct route_node *rn;
@@ -5371,8 +3293,8 @@ DEFUN (show_ipv6_mroute,
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[3]->text, "vrf"))
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
if (! table)
@@ -5392,17 +3314,10 @@ DEFUN (show_ipv6_mroute,
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_mroute,
- show_ipv6_mroute_vrf_cmd,
- "show ipv6 mroute " VRF_CMD_STR,
- SHOW_STR
- IP_STR
- "IPv6 Multicast routing table\n"
- VRF_CMD_HELP_STR)
DEFUN (show_ipv6_route_vrf_all,
show_ipv6_route_vrf_all_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR,
+ "show ipv6 route vrf all",
SHOW_STR
IP_STR
"IPv6 routing table\n"
@@ -5447,7 +3362,7 @@ DEFUN (show_ipv6_route_vrf_all,
DEFUN (show_ipv6_route_vrf_all_tag,
show_ipv6_route_vrf_all_tag_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " tag <1-4294967295>",
+ "show ipv6 route vrf all tag (1-4294967295)",
SHOW_STR
IP_STR
"IPv6 routing table\n"
@@ -5455,6 +3370,7 @@ DEFUN (show_ipv6_route_vrf_all_tag,
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_number = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -5464,8 +3380,8 @@ DEFUN (show_ipv6_route_vrf_all_tag,
int vrf_header = 1;
route_tag_t tag = 0;
- if (argv[0])
- tag = atol(argv[0]);
+ if (argv[idx_number]->arg)
+ tag = atol(argv[idx_number]->arg);
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
{
@@ -5501,7 +3417,7 @@ DEFUN (show_ipv6_route_vrf_all_tag,
DEFUN (show_ipv6_route_vrf_all_prefix_longer,
show_ipv6_route_vrf_all_prefix_longer_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes",
+ "show ipv6 route vrf all X:X::X:X/M longer-prefixes",
SHOW_STR
IP_STR
"IPv6 routing table\n"
@@ -5509,6 +3425,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer,
"IPv6 prefix\n"
"Show route matching the specified Network/Mask pair only\n")
{
+ int idx_ipv6_prefixlen = 5;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
@@ -5519,7 +3436,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer,
int first = 1;
int vrf_header = 1;
- ret = str2prefix (argv[0], &p);
+ ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p);
if (! ret)
{
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
@@ -5558,13 +3475,14 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer,
DEFUN (show_ipv6_route_vrf_all_protocol,
show_ipv6_route_vrf_all_protocol_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA,
+ "show ipv6 route vrf all <kernel|connected|static|ripng|ospf6|isis|bgp|table>",
SHOW_STR
IP_STR
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
{
+ int idx_protocol = 5;
int type;
struct route_table *table;
struct route_node *rn;
@@ -5574,7 +3492,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol,
int first = 1;
int vrf_header = 1;
- type = proto_redistnum (AFI_IP6, argv[0]);
+ type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg);
if (type < 0)
{
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
@@ -5613,13 +3531,14 @@ DEFUN (show_ipv6_route_vrf_all_protocol,
DEFUN (show_ipv6_route_vrf_all_addr,
show_ipv6_route_vrf_all_addr_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X",
+ "show ipv6 route vrf all X:X::X:X",
SHOW_STR
IP_STR
"IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR
"IPv6 Address\n")
{
+ int idx_ipv6 = 5;
int ret;
struct prefix_ipv6 p;
struct route_table *table;
@@ -5627,7 +3546,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
struct zebra_vrf *zvrf;
vrf_iter_t iter;
- ret = str2prefix_ipv6 (argv[0], &p);
+ ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p);
if (ret <= 0)
{
vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
@@ -5654,13 +3573,14 @@ DEFUN (show_ipv6_route_vrf_all_addr,
DEFUN (show_ipv6_route_vrf_all_prefix,
show_ipv6_route_vrf_all_prefix_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M",
+ "show ipv6 route vrf all X:X::X:X/M",
SHOW_STR
IP_STR
"IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR
"IPv6 prefix\n")
{
+ int idx_ipv6_prefixlen = 5;
int ret;
struct prefix_ipv6 p;
struct route_table *table;
@@ -5668,7 +3588,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
struct zebra_vrf *zvrf;
vrf_iter_t iter;
- ret = str2prefix_ipv6 (argv[0], &p);
+ ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p);
if (ret <= 0)
{
vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
@@ -5700,7 +3620,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
DEFUN (show_ipv6_route_vrf_all_summary,
show_ipv6_route_vrf_all_summary_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " summary",
+ "show ipv6 route vrf all summary",
SHOW_STR
IP_STR
"IPv6 routing table\n"
@@ -5719,7 +3639,7 @@ DEFUN (show_ipv6_route_vrf_all_summary,
DEFUN (show_ipv6_mroute_vrf_all,
show_ipv6_mroute_vrf_all_cmd,
- "show ipv6 mroute " VRF_ALL_CMD_STR,
+ "show ipv6 mroute vrf all",
SHOW_STR
IP_STR
"IPv6 Multicast routing table\n"
@@ -5755,7 +3675,7 @@ DEFUN (show_ipv6_mroute_vrf_all,
DEFUN (show_ipv6_route_vrf_all_summary_prefix,
show_ipv6_route_vrf_all_summary_prefix_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " summary prefix",
+ "show ipv6 route vrf all summary prefix",
SHOW_STR
IP_STR
"IPv6 routing table\n"
@@ -5902,9 +3822,7 @@ zebra_ip_config (struct vty *vty)
write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
-#ifdef HAVE_IPV6
write += static_config_ipv6 (vty);
-#endif /* HAVE_IPV6 */
write += zebra_import_table_config (vty);
return write;
@@ -5912,49 +3830,7 @@ zebra_ip_config (struct vty *vty)
DEFUN (ip_zebra_import_table_distance,
ip_zebra_import_table_distance_cmd,
- "ip import-table <1-252> distance <1-255>",
- IP_STR
- "import routes from non-main kernel table\n"
- "kernel routing table id\n"
- "Distance for imported routes\n"
- "Default distance value\n")
-{
- u_int32_t table_id = 0;
- int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
-
- if (argc)
- VTY_GET_INTEGER("table", table_id, argv[0]);
-
- if (!is_zebra_valid_kernel_table(table_id))
- {
- vty_out(vty, "Invalid routing table ID, %d. Must be in range 1-252%s",
- table_id, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (is_zebra_main_routing_table(table_id))
- {
- vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (argc > 1)
- VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255);
- return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1));
-
-}
-
-ALIAS (ip_zebra_import_table_distance,
- ip_zebra_import_table_cmd,
- "ip import-table <1-252>",
- IP_STR
- "import routes from non-main kernel table\n"
- "kernel routing table id\n")
-
-DEFUN (ip_zebra_import_table_distance_routemap,
- ip_zebra_import_table_distance_routemap_cmd,
- "ip import-table <1-252> distance <1-255> route-map WORD",
+ "ip import-table (1-252) [distance (1-255)] [route-map WORD]",
IP_STR
"import routes from non-main kernel table\n"
"kernel routing table id\n"
@@ -5964,11 +3840,13 @@ DEFUN (ip_zebra_import_table_distance_routemap,
"route-map name\n")
{
u_int32_t table_id = 0;
- int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
- const char *rmap_name;
- if (argc)
- VTY_GET_INTEGER("table", table_id, argv[0]);
+ VTY_GET_INTEGER("table", table_id, argv[2]->arg);
+ int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
+ char *rmap = strmatch (argv[argc - 2]->text, "route-map") ?
+ XSTRDUP(MTYPE_ROUTE_MAP_NAME, argv[argc - 1]->arg) : NULL;
+ if (argc == 7 || (argc == 5 && !rmap))
+ VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255);
if (!is_zebra_valid_kernel_table(table_id))
{
@@ -5980,42 +3858,23 @@ DEFUN (ip_zebra_import_table_distance_routemap,
if (is_zebra_main_routing_table(table_id))
{
vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
+ table_id, VTY_NEWLINE);
return CMD_WARNING;
}
- if (argc > 2)
- {
- VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255);
- rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]);
- }
- else
- rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
-
- return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1));
+ return (zebra_import_table(AFI_IP, table_id, distance, rmap, 1));
}
-ALIAS (ip_zebra_import_table_distance_routemap,
- ip_zebra_import_table_routemap_cmd,
- "ip import-table <1-252> route-map WORD",
- IP_STR
- "import routes from non-main kernel table\n"
- "kernel routing table id\n"
- "route-map for filtering\n"
- "route-map name\n")
-
DEFUN (no_ip_zebra_import_table,
no_ip_zebra_import_table_cmd,
- "no ip import-table <1-252> {route-map NAME}",
+ "no ip import-table (1-252) [distance (1-255)] [route-map NAME]",
NO_STR
IP_STR
"import routes from non-main kernel table\n"
"kernel routing table id\n")
{
u_int32_t table_id = 0;
-
- if (argc)
- VTY_GET_INTEGER("table", table_id, argv[0]);
+ VTY_GET_INTEGER("table", table_id, argv[3]->arg);
if (!is_zebra_valid_kernel_table(table_id))
{
@@ -6037,14 +3896,6 @@ DEFUN (no_ip_zebra_import_table,
return (zebra_import_table(AFI_IP, table_id, 0, NULL, 0));
}
-ALIAS (no_ip_zebra_import_table,
- no_ip_zebra_import_table_distance_cmd,
- "no ip import-table <1-252> distance <1-255> {route-map NAME}",
- IP_STR
- "import routes from non-main kernel table to main table"
- "kernel routing table id\n"
- "distance to be used\n")
-
static int
config_write_protocol (struct vty *vty)
{
@@ -6086,77 +3937,30 @@ zebra_vty_init (void)
install_element (CONFIG_NODE, &allow_external_route_update_cmd);
install_element (CONFIG_NODE, &no_allow_external_route_update_cmd);
- install_element (CONFIG_NODE, &ip_mroute_cmd);
install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
- install_element (CONFIG_NODE, &no_ip_mroute_cmd);
install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
install_element (CONFIG_NODE, &ip_multicast_mode_cmd);
install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd);
- install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd);
install_element (CONFIG_NODE, &ip_route_cmd);
- install_element (CONFIG_NODE, &ip_route_tag_cmd);
install_element (CONFIG_NODE, &ip_route_flags_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_cmd);
install_element (CONFIG_NODE, &ip_route_flags2_cmd);
- install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd);
install_element (CONFIG_NODE, &ip_route_mask_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_tag_cmd);
install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd);
install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd);
install_element (CONFIG_NODE, &no_ip_route_cmd);
- install_element (CONFIG_NODE, &no_ip_route_tag_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd);
install_element (CONFIG_NODE, &no_ip_route_flags2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd);
- install_element (CONFIG_NODE, &ip_route_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_tag_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd);
- install_element (CONFIG_NODE, &ip_zebra_import_table_cmd);
install_element (CONFIG_NODE, &ip_zebra_import_table_distance_cmd);
- install_element (CONFIG_NODE, &ip_zebra_import_table_routemap_cmd);
- install_element (CONFIG_NODE, &ip_zebra_import_table_distance_routemap_cmd);
install_element (CONFIG_NODE, &no_ip_zebra_import_table_cmd);
- install_element (CONFIG_NODE, &no_ip_zebra_import_table_distance_cmd);
install_element (VIEW_NODE, &show_vrf_cmd);
install_element (VIEW_NODE, &show_ip_route_cmd);
install_element (VIEW_NODE, &show_ip_route_ospf_instance_cmd);
install_element (VIEW_NODE, &show_ip_route_tag_cmd);
install_element (VIEW_NODE, &show_ip_nht_cmd);
- install_element (VIEW_NODE, &show_ip_nht_vrf_cmd);
install_element (VIEW_NODE, &show_ip_nht_vrf_all_cmd);
install_element (VIEW_NODE, &show_ipv6_nht_cmd);
- install_element (VIEW_NODE, &show_ipv6_nht_vrf_cmd);
install_element (VIEW_NODE, &show_ipv6_nht_vrf_all_cmd);
install_element (VIEW_NODE, &show_ip_route_addr_cmd);
install_element (VIEW_NODE, &show_ip_route_prefix_cmd);
@@ -6171,64 +3975,11 @@ zebra_vty_init (void)
/* Commands for VRF */
- install_element (CONFIG_NODE, &ip_route_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_addr_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_tag_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_prefix_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_protocol_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_supernets_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_summary_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_summary_prefix_cmd);
+ install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_tag_cmd);
@@ -6240,7 +3991,6 @@ zebra_vty_init (void)
install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_prefix_cmd);
-#ifdef HAVE_IPV6
install_element (CONFIG_NODE, &ipv6_route_cmd);
install_element (CONFIG_NODE, &ipv6_route_flags_cmd);
install_element (CONFIG_NODE, &ipv6_route_ifname_cmd);
@@ -6249,30 +3999,6 @@ zebra_vty_init (void)
install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd);
- install_element (CONFIG_NODE, &ipv6_route_pref_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);
- install_element (CONFIG_NODE, &ipv6_route_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd);
install_element (CONFIG_NODE, &ip_nht_default_route_cmd);
install_element (CONFIG_NODE, &no_ip_nht_default_route_cmd);
install_element (CONFIG_NODE, &ipv6_nht_default_route_cmd);
@@ -6289,50 +4015,6 @@ zebra_vty_init (void)
install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
/* Commands for VRF */
-
- install_element (CONFIG_NODE, &ipv6_route_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd);
- install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd);
-
-
- install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_tag_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_summary_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_summary_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_protocol_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_addr_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_prefix_longer_cmd);
-
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd);
@@ -6342,8 +4024,5 @@ zebra_vty_init (void)
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd);
-
install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
-#endif /* HAVE_IPV6 */
}
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 0b69af512..cb396942a 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -742,28 +742,28 @@ zsend_redistribute_route (int add, struct zserv *client, struct prefix *p,
/* ldpd needs all nexthops */
if (client->proto != ZEBRA_ROUTE_LDP)
- break;
+ break;
}
}
/* Distance */
- SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
- stream_putc (s, rib->distance);
+ SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
+ stream_putc (s, rib->distance);
/* Metric */
- SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
- stream_putl (s, rib->metric);
+ SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
+ stream_putl (s, rib->metric);
/* Tag */
- if (rib->tag)
- {
- SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
+ if (rib->tag)
+ {
+ SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
stream_putl(s, rib->tag);
- }
+ }
/* MTU */
- SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
- stream_putl (s, rib->mtu);
+ SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
+ stream_putl (s, rib->mtu);
/* write real message flags value */
stream_putc_at (s, messmark, zapi_flags);
@@ -2366,19 +2366,19 @@ DEFUN (show_table,
return CMD_SUCCESS;
}
-DEFUN (config_table,
+DEFUN (config_table,
config_table_cmd,
"table TABLENO",
"Configure target kernel routing table\n"
"TABLE integer\n")
{
- zebrad.rtm_table_default = strtol (argv[0], (char**)0, 10);
+ zebrad.rtm_table_default = strtol (argv[1]->arg, (char**)0, 10);
return CMD_SUCCESS;
}
DEFUN (no_config_table,
no_config_table_cmd,
- "no table TABLENO",
+ "no table [TABLENO]",
NO_STR
"Configure target kernel routing table\n"
"TABLE integer\n")
@@ -2435,7 +2435,7 @@ DEFUN (show_zebra_client,
show_zebra_client_cmd,
"show zebra client",
SHOW_STR
- "Zebra information"
+ "Zebra information\n"
"Client information")
{
struct listnode *node;
diff --git a/zebra/zserv.h b/zebra/zserv.h
index ce243dd6a..a0434d299 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -25,10 +25,10 @@
#include "rib.h"
#include "if.h"
#include "workqueue.h"
+#include "vrf.h"
#include "routemap.h"
#include "vty.h"
#include "zclient.h"
-#include "vrf.h"
#include "zebra/zebra_ns.h"
/* Default port information. */
diff --git a/zebra/zserv_null.c b/zebra/zserv_null.c
index acab22d96..4b52abb22 100644
--- a/zebra/zserv_null.c
+++ b/zebra/zserv_null.c
@@ -23,6 +23,7 @@
#include <zebra.h>
#include <vrf.h>
+#include <vty.h>
#include <zserv.h>
#include <zebra_ns.h>