summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-09-27 17:35:28 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-09-27 17:35:28 +0200
commit1e058f38c2f3acdec42b601024f8af8355e3b867 (patch)
tree81446451330ae09f072e8e91c1ad056d22ea62b1
parentzebra: cleanup reject vs blackhole vs null0 vs Null0 (diff)
downloadfrr-1e058f38c2f3acdec42b601024f8af8355e3b867.tar.xz
frr-1e058f38c2f3acdec42b601024f8af8355e3b867.zip
zebra: split ip route DEFUNs for blackhole, reject, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--zebra/zebra_vty.c152
1 files changed, 135 insertions, 17 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index ecc8fe94e..c450b82a2 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -339,11 +339,11 @@ DEFUN (show_ip_rpf_addr,
}
/* Static route configuration. */
-DEFPY(ip_route,
- ip_route_cmd,
+DEFPY(ip_route_blackhole,
+ ip_route_blackhole_cmd,
"[no] ip route\
<A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask> \
- <A.B.C.D$gate|INTERFACE$ifname|Null0$flag|reject$flag|blackhole$flag> \
+ <Null0|reject|blackhole>$flag \
[{ \
tag (1-4294967295) \
|(1-255)$distance \
@@ -355,8 +355,6 @@ DEFPY(ip_route,
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
"Null interface\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
@@ -367,7 +365,66 @@ DEFPY(ip_route,
MPLS_LABEL_HELPSTR)
{
return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix,
- mask_str, NULL, gate_str, ifname, flag,
+ mask_str, NULL, NULL, NULL, flag,
+ tag_str, distance_str, vrf, label);
+}
+
+DEFPY(ip_route_address_interface,
+ ip_route_address_interface_cmd,
+ "[no] ip route\
+ <A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask> \
+ A.B.C.D$gate \
+ INTERFACE$ifname \
+ [{ \
+ tag (1-4294967295) \
+ |(1-255)$distance \
+ |vrf NAME \
+ |label WORD \
+ }]",
+ NO_STR IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\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"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
+{
+ return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix,
+ mask_str, NULL, gate_str, ifname, NULL,
+ tag_str, distance_str, vrf, label);
+}
+
+DEFPY(ip_route,
+ ip_route_cmd,
+ "[no] ip route\
+ <A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask> \
+ <A.B.C.D$gate|INTERFACE$ifname> \
+ [{ \
+ tag (1-4294967295) \
+ |(1-255)$distance \
+ |vrf NAME \
+ |label WORD \
+ }]",
+ NO_STR IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\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"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
+{
+ return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix,
+ mask_str, NULL, gate_str, ifname, NULL,
tag_str, distance_str, vrf, label);
}
@@ -1762,15 +1819,75 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
return write;
}
+DEFPY(ipv6_route_blackhole,
+ ipv6_route_blackhole_cmd,
+ "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M] \
+ <Null0|reject|blackhole>$flag \
+ [{ \
+ tag (1-4294967295) \
+ |(1-255)$distance \
+ |vrf NAME \
+ |label WORD \
+ }]",
+ NO_STR
+ IPV6_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
+ "Null interface\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
+ MPLS_LABEL_HELPSTR)
+{
+ return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str,
+ NULL, from_str, NULL, NULL, flag,
+ tag_str, distance_str, vrf, label);
+}
+
+DEFPY(ipv6_route_address_interface,
+ ipv6_route_address_interface_cmd,
+ "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M] \
+ X:X::X:X$gate \
+ INTERFACE$ifname \
+ [{ \
+ tag (1-4294967295) \
+ |(1-255)$distance \
+ |vrf NAME \
+ |label WORD \
+ }]",
+ NO_STR
+ IPV6_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Set tag for this route\n"
+ "Tag value\n"
+ "Distance value for this prefix\n"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
+{
+ return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str,
+ NULL, from_str, gate_str, ifname, NULL,
+ tag_str, distance_str, vrf, label);
+}
+
DEFPY(ipv6_route,
ipv6_route_cmd,
- "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M] \
- <X:X::X:X$gate|INTERFACE$ifname|Null0$flag|reject$flag|blackhole$flag> \
- [{ \
- tag (1-4294967295) \
- |(1-255)$distance \
- |vrf NAME \
- |label WORD \
+ "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M] \
+ <X:X::X:X$gate|INTERFACE$ifname> \
+ [{ \
+ tag (1-4294967295) \
+ |(1-255)$distance \
+ |vrf NAME \
+ |label WORD \
}]",
NO_STR
IPV6_STR
@@ -1780,9 +1897,6 @@ DEFPY(ipv6_route,
"IPv6 source prefix\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
- "Null interface\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"
@@ -1790,7 +1904,7 @@ DEFPY(ipv6_route,
MPLS_LABEL_HELPSTR)
{
return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str,
- NULL, from_str, gate_str, ifname, flag,
+ NULL, from_str, gate_str, ifname, NULL,
tag_str, distance_str, vrf, label);
}
@@ -2677,6 +2791,8 @@ void zebra_vty_init(void)
install_element(CONFIG_NODE, &ip_mroute_dist_cmd);
install_element(CONFIG_NODE, &ip_multicast_mode_cmd);
install_element(CONFIG_NODE, &no_ip_multicast_mode_cmd);
+ install_element(CONFIG_NODE, &ip_route_blackhole_cmd);
+ install_element(CONFIG_NODE, &ip_route_address_interface_cmd);
install_element(CONFIG_NODE, &ip_route_cmd);
install_element(CONFIG_NODE, &ip_zebra_import_table_distance_cmd);
install_element(CONFIG_NODE, &no_ip_zebra_import_table_cmd);
@@ -2700,6 +2816,8 @@ void zebra_vty_init(void)
install_element(VIEW_NODE, &show_ip_route_vrf_all_summary_cmd);
install_element(VIEW_NODE, &show_ip_route_vrf_all_summary_prefix_cmd);
+ install_element(CONFIG_NODE, &ipv6_route_blackhole_cmd);
+ install_element(CONFIG_NODE, &ipv6_route_address_interface_cmd);
install_element(CONFIG_NODE, &ipv6_route_cmd);
install_element(CONFIG_NODE, &ip_nht_default_route_cmd);
install_element(CONFIG_NODE, &no_ip_nht_default_route_cmd);