summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
authorhasso <hasso>2003-05-25 19:21:25 +0000
committerhasso <hasso>2003-05-25 19:21:25 +0000
commit81dfcaa2e27d53f4eb61c549e03065dcb1b8eec3 (patch)
tree2aed449138a4833fe343052cdfa505be74332cb4 /zebra/zebra_vty.c
parent15291357d130b804dcdcfd81bdb1b86a84567fd0 (diff)
Route (reject|blackhole) support from 6Wind patch.
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c402
1 files changed, 345 insertions, 57 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index f6e7f51d..f7037f68 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -89,7 +89,7 @@ route_type_char (u_char type)
int
zebra_static_ipv4 (struct vty *vty, int add_cmd,
char *dest_str, char *mask_str, char *gate_str,
- char *distance_str)
+ char *flag_str, char *distance_str)
{
int ret;
u_char distance;
@@ -97,6 +97,7 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
struct in_addr gate;
struct in_addr mask;
char *ifname;
+ u_char flag = 0;
ret = str2prefix (dest_str, &p);
if (ret <= 0)
@@ -120,22 +121,29 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
/* Apply mask for given prefix. */
apply_mask (&p);
+ /* Route flags */
+ if (flag_str) {
+ switch(flag_str[0]) {
+ case 'r':
+ case 'R': /* XXX */
+ SET_FLAG (flag, ZEBRA_FLAG_REJECT);
+ break;
+ case 'b':
+ case 'B': /* XXX */
+ SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
+ break;
+ default:
+ vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ break;
+ }
+ }
+
/* Administrative distance. */
if (distance_str)
distance = atoi (distance_str);
else
distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
- /* Null0 static route. */
- if (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0)
- {
- if (add_cmd)
- static_add_ipv4 (&p, NULL, NULL, distance, 0);
- else
- static_delete_ipv4 (&p, NULL, NULL, distance, 0);
- return CMD_SUCCESS;
- }
-
/* When gateway is A.B.C.D format, gate is treated as nexthop
address other case gate is treated as interface name. */
ret = inet_aton (gate_str, &gate);
@@ -145,7 +153,7 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
ifname = gate_str;
if (add_cmd)
- static_add_ipv4 (&p, ifname ? NULL : &gate, ifname, distance, 0);
+ static_add_ipv4 (&p, ifname ? NULL : &gate, ifname, flag, distance, 0);
else
static_delete_ipv4 (&p, ifname ? NULL : &gate, ifname, distance, 0);
@@ -155,109 +163,218 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
/* Static route configuration. */
DEFUN (ip_route,
ip_route_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
+ "ip route A.B.C.D/M (A.B.C.D|INTERFACE)",
+ 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")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL);
+}
+
+DEFUN (ip_route_flags,
+ ip_route_flags_cmd,
+ "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
- "Null interface\n")
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
{
- return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL);
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL);
}
/* Mask as A.B.C.D format. */
DEFUN (ip_route_mask,
ip_route_mask_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
+ "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE)",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "IP gateway address\n"
+ "IP gateway interface name\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL);
+}
+
+DEFUN (ip_route_mask_flags,
+ ip_route_mask_flags_cmd,
+ "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
- "Null interface\n")
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
{
- return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL);
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL);
}
/* Distance option value. */
DEFUN (ip_route_distance,
ip_route_distance_cmd,
- "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
+ "ip route A.B.C.D/M (A.B.C.D|INTERFACE) <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"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2]);
+}
+
+DEFUN (ip_route_flags_distance,
+ ip_route_flags_distance_cmd,
+ "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
- "Null interface\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
"Distance value for this route\n")
{
- return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2]);
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3]);
}
DEFUN (ip_route_mask_distance,
ip_route_mask_distance_cmd,
- "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
+ "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) <1-255>",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
- "Null interface\n"
"Distance value for this route\n")
{
- return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3]);
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3]);
+}
+
+DEFUN (ip_route_mask_flags_distance,
+ ip_route_mask_flags_distance_cmd,
+ "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "IP gateway address\n"
+ "IP gateway interface name\n"
+ "Distance value for this route\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
DEFUN (no_ip_route,
no_ip_route_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
+ "no ip route A.B.C.D/M (A.B.C.D|INTERFACE)",
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")
+ "IP gateway interface name\n")
{
- return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL);
+ return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL);
}
+ALIAS (no_ip_route,
+ no_ip_route_flags_cmd,
+ "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "IP gateway address\n"
+ "IP gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+
DEFUN (no_ip_route_mask,
no_ip_route_mask_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
+ "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE)",
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")
+ "IP gateway interface name\n")
{
- return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL);
+ return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL);
}
+ALIAS (no_ip_route_mask,
+ no_ip_route_mask_flags_cmd,
+ "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "IP gateway address\n"
+ "IP gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+
DEFUN (no_ip_route_distance,
no_ip_route_distance_cmd,
- "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
+ "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) <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"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2]);
+}
+
+DEFUN (no_ip_route_flags_distance,
+ no_ip_route_flags_distance_cmd,
+ "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
- "Null interface\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
"Distance value for this route\n")
{
- return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2]);
+ return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3]);
}
DEFUN (no_ip_route_mask_distance,
no_ip_route_mask_distance_cmd,
- "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
+ "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) <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"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3]);
+}
+
+DEFUN (no_ip_route_mask_flags_distance,
+ no_ip_route_mask_flags_distance_cmd,
+ "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
NO_STR
IP_STR
"Establish static routes\n"
@@ -265,10 +382,11 @@ DEFUN (no_ip_route_mask_distance,
"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"
"Distance value for this route\n")
{
- return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3]);
+ return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
/* New RIB. Detailed information for IPv4 route. */
@@ -289,6 +407,10 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
vty_out (vty, ", best");
if (rib->refcnt)
vty_out (vty, ", refcnt %ld", rib->refcnt);
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, ", blackhole");
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, ", reject");
vty_out (vty, "%s", VTY_NEWLINE);
#define ONE_DAY_SECOND 60*60*24
@@ -339,9 +461,6 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
case NEXTHOP_TYPE_IFNAME:
vty_out (vty, " directly connected, %s", nexthop->ifname);
break;
- case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " directly connected, via Null0");
- break;
default:
break;
}
@@ -422,8 +541,6 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
case NEXTHOP_TYPE_IFNAME:
vty_out (vty, " is directly connected, %s", nexthop->ifname);
break;
- case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " is directly connected, Null0");
default:
break;
}
@@ -450,6 +567,11 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
}
}
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, ", bh");
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, ", rej");
+
if (rib->type == ZEBRA_ROUTE_RIP
|| rib->type == ZEBRA_ROUTE_OSPF
|| rib->type == ZEBRA_ROUTE_BGP)
@@ -808,11 +930,14 @@ static_config_ipv4 (struct vty *vty)
case STATIC_IPV4_IFNAME:
vty_out (vty, " %s", si->gate.ifname);
break;
- case STATIC_IPV4_BLACKHOLE:
- vty_out (vty, " Null0");
- break;
}
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, " %s", "reject");
+
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, " %s", "blackhole");
+
if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
vty_out (vty, " %d", si->distance);
vty_out (vty, "%s", VTY_NEWLINE);
@@ -826,7 +951,7 @@ static_config_ipv4 (struct vty *vty)
/* General fucntion for IPv6 static route. */
int
static_ipv6_func (struct vty *vty, int add_cmd, char *dest_str,
- char *gate_str, char *ifname, char *distance_str)
+ char *gate_str, char *ifname, char *flag_str, char *distance_str)
{
int ret;
u_char distance;
@@ -835,6 +960,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, char *dest_str,
struct in6_addr gate_addr;
u_char type = 0;
int table = 0;
+ u_char flag = 0;
ret = str2prefix (dest_str, &p);
if (ret <= 0)
@@ -846,6 +972,23 @@ static_ipv6_func (struct vty *vty, int add_cmd, char *dest_str,
/* Apply mask for given prefix. */
apply_mask (&p);
+ /* Route flags */
+ if (flag_str) {
+ switch(flag_str[0]) {
+ case 'r':
+ case 'R': /* XXX */
+ SET_FLAG (flag, ZEBRA_FLAG_REJECT);
+ break;
+ case 'b':
+ case 'B': /* XXX */
+ SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
+ break;
+ default:
+ vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ break;
+ }
+ }
+
/* Administrative distance. */
if (distance_str)
distance = atoi (distance_str);
@@ -883,7 +1026,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, char *dest_str,
}
if (add_cmd)
- static_add_ipv6 (&p, type, gate, ifname, distance, table);
+ static_add_ipv6 (&p, type, gate, ifname, flag, distance, table);
else
static_delete_ipv6 (&p, type, gate, ifname, distance, table);
@@ -899,7 +1042,21 @@ DEFUN (ipv6_route,
"IPv6 gateway address\n"
"IPv6 gateway interface name\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL);
+ return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL);
+}
+
+DEFUN (ipv6_route_flags,
+ ipv6_route_flags_cmd,
+ "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL);
}
DEFUN (ipv6_route_ifname,
@@ -911,7 +1068,21 @@ DEFUN (ipv6_route_ifname,
"IPv6 gateway address\n"
"IPv6 gateway interface name\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL);
+ return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL);
+}
+
+DEFUN (ipv6_route_ifname_flags,
+ ipv6_route_ifname_flags_cmd,
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL);
}
DEFUN (ipv6_route_pref,
@@ -924,7 +1095,22 @@ DEFUN (ipv6_route_pref,
"IPv6 gateway interface name\n"
"Distance value for this prefix\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2]);
+ return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2]);
+}
+
+DEFUN (ipv6_route_flags_pref,
+ ipv6_route_flags_pref_cmd,
+ "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this prefix\n")
+{
+ return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3]);
}
DEFUN (ipv6_route_ifname_pref,
@@ -937,7 +1123,22 @@ DEFUN (ipv6_route_ifname_pref,
"IPv6 gateway interface name\n"
"Distance value for this prefix\n")
{
- return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3]);
+ return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3]);
+}
+
+DEFUN (ipv6_route_ifname_flags_pref,
+ ipv6_route_ifname_flags_pref_cmd,
+ "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this prefix\n")
+{
+ return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
DEFUN (no_ipv6_route,
@@ -950,9 +1151,21 @@ DEFUN (no_ipv6_route,
"IPv6 gateway address\n"
"IPv6 gateway interface name\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL);
+ return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL);
}
+ALIAS (no_ipv6_route,
+ no_ipv6_route_flags_cmd,
+ "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+
DEFUN (no_ipv6_route_ifname,
no_ipv6_route_ifname_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
@@ -963,9 +1176,21 @@ DEFUN (no_ipv6_route_ifname,
"IPv6 gateway address\n"
"IPv6 gateway interface name\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL);
+ return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL);
}
+ALIAS (no_ipv6_route_ifname,
+ no_ipv6_route_ifname_flags_cmd,
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+
DEFUN (no_ipv6_route_pref,
no_ipv6_route_pref_cmd,
"no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
@@ -977,7 +1202,24 @@ DEFUN (no_ipv6_route_pref,
"IPv6 gateway interface name\n"
"Distance value for this prefix\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2]);
+ return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2]);
+}
+
+DEFUN (no_ipv6_route_flags_pref,
+ no_ipv6_route_flags_pref_cmd,
+ "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this prefix\n")
+{
+ /* We do not care about argv[2] */
+ return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3]);
}
DEFUN (no_ipv6_route_ifname_pref,
@@ -991,7 +1233,23 @@ DEFUN (no_ipv6_route_ifname_pref,
"IPv6 gateway interface name\n"
"Distance value for this prefix\n")
{
- return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3]);
+ return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3]);
+}
+
+DEFUN (no_ipv6_route_ifname_flags_pref,
+ no_ipv6_route_ifname_flags_pref_cmd,
+ "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this prefix\n")
+{
+ return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
/* New RIB. Detailed information for IPv4 route. */
@@ -1014,6 +1272,10 @@ vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)
vty_out (vty, ", best");
if (rib->refcnt)
vty_out (vty, ", refcnt %ld", rib->refcnt);
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, ", blackhole");
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, ", reject");
vty_out (vty, "%s", VTY_NEWLINE);
#define ONE_DAY_SECOND 60*60*24
@@ -1191,6 +1453,11 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
}
}
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, ", bh");
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, ", rej");
+
if (rib->type == ZEBRA_ROUTE_RIPNG
|| rib->type == ZEBRA_ROUTE_OSPF6
|| rib->type == ZEBRA_ROUTE_BGP)
@@ -1465,6 +1732,12 @@ static_config_ipv6 (struct vty *vty)
break;
}
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, " %s", "reject");
+
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, " %s", "blackhole");
+
if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
vty_out (vty, " %d", si->distance);
vty_out (vty, "%s", VTY_NEWLINE);
@@ -1499,13 +1772,20 @@ zebra_vty_route_init ()
install_node (&ip_node, zebra_ip_config);
install_element (CONFIG_NODE, &ip_route_cmd);
+ install_element (CONFIG_NODE, &ip_route_flags_cmd);
install_element (CONFIG_NODE, &ip_route_mask_cmd);
+ install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
install_element (CONFIG_NODE, &no_ip_route_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
install_element (CONFIG_NODE, &ip_route_distance_cmd);
+ install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
+ install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
- install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
install_element (VIEW_NODE, &show_ip_route_cmd);
install_element (VIEW_NODE, &show_ip_route_addr_cmd);
@@ -1527,13 +1807,21 @@ zebra_vty_route_init ()
#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);
+ install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_cmd);
+ 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 (VIEW_NODE, &show_ipv6_route_cmd);
install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);