From 030721b7efef08e4706441172eaf4353a09bbbd3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 11:25:28 -0400 Subject: [PATCH 1/7] zebra: Refactore "ip route XXXXXX" commands Convert all 'ip route XXXX' commands to use the new syntax and collapse all functions that we can easily do. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 1225 ++++++++------------------------------------- 1 file changed, 203 insertions(+), 1022 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 005c9370b5..97fc6d2abe 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -337,26 +337,39 @@ DEFUN (show_ip_rpf_addr, return CMD_SUCCESS; } +static void +zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], + int idx_curr, char **tag, + char **distance, char **vrf) +{ + if (argc > idx_curr) + { + if (strmatch (argv[idx_curr]->text, "tag")) + { + *tag = argv[idx_curr]->arg; + idx_curr++; + } + + if (strmatch (argv[idx_curr]->text, "vrf")) + { + *distance = NULL; + *vrf = argv[idx_curr]->arg; + } + else + { + *distance = argv[idx_curr]->arg; + *vrf = argv[++idx_curr]->arg; + } + } + + return; +} + + /* Static route configuration. */ DEFUN (ip_route, ip_route_cmd, - "ip route A.B.C.D/M ", - 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") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -DEFUN (ip_route_tag, - ip_route_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -364,36 +377,29 @@ DEFUN (ip_route_tag, "IP gateway interface name\n" "Null interface\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname_null = 3; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname_null]->arg, + NULL, + tag, distance, vrf); } DEFUN (ip_route_flags, ip_route_flags_cmd, - "ip route A.B.C.D/M ", - 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") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_flags_tag, - ip_route_flags_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -402,73 +408,60 @@ DEFUN (ip_route_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname = 3; int idx_reject_blackhole = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + 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); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (ip_route_flags2, ip_route_flags2_cmd, - "ip route A.B.C.D/M ", - 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") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_flags2_tag, - ip_route_flags2_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(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") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_reject_blackhole = 3; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } /* 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 ", - 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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -DEFUN (ip_route_mask_tag, - ip_route_mask_tag_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -477,40 +470,29 @@ DEFUN (ip_route_mask_tag, "IP gateway interface name\n" "Null interface\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname_null = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + 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); + + 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); } DEFUN (ip_route_mask_flags, ip_route_mask_flags_cmd, - "ip route A.B.C.D A.B.C.D ", - 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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, 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 tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -520,38 +502,32 @@ DEFUN (ip_route_mask_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } + DEFUN (ip_route_mask_flags2, ip_route_mask_flags2_cmd, - "ip route A.B.C.D A.B.C.D ", - 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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, 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 tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -559,267 +535,25 @@ DEFUN (ip_route_mask_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); -} - -/* Distance option value. */ -DEFUN (ip_route_distance, - ip_route_distance_cmd, - "ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_tag_distance, - ip_route_tag_distance_cmd, - "ip route A.B.C.D/M tag (1-65535) (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") - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_number_2 = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_flags_distance, - ip_route_flags_distance_cmd, - "ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_flags_tag_distance, - ip_route_flags_tag_distance_cmd, - "ip route A.B.C.D/M tag (1-65535) (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") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_flags_distance2, - ip_route_flags_distance2_cmd, - "ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_flags_tag_distance2, - ip_route_flags_tag_distance2_cmd, - "ip route A.B.C.D/M tag (1-65535) (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") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_number_2 = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_mask_distance, - ip_route_mask_distance_cmd, - "ip route A.B.C.D A.B.C.D (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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_mask_tag_distance, - ip_route_mask_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, 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 tag (1-65535) (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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - - -DEFUN (ip_route_mask_flags_distance, - ip_route_mask_flags_distance_cmd, - "ip route A.B.C.D A.B.C.D (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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_mask_flags_distance2, - ip_route_mask_flags_distance2_cmd, - "ip route A.B.C.D A.B.C.D (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") + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} + int idx_curr = 5; + char *tag, *distance, *vrf; -DEFUN (ip_route_mask_flags_tag_distance2, - ip_route_mask_flags_tag_distance2_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (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") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + 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); } /* @@ -887,8 +621,6 @@ DEFUN (no_ip_route_tag, NULL, NULL); } - - DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, "no ip route A.B.C.D/M ", @@ -1294,518 +1026,9 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, argv[idx_number_2]->arg, NULL); } -/* Static route configuration. */ -DEFUN (ip_route_vrf, - ip_route_vrf_cmd, - "ip route A.B.C.D/M 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" - "Null interface\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_name = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_tag_vrf, - ip_route_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) 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" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_vrf, - ip_route_flags_vrf_cmd, - "ip route A.B.C.D/M 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" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_vrf, - ip_route_flags_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags2_vrf, - ip_route_flags2_vrf_cmd, - "ip route A.B.C.D/M 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" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_name = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags2_tag_vrf, - ip_route_flags2_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) 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) - -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -/* 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 vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_tag_vrf, - ip_route_mask_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - 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) - -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_vrf, - ip_route_mask_flags_vrf_cmd, - "ip route A.B.C.D A.B.C.D vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_tag_vrf, - ip_route_mask_flags_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - 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) - -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags2_vrf, - ip_route_mask_flags2_vrf_cmd, - "ip route A.B.C.D A.B.C.D 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" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags2_tag_vrf, - ip_route_mask_flags2_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -/* Distance option value. */ -DEFUN (ip_route_distance_vrf, - ip_route_distance_vrf_cmd, - "ip route A.B.C.D/M (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" - "Null interface\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_tag_distance_vrf, - ip_route_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (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" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_distance_vrf, - ip_route_flags_distance_vrf_cmd, - "ip route A.B.C.D/M (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" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_distance_vrf, - ip_route_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (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) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_distance2_vrf, - ip_route_flags_distance2_vrf_cmd, - "ip route A.B.C.D/M (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" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_distance2_vrf, - ip_route_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_distance_vrf, - ip_route_mask_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_tag_distance_vrf, - ip_route_mask_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (1-255) vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - - -DEFUN (ip_route_mask_flags_distance_vrf, - ip_route_mask_flags_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_distance2_vrf, - ip_route_mask_flags_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (1-255) vrf NAME", - 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) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - DEFUN (no_ip_route_vrf, no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1823,7 +1046,7 @@ DEFUN (no_ip_route_vrf, DEFUN (no_ip_route_flags_vrf, no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1843,7 +1066,7 @@ DEFUN (no_ip_route_flags_vrf, DEFUN (no_ip_route_tag_vrf, no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1864,7 +1087,7 @@ DEFUN (no_ip_route_tag_vrf, DEFUN (no_ip_route_flags_tag_vrf, no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1887,7 +1110,7 @@ DEFUN (no_ip_route_flags_tag_vrf, DEFUN (no_ip_route_flags2_vrf, no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1904,7 +1127,7 @@ DEFUN (no_ip_route_flags2_vrf, DEFUN (no_ip_route_flags2_tag_vrf, no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1924,7 +1147,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, DEFUN (no_ip_route_mask_vrf, no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1944,7 +1167,7 @@ DEFUN (no_ip_route_mask_vrf, 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 vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1966,7 +1189,7 @@ DEFUN (no_ip_route_mask_flags_vrf, 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 tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1989,7 +1212,7 @@ DEFUN (no_ip_route_mask_tag_vrf, DEFUN (no_ip_route_mask_flags_tag_vrf, no_ip_route_mask_flags_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2014,7 +1237,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, 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 vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2033,7 +1256,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, 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 tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2056,7 +1279,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, DEFUN (no_ip_route_distance_vrf, no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2076,7 +1299,7 @@ DEFUN (no_ip_route_distance_vrf, DEFUN (no_ip_route_tag_distance_vrf, no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2099,7 +1322,7 @@ DEFUN (no_ip_route_tag_distance_vrf, DEFUN (no_ip_route_flags_distance_vrf, no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2121,7 +1344,7 @@ DEFUN (no_ip_route_flags_distance_vrf, DEFUN (no_ip_route_flags_tag_distance_vrf, no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2146,7 +1369,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, DEFUN (no_ip_route_flags_distance2_vrf, no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2165,7 +1388,7 @@ DEFUN (no_ip_route_flags_distance2_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 tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2187,7 +1410,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, 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 (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2209,7 +1432,7 @@ DEFUN (no_ip_route_mask_distance_vrf, DEFUN (no_ip_route_mask_tag_distance_vrf, no_ip_route_mask_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2234,7 +1457,7 @@ DEFUN (no_ip_route_mask_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 (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2258,7 +1481,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, 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 tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2285,7 +1508,7 @@ DEFUN (no_ip_route_mask_flags_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 (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2306,7 +1529,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, 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 tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2840,7 +2063,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route vrf NAME [json]", + "show ip route " VRF_CMD_STR " [json]", SHOW_STR IP_STR "IP routing table\n" @@ -2876,7 +2099,7 @@ DEFUN (show_ip_nht, DEFUN (show_ip_nht_vrf_all, show_ip_nht_vrf_all_cmd, - "show ip nht vrf all", + "show ip nht " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -2916,7 +2139,7 @@ DEFUN (show_ipv6_nht, DEFUN (show_ipv6_nht_vrf_all, show_ipv6_nht_vrf_all_cmd, - "show ipv6 nht vrf all", + "show ipv6 nht " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 nexthop tracking table\n" @@ -3144,7 +2367,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route [vrf NAME] ", + "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -3534,7 +2757,7 @@ DEFUN (show_ip_route_summary_prefix, DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, - "show ip route vrf all", + "show ip route " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IP routing table\n" @@ -3579,7 +2802,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route vrf all tag (1-65535)", + "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -3633,7 +2856,7 @@ DEFUN (show_ip_route_vrf_all_tag, DEFUN (show_ip_route_vrf_all_prefix_longer, show_ip_route_vrf_all_prefix_longer_cmd, - "show ip route vrf all A.B.C.D/M longer-prefixes", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" @@ -3691,7 +2914,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route vrf all supernets-only", + "show ip route " VRF_ALL_CMD_STR " supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -3745,7 +2968,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route vrf all ", + "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -3800,7 +3023,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route vrf all A.B.C.D", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -3842,7 +3065,7 @@ 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 A.B.C.D/M", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -3889,7 +3112,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 summary ", + "show ip route " VRF_ALL_CMD_STR " summary ", SHOW_STR IP_STR "IP routing table\n" @@ -3908,7 +3131,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 summary prefix", + "show ip route " VRF_ALL_CMD_STR " summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -4718,7 +3941,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, DEFUN (ipv6_route_vrf, ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M vrf NAME", + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4734,7 +3957,7 @@ DEFUN (ipv6_route_vrf, DEFUN (ipv6_route_tag_vrf, ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4753,7 +3976,7 @@ DEFUN (ipv6_route_tag_vrf, DEFUN (ipv6_route_flags_vrf, ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M vrf NAME", + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4772,7 +3995,7 @@ DEFUN (ipv6_route_flags_vrf, DEFUN (ipv6_route_flags_tag_vrf, ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4794,7 +4017,7 @@ DEFUN (ipv6_route_flags_tag_vrf, DEFUN (ipv6_route_ifname_vrf, ipv6_route_ifname_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "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" @@ -4810,7 +4033,7 @@ DEFUN (ipv6_route_ifname_vrf, } 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-65535) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4830,7 +4053,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, DEFUN (ipv6_route_ifname_flags_vrf, ipv6_route_ifname_flags_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "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" @@ -4850,7 +4073,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, 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 tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4873,7 +4096,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, DEFUN (ipv6_route_pref_vrf, ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) vrf NAME", + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4891,7 +4114,7 @@ DEFUN (ipv6_route_pref_vrf, DEFUN (ipv6_route_pref_tag_vrf, ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4912,7 +4135,7 @@ DEFUN (ipv6_route_pref_tag_vrf, DEFUN (ipv6_route_flags_pref_vrf, ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) vrf NAME", + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4933,7 +4156,7 @@ DEFUN (ipv6_route_flags_pref_vrf, DEFUN (ipv6_route_flags_pref_tag_vrf, ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4957,7 +4180,7 @@ DEFUN (ipv6_route_flags_pref_tag_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 NAME", + "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" @@ -4976,7 +4199,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, DEFUN (ipv6_route_ifname_pref_tag_vrf, ipv6_route_ifname_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4998,7 +4221,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, 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 (1-255) vrf NAME", + "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" @@ -5020,7 +4243,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, 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 tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -5045,7 +4268,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M vrf NAME", + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5062,7 +4285,7 @@ DEFUN (no_ipv6_route_vrf, DEFUN (no_ipv6_route_tag_vrf, no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5082,7 +4305,7 @@ DEFUN (no_ipv6_route_tag_vrf, DEFUN (no_ipv6_route_flags_vrf, no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M vrf NAME", + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5102,7 +4325,7 @@ DEFUN (no_ipv6_route_flags_vrf, DEFUN (no_ipv6_route_flags_tag_vrf, no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5125,7 +4348,7 @@ DEFUN (no_ipv6_route_flags_tag_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 NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5143,7 +4366,7 @@ DEFUN (no_ipv6_route_ifname_vrf, 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-65535) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5164,7 +4387,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, 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 vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5185,7 +4408,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, 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 tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5209,7 +4432,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, DEFUN (no_ipv6_route_pref_vrf, no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5228,7 +4451,7 @@ DEFUN (no_ipv6_route_pref_vrf, DEFUN (no_ipv6_route_pref_tag_vrf, no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5250,7 +4473,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, DEFUN (no_ipv6_route_flags_pref_vrf, no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5273,7 +4496,7 @@ DEFUN (no_ipv6_route_flags_pref_vrf, DEFUN (no_ipv6_route_flags_pref_tag_vrf, no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5299,7 +4522,7 @@ DEFUN (no_ipv6_route_flags_pref_tag_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 NAME", + "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" @@ -5319,7 +4542,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, DEFUN (no_ipv6_route_ifname_pref_tag_vrf, no_ipv6_route_ifname_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5342,7 +4565,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, 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 (1-255) vrf NAME", + "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" @@ -5365,7 +4588,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, 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 tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5391,7 +4614,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route vrf NAME [json]", + * "show ipv6 route " VRF_CMD_STR " [json]", * SHOW_STR * IP_STR * "IPv6 routing table\n" @@ -5597,7 +4820,7 @@ DEFUN (show_ipv6_route_prefix_longer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route vrf NAME ", + * "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, * SHOW_STR * IP_STR * "IP routing table\n" @@ -5607,7 +4830,7 @@ DEFUN (show_ipv6_route_prefix_longer, */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route ", + "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -5846,7 +5069,7 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route vrf all", + "show ipv6 route " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 routing table\n" @@ -5891,7 +5114,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route vrf all tag (1-65535)", + "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5946,7 +5169,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route vrf all X:X::X:X/M longer-prefixes", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6004,7 +5227,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route vrf all ", + "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -6059,7 +5282,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, - "show ipv6 route vrf all X:X::X:X", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6101,7 +5324,7 @@ 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 X:X::X:X/M", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6148,7 +5371,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 summary", + "show ipv6 route " VRF_ALL_CMD_STR " summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6167,7 +5390,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", + "show ipv6 mroute " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 Multicast routing table\n" @@ -6203,7 +5426,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 summary prefix", + "show ipv6 route " VRF_ALL_CMD_STR " summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6540,17 +5763,11 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ip_multicast_mode_cmd); install_element (CONFIG_NODE, &no_ip_multicast_mode_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_flags2_cmd); @@ -6559,18 +5776,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_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); @@ -6625,18 +5830,6 @@ 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); @@ -6649,18 +5842,6 @@ zebra_vty_init (void) 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); From fb5b479d9d6bae7d80923f81fa214fe244a0a943 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 08:10:57 -0400 Subject: [PATCH 2/7] zebra: Fixup 'no ip route....' Rework the 'no ip route XXXX' commands to use the new cli and collapse all DEFUN's that we could into a much smaller set of commands. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 1032 ++++----------------------------------------- 1 file changed, 92 insertions(+), 940 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 97fc6d2abe..abdab53e40 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -556,54 +556,9 @@ DEFUN (ip_route_mask_flags2, tag, distance, vrf); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "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, no_ip_route_cmd, - "no ip route A.B.C.D/M ", - 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") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix (e.g. 10.0.0.0/8)\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * "Tag of this route\n" - * "Tag value\n" - * - */ -DEFUN (no_ip_route_tag, - no_ip_route_tag_cmd, - "no ip route A.B.C.D/M tag (1-65535)", + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -612,33 +567,29 @@ DEFUN (no_ip_route_tag, "IP gateway interface name\n" "Null interface\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname_null = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + 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); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname_null]->arg, + NULL, + tag, distance, vrf); } DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, - "no ip route A.B.C.D/M ", - 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") -{ - int idx_ipv4_prefixlen = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, 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 tag (1-65535)", + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -646,66 +597,26 @@ DEFUN (no_ip_route_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, NULL, argv[idx_reject_blackhole]->arg, - NULL, NULL); + 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); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, NULL, NULL, + tag, distance, vrf); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "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, no_ip_route_mask_cmd, - "no ip route A.B.C.D A.B.C.D ", - 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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix\n" - * "IP destination prefix mask\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * "Tag of this route\n" - * "Tag value\n" - * - */ -DEFUN (no_ip_route_mask_tag, - no_ip_route_mask_tag_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535)", + "no ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -715,38 +626,30 @@ DEFUN (no_ip_route_mask_tag, "IP gateway interface name\n" "Null interface\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname_null = 5; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + 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); } - - DEFUN (no_ip_route_mask_flags2, no_ip_route_mask_flags2_cmd, - "no ip route A.B.C.D A.B.C.D ", - 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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, 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 tag (1-65535)", + "no ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -755,596 +658,28 @@ DEFUN (no_ip_route_mask_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Tag of this route\n" - "Tag value\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, - NULL, NULL); -} - -DEFUN (no_ip_route_distance, - no_ip_route_distance_cmd, - "no ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_tag_distance, - no_ip_route_tag_distance_cmd, - "no ip route A.B.C.D/M tag (1-65535) (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_flags_distance, - no_ip_route_flags_distance_cmd, - "no ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_flags_tag_distance, - no_ip_route_flags_tag_distance_cmd, - "no ip route A.B.C.D/M tag (1-65535) (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_flags_distance2, - no_ip_route_flags_distance2_cmd, - "no ip route A.B.C.D/M (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_flags_tag_distance2, - no_ip_route_flags_tag_distance2_cmd, - "no ip route A.B.C.D/M tag (1-65535) (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") -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_mask_distance, - no_ip_route_mask_distance_cmd, - "no ip route A.B.C.D A.B.C.D (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, 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 tag (1-65535) (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, 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 (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, 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 tag (1-65535) (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_mask_flags_distance2, - no_ip_route_mask_flags_distance2_cmd, - "no ip route A.B.C.D A.B.C.D (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, 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 tag (1-65535) (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") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_vrf, - no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M " 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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_vrf, - no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M " 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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_tag_vrf, - no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " 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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_vrf, - no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " 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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags2_vrf, - no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M " 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) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags2_tag_vrf, - no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " 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" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_vrf, - no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -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 " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -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 tag (1-65535) " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -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 tag (1-65535) " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -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 " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -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 tag (1-65535) " 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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - - -DEFUN (no_ip_route_distance_vrf, - no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_tag_distance_vrf, - no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (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) { - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + NULL, NULL, + tag, distance, vrf); } -DEFUN (no_ip_route_flags_distance_vrf, - no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (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) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_distance_vrf, - no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, +DEFUN (no_ip_route_flags, + no_ip_route_flags_cmd, + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -1361,127 +696,23 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg,argv[idx_name]->arg); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } -DEFUN (no_ip_route_flags_distance2_vrf, - no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (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) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_distance2_vrf, - no_ip_route_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (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) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg , argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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 (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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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 (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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (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 [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -1500,56 +731,20 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, int idx_ipv4_2 = 4; int idx_ipv4_ifname = 5; int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - int idx_name = 11; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_curr = 7; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } -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 (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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (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) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} /* New RIB. Detailed information for IPv4 route. */ static void @@ -5769,25 +4964,9 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); install_element (CONFIG_NODE, &ip_route_mask_flags2_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_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_flags2_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_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_distance_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_routemap_cmd); install_element (CONFIG_NODE, &no_ip_zebra_import_table_cmd); @@ -5830,30 +5009,8 @@ zebra_vty_init (void) /* Commands for VRF */ - 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, &no_ip_route_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd); + install_element (CONFIG_NODE, &no_ip_route_flags_cmd); + install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_cmd); install_element (ENABLE_NODE, &show_ip_route_vrf_cmd); @@ -5877,7 +5034,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ip_route_vrf_all_summary_cmd); install_element (ENABLE_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); @@ -5969,8 +5125,6 @@ zebra_vty_init (void) 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_all_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd); @@ -5988,8 +5142,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_cmd); install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); -#endif /* HAVE_IPV6 */ } From 96121d19fa270325a4d3860e130c3a5d0d057639 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 09:23:26 -0400 Subject: [PATCH 3/7] zebra: Refactor 'ipv6 route XXXX' for new cli Take existing code for 'ipv6 route XXX' and refactor to use the new cli. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 650 +++++----------------------------------------- 1 file changed, 63 insertions(+), 587 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index abdab53e40..ea911653fa 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2527,55 +2527,36 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, DEFUN (ipv6_route, ipv6_route_cmd, - "ipv6 route X:X::X:X/M ", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); -} - -DEFUN (ipv6_route_tag, - ipv6_route_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535)", + "ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, NULL, + tag, distance, vrf); } + DEFUN (ipv6_route_flags, ipv6_route_flags_cmd, - "ipv6 route X:X::X:X/M ", - 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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (ipv6_route_flags_tag, - ipv6_route_flags_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535)", + "ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2583,144 +2564,62 @@ DEFUN (ipv6_route_flags_tag, "IPv6 gateway interface name\n" "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" + "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_reject_blackhole = 4; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); + 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); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } 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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, 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-65535)", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); + 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); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + NULL, + tag, distance, vrf); } DEFUN (ipv6_route_ifname_flags, ipv6_route_ifname_flags_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" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, 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 tag (1-65535)", - 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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); -} - -DEFUN (ipv6_route_pref, - ipv6_route_pref_cmd, - "ipv6 route X:X::X:X/M (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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_route_pref_tag, - ipv6_route_pref_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_number_2 = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ipv6_route_flags_pref, - ipv6_route_flags_pref_cmd, - "ipv6 route X:X::X:X/M (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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_route_flags_pref_tag, - ipv6_route_flags_pref_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255)", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2730,94 +2629,25 @@ DEFUN (ipv6_route_flags_pref_tag, "Silently discard pkts when matched\n" "Set tag for this route\n" "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, 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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, 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-65535) (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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, 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 (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") + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; int idx_reject_blackhole = 5; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} + int idx_curr = 6; + char *tag, *distance, *vrf; -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 tag (1-65535) (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") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (no_ipv6_route, @@ -3134,332 +2964,6 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } -DEFUN (ipv6_route_vrf, - ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_name = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_tag_vrf, - ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_vrf, - ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_tag_vrf, - ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} -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-65535) " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_flags_vrf, - ipv6_route_ifname_flags_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" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -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 tag (1-65535) " 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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_pref_vrf, - ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_pref_tag_vrf, - ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_pref_vrf, - ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_pref_tag_vrf, - ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (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" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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-65535) (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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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 (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) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (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" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, @@ -5042,22 +4546,10 @@ 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); @@ -5092,30 +4584,14 @@ zebra_vty_init (void) /* 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); From 28dadafced1b918b9095d22ffc6a3bfe6349d6f7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 10:01:50 -0400 Subject: [PATCH 4/7] zebra: Refactor 'no ipv6 route XXXX' for new cli Refactor the 'no ipv6 route XXXX' commands to work under the new cli and to collapse the code to a much smaller set. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 688 ++++------------------------------------------ 1 file changed, 60 insertions(+), 628 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ea911653fa..121c0c0c04 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2406,7 +2406,6 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) return write; } -#ifdef HAVE_IPV6 /* General fucntion for IPv6 static route. */ static int static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, @@ -2652,22 +2651,7 @@ DEFUN (ipv6_route_ifname_flags, DEFUN (no_ipv6_route, no_ipv6_route_cmd, - "no ipv6 route X:X::X:X/M ", - 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_tag, - no_ipv6_route_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535)", + "no ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2675,35 +2659,28 @@ DEFUN (no_ipv6_route_tag, "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; - int idx_number = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); + 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); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, NULL, + tag, distance, vrf); } DEFUN (no_ipv6_route_flags, no_ipv6_route_flags_cmd, - "no ipv6 route X:X::X:X/M ", - 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_flags_tag, - no_ipv6_route_flags_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535)", + "no ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2713,34 +2690,30 @@ DEFUN (no_ipv6_route_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); + 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); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, 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-65535)", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2748,546 +2721,30 @@ DEFUN (no_ipv6_route_ifname_tag, "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + NULL, + tag, distance, vrf); } 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 ", - 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, 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 tag (1-65535)", - 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); -} - -DEFUN (no_ipv6_route_pref, - no_ipv6_route_pref_cmd, - "no ipv6 route X:X::X:X/M (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_pref_tag, - no_ipv6_route_pref_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ipv6_route_flags_pref, - no_ipv6_route_flags_pref_cmd, - "no ipv6 route X:X::X:X/M (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_flags_pref_tag, - no_ipv6_route_flags_pref_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, 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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, 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-65535) (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_number_2 = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, 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 (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, 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 tag (1-65535) (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") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - - -DEFUN (no_ipv6_route_vrf, - no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M " 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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_name = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_tag_vrf, - no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " 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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_vrf, - no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M " 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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_tag_vrf, - no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -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-65535) " 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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -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 " 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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -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 tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_name = 10; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_pref_vrf, - no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_pref_tag_vrf, - no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_pref_vrf, - no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_pref_tag_vrf, - no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (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" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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-65535) (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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -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 (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) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -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 tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -3305,10 +2762,18 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, int idx_ipv6 = 4; int idx_interface = 5; int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - int idx_name = 11; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_curr = 7; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } /* @@ -4204,7 +3669,6 @@ static_config_ipv6 (struct vty *vty) } return write; } -#endif /* HAVE_IPV6 */ DEFUN (allow_external_route_update, allow_external_route_update_cmd, @@ -4261,9 +3725,7 @@ zebra_ip_config (struct vty *vty) write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); -#ifdef HAVE_IPV6 write += static_config_ipv6 (vty); -#endif /* HAVE_IPV6 */ write += zebra_import_table_config (vty); return write; @@ -4546,18 +4008,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); - install_element (CONFIG_NODE, &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, &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); @@ -4583,24 +4033,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ipv6_mroute_cmd); /* Commands for VRF */ - - 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, &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, &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_all_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd); From 5bebf56884d86291cdf95825a79aea420b6fe93f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 11:51:10 -0400 Subject: [PATCH 5/7] zebra: Put back missing code When pulling forward the zebra_vty.c changes I accidently dropped these changes from earlier commits. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 121c0c0c04..a9f0e87017 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1258,7 +1258,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route " VRF_CMD_STR " [json]", + "show ip route vrf NAME [json]", SHOW_STR IP_STR "IP routing table\n" @@ -1294,7 +1294,7 @@ DEFUN (show_ip_nht, 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" @@ -1334,7 +1334,7 @@ DEFUN (show_ipv6_nht, 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" @@ -1952,7 +1952,7 @@ DEFUN (show_ip_route_summary_prefix, DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, - "show ip route " VRF_ALL_CMD_STR, + "show ip route vrf all", SHOW_STR IP_STR "IP routing table\n" @@ -1997,7 +1997,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ip route vrf all tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -2051,7 +2051,7 @@ DEFUN (show_ip_route_vrf_all_tag, DEFUN (show_ip_route_vrf_all_prefix_longer, show_ip_route_vrf_all_prefix_longer_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes", + "show ip route vrf all A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" @@ -2109,7 +2109,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route " VRF_ALL_CMD_STR " supernets-only", + "show ip route vrf all supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -2163,7 +2163,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route vrf all " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -2218,7 +2218,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D", + "show ip route vrf all A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -2260,7 +2260,7 @@ 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" @@ -2307,7 +2307,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" @@ -2326,7 +2326,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" @@ -2994,11 +2994,11 @@ DEFUN (show_ipv6_route_prefix_longer, */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route ", SHOW_STR IP_STR "IP routing table\n" - QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) + QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { int idx_protocol = 3; int type; @@ -3233,7 +3233,7 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route " VRF_ALL_CMD_STR, + "show ipv6 route vrf all", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3278,7 +3278,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ipv6 route vrf all tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3333,7 +3333,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes", + "show ipv6 route vrf all X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3391,7 +3391,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route vrf all ", SHOW_STR IP_STR "IP routing table\n" @@ -3446,7 +3446,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X", + "show ipv6 route vrf all X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3488,7 +3488,7 @@ 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" @@ -3535,7 +3535,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" @@ -3554,7 +3554,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" @@ -3590,7 +3590,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" From 31500417e45002f3bbc7850d7b60d854a7333fea Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 23:50:02 +0000 Subject: [PATCH 6/7] bgpd: fixed more CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 60 ++---- bgpd/bgp_vty.c | 551 ++++++++--------------------------------------- 2 files changed, 110 insertions(+), 501 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d5dc37a03c..712d9fda76 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,17 +7732,14 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7799,9 +7796,6 @@ DEFUN (show_ip_bgp_ipv4, return CMD_WARNING; } - // "show [ip] bgp [ WORD] [] - // [cidr-only|<[dampening] >|regexp .LINE|prefix-list WORD|filter-list WORD| - // community []|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes] [json]", if (strmatch(argv[idx_sh_type]->text, "cidr-only")) return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); @@ -7863,13 +7857,13 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [] [bestpath|multipath] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [bestpath|multipath] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" + "Address family\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7878,8 +7872,6 @@ DEFUN (show_ip_bgp_route, "Address Family modifier\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" - "Address family\n" - "Address Family modifier\n" "Network in the BGP routing table to display\n" "IP prefix /, e.g., 35.0.0.0/8\n" "IPv6 prefix /\n" @@ -9256,17 +9248,14 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [] WORD [] neighbors [] [json]", + "show [ip] bgp [] WORD [< [unicast]|ipv4 multicast>] neighbors [] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9432,17 +9421,14 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show [ip] bgp [ WORD] [] neighbors [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] neighbors [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9783,21 +9769,9 @@ DEFUN (no_bgp_distance_source_access_list, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "bgp dampening", - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * - * "bgp dampening <1-45>", - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * "Half-life time for the penalty\n" - * - */ DEFUN (bgp_damp_set, bgp_damp_set_cmd, - "bgp dampening (1-45) (1-20000) (1-20000) (1-255)", + "bgp dampening [(1-45) [(1-20000) (1-20000) (1-255)]]", "BGP Specific commands\n" "Enable route-flap dampening\n" "Half-life time for the penalty\n" @@ -9805,26 +9779,26 @@ DEFUN (bgp_damp_set, "Value to start suppressing a route\n" "Maximum duration to suppress a stable route\n") { - int idx_number = 2; - int idx_number_2 = 3; - int idx_number_3 = 4; - int idx_number_4 = 5; + int idx_half_life = 2; + int idx_reuse = 3; + int idx_suppress = 4; + int idx_max_suppress = 5; struct bgp *bgp; int half = DEFAULT_HALF_LIFE * 60; int reuse = DEFAULT_REUSE; int suppress = DEFAULT_SUPPRESS; int max = 4 * half; - if (argc == 4) + if (argc == 6) { - half = atoi (argv[idx_number]->arg) * 60; - reuse = atoi (argv[idx_number_2]->arg); - suppress = atoi (argv[idx_number_3]->arg); - max = atoi (argv[idx_number_4]->arg) * 60; + half = atoi (argv[idx_half_life]->arg) * 60; + reuse = atoi (argv[idx_reuse]->arg); + suppress = atoi (argv[idx_suppress]->arg); + max = atoi (argv[idx_max_suppress]->arg) * 60; } - else if (argc == 1) + else if (argc == 3) { - half = atoi (argv[idx_number]->arg) * 60; + half = atoi (argv[idx_half_life]->arg) * 60; max = 4 * half; } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 2b2731a890..46072a8c6f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -656,28 +656,17 @@ DEFUN (no_auto_summary, } /* "router bgp" commands. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "router bgp", - * ROUTER_STR - * BGP_STR - * - * "router bgp (1-4294967295) (view|vrf) WORD", - * ROUTER_STR - * BGP_STR - * AS_STR - * "BGP view\nBGP VRF\n" - * "View/VRF name\n" - * - */ DEFUN (router_bgp, router_bgp_cmd, - "router bgp (1-4294967295)", + "router bgp [(1-4294967295) [ WORD]]", ROUTER_STR BGP_STR - AS_STR) + AS_STR + BGP_INSTANCE_HELP_STR) { - int idx_number = 2; + int idx_asn = 2; + int idx_view_vrf = 3; + int idx_vrf = 4; int ret; as_t as; struct bgp *bgp; @@ -685,7 +674,7 @@ DEFUN (router_bgp, enum bgp_instance_type inst_type; // "router bgp" without an ASN - if (argc < 1) + if (argc == 2) { //Pending: Make VRF option available for ASN less config bgp = bgp_get_default(); @@ -706,15 +695,16 @@ DEFUN (router_bgp, // "router bgp X" else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX); inst_type = BGP_INSTANCE_TYPE_DEFAULT; - if (argc == 3) + if (argc > 3) { - name = argv[4]->arg; - if (!strcmp(argv[3]->arg, "vrf")) + name = argv[idx_vrf]->arg; + + if (!strcmp(argv[idx_view_vrf]->text, "vrf")) inst_type = BGP_INSTANCE_TYPE_VRF; - else if (!strcmp(argv[3]->arg, "view")) + else if (!strcmp(argv[idx_view_vrf]->text, "view")) inst_type = BGP_INSTANCE_TYPE_VIEW; } @@ -745,38 +735,24 @@ DEFUN (router_bgp, } /* "no router bgp" commands. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no router bgp", - * NO_STR - * ROUTER_STR - * BGP_STR - * - * "no router bgp (1-4294967295) (view|vrf) WORD", - * NO_STR - * ROUTER_STR - * BGP_STR - * AS_STR - * "BGP view\nBGP VRF\n" - * "View/VRF name\n" - * - */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp (1-4294967295)", + "no router bgp [(1-4294967295) [ WORD]]", NO_STR ROUTER_STR BGP_STR - AS_STR) + AS_STR + BGP_INSTANCE_HELP_STR) { - int idx_number = 3; + int idx_asn = 3; + int idx_view_vrf = 4; + int idx_vrf = 5; as_t as; struct bgp *bgp; const char *name = NULL; - // "no router bgp" without an ASN - if (argc < 1) + if (argc == 3) { //Pending: Make VRF option available for ASN less config bgp = bgp_get_default(); @@ -795,10 +771,10 @@ DEFUN (no_router_bgp, } else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX); - if (argc == 3) - name = argv[5]->arg; + if (argc > 4) + name = argv[idx_vrf]->arg; /* Lookup bgp structure. */ bgp = bgp_lookup (as, name); @@ -844,31 +820,24 @@ DEFUN (bgp_router_id, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp router-id A.B.C.D", - * NO_STR - * BGP_STR - * "Override configured router identifier\n" - * "Manually configured router identifier\n" - * - */ DEFUN (no_bgp_router_id, no_bgp_router_id_cmd, - "no bgp router-id", + "no bgp router-id [A.B.C.D]", NO_STR BGP_STR - "Override configured router identifier\n") + "Override configured router identifier\n" + "Manually configured router identifier\n") { + int idx_router_id = 3; int ret; struct in_addr id; struct bgp *bgp; bgp = vty->index; - if (argc == 1) + if (argc > idx_router_id) { - ret = inet_aton (argv[3]->arg, &id); + ret = inet_aton (argv[idx_router_id]->arg, &id); if (! ret) { vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); @@ -2801,55 +2770,45 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, return bgp_vty_return (vty, ret); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor WORD interface peer-group WORD", - * NEIGHBOR_STR - * "Interface name or neighbor tag\n" - * "Enable BGP on interface\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (neighbor_interface_config, neighbor_interface_config_cmd, - "neighbor WORD interface", + "neighbor WORD interface [peer-group WORD]", NEIGHBOR_STR "Interface name or neighbor tag\n" - "Enable BGP on interface\n") + "Enable BGP on interface\n" + "Member of the peer-group\n" + "peer-group name\n") { int idx_word = 1; - if (argc == 2) + int idx_peer_group_word = 4; + + if (argc > idx_peer_group_word) return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, - argv[3]->arg, NULL); + argv[idx_peer_group_word]->arg, NULL); else return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, NULL, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor WORD interface v6only peer-group WORD", - * NEIGHBOR_STR - * "Interface name or neighbor tag\n" - * "Enable BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (neighbor_interface_config_v6only, neighbor_interface_config_v6only_cmd, - "neighbor WORD interface v6only", + "neighbor WORD interface v6only [peer-group WORD]", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - "Enable BGP with v6 link-local only\n") + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "peer-group name\n") { int idx_word = 1; + int idx_peer_group_word = 5; + + if (argc > idx_peer_group_word) + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, + argv[idx_peer_group_word]->arg, NULL); + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, - argv[5]->arg, NULL); + NULL, NULL); } @@ -2967,56 +2926,17 @@ DEFUN (no_neighbor, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor WORD interface remote-as ((1-4294967295)|internal|external)", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * AS_STR - * - * "no neighbor WORD interface v6only peer-group WORD", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - * "no neighbor WORD interface v6only remote-as ((1-4294967295)|internal|external)", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * AS_STR - * - * "no neighbor WORD interface v6only", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * - * "no neighbor WORD interface peer-group WORD", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (no_neighbor_interface_config, no_neighbor_interface_config_cmd, - "no neighbor WORD interface", + "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]", NO_STR NEIGHBOR_STR "Interface name\n" - "Configure BGP on interface\n") + "Configure BGP on interface\n" + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "peer-group name\n" + AS_STR) { int idx_word = 2; struct peer *peer; @@ -4083,57 +4003,6 @@ DEFUN (no_neighbor_nexthop_local_unchanged, PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor attribute-unchanged med next-hop as-path", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * - * "neighbor attribute-unchanged med as-path next-hop", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * - * "neighbor attribute-unchanged as-path next-hop med", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * - * "neighbor attribute-unchanged next-hop as-path med", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * "Med attribute\n" - * - * "neighbor attribute-unchanged as-path med next-hop", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * - * "neighbor attribute-unchanged next-hop med as-path", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * "As-path attribute\n" - * - */ DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, "neighbor attribute-unchanged", @@ -4244,76 +4113,16 @@ DEFUN (neighbor_attr_unchanged4, bgp_node_safi (vty), flags); } - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor attribute-unchanged next-hop med as-path", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * "As-path attribute\n" - * - * "no neighbor attribute-unchanged as-path med next-hop", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * - * "no neighbor attribute-unchanged med as-path next-hop", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * - * "no neighbor attribute-unchanged next-hop as-path med", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * "Med attribute\n" - * - * "no neighbor attribute-unchanged as-path next-hop med", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * - * "no neighbor attribute-unchanged med next-hop as-path", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * - */ DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor attribute-unchanged", + "no neighbor attribute-unchanged [as-path] [next-hop] [med]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n") + "BGP attribute is propagated unchanged to this neighbor\n" + "As-path attribute\n" + "Med attribute\n" + "Nexthop attribute\n") { int idx_peer = 2; return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -4555,9 +4364,6 @@ DEFUN (neighbor_description, return CMD_SUCCESS; } -/* CHECK ME quentin mentioned something about LINE vs .LINE vs LINE... but - * I don't remember what. We need to check all LINE and AA:NN - * */ DEFUN (no_neighbor_description, no_neighbor_description_cmd, "no neighbor description [LINE]", @@ -5686,67 +5492,18 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, bgp_node_safi (vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 0, argv[idx_number_3]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor maximum-prefix <1-4294967295>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100> restart <1-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * "Restart bgp connection after limit is exceeded\n" - * "Restart interval in minutes" - * - * "no neighbor maximum-prefix <1-4294967295> warning-only", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Only give warning message when limit is exceeded\n" - * - * "no neighbor maximum-prefix <1-4294967295> restart <1-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Restart bgp connection after limit is exceeded\n" - * "Restart interval in minutes" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100> warning-only", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * "Only give warning message when limit is exceeded\n" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * - */ DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, - "no neighbor maximum-prefix", + "no neighbor maximum-prefix [<1-4294967295> [<1-100>] [restart <1-65535>] [warning-only]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n") + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Restart bgp connection after limit is exceeded\n" + "Restart interval in minutes" + "Only give warning message when limit is exceeded\n") { int idx_peer = 2; return peer_maximum_prefix_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -5755,23 +5512,16 @@ DEFUN (no_neighbor_maximum_prefix, /* "neighbor allowas-in" */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor allowas-in <1-10>", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Accept as-path with my AS present in it\n" - * "Number of occurances of AS number\n" - * - */ DEFUN (neighbor_allowas_in, neighbor_allowas_in_cmd, - "neighbor allowas-in", + "neighbor allowas-in [(1-10)]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Accept as-path with my AS present in it\n") + "Accept as-path with my AS present in it\n" + "Number of occurances of AS number\n") { int idx_peer = 1; + int idx_number = 3; int ret; struct peer *peer; unsigned int allow_num; @@ -5780,10 +5530,10 @@ DEFUN (neighbor_allowas_in, if (! peer) return CMD_WARNING; - if (argc == 1) + if (argc <= idx_number) allow_num = 3; else - VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[3]->arg, 1, 10); + VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[idx_number]->arg, 1, 10); ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), allow_num); @@ -6233,7 +5983,7 @@ bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []|in [prefix-filter]|out>]", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [< [unicast]|ipv4 multicast>] []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -6247,11 +5997,8 @@ DEFUN (clear_ip_bgp_all, "Clear all members of peer-group\n" "BGP peer-group name\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7099,17 +6846,14 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show [ip] bgp [ WORD] [] summary [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] summary [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9157,7 +8901,7 @@ bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show [ip] bgp [ WORD] [] update-groups [SUBGROUP-ID]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR @@ -10001,57 +9745,18 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute (ospf|table) <1-65535> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - */ DEFUN (no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_cmd, - "no redistribute (1-65535)", + "no redistribute (1-65535) [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n") + "Instance ID/Table ID\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_ospf_table = 2; int idx_number = 3; @@ -10067,51 +9772,16 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); } - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * - */ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute ", + "no redistribute [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD) + QUAGGA_IP_REDIST_HELP_STR_BGPD + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_protocol = 2; int type; @@ -10125,10 +9795,6 @@ DEFUN (no_bgp_redistribute_ipv4, return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); } - - - - #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, @@ -10264,47 +9930,16 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * - */ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute ", + "no redistribute [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD) + QUAGGA_IP6_REDIST_HELP_STR_BGPD + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_protocol = 2; int type; From e961923c7217b935027107cad30c35c3907c936f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 00:07:46 +0000 Subject: [PATCH 7/7] bgpd, etc: changed .LINE to LINE... Signed-off-by: Daniel Walton --- bgpd/bgp_filter.c | 4 ++-- bgpd/bgp_routemap.c | 4 ++-- bgpd/bgp_vty.c | 18 +++++++++--------- lib/filter.c | 4 ++-- lib/plist.c | 4 ++-- pimd/pim_cmd.c | 4 ++-- tests/heavy-thread.c | 2 +- tests/heavy-wq.c | 2 +- tests/heavy.c | 2 +- vtysh/vtysh.c | 2 +- zebra/zebra_vty.c | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 05d5eafae6..5af840810b 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -428,7 +428,7 @@ as_list_dup_check (struct as_list *aslist, struct as_filter *new) DEFUN (ip_as_path, ip_as_path_cmd, - "ip as-path access-list WORD .LINE", + "ip as-path access-list WORD LINE...", IP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" @@ -486,7 +486,7 @@ DEFUN (ip_as_path, DEFUN (no_ip_as_path, no_ip_as_path_cmd, - "no ip as-path access-list WORD .LINE", + "no ip as-path access-list WORD LINE...", NO_STR IP_STR "BGP autonomous system path filter\n" diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e1d8ca896d..dc90094f65 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3938,7 +3938,7 @@ DEFUN (no_set_aspath_exclude, DEFUN (set_community, set_community_cmd, - "set community .AA:NN", + "set community AA:NN...", SET_STR "BGP community attribute\n" COMMUNITY_VAL_STR) @@ -4047,7 +4047,7 @@ DEFUN (set_community_none, * "BGP community attribute\n" * "No community attribute\n" * - * "no set community .AA:NN", + * "no set community AA:NN...", * NO_STR * SET_STR * "BGP community attribute\n" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 46072a8c6f..1fcdede2db 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4338,7 +4338,7 @@ DEFUN (no_neighbor_disable_connected_check, DEFUN (neighbor_description, neighbor_description_cmd, - "neighbor description .LINE", + "neighbor description LINE...", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Neighbor specific description\n" @@ -11293,7 +11293,7 @@ community_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, /* ip community-list standard */ DEFUN (ip_community_list_standard, ip_community_list_standard_cmd, - "ip community-list <(1-99)|standard WORD> [.AA:NN]", + "ip community-list <(1-99)|standard WORD> AA:NN...", IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" @@ -11308,7 +11308,7 @@ DEFUN (ip_community_list_standard, DEFUN (no_ip_community_list_standard_all, no_ip_community_list_standard_all_cmd, - "no ip community-list <(1-99)|standard WORD> [ [.AA:NN]]", + "no ip community-list <(1-99)|standard WORD> AA:NN...", NO_STR IP_STR COMMUNITY_LIST_STR @@ -11325,7 +11325,7 @@ DEFUN (no_ip_community_list_standard_all, /* ip community-list expanded */ DEFUN (ip_community_list_expanded_all, ip_community_list_expanded_all_cmd, - "ip community-list <(100-500)|expanded WORD> [ [.LINE]]", + "ip community-list <(100-500)|expanded WORD> LINE...", IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" @@ -11340,7 +11340,7 @@ DEFUN (ip_community_list_expanded_all, DEFUN (no_ip_community_list_expanded_all, no_ip_community_list_expanded_all_cmd, - "no ip community-list <(100-500)|expanded WORD> [ [.LINE]]", + "no ip community-list <(100-500)|expanded WORD> LINE...", NO_STR IP_STR COMMUNITY_LIST_STR @@ -11532,7 +11532,7 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, DEFUN (ip_extcommunity_list_standard, ip_extcommunity_list_standard_cmd, - "ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", + "ip extcommunity-list <(1-99)|standard WORD> AA:NN...", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" @@ -11547,7 +11547,7 @@ DEFUN (ip_extcommunity_list_standard, DEFUN (ip_extcommunity_list_name_expanded, ip_extcommunity_list_name_expanded_cmd, - "ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", + "ip extcommunity-list <(100-500)|expanded WORD> LINE...", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" @@ -11562,7 +11562,7 @@ DEFUN (ip_extcommunity_list_name_expanded, DEFUN (no_ip_extcommunity_list_standard_all, no_ip_extcommunity_list_standard_all_cmd, - "no ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", + "no ip extcommunity-list <(1-99)|standard WORD> AA:NN...", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -11578,7 +11578,7 @@ DEFUN (no_ip_extcommunity_list_standard_all, DEFUN (no_ip_extcommunity_list_expanded_all, no_ip_extcommunity_list_expanded_all_cmd, - "no ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", + "no ip extcommunity-list <(100-500)|expanded WORD> LINE...", NO_STR IP_STR EXTCOMMUNITY_LIST_STR diff --git a/lib/filter.c b/lib/filter.c index 40bf0a3395..11dd7cd1c9 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1470,7 +1470,7 @@ DEFUN (no_access_list_all, DEFUN (access_list_remark, access_list_remark_cmd, - "access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark .LINE", + "access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark LINE...", "Add an access list entry\n" "IP standard access list\n" "IP extended access list\n" @@ -1666,7 +1666,7 @@ DEFUN (no_ipv6_access_list_all, DEFUN (ipv6_access_list_remark, ipv6_access_list_remark_cmd, - "ipv6 access-list WORD remark .LINE", + "ipv6 access-list WORD remark LINE...", IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" diff --git a/lib/plist.c b/lib/plist.c index 5911d6cf7f..0d1cafde66 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1898,7 +1898,7 @@ DEFUN (no_ip_prefix_list_sequence_number, DEFUN (ip_prefix_list_description, ip_prefix_list_description_cmd, - "ip prefix-list WORD description .LINE", + "ip prefix-list WORD description LINE...", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2609,7 +2609,7 @@ DEFUN (no_ipv6_prefix_list_sequence_number, DEFUN (ipv6_prefix_list_description, ipv6_prefix_list_description_cmd, - "ipv6 prefix-list WORD description .LINE", + "ipv6 prefix-list WORD description LINE...", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 52302a6460..f1c2753526 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4160,7 +4160,7 @@ static struct igmp_sock *find_igmp_sock_by_fd(int fd) DEFUN (test_igmp_receive_report, test_igmp_receive_report_cmd, - "test igmp receive report (0-65535) A.B.C.D (1-6) .LINE", + "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...", "Test\n" "Test IGMP protocol\n" "Test IGMP message\n" @@ -4276,7 +4276,7 @@ static int hexval(uint8_t ch) DEFUN (test_pim_receive_dump, test_pim_receive_dump_cmd, - "test pim receive dump INTERFACE A.B.C.D .LINE", + "test pim receive dump INTERFACE A.B.C.D LINE...", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" diff --git a/tests/heavy-thread.c b/tests/heavy-thread.c index c2e71c17d6..c43fa76c0e 100644 --- a/tests/heavy-thread.c +++ b/tests/heavy-thread.c @@ -104,7 +104,7 @@ clear_something (struct thread *thread) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c index 2d15dc37bd..97371face1 100644 --- a/tests/heavy-wq.c +++ b/tests/heavy-wq.c @@ -140,7 +140,7 @@ clear_something (struct vty *vty, const char *str) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/tests/heavy.c b/tests/heavy.c index 9af46c88f7..6ba8d9aa6d 100644 --- a/tests/heavy.c +++ b/tests/heavy.c @@ -82,7 +82,7 @@ clear_something (struct vty *vty, const char *str) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 05fb038184..e6aebd6b1a 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1700,7 +1700,7 @@ ALIAS (vtysh_exit_vrf, * and isisd. */ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD, interface_desc_cmd, - "description .LINE", + "description LINE...", "Interface specific description\n" "Characters describing this interface\n") diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index a9f0e87017..88036f44bd 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1562,7 +1562,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route [vrf NAME] ", SHOW_STR IP_STR "IP routing table\n" @@ -2163,7 +2163,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route vrf all " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route vrf all ", SHOW_STR IP_STR "IP routing table\n"