summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c5245
1 files changed, 1070 insertions, 4175 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 40bf0eac78..6c3dfe0e06 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -13,10 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
@@ -31,8 +30,8 @@
#include "nexthop.h"
#include "vrf.h"
#include "mpls.h"
-#include "lib/json.h"
#include "routemap.h"
+#include "srcdest_table.h"
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
@@ -41,11 +40,14 @@
#include "zebra/redistribute.h"
#include "zebra/zebra_routemap.h"
#include "zebra/zebra_static.h"
+#include "lib/json.h"
extern int allow_delete;
static int do_show_ip_route(struct vty *vty, const char *vrf_name,
- safi_t safi, u_char use_json);
+ afi_t afi, safi_t safi, bool use_fib, u_char use_json,
+ route_tag_t tag, struct prefix *longer_prefix_p,
+ bool supernets_only, int type, u_short ospf_instance_id);
static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
int mcast);
@@ -124,10 +126,24 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
VTY_NEWLINE);
return CMD_WARNING;
}
- if (mpls_str2label (label_str, &snh_label.num_labels,
- snh_label.label))
+ int rc = mpls_str2label (label_str, &snh_label.num_labels,
+ snh_label.label);
+ if (rc < 0)
{
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ switch (rc) {
+ case -1:
+ vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ break;
+ case -2:
+ vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
+ MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
+ VTY_NEWLINE);
+ break;
+ case -3:
+ vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
+ MPLS_MAX_LABELS, VTY_NEWLINE);
+ break;
+ }
return CMD_WARNING;
}
}
@@ -141,10 +157,10 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP, safi, type, &p, NULL, ifindex, ifname,
+ static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP, safi, type, &p, NULL, ifindex, tag,
+ static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -169,21 +185,21 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
if (gate_str == NULL)
{
if (add_cmd)
- static_add_route (AFI_IP, safi, type, &p, NULL, ifindex, ifname, flag,
+ static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, ifname, flag,
tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP, safi, type, &p, NULL, ifindex, tag, distance,
+ static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, tag, distance,
zvrf, &snh_label);
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);
if (!ret)
{
- struct interface *ifp = if_lookup_by_name_vrf (gate_str, zvrf_id (zvrf));
+ struct interface *ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp)
{
vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE);
@@ -198,11 +214,11 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
type = STATIC_IPV4_GATEWAY;
if (add_cmd)
- static_add_route (AFI_IP, safi, type, &p,
+ static_add_route (AFI_IP, safi, type, &p, NULL,
ifindex ? NULL : (union g_addr *)&gate, ifindex, ifname,
flag, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP, safi, type, &p,
+ static_delete_route (AFI_IP, safi, type, &p, NULL,
ifindex ? NULL : (union g_addr *)&gate, ifindex, tag,
distance, zvrf, &snh_label);
@@ -212,7 +228,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 +236,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 +254,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 +273,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 +296,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,22 +311,17 @@ 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,
- "show ip rpf",
+ "show ip rpf [json]",
SHOW_STR
IP_STR
- "Display RPF information for multicast source\n")
+ "Display RPF information for multicast source\n"
+ JSON_STR)
{
- return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, 0);
+ int uj = use_json(argc, argv);
+ return do_show_ip_route (vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST, false, uj, 0, NULL, false, -1, 0);
}
DEFUN (show_ip_rpf_addr,
@@ -332,21 +332,22 @@ 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;
+ struct route_entry *re;
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);
return CMD_WARNING;
}
- rib = rib_match_ipv4_multicast (VRF_DEFAULT, addr, &rn);
+ re = rib_match_ipv4_multicast (VRF_DEFAULT, addr, &rn);
- if (rib)
+ if (re)
vty_show_ip_route_detail (vty, rn, 1);
else
vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
@@ -354,1127 +355,108 @@ 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")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3],
- NULL, NULL, NULL);
-}
-
-/* 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);
-}
-
-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>",
- 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")
-
-{
- 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")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL,
- argv[3], NULL, NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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>",
- 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")
-
-DEFUN (no_ip_route_flags_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")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3],
- NULL, NULL, NULL);
-}
-
-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[2],
- 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")
-
-DEFUN (no_ip_route_mask_flags_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")
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[4],
- NULL, NULL, NULL);
-}
-
-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[3],
- 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")
+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, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
- argv[5], 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++;
+ }
+ }
-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);
+ return;
}
/* 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)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL,
- NULL, NULL, argv[2], NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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,
- 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)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1],
- NULL, NULL, argv[2], NULL);
-}
-
-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,
+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"
- "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, NULL, argv[1],
- argv[2], NULL, argv[3], 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,
- 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"
- VRF_CMD_HELP_STR)
-
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, argv[3], NULL, argv[4], NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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,
- 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);
-}
+ int idx_ipv4_prefixlen = 2;
+ int idx_ipv4_ifname_null = 3;
+ int idx_curr = 4;
+ char *tag, *distance, *vrf;
-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);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, 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);
+ 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_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,
+DEFUN (ip_route_flags,
+ ip_route_flags_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"
"Distance value for this route\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
- argv[2], argv[3], argv[4],argv[5], NULL);
-}
+ int idx_ipv4_prefixlen = 2;
+ int idx_reject_blackhole = 3;
+ int idx_curr = 4;
+ char *tag, *distance, *vrf;
-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);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, 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);
+ return zebra_static_ipv4 (vty, SAFI_UNICAST, 1,
+ argv[idx_ipv4_prefixlen]->arg,
+ NULL,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, 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)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- NULL, NULL, argv[3], argv[4], NULL);
-}
-
-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,
+/* 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> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@@ -1485,425 +467,120 @@ DEFUN (ip_route_mask_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], argv[1], argv[2],
- NULL, argv[3], argv[4], argv[5], 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)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5], argv[6], NULL);
-}
+ int idx_ipv4 = 2;
+ int idx_ipv4_2 = 3;
+ int idx_ipv4_ifname_null = 4;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &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);
+ 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_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_flags,
+ ip_route_mask_flags_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)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
- argv[2], argv[3], argv[4], argv[5], NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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,
- 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"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- argv[2], NULL, argv[3], 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_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, 1,
+ argv[idx_ipv4]->arg,
+ argv[idx_ipv4_2]->arg,
+ NULL,
+ argv[idx_reject_blackhole]->arg,
+ 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,
+ 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"
"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"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- argv[2], NULL, argv[3], NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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,
- 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"
- VRF_CMD_HELP_STR)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, argv[3], NULL, argv[4], NULL);
-}
-
-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);
-}
-
-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);
-}
-
-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,
- 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"
- 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
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL,
- NULL, argv[2], 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_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_prefixlen]->arg,
+ NULL,
+ argv[idx_ipv4_ifname_null]->arg,
+ 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 <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
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"
- 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)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1],
- NULL, argv[2], argv[3], NULL);
-}
+ int idx_ipv4_prefixlen = 3;
+ int idx_curr = 5;
+ char *tag, *distance, *vrf;
-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);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, 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)
-{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, NULL, argv[3], 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_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,
+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"
@@ -1915,169 +592,135 @@ DEFUN (no_ip_route_mask_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
+ MPLS_LABEL_HELPSTR)
{
- return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
- NULL, argv[3], argv[4], argv[5], 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_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);
+ 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, 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_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 <reject|blackhole> [tag (1-4294967295)] [(1-255)] [vrf NAME]",
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"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- 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_curr = 6;
+ 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,
+ NULL, NULL,
+ tag, distance, vrf, NULL);
}
/* New RIB. Detailed information for IPv4 route. */
static void
vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
{
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop, *tnexthop;
int recursing;
- char buf[PREFIX_STRLEN];
+ char buf[SRCDEST2STR_BUFFER];
struct zebra_vrf *zvrf;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
const char *mcast_info = "";
if (mcast)
{
- rib_table_info_t *info = rn->table->info;
+ rib_table_info_t *info = srcdest_rnode_table_info(rn);
mcast_info = (info->safi == SAFI_MULTICAST)
? " using Multicast RIB"
: " using Unicast RIB";
}
-
+
vty_out (vty, "Routing entry for %s%s%s",
- prefix2str (&rn->p, buf, sizeof(buf)), mcast_info,
+ srcdest_rnode2str(rn, buf, sizeof(buf)), mcast_info,
VTY_NEWLINE);
- vty_out (vty, " Known via \"%s", zebra_route_string (rib->type));
- if (rib->instance)
- vty_out (vty, "[%d]", rib->instance);
+ vty_out (vty, " Known via \"%s", zebra_route_string (re->type));
+ if (re->instance)
+ vty_out (vty, "[%d]", re->instance);
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);
- if (rib->mtu)
- vty_out (vty, ", mtu %u", rib->mtu);
- if (rib->vrf_id != VRF_DEFAULT)
+ vty_out (vty, ", distance %u, metric %u", re->distance, re->metric);
+ if (re->tag)
+ vty_out (vty, ", tag %d", re->tag);
+ if (re->mtu)
+ vty_out (vty, ", mtu %u", re->mtu);
+ if (re->vrf_id != VRF_DEFAULT)
{
- zvrf = vrf_info_lookup(rib->vrf_id);
+ zvrf = vrf_info_lookup(re->vrf_id);
vty_out (vty, ", vrf %s", zvrf_name (zvrf));
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->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))
+ if (re->refcnt)
+ vty_out (vty, ", refcnt %ld", re->refcnt);
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
vty_out (vty, ", blackhole");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", reject");
vty_out (vty, "%s", VTY_NEWLINE);
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
tm = gmtime (&uptime);
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);
}
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
char addrstr[32];
@@ -2092,7 +735,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
if (nexthop->ifindex)
vty_out (vty, ", via %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -2100,11 +743,11 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
if (nexthop->ifindex)
vty_out (vty, ", via %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out (vty, " directly connected, %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out (vty, " directly connected, Null0");
@@ -2146,12 +789,12 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
}
/* 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 (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, 1));
+ }
vty_out (vty, "%s", VTY_NEWLINE);
}
@@ -2160,57 +803,59 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
}
static void
-vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
+vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *re,
json_object *json)
{
struct nexthop *nexthop, *tnexthop;
int recursing;
int len = 0;
- char buf[BUFSIZ];
+ char buf[SRCDEST2STR_BUFFER];
json_object *json_nexthops = NULL;
json_object *json_nexthop = NULL;
json_object *json_route = NULL;
+ json_object *json_labels = NULL;
if (json)
{
json_route = json_object_new_object();
json_nexthops = json_object_new_array();
- json_object_string_add(json_route, "prefix", prefix2str (&rn->p, buf, sizeof buf));
- json_object_string_add(json_route, "protocol", zebra_route_string(rib->type));
+ json_object_string_add(json_route, "prefix", srcdest_rnode2str (rn, buf, sizeof buf));
+ json_object_string_add(json_route, "protocol", zebra_route_string(re->type));
- if (rib->instance)
- json_object_int_add(json_route, "instance", rib->instance);
+ if (re->instance)
+ json_object_int_add(json_route, "instance", re->instance);
- if (rib->vrf_id)
- json_object_int_add(json_route, "vrfId", rib->vrf_id);
+ if (re->vrf_id)
+ json_object_int_add(json_route, "vrfId", re->vrf_id);
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
json_object_boolean_true_add(json_route, "selected");
- if (rib->type != ZEBRA_ROUTE_CONNECT && rib->type != ZEBRA_ROUTE_KERNEL)
+ if (re->type != ZEBRA_ROUTE_CONNECT && re->type != ZEBRA_ROUTE_KERNEL)
{
- json_object_int_add(json_route, "distance", rib->distance);
- json_object_int_add(json_route, "metric", rib->metric);
+ json_object_int_add(json_route, "distance", re->distance);
+ json_object_int_add(json_route, "metric", re->metric);
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
json_object_boolean_true_add(json_route, "blackhole");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
json_object_boolean_true_add(json_route, "reject");
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
tm = gmtime (&uptime);
if (uptime < ONE_DAY_SECOND)
@@ -2223,7 +868,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
json_object_string_add(json_route, "uptime", buf);
}
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
json_nexthop = json_object_new_object();
@@ -2240,7 +885,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
if (nexthop->ifindex)
{
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
}
break;
case NEXTHOP_TYPE_IPV6:
@@ -2251,14 +896,14 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
if (nexthop->ifindex)
{
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
}
break;
case NEXTHOP_TYPE_IFINDEX:
json_object_boolean_true_add(json_nexthop, "directlyConnected");
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
json_object_boolean_true_add(json_nexthop, "blackhole");
@@ -2298,6 +943,16 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
break;
}
+ if (nexthop->nh_label && nexthop->nh_label->num_labels)
+ {
+ json_labels = json_object_new_array();
+
+ for (int label_index = 0; label_index < nexthop->nh_label->num_labels; label_index++)
+ json_object_array_add(json_labels, json_object_new_int(nexthop->nh_label->label[label_index]));
+
+ json_object_object_add(json_nexthop, "labels", json_labels);
+ }
+
json_object_array_add(json_nexthops, json_nexthop);
}
@@ -2307,27 +962,26 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
}
/* Nexthop information. */
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
- if (nexthop == rib->nexthop)
+ if (nexthop == re->nexthop)
{
/* Prefix information. */
- len = vty_out (vty, "%c", zebra_route_char (rib->type));
- if (rib->instance)
- len += vty_out (vty, "[%d]", rib->instance);
+ len = vty_out (vty, "%c", zebra_route_char (re->type));
+ if (re->instance)
+ len += vty_out (vty, "[%d]", re->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 (re->flags, ZEBRA_FLAG_SELECTED)
+ ? '>' : ' ',
CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
? '*' : ' ',
- prefix2str (&rn->p, buf, sizeof buf));
+ srcdest_rnode2str (rn, buf, sizeof buf));
/* Distance and metric display. */
- if (rib->type != ZEBRA_ROUTE_CONNECT
- && rib->type != ZEBRA_ROUTE_KERNEL)
- len += vty_out (vty, " [%d/%d]", rib->distance,
- rib->metric);
+ if (re->type != ZEBRA_ROUTE_CONNECT
+ && re->type != ZEBRA_ROUTE_KERNEL)
+ len += vty_out (vty, " [%d/%d]", re->distance,
+ re->metric);
}
else
vty_out (vty, " %c%*c",
@@ -2342,7 +996,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
if (nexthop->ifindex)
vty_out (vty, ", %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -2350,12 +1004,12 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
if (nexthop->ifindex)
vty_out (vty, ", %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out (vty, " is directly connected, %s",
- ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out (vty, " is directly connected, Null0");
@@ -2396,38 +1050,39 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
/* 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, ", label %s",
+ mpls_label2str (nexthop->nh_label->num_labels,
+ nexthop->nh_label->label, buf, BUFSIZ, 1));
+ }
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
vty_out (vty, ", bh");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", rej");
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
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);
}
@@ -2435,28 +1090,27 @@ 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_STR
- IP_STR
- "IP routing table\n")
+static bool
+use_fib (struct cmd_token *token)
{
- return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv));
+ return strncmp(token->arg, "route", strlen(token->arg));
}
static int
-do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
- u_char use_json)
+do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
+ bool use_fib, u_char use_json, route_tag_t tag,
+ struct prefix *longer_prefix_p, bool supernets_only,
+ int type, u_short ospf_instance_id)
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
int first = 1;
struct zebra_vrf *zvrf = NULL;
char buf[BUFSIZ];
json_object *json = NULL;
json_object *json_prefix = NULL;
+ u_int32_t addr;
if (!(zvrf = zebra_vrf_lookup_by_name (vrf_name)))
{
@@ -2476,7 +1130,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
return CMD_SUCCESS;
}
- table = zebra_vrf_table (AFI_IP, safi, zvrf_id (zvrf));
+ table = zebra_vrf_table (afi, safi, zvrf_id (zvrf));
if (! table)
{
if (use_json)
@@ -2485,93 +1139,106 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
}
if (use_json)
- {
json = json_object_new_object();
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
+ /* Show all routes. */
+ for (rn = route_top (table); rn; rn = route_next (rn))
+ {
+ RNODE_FOREACH_RE (rn, re)
{
- RNODE_FOREACH_RIB (rn, rib)
+ if (use_fib && !CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
+ continue;
+
+ if (tag && re->tag != tag)
+ continue;
+
+ if (longer_prefix_p && ! prefix_match (longer_prefix_p, &rn->p))
+ continue;
+
+ /* This can only be true when the afi is IPv4 */
+ if (supernets_only)
{
- if (!json_prefix)
- json_prefix = json_object_new_array();
- vty_show_ip_route (vty, rn, rib, json_prefix);
+ addr = ntohl (rn->p.u.prefix4.s_addr);
+
+ if (IN_CLASSC (addr) && rn->p.prefixlen >= 24)
+ continue;
+
+ if (IN_CLASSB (addr) && rn->p.prefixlen >= 16)
+ continue;
+
+ if (IN_CLASSA (addr) && rn->p.prefixlen >= 8)
+ continue;
}
- if (json_prefix)
+ if (type && re->type != type)
+ continue;
+
+ if (ospf_instance_id && (re->type != ZEBRA_ROUTE_OSPF || re->instance != ospf_instance_id))
+ continue;
+
+ if (use_json)
{
- prefix2str (&rn->p, buf, sizeof buf);
- json_object_object_add(json, buf, json_prefix);
- json_prefix = NULL;
+ if (!json_prefix)
+ json_prefix = json_object_new_array();
}
- }
-
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
- json_object_free(json);
- }
- else
- {
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- {
- RNODE_FOREACH_RIB (rn, rib)
+ else
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
+ if (afi == AFI_IP)
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
+ else
+ vty_out (vty, SHOW_ROUTE_V6_HEADER);
+
+ if (zvrf_id (zvrf) != VRF_DEFAULT)
+ vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
}
+
+ vty_show_ip_route (vty, rn, re, json_prefix);
}
- }
- return CMD_SUCCESS;
-}
+ if (json_prefix)
+ {
+ prefix2str (&rn->p, buf, sizeof buf);
+ json_object_object_add(json, buf, json_prefix);
+ json_prefix = NULL;
+ }
+ }
-DEFUN (show_ip_route_vrf,
- show_ip_route_vrf_cmd,
- "show ip route " VRF_CMD_STR " {json}",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR)
-{
- u_char uj = use_json(argc, argv);
+ if (use_json)
+ {
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ json_object_free(json);
+ }
- 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 CMD_SUCCESS;
}
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"
@@ -2592,31 +1259,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"
@@ -2697,272 +1359,125 @@ DEFUN (no_ipv6_nht_default_route,
return CMD_SUCCESS;
}
-DEFUN (show_ip_route_tag,
- show_ip_route_tag_cmd,
- "show ip route tag <1-4294967295>",
+// dwalton one "show ip route" to rule them all
+DEFUN (show_ip_route,
+ show_ip_route_cmd,
+ "show ip <fib|route> [vrf NAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
+ VRF_CMD_HELP_STR
"Show only routes with tag\n"
- "Tag value\n")
+ "Tag value\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Show route matching the specified Network/Mask pair only\n"
+ "Show supernet entries only\n"
+ FRR_IP_REDIST_HELP_STR_ZEBRA
+ "Open Shortest Path First (OSPFv2)\n"
+ "Instance ID\n"
+ JSON_STR)
{
+ bool uf = use_fib(argv[2]);
struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
+ int vrf_all = 0;
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+ int uj = use_json(argc, argv);
+ int idx = 0;
+ struct prefix p;
+ bool longer_prefixes = false;
+ bool supernets_only = false;
+ int type = 0;
+ u_short ospf_instance_id = 0;
- if (argc > 1)
+ if (argv_find (argv, argc, "vrf", &idx))
{
- VTY_GET_INTEGER_RANGE("tag", tag, argv[1], 0, 4294967295);
- VRF_GET_ID (vrf_id, argv[0]);
+ if (strmatch(argv[idx+1]->arg, "all"))
+ vrf_all = 1;
+ else
+ VRF_GET_ID (vrf_id, argv[idx+1]->arg);
}
- else
- VTY_GET_INTEGER_RANGE("tag", tag, argv[0], 0, 4294967295);
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show all IPv4 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (rib->tag != tag)
- continue;
+ if (argv_find (argv, argc, "tag", &idx))
+ VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- 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_STR
- IP_STR
- "IP routing table\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- int ret;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if (argc > 1)
+ else if (argv_find (argv, argc, "A.B.C.D/M", &idx))
{
- ret = str2prefix (argv[1], &p);
- VRF_GET_ID (vrf_id, argv[0]);
+ str2prefix (argv[idx]->arg, &p);
+ longer_prefixes = true;
}
- else
- ret = str2prefix (argv[0], &p);
- if (! ret)
+ else if (argv_find (argv, argc, "supernets_only", &idx))
+ supernets_only = true;
+
+ else
{
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
+ if (argv_find (argv, argc, "kernel", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "connected", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "static", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "rip", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "ospf", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "isis", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "bgp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "pim", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "eigrp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "nhrp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "table", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "vnc", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+
+ if (argv_find (argv, argc, "(1-65535)", &idx))
+ VTY_GET_INTEGER ("Instance", ospf_instance_id, argv[idx]->arg);
+
+ if (type < 0)
+ {
+ vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- 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_STR
- IP_STR
- "IP routing table\n"
- "Show supernet entries only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- u_int32_t addr;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- addr = ntohl (rn->p.u.prefix4.s_addr);
-
- if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
- || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
- || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- 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 " FRR_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- FRR_IP_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if (argc > 1)
+ if (vrf_all)
{
- type = proto_redistnum (AFI_IP, argv[1]);
- VRF_GET_ID (vrf_id, argv[0]);
- }
- else
- type = proto_redistnum (AFI_IP, argv[0]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ if ((zvrf = vrf->info) == NULL ||
+ (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
+ continue;
- if (type < 0)
+ do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id);
+ }
+ }
+ else
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
+ vrf = vrf_lookup_by_id (vrf_id);
+ do_show_ip_route (vty, vrf->name, AFI_IP, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id);
}
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- return CMD_SUCCESS;
-}
-
-ALIAS (show_ip_route_protocol,
- show_ip_route_vrf_protocol_cmd,
- "show ip route " VRF_CMD_STR " " FRR_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- FRR_IP_REDIST_HELP_STR_ZEBRA)
-
-DEFUN (show_ip_route_ospf_instance,
- show_ip_route_ospf_instance_cmd,
- "show ip route ospf <1-65535>",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- "Open Shortest Path First (OSPFv2)\n"
- "Instance ID\n")
-{
- 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]);
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == ZEBRA_ROUTE_OSPF && rib->instance == instance)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
return CMD_SUCCESS;
}
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;
@@ -2971,13 +1486,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)
{
@@ -3003,21 +1520,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;
@@ -3026,13 +1535,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)
{
@@ -3058,20 +1569,12 @@ 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)
{
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
@@ -3081,32 +1584,32 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
memset (&rib_cnt, 0, sizeof(rib_cnt));
memset (&fib_cnt, 0, sizeof(fib_cnt));
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
+ RNODE_FOREACH_RE (rn, re)
{
- is_ibgp = (rib->type == ZEBRA_ROUTE_BGP &&
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP));
+ is_ibgp = (re->type == ZEBRA_ROUTE_BGP &&
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_IBGP));
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
if (is_ibgp)
rib_cnt[ZEBRA_ROUTE_IBGP]++;
else
- rib_cnt[rib->type]++;
+ rib_cnt[re->type]++;
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
{
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
if (is_ibgp)
fib_cnt[ZEBRA_ROUTE_IBGP]++;
else
- fib_cnt[rib->type]++;
+ fib_cnt[re->type]++;
}
}
vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
"Route Source", "Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
+ zvrf_name (((rib_table_info_t *)table->info)->zvrf),
VTY_NEWLINE);
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
@@ -3146,7 +1649,7 @@ static void
vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop;
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
@@ -3157,26 +1660,26 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
memset (&rib_cnt, 0, sizeof(rib_cnt));
memset (&fib_cnt, 0, sizeof(fib_cnt));
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
+ RNODE_FOREACH_RE (rn, re)
{
/*
* In case of ECMP, count only once.
*/
cnt = 0;
- for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
+ for (nexthop = re->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
{
cnt++;
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
- rib_cnt[rib->type]++;
+ rib_cnt[re->type]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
- fib_cnt[rib->type]++;
+ fib_cnt[re->type]++;
}
- if (rib->type == ZEBRA_ROUTE_BGP &&
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
+ if (re->type == ZEBRA_ROUTE_BGP &&
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_IBGP))
{
rib_cnt[ZEBRA_ROUTE_IBGP]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
@@ -3187,7 +1690,7 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
"Route Source", "Prefix Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
+ zvrf_name (((rib_table_info_t *)table->info)->zvrf),
VTY_NEWLINE);
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
@@ -3219,17 +1722,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)
@@ -3240,30 +1744,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)
@@ -3274,289 +1770,17 @@ 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_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR)
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-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_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- route_tag_t tag = 0;
-
- if (argv[0])
- VTY_GET_INTEGER_RANGE("tag", tag, argv[0], 0, 4294967295);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv4 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
- return CMD_SUCCESS;
-}
-
-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_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_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")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int ret;
- int first = 1;
- int vrf_header = 1;
-
- ret = str2prefix (argv[0], &p);
- if (! ret)
- {
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_supernets,
- show_ip_route_vrf_all_supernets_cmd,
- "show ip route " VRF_ALL_CMD_STR " supernets-only",
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show supernet entries only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- u_int32_t addr;
- int first = 1;
- int vrf_header = 1;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- addr = ntohl (rn->p.u.prefix4.s_addr);
-
- if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
- || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
- || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_protocol,
- show_ip_route_vrf_all_protocol_cmd,
- "show ip route " VRF_ALL_CMD_STR " " FRR_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- FRR_IP_REDIST_HELP_STR_ZEBRA"\n")
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
-
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0)
- {
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
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;
@@ -3564,7 +1788,7 @@ DEFUN (show_ip_route_vrf_all_addr,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- 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);
@@ -3591,13 +1815,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;
@@ -3605,7 +1830,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- 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);
@@ -3637,7 +1862,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"
@@ -3656,7 +1881,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"
@@ -3674,43 +1899,49 @@ DEFUN (show_ip_route_vrf_all_summary_prefix,
return CMD_SUCCESS;
}
-/* Write IPv4 static route configuration. */
+/* Write static route configuration. */
static int
-static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
+static_config (struct vty *vty, afi_t afi, safi_t safi, const char *cmd)
{
struct route_node *rn;
struct static_route *si;
struct route_table *stable;
struct vrf *vrf;
struct zebra_vrf *zvrf;
- char buf[BUFSIZ];
+ char buf[SRCDEST2STR_BUFFER];
int write =0;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
- zvrf = vrf->info;
- if (! zvrf)
- continue;
-
- if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
+ if (!(zvrf = vrf->info))
+ continue;
+ if ((stable = zvrf->stable[afi][safi]) == NULL)
continue;
- for (rn = route_top (stable); rn; rn = route_next (rn))
+ for (rn = route_top (stable); rn; rn = srcdest_route_next (rn))
for (si = rn->info; si; si = si->next)
{
- vty_out (vty, "%s %s", cmd, prefix2str (&rn->p, buf, sizeof buf));
+ vty_out (vty, "%s %s", cmd, srcdest_rnode2str (rn, buf, sizeof buf));
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
break;
+ case STATIC_IPV6_GATEWAY:
+ vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
+ break;
case STATIC_IFINDEX:
vty_out (vty, " %s", si->ifname);
break;
case STATIC_BLACKHOLE:
vty_out (vty, " Null0");
break;
+ case STATIC_IPV6_GATEWAY_IFINDEX:
+ vty_out (vty, " %s %s",
+ inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
+ ifindex2ifname (si->ifindex, si->vrf_id));
+ break;
}
/* flags are incompatible with STATIC_BLACKHOLE */
@@ -3730,13 +1961,13 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
vty_out (vty, " %d", si->distance);
if (si->vrf_id != VRF_DEFAULT)
- vty_out (vty, " vrf %s", zvrf ? zvrf_name (zvrf) : "");
+ vty_out (vty, " vrf %s", zvrf_name (zvrf));
/* Label information */
if (si->snh_label.num_labels)
vty_out (vty, " label %s",
mpls_label2str (si->snh_label.num_labels,
- si->snh_label.label, buf, sizeof buf));
+ si->snh_label.label, buf, sizeof buf, 0));
vty_out (vty, "%s", VTY_NEWLINE);
@@ -3749,14 +1980,16 @@ 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 *src_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;
- struct prefix p;
+ struct prefix p, src;
+ struct prefix_ipv6 *src_p = NULL;
struct in6_addr *gate = NULL;
struct in6_addr gate_addr;
u_char type = STATIC_BLACKHOLE;
@@ -3766,7 +1999,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)
{
@@ -3774,6 +2007,17 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
return CMD_WARNING;
}
+ if (src_str)
+ {
+ ret = str2prefix (src_str, &src);
+ if (ret <= 0 || src.family != AF_INET6)
+ {
+ vty_out (vty, "%% Malformed source address%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ src_p = (struct prefix_ipv6*)&src;
+ }
+
/* Apply mask for given prefix. */
apply_mask (&p);
@@ -3805,15 +2049,29 @@ 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;
- }
- if (mpls_str2label (label_str, &snh_label.num_labels,
- snh_label.label))
{
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ int rc = mpls_str2label (label_str, &snh_label.num_labels,
+ snh_label.label);
+ if (rc < 0)
+ {
+ switch (rc) {
+ case -1:
+ vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ break;
+ case -2:
+ vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
+ MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
+ VTY_NEWLINE);
+ break;
+ case -3:
+ vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
+ MPLS_MAX_LABELS, VTY_NEWLINE);
+ break;
+ }
return CMD_WARNING;
}
}
@@ -3827,11 +2085,11 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, ifindex, ifname,
- ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, ifname,
+ 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);
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, tag,
+ distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -3857,780 +2115,208 @@ 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_id (zvrf));
+ ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
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_id (zvrf));
- if (!ifp)
- {
- vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
+ {
+ type = STATIC_IFINDEX;
+ ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
+ 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);
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, (union g_addr *)gate,
+ 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);
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, (union g_addr *)gate,
+ 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>",
- 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
+ "ipv6 route X:X::X:X/M [from 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 source-dest route\n"
+ "IPv6 source prefix\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)
+ "Distance value for this prefix\n"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6_ifname;
+ int idx_curr;
+ char *src, *tag, *distance, *vrf;
-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)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3], NULL);
-}
+ if (!strcmp(argv[3]->text, "from"))
+ {
+ src = argv[4]->arg;
+ idx_ipv6_ifname = 5;
+ idx_curr = 6;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6_ifname = 3;
+ idx_curr = 4;
+ }
-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,
+ src,
+ 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 [from 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"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\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, 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
+ MPLS_LABEL_HELPSTR)
{
- 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;
+ int idx_reject_blackhole;
+ int idx_curr;
+ char *src, *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);
-}
+ if (!strcmp(argv[3]->text, "from"))
+ {
+ src = argv[4]->arg;
+ idx_ipv6_ifname = 5;
+ idx_reject_blackhole = 6;
+ idx_curr = 7;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6_ifname = 3;
+ idx_reject_blackhole = 4;
+ idx_curr = 5;
+ }
-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);
+ 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,
+ src,
+ 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 [from 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 source-dest route\n"
+ "IPv6 source prefix\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)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5], NULL);
-}
+ int idx_ipv6_prefixlen = 2;
+ int idx_ipv6 = 3;
+ int idx_interface = 4;
+ int idx_curr = 5;
+ char *src, *tag, *distance, *vrf;
-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)
-{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4], NULL);
-}
+ if (!strcmp(argv[3]->text, "from"))
+ {
+ src = argv[4]->arg;
+ idx_ipv6 = 5;
+ idx_interface = 6;
+ idx_curr = 7;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6 = 3;
+ idx_interface = 4;
+ idx_curr = 5;
+ }
-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,
+ src,
+ 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 [from 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"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
@@ -4638,269 +2324,203 @@ 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
+ MPLS_LABEL_HELPSTR)
{
- 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;
+ int idx_interface;
+ int idx_reject_blackhole;
+ int idx_curr;
+ char *src, *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);
-}
+ if (!strcmp(argv[3]->text, "from"))
+ {
+ src = argv[4]->arg;
+ idx_ipv6 = 5;
+ idx_interface = 6;
+ idx_reject_blackhole = 7;
+ idx_curr = 8;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6 = 3;
+ idx_interface = 4;
+ idx_reject_blackhole = 5;
+ idx_curr = 6;
+ }
-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,
- 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"
- VRF_CMD_HELP_STR)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, 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 (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);
+ return static_ipv6_func (vty, 1,
+ argv[idx_ipv6_prefixlen]->arg,
+ src,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ argv[idx_reject_blackhole]->arg,
+ 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,
+DEFUN (no_ipv6_route,
+ no_ipv6_route_cmd,
+ "no ipv6 route X:X::X:X/M [from 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"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
+ "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
+ MPLS_LABEL_HELPSTR)
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4], NULL);
-}
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6_ifname;
+ int idx_curr;
+ char *src, *tag, *distance, *vrf;
-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);
-}
+ if (!strcmp(argv[4]->text, "from"))
+ {
+ src = argv[5]->arg;
+ idx_ipv6_ifname = 6;
+ idx_curr = 7;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6_ifname = 4;
+ idx_curr = 5;
+ }
-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);
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, 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);
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ src,
+ argv[idx_ipv6_ifname]->arg,
+ NULL, NULL,
+ tag, distance, vrf, 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 [from 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"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\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], 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
+ MPLS_LABEL_HELPSTR)
{
- 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;
+ int idx_reject_blackhole;
+ int idx_curr;
+ char *src, *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);
-}
+ if (!strcmp(argv[4]->text, "from"))
+ {
+ src = argv[5]->arg;
+ idx_ipv6_ifname = 6;
+ idx_reject_blackhole = 7;
+ idx_curr = 8;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6_ifname = 4;
+ idx_reject_blackhole = 5;
+ idx_curr = 6;
+ }
-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);
+ 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,
+ src,
+ 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 [from 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 source-dest route\n"
+ "IPv6 source prefix\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)
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- /* 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);
-}
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6;
+ int idx_interface;
+ int idx_curr;
+ char *src, *tag, *distance, *vrf;
-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)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4], NULL);
-}
+ if (!strcmp(argv[4]->text, "from"))
+ {
+ src = argv[5]->arg;
+ idx_ipv6 = 6;
+ idx_interface = 7;
+ idx_curr = 8;
+ }
+ else
+ {
+ src = NULL;
+ idx_ipv6 = 4;
+ idx_interface = 5;
+ idx_curr = 6;
+ }
-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,
+ src,
+ 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 [from 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"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
@@ -4908,291 +2528,150 @@ 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)
-{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], NULL);
-}
-
-DEFUN (show_ipv6_route,
- show_ipv6_route_cmd,
- "show ipv6 route {json}",
- SHOW_STR
- IP_STR
- "IPv6 routing table\n")
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
- struct zebra_vrf *zvrf = NULL;
- 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_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;
- }
-
- if (zvrf_id (zvrf) == 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_id (zvrf);
- }
-
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- {
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
+ int idx_ipv6_prefixlen = 3;
+ int idx_ipv6;
+ int idx_interface;
+ int idx_reject_blackhole;
+ int idx_curr;
+ char *src, *tag, *distance, *vrf;
- if (uj)
+ if (!strcmp(argv[4]->text, "from"))
{
- json = json_object_new_object();
-
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- {
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (!json_prefix)
- json_prefix = json_object_new_array();
- vty_show_ip_route (vty, rn, rib, json_prefix);
- }
-
- if (json_prefix)
- {
- prefix2str (&rn->p, buf, sizeof buf);
- json_object_object_add(json, buf, json_prefix);
- json_prefix = NULL;
- }
- }
-
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
- json_object_free(json);
+ src = argv[5]->arg;
+ idx_ipv6 = 6;
+ idx_interface = 7;
+ idx_reject_blackhole = 8;
+ idx_curr = 9;
}
else
{
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- {
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
+ src = NULL;
+ idx_ipv6 = 4;
+ idx_interface = 5;
+ idx_reject_blackhole = 6;
+ idx_curr = 7;
}
- return CMD_SUCCESS;
-}
+ tag = distance = vrf = NULL;
+ zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf, NULL);
-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)
+ return static_ipv6_func (vty, 0,
+ argv[idx_ipv6_prefixlen]->arg,
+ src,
+ argv[idx_ipv6]->arg,
+ argv[idx_interface]->arg,
+ argv[idx_reject_blackhole]->arg,
+ tag, distance, vrf, NULL);
+}
-DEFUN (show_ipv6_route_tag,
- show_ipv6_route_tag_cmd,
- "show ipv6 route tag <1-4294967295>",
+// dwalton duplicate to here
+DEFUN (show_ipv6_route,
+ show_ipv6_route_cmd,
+ "show ipv6 <fib|route> [vrf NAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]",
SHOW_STR
IP_STR
- "IPv6 routing table\n"
+ "IP forwarding table\n"
+ "IP routing table\n"
+ VRF_CMD_HELP_STR
"Show only routes with tag\n"
- "Tag value\n")
+ "Tag value\n"
+ "IPv6 prefix\n"
+ "Show route matching the specified Network/Mask pair only\n"
+ FRR_IP6_REDIST_HELP_STR_ZEBRA
+ JSON_STR)
{
+ bool uf = use_fib(argv[2]);
struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
+ int vrf_all = 0;
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+ int uj = use_json(argc, argv);
+ int idx = 0;
+ struct prefix p;
+ bool longer_prefixes = false;
+ bool supernets_only = false;
+ int type = 0;
- if (argc > 1)
+ if (argv_find (argv, argc, "vrf", &idx))
{
- VRF_GET_ID (vrf_id, argv[0]);
- VTY_GET_INTEGER_RANGE("tag", tag, argv[1], 0, 4294967295);
+ if (strmatch(argv[idx+1]->arg, "all"))
+ vrf_all = 1;
+ else
+ VRF_GET_ID (vrf_id, argv[idx+1]->arg);
}
- else
- VTY_GET_INTEGER_RANGE("tag", tag, argv[0], 0, 4294967295);
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
+ if (argv_find (argv, argc, "tag", &idx))
+ VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
- /* Show all IPv6 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- 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_STR
- IP_STR
- "IPv6 routing table\n"
- "IPv6 prefix\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- int ret;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if (argc > 1)
+ else if (argv_find (argv, argc, "X:X::X:X/M", &idx))
{
- VRF_GET_ID (vrf_id, argv[0]);
- ret = str2prefix (argv[1], &p);
+ str2prefix (argv[idx]->arg, &p);
+ longer_prefixes = true;
}
- else
- ret = str2prefix (argv[0], &p);
- if (! ret)
+ else
{
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
+ if (argv_find (argv, argc, "kernel", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "connected", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "static", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "ripng", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "ospf6", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "isis", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "bgp", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "nhrp", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "table", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "vnc", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+
+ if (type < 0)
+ {
+ vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- 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 " FRR_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- FRR_IP6_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if ( argc >1 )
+ if (vrf_all)
{
- VRF_GET_ID (vrf_id, argv[0]);
- type = proto_redistnum (AFI_IP6, argv[1]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ if ((zvrf = vrf->info) == NULL ||
+ (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
+ continue;
+
+ do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP6, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, 0);
+ }
}
else
- type = proto_redistnum (AFI_IP6, argv[0]);
-
- if (type < 0)
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
+ vrf = vrf_lookup_by_id (vrf_id);
+ do_show_ip_route (vty, vrf->name, AFI_IP6, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, 0);
}
-
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
return CMD_SUCCESS;
}
-ALIAS (show_ipv6_route_protocol,
- show_ipv6_route_vrf_protocol_cmd,
- "show ipv6 route " VRF_CMD_STR " " FRR_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_CMD_HELP_STR
- FRR_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;
@@ -5201,13 +2680,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)
{
@@ -5233,21 +2714,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;
@@ -5256,13 +2729,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)
{
@@ -5288,29 +2761,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)
@@ -5321,30 +2787,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)
@@ -5355,283 +2814,56 @@ 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;
- struct rib *rib;
+ struct route_entry *re;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (argc > 0)
- VRF_GET_ID (vrf_id, argv[0]);
+ if (argc == 5)
+ VRF_GET_ID (vrf_id, argv[4]->arg);
table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
if (! table)
return CMD_SUCCESS;
/* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
+ RNODE_FOREACH_RE (rn, re)
{
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
+ vty_show_ip_route (vty, rn, re, NULL);
}
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_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR)
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-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_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- route_tag_t tag = 0;
-
- if (argv[0])
- VTY_GET_INTEGER_RANGE("tag", tag, argv[0], 0, 4294967295);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv6 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-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_STR
- IP_STR
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR
- "IPv6 prefix\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int ret;
- int first = 1;
- int vrf_header = 1;
-
- ret = str2prefix (argv[0], &p);
- if (! ret)
- {
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_vrf_all_protocol,
- show_ipv6_route_vrf_all_protocol_cmd,
- "show ipv6 route " VRF_ALL_CMD_STR " " FRR_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- FRR_IP6_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
-
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0)
- {
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
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;
@@ -5639,7 +2871,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- 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);
@@ -5666,13 +2898,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;
@@ -5680,7 +2913,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- 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);
@@ -5712,7 +2945,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"
@@ -5731,7 +2964,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"
@@ -5739,7 +2972,7 @@ DEFUN (show_ipv6_mroute_vrf_all,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct vrf *vrf;
struct zebra_vrf *zvrf;
int first = 1;
@@ -5747,19 +2980,19 @@ DEFUN (show_ipv6_mroute_vrf_all,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
+ (table = zvrf->table[AFI_IP6][SAFI_MULTICAST]) == NULL)
continue;
/* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
+ RNODE_FOREACH_RE (rn, re)
{
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
+ vty_show_ip_route (vty, rn, re, NULL);
}
}
return CMD_SUCCESS;
@@ -5767,7 +3000,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"
@@ -5785,88 +3018,10 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix,
return CMD_SUCCESS;
}
-/* Write IPv6 static route configuration. */
-static int
-static_config_ipv6 (struct vty *vty)
-{
- struct route_node *rn;
- struct static_route *si;
- int write = 0;
- char buf[PREFIX_STRLEN];
- struct route_table *stable;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- zvrf = vrf->info;
- if (! zvrf)
- continue;
-
- if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- for (rn = route_top (stable); rn; rn = route_next (rn))
- for (si = rn->info; si; si = si->next)
- {
- vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf));
-
- switch (si->type)
- {
- case STATIC_IPV6_GATEWAY:
- vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
- break;
- case STATIC_IFINDEX:
- vty_out (vty, " %s", si->ifname);
- break;
- case STATIC_BLACKHOLE:
- vty_out (vty, " Null0" );
- break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
- vty_out (vty, " %s %s",
- inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
- ifindex2ifname_vrf (si->ifindex, si->vrf_id));
- break;
- }
-
- /* flags are incompatible with STATIC_BLACKHOLE */
- if (si->type != STATIC_BLACKHOLE)
- {
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
- vty_out (vty, " %s", "reject");
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
- vty_out (vty, " %s", "blackhole");
- }
-
- if (si->tag)
- vty_out (vty, " tag %"ROUTE_TAG_PRI, si->tag);
-
- if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
- vty_out (vty, " %d", si->distance);
-
- if (si->vrf_id != VRF_DEFAULT)
- {
- vty_out (vty, " vrf %s", zvrf_name (zvrf));
- }
-
- /* Label information */
- if (si->snh_label.num_labels)
- vty_out (vty, " label %s",
- mpls_label2str (si->snh_label.num_labels,
- si->snh_label.label, buf, sizeof buf));
-
- vty_out (vty, "%s", VTY_NEWLINE);
-
- write = 1;
- }
- }
- return write;
-}
-
DEFUN (allow_external_route_update,
allow_external_route_update_cmd,
"allow-external-route-update",
- "Allow Quagga routes to be overwritten by external processes")
+ "Allow FRR routes to be overwritten by external processes\n")
{
allow_delete = 1;
@@ -5876,7 +3031,8 @@ DEFUN (allow_external_route_update,
DEFUN (no_allow_external_route_update,
no_allow_external_route_update_cmd,
"no allow-external-route-update",
- "Allow Quagga routes to be overwritten by external processes")
+ NO_STR
+ "Allow FRR routes to be overwritten by external processes\n")
{
allow_delete = 0;
@@ -5895,9 +3051,10 @@ DEFUN (show_vrf,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
- zvrf = vrf->info;
- if (! zvrf || ! zvrf_id (zvrf))
- continue;
+ if (!(zvrf = vrf->info))
+ continue;
+ if (!zvrf_id (zvrf))
+ continue;
vty_out (vty, "vrf %s ", zvrf_name (zvrf));
if (zvrf_id (zvrf) == VRF_UNKNOWN)
@@ -5917,11 +3074,9 @@ zebra_ip_config (struct vty *vty)
{
int write = 0;
- 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 += static_config (vty, AFI_IP, SAFI_UNICAST, "ip route");
+ write += static_config (vty, AFI_IP, SAFI_MULTICAST, "ip mroute");
+ write += static_config (vty, AFI_IP6, SAFI_UNICAST, "ipv6 route");
write += zebra_import_table_config (vty);
return write;
@@ -5929,49 +3084,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"
@@ -5981,11 +3094,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))
{
@@ -5997,42 +3112,27 @@ 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")
+ "kernel routing table id\n"
+ "Distance for imported routes\n"
+ "Default distance value\n"
+ "route-map for filtering\n"
+ "route-map name\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))
{
@@ -6054,14 +3154,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)
{
@@ -6103,83 +3195,27 @@ 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);
- install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
- install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
install_element (VIEW_NODE, &show_ip_route_summary_cmd);
install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
@@ -6188,76 +3224,14 @@ 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 (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_all_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_tag_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_all_addr_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_protocol_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_supernets_cmd);
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);
@@ -6266,101 +3240,22 @@ 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);
install_element (CONFIG_NODE, &no_ipv6_nht_default_route_cmd);
install_element (VIEW_NODE, &show_ipv6_route_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_tag_cmd);
install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd);
-
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);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_all_protocol_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_addr_cmd);
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 */
}