zebra: remove redundant DEFUNs for labeled static routes

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2017-07-27 12:16:41 -03:00
parent 8bcbf3b0d7
commit d97c792e9f
3 changed files with 63 additions and 674 deletions

View File

@ -283,570 +283,6 @@ DEFUN (no_mpls_label_bind,
return zebra_mpls_bind(vty, 0, argv[4]->arg, NULL);
}
/* Static route configuration. */
DEFUN (ip_route_label,
ip_route_label_cmd,
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg, NULL,
argv[3]->arg, NULL, NULL, NULL, NULL,
argv[5]->arg);
}
DEFUN (ip_route_tag_label,
ip_route_tag_label_cmd,
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg, NULL,
argv[3]->arg, NULL, argv[5]->arg, NULL, NULL,
argv[7]->arg);
}
/* Mask as A.B.C.D format. */
DEFUN (ip_route_mask_label,
ip_route_mask_label_cmd,
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg,
argv[3]->arg, argv[4]->arg, NULL, NULL, NULL,
NULL, argv[6]->arg);
}
DEFUN (ip_route_mask_tag_label,
ip_route_mask_tag_label_cmd,
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg,
argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg,
NULL, NULL, argv[8]->arg);
}
/* Distance option value. */
DEFUN (ip_route_distance_label,
ip_route_distance_label_cmd,
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg, NULL,
argv[3]->arg, NULL, NULL, argv[4]->arg, NULL,
argv[6]->arg);
}
DEFUN (ip_route_tag_distance_label,
ip_route_tag_distance_label_cmd,
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg, NULL,
argv[3]->arg, NULL, argv[5]->arg, argv[6]->arg,
NULL, argv[8]->arg);
}
DEFUN (ip_route_mask_distance_label,
ip_route_mask_distance_label_cmd,
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg,
argv[3]->arg, argv[4]->arg, NULL, NULL,
argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (ip_route_mask_tag_distance_label,
ip_route_mask_tag_distance_label_cmd,
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
IP_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[2]->arg,
argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg,
argv[7]->arg, NULL, argv[9]->arg);
}
DEFUN (no_ip_route_label,
no_ip_route_label_cmd,
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg, NULL,
argv[4]->arg, NULL, NULL, NULL, NULL,
argv[6]->arg);
}
DEFUN (no_ip_route_tag_label,
no_ip_route_tag_label_cmd,
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg, NULL,
argv[4]->arg, NULL, argv[6]->arg, NULL, NULL,
argv[8]->arg);
}
DEFUN (no_ip_route_mask_label,
no_ip_route_mask_label_cmd,
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg,
argv[4]->arg, argv[5]->arg, NULL, NULL, NULL,
NULL, argv[7]->arg);
}
DEFUN (no_ip_route_mask_tag_label,
no_ip_route_mask_tag_label_cmd,
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg,
argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg,
NULL, NULL, argv[9]->arg);
}
DEFUN (no_ip_route_distance_label,
no_ip_route_distance_label_cmd,
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg, NULL,
argv[4]->arg, NULL, NULL, argv[5]->arg, NULL,
argv[7]->arg);
}
DEFUN (no_ip_route_tag_distance_label,
no_ip_route_tag_distance_label_cmd,
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg, NULL,
argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg,
NULL, argv[9]->arg);
}
DEFUN (no_ip_route_mask_distance_label,
no_ip_route_mask_distance_label_cmd,
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg,
argv[4]->arg, argv[5]->arg, NULL, NULL,
argv[6]->arg, NULL, argv[8]->arg);
}
DEFUN (no_ip_route_mask_tag_distance_label,
no_ip_route_mask_tag_distance_label_cmd,
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[3]->arg,
argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg,
argv[8]->arg, NULL, argv[10]->arg);
}
DEFUN (ipv6_route_label,
ipv6_route_label_cmd,
"ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg, NULL,
NULL, NULL, NULL, NULL, argv[5]->arg);
}
DEFUN (ipv6_route_tag_label,
ipv6_route_tag_label_cmd,
"ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg, NULL,
NULL, argv[5]->arg, NULL, NULL, argv[7]->arg);
}
DEFUN (ipv6_route_ifname_label,
ipv6_route_ifname_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg,
argv[4]->arg, NULL, NULL, NULL, NULL,
argv[6]->arg);
}
DEFUN (ipv6_route_ifname_tag_label,
ipv6_route_ifname_tag_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg,
argv[4]->arg, NULL, argv[6]->arg, NULL, NULL,
argv[8]->arg);
}
DEFUN (ipv6_route_pref_label,
ipv6_route_pref_label_cmd,
"ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg, NULL,
NULL, NULL, argv[4]->arg, NULL, argv[6]->arg);
}
DEFUN (ipv6_route_pref_tag_label,
ipv6_route_pref_tag_label_cmd,
"ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg, NULL,
NULL, argv[5]->arg, argv[6]->arg, NULL,
argv[8]->arg);
}
DEFUN (ipv6_route_ifname_pref_label,
ipv6_route_ifname_pref_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg,
argv[4]->arg, NULL, NULL, argv[5]->arg, NULL,
argv[7]->arg);
}
DEFUN (ipv6_route_ifname_pref_tag_label,
ipv6_route_ifname_pref_tag_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 1, argv[2]->arg, NULL, argv[3]->arg,
argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg,
NULL, argv[9]->arg);
}
DEFUN (no_ipv6_route_label,
no_ipv6_route_label_cmd,
"no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg, NULL,
NULL, NULL, NULL, NULL, argv[6]->arg);
}
DEFUN (no_ipv6_route_tag_label,
no_ipv6_route_tag_label_cmd,
"no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg, NULL,
NULL, argv[6]->arg, NULL, NULL, argv[8]->arg);
}
DEFUN (no_ipv6_route_ifname_label,
no_ipv6_route_ifname_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg,
argv[5]->arg, NULL, NULL, NULL, NULL,
argv[7]->arg);
}
DEFUN (no_ipv6_route_ifname_tag_label,
no_ipv6_route_ifname_tag_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg,
argv[5]->arg, NULL, argv[7]->arg, NULL, NULL,
argv[9]->arg);
}
DEFUN (no_ipv6_route_pref_label,
no_ipv6_route_pref_label_cmd,
"no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg, NULL,
NULL, NULL, argv[5]->arg, NULL, argv[7]->arg);
}
DEFUN (no_ipv6_route_pref_tag_label,
no_ipv6_route_pref_tag_label_cmd,
"no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg, NULL,
NULL, argv[6]->arg, argv[7]->arg, NULL,
argv[9]->arg);
}
DEFUN (no_ipv6_route_ifname_pref_label,
no_ipv6_route_ifname_pref_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg,
argv[5]->arg, NULL, NULL, argv[6]->arg, NULL,
argv[8]->arg);
}
DEFUN (no_ipv6_route_ifname_pref_tag_label,
no_ipv6_route_ifname_pref_tag_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
NO_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"
MPLS_LABEL_HELPSTR)
{
return static_ipv6_func(vty, 0, argv[3]->arg, NULL, argv[4]->arg,
argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg,
NULL, argv[10]->arg);
}
/* MPLS LSP configuration write function. */
static int zebra_mpls_config(struct vty *vty)
{
@ -1024,44 +460,11 @@ void zebra_mpls_vty_init(void)
install_node(&mpls_node, zebra_mpls_config);
install_element(CONFIG_NODE, &ip_route_label_cmd);
install_element(CONFIG_NODE, &ip_route_tag_label_cmd);
install_element(CONFIG_NODE, &ip_route_mask_label_cmd);
install_element(CONFIG_NODE, &ip_route_mask_tag_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_tag_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_mask_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_mask_tag_label_cmd);
install_element(CONFIG_NODE, &ip_route_distance_label_cmd);
install_element(CONFIG_NODE, &ip_route_tag_distance_label_cmd);
install_element(CONFIG_NODE, &ip_route_mask_distance_label_cmd);
install_element(CONFIG_NODE, &ip_route_mask_tag_distance_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_distance_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_tag_distance_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_mask_distance_label_cmd);
install_element(CONFIG_NODE, &no_ip_route_mask_tag_distance_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_ifname_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_ifname_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_pref_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_ifname_pref_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_pref_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_ifname_pref_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_tag_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_ifname_tag_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_pref_tag_label_cmd);
install_element(CONFIG_NODE, &ipv6_route_ifname_pref_tag_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_tag_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_ifname_tag_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_pref_tag_label_cmd);
install_element(CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_label_cmd);
install_element(CONFIG_NODE, &mpls_transit_lsp_cmd);
install_element(CONFIG_NODE, &no_mpls_transit_lsp_cmd);
install_element(CONFIG_NODE, &no_mpls_transit_lsp_out_label_cmd);
install_element(CONFIG_NODE, &no_mpls_transit_lsp_all_cmd);
install_element(CONFIG_NODE, &mpls_label_bind_cmd);
install_element(CONFIG_NODE, &no_mpls_label_bind_cmd);

View File

@ -100,16 +100,4 @@ extern int static_delete_route(afi_t, safi_t safi, u_char type,
struct zebra_vrf *zvrf,
struct static_nh_label *snh_label);
int zebra_static_ipv4(struct vty *vty, safi_t safi, int add_cmd,
const char *dest_str, const char *mask_str,
const char *gate_str, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str);
int static_ipv6_func(struct vty *vty, int add_cmd, const char *dest_str,
const char *src_str, const char *gate_str,
const char *ifname, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str);
#endif

View File

@ -61,11 +61,11 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
#define CMD_VNI_RANGE "(1-16777215)"
/* General function for static route. */
int zebra_static_ipv4(struct vty *vty, safi_t safi, int add_cmd,
const char *dest_str, const char *mask_str,
const char *gate_str, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str)
static int zebra_static_ipv4(struct vty *vty, safi_t safi, int add_cmd,
const char *dest_str, const char *mask_str,
const char *gate_str, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str)
{
int ret;
u_char distance;
@ -362,7 +362,11 @@ static void zebra_vty_ip_route_tdv_helper(int argc, struct cmd_token *argv[],
char **distance, char **vrf,
char **labels)
{
*tag = NULL;
*distance = NULL;
*vrf = NULL;
if (labels)
*labels = NULL;
while (idx_curr < argc) {
if (strmatch(argv[idx_curr]->text, "tag")) {
if (tag)
@ -389,7 +393,7 @@ static void zebra_vty_ip_route_tdv_helper(int argc, struct cmd_token *argv[],
/* Static route configuration. */
DEFUN (ip_route,
ip_route_cmd,
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
@ -399,21 +403,21 @@ DEFUN (ip_route,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv4_prefixlen = 2;
int idx_ipv4_ifname_null = 3;
int idx_curr = 4;
char *tag, *distance, *vrf;
char *tag, *distance, *vrf, *label;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return zebra_static_ipv4(vty, SAFI_UNICAST, 1,
argv[idx_ipv4_prefixlen]->arg, NULL,
argv[idx_ipv4_ifname_null]->arg, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN (ip_route_flags,
@ -434,7 +438,6 @@ DEFUN (ip_route_flags,
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, NULL);
@ -446,7 +449,7 @@ DEFUN (ip_route_flags,
/* Mask as A.B.C.D format. */
DEFUN_HIDDEN (ip_route_mask,
ip_route_mask_cmd,
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
@ -457,22 +460,22 @@ DEFUN_HIDDEN (ip_route_mask,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv4 = 2;
int idx_ipv4_2 = 3;
int idx_ipv4_ifname_null = 4;
int idx_curr = 5;
char *tag, *distance, *vrf;
char *tag, *distance, *vrf, *label;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return zebra_static_ipv4(vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg,
argv[idx_ipv4_2]->arg,
argv[idx_ipv4_ifname_null]->arg, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN_HIDDEN (ip_route_mask_flags,
@ -495,7 +498,6 @@ DEFUN_HIDDEN (ip_route_mask_flags,
int idx_curr = 5;
char *tag, *distance, *vrf;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
@ -507,7 +509,7 @@ DEFUN_HIDDEN (ip_route_mask_flags,
DEFUN (no_ip_route,
no_ip_route_cmd,
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
NO_STR
IP_STR
"Establish static routes\n"
@ -518,21 +520,21 @@ DEFUN (no_ip_route,
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv4_prefixlen = 3;
int idx_ipv4_ifname_null = 4;
int idx_curr = 5;
char *tag, *distance, *vrf;
char *tag, *distance, *vrf, *label;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return zebra_static_ipv4(vty, SAFI_UNICAST, 0,
argv[idx_ipv4_prefixlen]->arg, NULL,
argv[idx_ipv4_ifname_null]->arg, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN (no_ip_route_flags,
@ -553,7 +555,6 @@ DEFUN (no_ip_route_flags,
int idx_curr = 5;
char *tag, *distance, *vrf;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
@ -564,7 +565,7 @@ DEFUN (no_ip_route_flags,
DEFUN_HIDDEN (no_ip_route_mask,
no_ip_route_mask_cmd,
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
NO_STR
IP_STR
"Establish static routes\n"
@ -576,22 +577,22 @@ DEFUN_HIDDEN (no_ip_route_mask,
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv4 = 3;
int idx_ipv4_2 = 4;
int idx_ipv4_ifname_null = 5;
int idx_curr = 6;
char *tag, *distance, *vrf;
char *tag, *distance, *vrf, *label;
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return zebra_static_ipv4(vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg,
argv[idx_ipv4_2]->arg,
argv[idx_ipv4_ifname_null]->arg, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN_HIDDEN (no_ip_route_mask_flags,
@ -614,7 +615,6 @@ DEFUN_HIDDEN (no_ip_route_mask_flags,
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, NULL);
@ -1997,11 +1997,11 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
}
/* General fucntion for IPv6 static route. */
int static_ipv6_func(struct vty *vty, int add_cmd, const char *dest_str,
const char *src_str, const char *gate_str,
const char *ifname, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str)
static int static_ipv6_func(struct vty *vty, int add_cmd, const char *dest_str,
const char *src_str, const char *gate_str,
const char *ifname, const char *flag_str,
const char *tag_str, const char *distance_str,
const char *vrf_id_str, const char *label_str)
{
int ret;
u_char distance;
@ -2185,7 +2185,7 @@ int 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 [from X:X::X:X/M] <X:X::X:X|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"ipv6 route X:X::X:X/M [from X:X::X:X/M] <X:X::X:X|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@ -2197,12 +2197,13 @@ DEFUN (ipv6_route,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv6_prefixlen = 2;
int idx_ipv6_ifname;
int idx_curr;
char *src, *tag, *distance, *vrf;
char *src, *tag, *distance, *vrf, *label;
if (strmatch(argv[3]->text, "from")) {
src = argv[4]->arg;
@ -2214,13 +2215,12 @@ DEFUN (ipv6_route,
idx_curr = 4;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return static_ipv6_func(vty, 1, argv[idx_ipv6_prefixlen]->arg, src,
argv[idx_ipv6_ifname]->arg, NULL, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN (ipv6_route_flags,
@ -2253,7 +2253,6 @@ DEFUN (ipv6_route_flags,
idx_curr = 4;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
@ -2264,7 +2263,7 @@ DEFUN (ipv6_route_flags,
DEFUN (ipv6_route_ifname,
ipv6_route_ifname_cmd,
"ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@ -2275,13 +2274,14 @@ DEFUN (ipv6_route_ifname,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv6_prefixlen = 2;
int idx_ipv6 = 3;
int idx_interface = 4;
int idx_curr = 5;
char *src, *tag, *distance, *vrf;
char *src, *tag, *distance, *vrf, *label;
if (strmatch(argv[3]->text, "from")) {
src = argv[4]->arg;
@ -2295,18 +2295,17 @@ DEFUN (ipv6_route_ifname,
idx_curr = 5;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return static_ipv6_func(vty, 1, argv[idx_ipv6_prefixlen]->arg, src,
argv[idx_ipv6]->arg, argv[idx_interface]->arg,
NULL, tag, distance, vrf, NULL);
NULL, tag, distance, vrf, label);
}
DEFUN (no_ipv6_route,
no_ipv6_route_cmd,
"no ipv6 route X:X::X:X/M [from X:X::X:X/M] <X:X::X:X|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"no ipv6 route X:X::X:X/M [from X:X::X:X/M] <X:X::X:X|INTERFACE|null0> [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
NO_STR
IP_STR
"Establish static routes\n"
@ -2319,12 +2318,13 @@ DEFUN (no_ipv6_route,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv6_prefixlen = 3;
int idx_ipv6_ifname;
int idx_curr;
char *src, *tag, *distance, *vrf;
char *src, *tag, *distance, *vrf, *label;
if (strmatch(argv[4]->text, "from")) {
src = argv[5]->arg;
@ -2336,13 +2336,12 @@ DEFUN (no_ipv6_route,
idx_curr = 5;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return static_ipv6_func(vty, 0, argv[idx_ipv6_prefixlen]->arg, src,
argv[idx_ipv6_ifname]->arg, NULL, NULL, tag,
distance, vrf, NULL);
distance, vrf, label);
}
DEFUN (no_ipv6_route_flags,
@ -2376,7 +2375,6 @@ DEFUN (no_ipv6_route_flags,
idx_curr = 5;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
@ -2387,7 +2385,7 @@ DEFUN (no_ipv6_route_flags,
DEFUN (no_ipv6_route_ifname,
no_ipv6_route_ifname_cmd,
"no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [{tag (1-4294967295)|(1-255)|vrf NAME}]",
"no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [{tag (1-4294967295)|(1-255)|vrf NAME|label WORD}]",
NO_STR
IP_STR
"Establish static routes\n"
@ -2399,13 +2397,14 @@ DEFUN (no_ipv6_route_ifname,
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
VRF_CMD_HELP_STR)
VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR)
{
int idx_ipv6_prefixlen = 3;
int idx_ipv6;
int idx_interface;
int idx_curr;
char *src, *tag, *distance, *vrf;
char *src, *tag, *distance, *vrf, *label;
if (strmatch(argv[4]->text, "from")) {
src = argv[5]->arg;
@ -2419,13 +2418,12 @@ DEFUN (no_ipv6_route_ifname,
idx_curr = 6;
}
tag = distance = vrf = NULL;
zebra_vty_ip_route_tdv_helper(argc, argv, idx_curr, &tag, &distance,
&vrf, NULL);
&vrf, &label);
return static_ipv6_func(vty, 0, argv[idx_ipv6_prefixlen]->arg, src,
argv[idx_ipv6]->arg, argv[idx_interface]->arg,
NULL, tag, distance, vrf, NULL);
NULL, tag, distance, vrf, label);
}
DEFUN (show_ipv6_route,