paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* Zebra VTY functions |
| 2 | * Copyright (C) 2002 Kunihiro Ishiguro |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <zebra.h> |
| 23 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 24 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 25 | #include "if.h" |
| 26 | #include "prefix.h" |
| 27 | #include "command.h" |
| 28 | #include "table.h" |
| 29 | #include "rib.h" |
Feng Lu | 41f44a2 | 2015-05-22 11:39:56 +0200 | [diff] [blame] | 30 | #include "vrf.h" |
Pradosh Mohapatra | 60cc959 | 2015-11-09 20:21:41 -0500 | [diff] [blame] | 31 | #include "nexthop.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 32 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 33 | #include "zebra/zserv.h" |
Pradosh Mohapatra | 60cc959 | 2015-11-09 20:21:41 -0500 | [diff] [blame] | 34 | #include "zebra/zebra_rnh.h" |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 35 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 36 | static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id); |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 37 | static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, |
| 38 | int mcast); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 39 | static void vty_show_ip_route (struct vty *vty, struct route_node *rn, |
| 40 | struct rib *rib); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 41 | |
| 42 | /* General function for static route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 43 | static int |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 44 | zebra_static_ipv4_safi (struct vty *vty, safi_t safi, int add_cmd, |
| 45 | const char *dest_str, const char *mask_str, |
| 46 | const char *gate_str, const char *flag_str, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 47 | const char *tag_str, const char *distance_str, |
| 48 | const char *vrf_id_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 49 | { |
| 50 | int ret; |
| 51 | u_char distance; |
| 52 | struct prefix p; |
| 53 | struct in_addr gate; |
| 54 | struct in_addr mask; |
hasso | 39db97e | 2004-10-12 20:50:58 +0000 | [diff] [blame] | 55 | const char *ifname; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 56 | u_char flag = 0; |
Paul Jakma | 96d1060 | 2016-07-01 14:23:45 +0100 | [diff] [blame] | 57 | route_tag_t tag = 0; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 58 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 59 | |
| 60 | ret = str2prefix (dest_str, &p); |
| 61 | if (ret <= 0) |
| 62 | { |
| 63 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 64 | return CMD_WARNING; |
| 65 | } |
| 66 | |
| 67 | /* Cisco like mask notation. */ |
| 68 | if (mask_str) |
| 69 | { |
| 70 | ret = inet_aton (mask_str, &mask); |
| 71 | if (ret == 0) |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 72 | { |
| 73 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 74 | return CMD_WARNING; |
| 75 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 76 | p.prefixlen = ip_masklen (mask); |
| 77 | } |
| 78 | |
| 79 | /* Apply mask for given prefix. */ |
| 80 | apply_mask (&p); |
| 81 | |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 82 | /* Administrative distance. */ |
| 83 | if (distance_str) |
| 84 | distance = atoi (distance_str); |
| 85 | else |
| 86 | distance = ZEBRA_STATIC_DISTANCE_DEFAULT; |
| 87 | |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 88 | /* tag */ |
| 89 | if (tag_str) |
| 90 | tag = atoi (tag_str); |
| 91 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 92 | /* VRF id */ |
| 93 | if (vrf_id_str) |
| 94 | VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str); |
| 95 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 96 | /* tag */ |
| 97 | if (tag_str) |
| 98 | tag = atoi(tag_str); |
| 99 | |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 100 | /* Null0 static route. */ |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 101 | if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0)) |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 102 | { |
| 103 | if (flag_str) |
| 104 | { |
| 105 | vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE); |
| 106 | return CMD_WARNING; |
| 107 | } |
| 108 | if (add_cmd) |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 109 | static_add_ipv4_safi (safi, &p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, tag, distance, vrf_id); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 110 | else |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 111 | static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 112 | return CMD_SUCCESS; |
| 113 | } |
| 114 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 115 | /* Route flags */ |
| 116 | if (flag_str) { |
| 117 | switch(flag_str[0]) { |
| 118 | case 'r': |
| 119 | case 'R': /* XXX */ |
| 120 | SET_FLAG (flag, ZEBRA_FLAG_REJECT); |
| 121 | break; |
| 122 | case 'b': |
| 123 | case 'B': /* XXX */ |
| 124 | SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE); |
| 125 | break; |
| 126 | default: |
| 127 | vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 128 | return CMD_WARNING; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 132 | if (gate_str == NULL) |
| 133 | { |
| 134 | if (add_cmd) |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 135 | static_add_ipv4_safi (safi, &p, NULL, NULL, flag, tag, distance, vrf_id); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 136 | else |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 137 | static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 138 | |
| 139 | return CMD_SUCCESS; |
| 140 | } |
| 141 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 142 | /* When gateway is A.B.C.D format, gate is treated as nexthop |
| 143 | address other case gate is treated as interface name. */ |
| 144 | ret = inet_aton (gate_str, &gate); |
| 145 | if (ret) |
| 146 | ifname = NULL; |
| 147 | else |
| 148 | ifname = gate_str; |
| 149 | |
| 150 | if (add_cmd) |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 151 | static_add_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, flag, tag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 152 | else |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 153 | static_delete_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, tag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 154 | |
| 155 | return CMD_SUCCESS; |
| 156 | } |
| 157 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 158 | /* Static unicast routes for multicast RPF lookup. */ |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 159 | DEFUN (ip_mroute_dist, |
| 160 | ip_mroute_dist_cmd, |
| 161 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 162 | IP_STR |
| 163 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 164 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 165 | "Nexthop address\n" |
| 166 | "Nexthop interface name\n" |
| 167 | "Distance\n") |
| 168 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 169 | VTY_WARN_EXPERIMENTAL(); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 170 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 171 | NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 172 | } |
| 173 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 174 | ALIAS (ip_mroute_dist, |
| 175 | ip_mroute_cmd, |
| 176 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", |
| 177 | IP_STR |
| 178 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 179 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 180 | "Nexthop address\n" |
| 181 | "Nexthop interface name\n") |
| 182 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 183 | DEFUN (ip_mroute_dist_vrf, |
| 184 | ip_mroute_dist_vrf_cmd, |
| 185 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR, |
| 186 | IP_STR |
| 187 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 188 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 189 | "Nexthop address\n" |
| 190 | "Nexthop interface name\n" |
| 191 | "Distance\n" |
| 192 | VRF_CMD_HELP_STR) |
| 193 | { |
| 194 | VTY_WARN_EXPERIMENTAL(); |
| 195 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 196 | NULL, NULL, argc > 3 ? argv[2] : NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 197 | argc > 3 ? argv[3] : argv[2]); |
| 198 | } |
| 199 | |
| 200 | ALIAS (ip_mroute_dist_vrf, |
| 201 | ip_mroute_vrf_cmd, |
| 202 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) "VRF_CMD_STR, |
| 203 | IP_STR |
| 204 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 205 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 206 | "Nexthop address\n" |
| 207 | "Nexthop interface name\n" |
| 208 | VRF_CMD_HELP_STR) |
| 209 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 210 | DEFUN (no_ip_mroute_dist, |
| 211 | no_ip_mroute_dist_cmd, |
| 212 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 213 | IP_STR |
| 214 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 215 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 216 | "Nexthop address\n" |
| 217 | "Nexthop interface name\n" |
| 218 | "Distance\n") |
| 219 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 220 | VTY_WARN_EXPERIMENTAL(); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 221 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 222 | NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 223 | } |
| 224 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 225 | ALIAS (no_ip_mroute_dist, |
| 226 | no_ip_mroute_cmd, |
| 227 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", |
| 228 | NO_STR |
| 229 | IP_STR |
| 230 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 231 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 232 | "Nexthop address\n" |
| 233 | "Nexthop interface name\n") |
| 234 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 235 | DEFUN (no_ip_mroute_dist_vrf, |
| 236 | no_ip_mroute_dist_vrf_cmd, |
| 237 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR, |
| 238 | IP_STR |
| 239 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 240 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 241 | "Nexthop address\n" |
| 242 | "Nexthop interface name\n" |
| 243 | "Distance\n" |
| 244 | VRF_CMD_HELP_STR) |
| 245 | { |
| 246 | VTY_WARN_EXPERIMENTAL(); |
| 247 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 248 | NULL, NULL, argc > 3 ? argv[2] : NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 249 | argc > 3 ? argv[3] : argv[2]); |
| 250 | } |
| 251 | |
| 252 | ALIAS (no_ip_mroute_dist_vrf, |
| 253 | no_ip_mroute_vrf_cmd, |
| 254 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) " VRF_CMD_STR, |
| 255 | NO_STR |
| 256 | IP_STR |
| 257 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 258 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 259 | "Nexthop address\n" |
| 260 | "Nexthop interface name\n" |
| 261 | VRF_CMD_HELP_STR) |
| 262 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 263 | DEFUN (ip_multicast_mode, |
| 264 | ip_multicast_mode_cmd, |
| 265 | "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", |
| 266 | IP_STR |
| 267 | "Multicast options\n" |
| 268 | "RPF lookup behavior\n" |
| 269 | "Lookup in unicast RIB only\n" |
| 270 | "Lookup in multicast RIB only\n" |
| 271 | "Try multicast RIB first, fall back to unicast RIB\n" |
| 272 | "Lookup both, use entry with lower distance\n" |
| 273 | "Lookup both, use entry with longer prefix\n") |
| 274 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 275 | VTY_WARN_EXPERIMENTAL(); |
| 276 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 277 | if (!strncmp (argv[0], "u", 1)) |
| 278 | multicast_mode_ipv4_set (MCAST_URIB_ONLY); |
| 279 | else if (!strncmp (argv[0], "mrib-o", 6)) |
| 280 | multicast_mode_ipv4_set (MCAST_MRIB_ONLY); |
| 281 | else if (!strncmp (argv[0], "mrib-t", 6)) |
| 282 | multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); |
| 283 | else if (!strncmp (argv[0], "low", 3)) |
| 284 | multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); |
| 285 | else if (!strncmp (argv[0], "lon", 3)) |
| 286 | multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); |
| 287 | else |
| 288 | { |
| 289 | vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE); |
| 290 | return CMD_WARNING; |
| 291 | } |
| 292 | |
| 293 | return CMD_SUCCESS; |
| 294 | } |
| 295 | |
| 296 | DEFUN (no_ip_multicast_mode, |
| 297 | no_ip_multicast_mode_cmd, |
| 298 | "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", |
| 299 | NO_STR |
| 300 | IP_STR |
| 301 | "Multicast options\n" |
| 302 | "RPF lookup behavior\n" |
| 303 | "Lookup in unicast RIB only\n" |
| 304 | "Lookup in multicast RIB only\n" |
| 305 | "Try multicast RIB first, fall back to unicast RIB\n" |
| 306 | "Lookup both, use entry with lower distance\n" |
| 307 | "Lookup both, use entry with longer prefix\n") |
| 308 | { |
| 309 | multicast_mode_ipv4_set (MCAST_NO_CONFIG); |
| 310 | return CMD_SUCCESS; |
| 311 | } |
| 312 | |
| 313 | ALIAS (no_ip_multicast_mode, |
| 314 | no_ip_multicast_mode_noarg_cmd, |
| 315 | "no ip multicast rpf-lookup-mode", |
| 316 | NO_STR |
| 317 | IP_STR |
| 318 | "Multicast options\n" |
| 319 | "RPF lookup behavior\n") |
| 320 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 321 | DEFUN (show_ip_rpf, |
| 322 | show_ip_rpf_cmd, |
| 323 | "show ip rpf", |
| 324 | SHOW_STR |
| 325 | IP_STR |
| 326 | "Display RPF information for multicast source\n") |
| 327 | { |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 328 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 329 | |
| 330 | if (argc > 0) |
| 331 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 332 | |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 333 | VTY_WARN_EXPERIMENTAL(); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 334 | return do_show_ip_route(vty, SAFI_MULTICAST, vrf_id); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 335 | } |
| 336 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 337 | ALIAS (show_ip_rpf, |
| 338 | show_ip_rpf_vrf_cmd, |
| 339 | "show ip rpf " VRF_CMD_STR, |
| 340 | SHOW_STR |
| 341 | IP_STR |
| 342 | "Display RPF information for multicast source\n" |
| 343 | VRF_CMD_HELP_STR) |
| 344 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 345 | DEFUN (show_ip_rpf_addr, |
| 346 | show_ip_rpf_addr_cmd, |
| 347 | "show ip rpf A.B.C.D", |
| 348 | SHOW_STR |
| 349 | IP_STR |
| 350 | "Display RPF information for multicast source\n" |
| 351 | "IP multicast source address (e.g. 10.0.0.0)\n") |
| 352 | { |
| 353 | struct in_addr addr; |
| 354 | struct route_node *rn; |
| 355 | struct rib *rib; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 356 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 357 | int ret; |
| 358 | |
| 359 | if (argc > 1) |
| 360 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 361 | |
| 362 | VTY_WARN_EXPERIMENTAL(); |
| 363 | |
| 364 | ret = inet_aton (argv[0], &addr); |
| 365 | if (ret == 0) |
| 366 | { |
| 367 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 368 | return CMD_WARNING; |
| 369 | } |
| 370 | |
| 371 | rib = rib_match_ipv4_multicast (addr, &rn, vrf_id); |
| 372 | |
| 373 | if (rib) |
| 374 | vty_show_ip_route_detail (vty, rn, 1); |
| 375 | else |
| 376 | vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE); |
| 377 | |
| 378 | return CMD_SUCCESS; |
| 379 | } |
| 380 | |
| 381 | ALIAS (show_ip_rpf_addr, |
| 382 | show_ip_rpf_addr_vrf_cmd, |
| 383 | "show ip rpf A.B.C.D " VRF_CMD_STR, |
| 384 | SHOW_STR |
| 385 | IP_STR |
| 386 | "Display RPF information for multicast source\n" |
| 387 | "IP multicast source address (e.g. 10.0.0.0)\n" |
| 388 | VRF_CMD_HELP_STR) |
| 389 | |
| 390 | DEFUN (show_ip_rpf_vrf_all, |
| 391 | show_ip_rpf_vrf_all_cmd, |
| 392 | "show ip rpf " VRF_ALL_CMD_STR, |
| 393 | SHOW_STR |
| 394 | IP_STR |
| 395 | "Display RPF information for multicast source\n" |
| 396 | VRF_ALL_CMD_HELP_STR) |
| 397 | { |
| 398 | struct zebra_vrf *zvrf; |
| 399 | struct route_table *table; |
| 400 | struct route_node *rn; |
| 401 | struct rib *rib; |
| 402 | vrf_iter_t iter; |
| 403 | int first = 1; |
| 404 | |
| 405 | VTY_WARN_EXPERIMENTAL(); |
| 406 | |
| 407 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 408 | { |
| 409 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 410 | (table = zvrf->table[AFI_IP][SAFI_MULTICAST]) == NULL) |
| 411 | continue; |
| 412 | |
| 413 | /* Show all IPv4 routes. */ |
| 414 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 415 | RNODE_FOREACH_RIB (rn, rib) |
| 416 | { |
| 417 | if (first) |
| 418 | { |
| 419 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 420 | first = 0; |
| 421 | } |
| 422 | vty_show_ip_route (vty, rn, rib); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | return CMD_SUCCESS; |
| 427 | } |
| 428 | |
| 429 | DEFUN (show_ip_rpf_addr_vrf_all, |
| 430 | show_ip_rpf_addr_vrf_all_cmd, |
| 431 | "show ip rpf A.B.C.D " VRF_ALL_CMD_STR, |
| 432 | SHOW_STR |
| 433 | IP_STR |
| 434 | "Display RPF information for multicast source\n" |
| 435 | "IP multicast source address (e.g. 10.0.0.0)\n" |
| 436 | VRF_ALL_CMD_HELP_STR) |
| 437 | { |
| 438 | struct in_addr addr; |
| 439 | struct route_node *rn; |
| 440 | vrf_iter_t iter; |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 441 | int ret; |
| 442 | |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 443 | VTY_WARN_EXPERIMENTAL(); |
| 444 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 445 | ret = inet_aton (argv[0], &addr); |
| 446 | if (ret == 0) |
| 447 | { |
| 448 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 449 | return CMD_WARNING; |
| 450 | } |
| 451 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 452 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 453 | { |
| 454 | if (rib_match_ipv4_multicast (addr, &rn, vrf_iter2id (iter))) |
| 455 | vty_show_ip_route_detail (vty, rn, 1); |
| 456 | } |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 457 | |
| 458 | return CMD_SUCCESS; |
| 459 | } |
| 460 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 461 | /* Static route configuration. */ |
| 462 | DEFUN (ip_route, |
| 463 | ip_route_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 464 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 465 | IP_STR |
| 466 | "Establish static routes\n" |
| 467 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 468 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 469 | "IP gateway interface name\n" |
| 470 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 471 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 472 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 473 | NULL, NULL, NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 474 | } |
| 475 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 476 | DEFUN (ip_route_tag, |
| 477 | ip_route_tag_cmd, |
| 478 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>", |
| 479 | IP_STR |
| 480 | "Establish static routes\n" |
| 481 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 482 | "IP gateway address\n" |
| 483 | "IP gateway interface name\n" |
| 484 | "Null interface\n" |
| 485 | "Set tag for this route\n" |
| 486 | "Tag value\n") |
| 487 | { |
| 488 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 489 | argv[1], NULL, argv[2], NULL, NULL); |
| 490 | } |
| 491 | |
| 492 | DEFUN (ip_route_tag_vrf, |
| 493 | ip_route_tag_vrf_cmd, |
| 494 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR, |
| 495 | IP_STR |
| 496 | "Establish static routes\n" |
| 497 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 498 | "IP gateway address\n" |
| 499 | "IP gateway interface name\n" |
| 500 | "Null interface\n" |
| 501 | "Set tag for this route\n" |
| 502 | "Tag value\n" |
| 503 | VRF_CMD_HELP_STR) |
| 504 | { |
| 505 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 506 | argv[1], NULL, argv[2], NULL, argv[3]); |
| 507 | } |
| 508 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 509 | DEFUN (ip_route_flags, |
| 510 | ip_route_flags_cmd, |
| 511 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 512 | IP_STR |
| 513 | "Establish static routes\n" |
| 514 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 515 | "IP gateway address\n" |
| 516 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 517 | "Emit an ICMP unreachable when matched\n" |
| 518 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 519 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 520 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 521 | argv[2], NULL, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 522 | } |
| 523 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 524 | DEFUN (ip_route_flags_tag, |
| 525 | ip_route_flags_tag_cmd, |
| 526 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 527 | IP_STR |
| 528 | "Establish static routes\n" |
| 529 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 530 | "IP gateway address\n" |
| 531 | "IP gateway interface name\n" |
| 532 | "Emit an ICMP unreachable when matched\n" |
| 533 | "Silently discard pkts when matched\n" |
| 534 | "Set tag for this route\n" |
| 535 | "Tag value\n") |
| 536 | |
| 537 | { |
| 538 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 539 | argv[2], argv[3], NULL, NULL); |
| 540 | } |
| 541 | |
| 542 | DEFUN (ip_route_flags_tag_vrf, |
| 543 | ip_route_flags_tag_vrf_cmd, |
| 544 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 545 | IP_STR |
| 546 | "Establish static routes\n" |
| 547 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 548 | "IP gateway address\n" |
| 549 | "IP gateway interface name\n" |
| 550 | "Emit an ICMP unreachable when matched\n" |
| 551 | "Silently discard pkts when matched\n" |
| 552 | "Set tag for this route\n" |
| 553 | "Tag value\n" |
| 554 | VRF_CMD_HELP_STR) |
| 555 | { |
| 556 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 557 | argv[2], argv[3], NULL, argv[4]); |
| 558 | } |
| 559 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 560 | DEFUN (ip_route_flags2, |
| 561 | ip_route_flags2_cmd, |
| 562 | "ip route A.B.C.D/M (reject|blackhole)", |
| 563 | IP_STR |
| 564 | "Establish static routes\n" |
| 565 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 566 | "Emit an ICMP unreachable when matched\n" |
| 567 | "Silently discard pkts when matched\n") |
| 568 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 569 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 570 | NULL, argv[1], NULL, NULL, NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 571 | } |
| 572 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 573 | DEFUN (ip_route_flags2_tag, |
| 574 | ip_route_flags2_tag_cmd, |
| 575 | "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>", |
| 576 | IP_STR |
| 577 | "Establish static routes\n" |
| 578 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 579 | "Emit an ICMP unreachable when matched\n" |
| 580 | "Silently discard pkts when matched\n" |
| 581 | "Set tag for this route\n" |
| 582 | "Tag value\n") |
| 583 | { |
| 584 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, |
| 585 | argv[1], argv[2], NULL, NULL); |
| 586 | } |
| 587 | |
| 588 | DEFUN (ip_route_flags2_tag_vrf, |
| 589 | ip_route_flags2_tag_vrf_cmd, |
| 590 | "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>", |
| 591 | IP_STR |
| 592 | "Establish static routes\n" |
| 593 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 594 | "Emit an ICMP unreachable when matched\n" |
| 595 | "Silently discard pkts when matched\n" |
| 596 | "Set tag for this route\n" |
| 597 | "Tag value\n" |
| 598 | VRF_CMD_HELP_STR) |
| 599 | { |
| 600 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, |
| 601 | argv[1], argv[2], NULL, argv[3]); |
| 602 | } |
| 603 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 604 | /* Mask as A.B.C.D format. */ |
| 605 | DEFUN (ip_route_mask, |
| 606 | ip_route_mask_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 607 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)", |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 608 | IP_STR |
| 609 | "Establish static routes\n" |
| 610 | "IP destination prefix\n" |
| 611 | "IP destination prefix mask\n" |
| 612 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 613 | "IP gateway interface name\n" |
| 614 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 615 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 616 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 617 | argv[2], NULL, NULL, NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 618 | } |
| 619 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 620 | DEFUN (ip_route_mask_tag, |
| 621 | ip_route_mask_tag_cmd, |
| 622 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>", |
| 623 | IP_STR |
| 624 | "Establish static routes\n" |
| 625 | "IP destination prefix\n" |
| 626 | "IP destination prefix mask\n" |
| 627 | "IP gateway address\n" |
| 628 | "IP gateway interface name\n" |
| 629 | "Null interface\n" |
| 630 | "Set tag for this route\n" |
| 631 | "Tag value\n") |
| 632 | |
| 633 | { |
| 634 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 635 | NULL, argv[3], NULL, NULL); |
| 636 | } |
| 637 | |
| 638 | DEFUN (ip_route_mask_tag_vrf, |
| 639 | ip_route_mask_tag_vrf_cmd, |
| 640 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR, |
| 641 | IP_STR |
| 642 | "Establish static routes\n" |
| 643 | "IP destination prefix\n" |
| 644 | "IP destination prefix mask\n" |
| 645 | "IP gateway address\n" |
| 646 | "IP gateway interface name\n" |
| 647 | "Null interface\n" |
| 648 | "Set tag for this route\n" |
| 649 | "Tag value\n" |
| 650 | VRF_CMD_HELP_STR) |
| 651 | { |
| 652 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 653 | NULL, argv[3], NULL, argv[4]); |
| 654 | } |
| 655 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 656 | DEFUN (ip_route_mask_flags, |
| 657 | ip_route_mask_flags_cmd, |
| 658 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 659 | IP_STR |
| 660 | "Establish static routes\n" |
| 661 | "IP destination prefix\n" |
| 662 | "IP destination prefix mask\n" |
| 663 | "IP gateway address\n" |
| 664 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 665 | "Emit an ICMP unreachable when matched\n" |
| 666 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 667 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 668 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 669 | argv[2], argv[3], NULL, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 670 | } |
| 671 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 672 | DEFUN (ip_route_mask_flags_tag, |
| 673 | ip_route_mask_flags_tag_cmd, |
| 674 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 675 | IP_STR |
| 676 | "Establish static routes\n" |
| 677 | "IP destination prefix\n" |
| 678 | "IP destination prefix mask\n" |
| 679 | "IP gateway address\n" |
| 680 | "IP gateway interface name\n" |
| 681 | "Emit an ICMP unreachable when matched\n" |
| 682 | "Silently discard pkts when matched\n" |
| 683 | "Set tag for this route\n" |
| 684 | "Tag value\n") |
| 685 | { |
| 686 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 687 | argv[2], argv[3], argv[4], NULL, NULL); |
| 688 | } |
| 689 | |
| 690 | DEFUN (ip_route_mask_flags_tag_vrf, |
| 691 | ip_route_mask_flags_tag_vrf_cmd, |
| 692 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 693 | IP_STR |
| 694 | "Establish static routes\n" |
| 695 | "IP destination prefix\n" |
| 696 | "IP destination prefix mask\n" |
| 697 | "IP gateway address\n" |
| 698 | "IP gateway interface name\n" |
| 699 | "Emit an ICMP unreachable when matched\n" |
| 700 | "Silently discard pkts when matched\n" |
| 701 | "Set tag for this route\n" |
| 702 | "Tag value\n" |
| 703 | VRF_CMD_HELP_STR) |
| 704 | { |
| 705 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 706 | argv[2], argv[3], argv[4], NULL, argv[5]); |
| 707 | } |
| 708 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 709 | DEFUN (ip_route_mask_flags2, |
| 710 | ip_route_mask_flags2_cmd, |
| 711 | "ip route A.B.C.D A.B.C.D (reject|blackhole)", |
| 712 | IP_STR |
| 713 | "Establish static routes\n" |
| 714 | "IP destination prefix\n" |
| 715 | "IP destination prefix mask\n" |
| 716 | "Emit an ICMP unreachable when matched\n" |
| 717 | "Silently discard pkts when matched\n") |
| 718 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 719 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 720 | NULL, argv[2], NULL, NULL, NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 721 | } |
| 722 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 723 | DEFUN (ip_route_mask_flags2_tag, |
| 724 | ip_route_mask_flags2_tag_cmd, |
| 725 | "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>", |
| 726 | IP_STR |
| 727 | "Establish static routes\n" |
| 728 | "IP destination prefix\n" |
| 729 | "IP destination prefix mask\n" |
| 730 | "Emit an ICMP unreachable when matched\n" |
| 731 | "Silently discard pkts when matched\n" |
| 732 | "Set tag for this route\n" |
| 733 | "Tag value\n") |
| 734 | { |
| 735 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, |
| 736 | argv[2], argv[3], NULL, NULL); |
| 737 | } |
| 738 | |
| 739 | DEFUN (ip_route_mask_flags2_tag_vrf, |
| 740 | ip_route_mask_flags2_tag_vrf_cmd, |
| 741 | "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 742 | IP_STR |
| 743 | "Establish static routes\n" |
| 744 | "IP destination prefix\n" |
| 745 | "IP destination prefix mask\n" |
| 746 | "Emit an ICMP unreachable when matched\n" |
| 747 | "Silently discard pkts when matched\n" |
| 748 | "Set tag for this route\n" |
| 749 | "Tag value\n" |
| 750 | VRF_CMD_HELP_STR) |
| 751 | { |
| 752 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, |
| 753 | argv[2], argv[3], NULL, argv[4]); |
| 754 | } |
| 755 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 756 | /* Distance option value. */ |
| 757 | DEFUN (ip_route_distance, |
| 758 | ip_route_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 759 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 760 | IP_STR |
| 761 | "Establish static routes\n" |
| 762 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 763 | "IP gateway address\n" |
| 764 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 765 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 766 | "Distance value for this route\n") |
| 767 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 768 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 769 | argv[1], NULL, NULL, argv[2], NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 770 | } |
| 771 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 772 | DEFUN (ip_route_tag_distance, |
| 773 | ip_route_tag_distance_cmd, |
| 774 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", |
| 775 | IP_STR |
| 776 | "Establish static routes\n" |
| 777 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 778 | "IP gateway address\n" |
| 779 | "IP gateway interface name\n" |
| 780 | "Null interface\n" |
| 781 | "Set tag for this route\n" |
| 782 | "Tag value\n" |
| 783 | "Distance value for this route\n") |
| 784 | { |
| 785 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 786 | argv[1], NULL, argv[2], argv[3], NULL); |
| 787 | } |
| 788 | |
| 789 | DEFUN (ip_route_tag_distance_vrf, |
| 790 | ip_route_tag_distance_vrf_cmd, |
| 791 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 792 | IP_STR |
| 793 | "Establish static routes\n" |
| 794 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 795 | "IP gateway address\n" |
| 796 | "IP gateway interface name\n" |
| 797 | "Null interface\n" |
| 798 | "Set tag for this route\n" |
| 799 | "Tag value\n" |
| 800 | "Distance value for this route\n" |
| 801 | VRF_CMD_HELP_STR) |
| 802 | { |
| 803 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 804 | argv[1], NULL, argv[2], argv[3], argv[4]); |
| 805 | } |
| 806 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 807 | DEFUN (ip_route_flags_distance, |
| 808 | ip_route_flags_distance_cmd, |
| 809 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 810 | IP_STR |
| 811 | "Establish static routes\n" |
| 812 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 813 | "IP gateway address\n" |
| 814 | "IP gateway interface name\n" |
| 815 | "Emit an ICMP unreachable when matched\n" |
| 816 | "Silently discard pkts when matched\n" |
| 817 | "Distance value for this route\n") |
| 818 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 819 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 820 | argv[2], NULL, argv[3], NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 821 | } |
| 822 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 823 | DEFUN (ip_route_flags_tag_distance, |
| 824 | ip_route_flags_tag_distance_cmd, |
| 825 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 826 | IP_STR |
| 827 | "Establish static routes\n" |
| 828 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 829 | "IP gateway address\n" |
| 830 | "IP gateway interface name\n" |
| 831 | "Emit an ICMP unreachable when matched\n" |
| 832 | "Silently discard pkts when matched\n" |
| 833 | "Set tag for this route\n" |
| 834 | "Tag value\n" |
| 835 | "Distance value for this route\n") |
| 836 | { |
| 837 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 838 | argv[2], argv[3], argv[4], NULL); |
| 839 | } |
| 840 | |
| 841 | DEFUN (ip_route_flags_tag_distance_vrf, |
| 842 | ip_route_flags_tag_distance_vrf_cmd, |
| 843 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 844 | IP_STR |
| 845 | "Establish static routes\n" |
| 846 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 847 | "IP gateway address\n" |
| 848 | "IP gateway interface name\n" |
| 849 | "Emit an ICMP unreachable when matched\n" |
| 850 | "Silently discard pkts when matched\n" |
| 851 | "Set tag for this route\n" |
| 852 | "Tag value\n" |
| 853 | "Distance value for this route\n" |
| 854 | VRF_CMD_HELP_STR) |
| 855 | { |
| 856 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], |
| 857 | argv[2], argv[3], argv[4], argv[5]); |
| 858 | } |
| 859 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 860 | DEFUN (ip_route_flags_distance2, |
| 861 | ip_route_flags_distance2_cmd, |
| 862 | "ip route A.B.C.D/M (reject|blackhole) <1-255>", |
| 863 | IP_STR |
| 864 | "Establish static routes\n" |
| 865 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 866 | "Emit an ICMP unreachable when matched\n" |
| 867 | "Silently discard pkts when matched\n" |
| 868 | "Distance value for this route\n") |
| 869 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 870 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 871 | NULL, argv[1], NULL, argv[2], NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 872 | } |
| 873 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 874 | DEFUN (ip_route_flags_tag_distance2, |
| 875 | ip_route_flags_tag_distance2_cmd, |
| 876 | "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>", |
| 877 | IP_STR |
| 878 | "Establish static routes\n" |
| 879 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 880 | "Emit an ICMP unreachable when matched\n" |
| 881 | "Silently discard pkts when matched\n" |
| 882 | "Set tag for this route\n" |
| 883 | "Tag value\n" |
| 884 | "Distance value for this route\n") |
| 885 | { |
| 886 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 887 | NULL, argv[1], argv[2], argv[3], NULL); |
| 888 | } |
| 889 | |
| 890 | DEFUN (ip_route_flags_tag_distance2_vrf, |
| 891 | ip_route_flags_tag_distance2_vrf_cmd, |
| 892 | "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 893 | IP_STR |
| 894 | "Establish static routes\n" |
| 895 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 896 | "Emit an ICMP unreachable when matched\n" |
| 897 | "Silently discard pkts when matched\n" |
| 898 | "Set tag for this route\n" |
| 899 | "Tag value\n" |
| 900 | "Distance value for this route\n" |
| 901 | VRF_CMD_HELP_STR) |
| 902 | { |
| 903 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 904 | NULL, argv[1], argv[2], argv[3], argv[4]); |
| 905 | } |
| 906 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 907 | DEFUN (ip_route_mask_distance, |
| 908 | ip_route_mask_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 909 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 910 | IP_STR |
| 911 | "Establish static routes\n" |
| 912 | "IP destination prefix\n" |
| 913 | "IP destination prefix mask\n" |
| 914 | "IP gateway address\n" |
| 915 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 916 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 917 | "Distance value for this route\n") |
| 918 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 919 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 920 | NULL, NULL, argv[3], NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 921 | } |
| 922 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 923 | DEFUN (ip_route_mask_tag_distance, |
| 924 | ip_route_mask_tag_distance_cmd, |
| 925 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", |
| 926 | IP_STR |
| 927 | "Establish static routes\n" |
| 928 | "IP destination prefix\n" |
| 929 | "IP destination prefix mask\n" |
| 930 | "IP gateway address\n" |
| 931 | "IP gateway interface name\n" |
| 932 | "Null interface\n" |
| 933 | "Set tag for this route\n" |
| 934 | "Tag value\n" |
| 935 | "Distance value for this route\n") |
| 936 | { |
| 937 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 938 | argv[2], NULL, argv[3], argv[4], NULL); |
| 939 | } |
| 940 | |
| 941 | DEFUN (ip_route_mask_tag_distance_vrf, |
| 942 | ip_route_mask_tag_distance_vrf_cmd, |
| 943 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 944 | IP_STR |
| 945 | "Establish static routes\n" |
| 946 | "IP destination prefix\n" |
| 947 | "IP destination prefix mask\n" |
| 948 | "IP gateway address\n" |
| 949 | "IP gateway interface name\n" |
| 950 | "Null interface\n" |
| 951 | "Set tag for this route\n" |
| 952 | "Tag value\n" |
| 953 | "Distance value for this route\n" |
| 954 | VRF_CMD_HELP_STR) |
| 955 | { |
| 956 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 957 | argv[2], NULL, argv[3], argv[4], argv[5]); |
| 958 | } |
| 959 | |
| 960 | |
| 961 | DEFUN (ip_route_mask_flags_tag_distance, |
| 962 | ip_route_mask_flags_tag_distance_cmd, |
| 963 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 964 | IP_STR |
| 965 | "Establish static routes\n" |
| 966 | "IP destination prefix\n" |
| 967 | "IP destination prefix mask\n" |
| 968 | "IP gateway address\n" |
| 969 | "IP gateway interface name\n" |
| 970 | "Set tag for this route\n" |
| 971 | "Tag value\n" |
| 972 | "Distance value for this route\n" |
| 973 | "Emit an ICMP unreachable when matched\n" |
| 974 | "Silently discard pkts when matched\n") |
| 975 | { |
| 976 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 977 | argv[3], argv[4], argv[5], NULL); |
| 978 | } |
| 979 | |
| 980 | DEFUN (ip_route_mask_flags_tag_distance_vrf, |
| 981 | ip_route_mask_flags_tag_distance_vrf_cmd, |
| 982 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 983 | IP_STR |
| 984 | "Establish static routes\n" |
| 985 | "IP destination prefix\n" |
| 986 | "IP destination prefix mask\n" |
| 987 | "IP gateway address\n" |
| 988 | "IP gateway interface name\n" |
| 989 | "Set tag for this route\n" |
| 990 | "Tag value\n" |
| 991 | "Distance value for this route\n" |
| 992 | "Emit an ICMP unreachable when matched\n" |
| 993 | "Silently discard pkts when matched\n" |
| 994 | VRF_CMD_HELP_STR) |
| 995 | { |
| 996 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 997 | argv[3], argv[4], argv[5], argv[6]); |
| 998 | } |
| 999 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1000 | DEFUN (ip_route_mask_flags_distance, |
| 1001 | ip_route_mask_flags_distance_cmd, |
| 1002 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 1003 | IP_STR |
| 1004 | "Establish static routes\n" |
| 1005 | "IP destination prefix\n" |
| 1006 | "IP destination prefix mask\n" |
| 1007 | "IP gateway address\n" |
| 1008 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1009 | "Emit an ICMP unreachable when matched\n" |
Christian Franke | 2b00515 | 2013-09-30 12:27:49 +0000 | [diff] [blame] | 1010 | "Silently discard pkts when matched\n" |
| 1011 | "Distance value for this route\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1012 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1013 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], |
| 1014 | argv[3], NULL, argv[4], NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1015 | } |
| 1016 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1017 | DEFUN (ip_route_mask_flags_distance2, |
| 1018 | ip_route_mask_flags_distance2_cmd, |
| 1019 | "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", |
| 1020 | IP_STR |
| 1021 | "Establish static routes\n" |
| 1022 | "IP destination prefix\n" |
| 1023 | "IP destination prefix mask\n" |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1024 | "Emit an ICMP unreachable when matched\n" |
Christian Franke | 2b00515 | 2013-09-30 12:27:49 +0000 | [diff] [blame] | 1025 | "Silently discard pkts when matched\n" |
| 1026 | "Distance value for this route\n") |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1027 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1028 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1029 | NULL, argv[2], NULL, argv[3], NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1030 | } |
| 1031 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1032 | DEFUN (ip_route_mask_flags_tag_distance2, |
| 1033 | ip_route_mask_flags_tag_distance2_cmd, |
| 1034 | "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>", |
| 1035 | IP_STR |
| 1036 | "Establish static routes\n" |
| 1037 | "IP destination prefix\n" |
| 1038 | "IP destination prefix mask\n" |
| 1039 | "Set tag for this route\n" |
| 1040 | "Tag value\n" |
| 1041 | "Distance value for this route\n" |
| 1042 | "Emit an ICMP unreachable when matched\n" |
| 1043 | "Silently discard pkts when matched\n") |
| 1044 | { |
| 1045 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, |
| 1046 | argv[2], argv[3], argv[4], NULL); |
| 1047 | } |
| 1048 | |
| 1049 | DEFUN (ip_route_mask_flags_tag_distance2_vrf, |
| 1050 | ip_route_mask_flags_tag_distance2_vrf_cmd, |
| 1051 | "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1052 | IP_STR |
| 1053 | "Establish static routes\n" |
| 1054 | "IP destination prefix\n" |
| 1055 | "IP destination prefix mask\n" |
| 1056 | "Set tag for this route\n" |
| 1057 | "Tag value\n" |
| 1058 | "Distance value for this route\n" |
| 1059 | "Emit an ICMP unreachable when matched\n" |
| 1060 | "Silently discard pkts when matched\n" |
| 1061 | VRF_CMD_HELP_STR) |
| 1062 | { |
| 1063 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, |
| 1064 | argv[2], argv[3], argv[4], argv[5]); |
| 1065 | } |
| 1066 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1067 | DEFUN (no_ip_route, |
| 1068 | no_ip_route_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1069 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1070 | NO_STR |
| 1071 | IP_STR |
| 1072 | "Establish static routes\n" |
| 1073 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1074 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1075 | "IP gateway interface name\n" |
| 1076 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1077 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1078 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, |
| 1079 | argv[1], NULL, NULL, NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1082 | DEFUN (no_ip_route_tag, |
| 1083 | no_ip_route_tag_cmd, |
| 1084 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>", |
| 1085 | NO_STR |
| 1086 | IP_STR |
| 1087 | "Establish static routes\n" |
| 1088 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1089 | "IP gateway address\n" |
| 1090 | "IP gateway interface name\n" |
| 1091 | "Null interface\n" |
| 1092 | "Tag of this route\n" |
| 1093 | "Tag value\n") |
| 1094 | { |
| 1095 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1096 | NULL, argv[2], NULL, NULL); |
| 1097 | } |
| 1098 | |
| 1099 | DEFUN (no_ip_route_tag_vrf, |
| 1100 | no_ip_route_tag_vrf_cmd, |
| 1101 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR, |
| 1102 | NO_STR |
| 1103 | IP_STR |
| 1104 | "Establish static routes\n" |
| 1105 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1106 | "IP gateway address\n" |
| 1107 | "IP gateway interface name\n" |
| 1108 | "Null interface\n" |
| 1109 | "Tag of this route\n" |
| 1110 | "Tag value\n" |
| 1111 | VRF_CMD_HELP_STR) |
| 1112 | { |
| 1113 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1114 | NULL, argv[2], NULL, argv[3]); |
| 1115 | } |
| 1116 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1117 | ALIAS (no_ip_route, |
| 1118 | no_ip_route_flags_cmd, |
| 1119 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1120 | NO_STR |
| 1121 | IP_STR |
| 1122 | "Establish static routes\n" |
| 1123 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1124 | "IP gateway address\n" |
| 1125 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1126 | "Emit an ICMP unreachable when matched\n" |
| 1127 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1128 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1129 | ALIAS (no_ip_route_tag, |
| 1130 | no_ip_route_flags_tag_cmd, |
| 1131 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 1132 | NO_STR |
| 1133 | IP_STR |
| 1134 | "Establish static routes\n" |
| 1135 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1136 | "IP gateway address\n" |
| 1137 | "IP gateway interface name\n" |
| 1138 | "Emit an ICMP unreachable when matched\n" |
| 1139 | "Silently discard pkts when matched\n" |
| 1140 | "Tag of this route\n" |
| 1141 | "Tag value\n") |
| 1142 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1143 | DEFUN (no_ip_route_flags2, |
| 1144 | no_ip_route_flags2_cmd, |
| 1145 | "no ip route A.B.C.D/M (reject|blackhole)", |
| 1146 | NO_STR |
| 1147 | IP_STR |
| 1148 | "Establish static routes\n" |
| 1149 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1150 | "Emit an ICMP unreachable when matched\n" |
| 1151 | "Silently discard pkts when matched\n") |
| 1152 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1153 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, |
| 1154 | NULL, NULL, NULL, NULL, NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1155 | } |
| 1156 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1157 | DEFUN (no_ip_route_flags2_tag, |
| 1158 | no_ip_route_flags2_tag_cmd, |
| 1159 | "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>", |
| 1160 | NO_STR |
| 1161 | IP_STR |
| 1162 | "Establish static routes\n" |
| 1163 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1164 | "Emit an ICMP unreachable when matched\n" |
| 1165 | "Silently discard pkts when matched\n" |
| 1166 | "Tag of this route\n" |
| 1167 | "Tag value\n") |
| 1168 | { |
| 1169 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1170 | NULL, argv[1], NULL, NULL); |
| 1171 | } |
| 1172 | |
| 1173 | DEFUN (no_ip_route_flags2_tag_vrf, |
| 1174 | no_ip_route_flags2_tag_vrf_cmd, |
| 1175 | "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 1176 | NO_STR |
| 1177 | IP_STR |
| 1178 | "Establish static routes\n" |
| 1179 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1180 | "Emit an ICMP unreachable when matched\n" |
| 1181 | "Silently discard pkts when matched\n" |
| 1182 | "Tag of this route\n" |
| 1183 | "Tag value\n" |
| 1184 | VRF_CMD_HELP_STR) |
| 1185 | { |
| 1186 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1187 | NULL, argv[1], NULL, argv[2]); |
| 1188 | } |
| 1189 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1190 | DEFUN (no_ip_route_mask, |
| 1191 | no_ip_route_mask_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1192 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)", |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1193 | NO_STR |
| 1194 | IP_STR |
| 1195 | "Establish static routes\n" |
| 1196 | "IP destination prefix\n" |
| 1197 | "IP destination prefix mask\n" |
| 1198 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1199 | "IP gateway interface name\n" |
| 1200 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1201 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1202 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1203 | argv[2], NULL, NULL, NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1204 | } |
| 1205 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1206 | DEFUN (no_ip_route_mask_tag, |
| 1207 | no_ip_route_mask_tag_cmd, |
| 1208 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>", |
| 1209 | NO_STR |
| 1210 | IP_STR |
| 1211 | "Establish static routes\n" |
| 1212 | "IP destination prefix\n" |
| 1213 | "IP destination prefix mask\n" |
| 1214 | "IP gateway address\n" |
| 1215 | "IP gateway interface name\n" |
| 1216 | "Null interface\n" |
| 1217 | "Tag of this route\n" |
| 1218 | "Tag value\n") |
| 1219 | { |
| 1220 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], |
| 1221 | NULL, argv[3], NULL, NULL); |
| 1222 | } |
| 1223 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1224 | ALIAS (no_ip_route_mask, |
| 1225 | no_ip_route_mask_flags_cmd, |
| 1226 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1227 | NO_STR |
| 1228 | IP_STR |
| 1229 | "Establish static routes\n" |
| 1230 | "IP destination prefix\n" |
| 1231 | "IP destination prefix mask\n" |
| 1232 | "IP gateway address\n" |
| 1233 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1234 | "Emit an ICMP unreachable when matched\n" |
| 1235 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1236 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1237 | ALIAS (no_ip_route_mask_tag, |
| 1238 | no_ip_route_mask_flags_tag_cmd, |
| 1239 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 1240 | NO_STR |
| 1241 | IP_STR |
| 1242 | "Establish static routes\n" |
| 1243 | "IP destination prefix\n" |
| 1244 | "IP destination prefix mask\n" |
| 1245 | "IP gateway address\n" |
| 1246 | "IP gateway interface name\n" |
| 1247 | "Emit an ICMP unreachable when matched\n" |
| 1248 | "Silently discard pkts when matched\n" |
| 1249 | "Tag of this route\n" |
| 1250 | "Tag value\n") |
| 1251 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1252 | DEFUN (no_ip_route_mask_flags2, |
| 1253 | no_ip_route_mask_flags2_cmd, |
| 1254 | "no ip route A.B.C.D A.B.C.D (reject|blackhole)", |
| 1255 | NO_STR |
| 1256 | IP_STR |
| 1257 | "Establish static routes\n" |
| 1258 | "IP destination prefix\n" |
| 1259 | "IP destination prefix mask\n" |
| 1260 | "Emit an ICMP unreachable when matched\n" |
| 1261 | "Silently discard pkts when matched\n") |
| 1262 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1263 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1264 | NULL, NULL, NULL, NULL, NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1265 | } |
| 1266 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1267 | DEFUN (no_ip_route_mask_flags2_tag, |
| 1268 | no_ip_route_mask_flags2_tag_cmd, |
| 1269 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>", |
| 1270 | NO_STR |
| 1271 | IP_STR |
| 1272 | "Establish static routes\n" |
| 1273 | "IP destination prefix\n" |
| 1274 | "IP destination prefix mask\n" |
| 1275 | "Emit an ICMP unreachable when matched\n" |
| 1276 | "Silently discard pkts when matched\n" |
| 1277 | "Tag of this route\n" |
| 1278 | "Tag value\n") |
| 1279 | { |
| 1280 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1281 | NULL, NULL, argv[2], NULL, NULL); |
| 1282 | } |
| 1283 | |
| 1284 | DEFUN (no_ip_route_mask_flags2_tag_vrf, |
| 1285 | no_ip_route_mask_flags2_tag_vrf_cmd, |
| 1286 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 1287 | NO_STR |
| 1288 | IP_STR |
| 1289 | "Establish static routes\n" |
| 1290 | "IP destination prefix\n" |
| 1291 | "IP destination prefix mask\n" |
| 1292 | "Emit an ICMP unreachable when matched\n" |
| 1293 | "Silently discard pkts when matched\n" |
| 1294 | "Tag of this route\n" |
| 1295 | "Tag value\n" |
| 1296 | VRF_CMD_HELP_STR) |
| 1297 | { |
| 1298 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1299 | NULL, NULL, argv[2], NULL, argv[3]); |
| 1300 | } |
| 1301 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1302 | DEFUN (no_ip_route_distance, |
| 1303 | no_ip_route_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1304 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1305 | NO_STR |
| 1306 | IP_STR |
| 1307 | "Establish static routes\n" |
| 1308 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1309 | "IP gateway address\n" |
| 1310 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1311 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1312 | "Distance value for this route\n") |
| 1313 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1314 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, |
| 1315 | argv[1], NULL, NULL, argv[2], NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1316 | } |
| 1317 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1318 | DEFUN (no_ip_route_tag_distance, |
| 1319 | no_ip_route_tag_distance_cmd, |
| 1320 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", |
| 1321 | NO_STR |
| 1322 | IP_STR |
| 1323 | "Establish static routes\n" |
| 1324 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1325 | "IP gateway address\n" |
| 1326 | "IP gateway interface name\n" |
| 1327 | "Null interface\n" |
| 1328 | "Tag of this route\n" |
| 1329 | "Tag value\n" |
| 1330 | "Distance value for this route\n") |
| 1331 | { |
| 1332 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1333 | NULL, argv[2], argv[3], NULL); |
| 1334 | } |
| 1335 | |
| 1336 | DEFUN (no_ip_route_tag_distance_vrf, |
| 1337 | no_ip_route_tag_distance_vrf_cmd, |
| 1338 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1339 | NO_STR |
| 1340 | IP_STR |
| 1341 | "Establish static routes\n" |
| 1342 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1343 | "IP gateway address\n" |
| 1344 | "IP gateway interface name\n" |
| 1345 | "Null interface\n" |
| 1346 | "Tag of this route\n" |
| 1347 | "Tag value\n" |
| 1348 | "Distance value for this route\n" |
| 1349 | VRF_CMD_HELP_STR) |
| 1350 | { |
| 1351 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1352 | NULL, argv[2], argv[3], argv[4]); |
| 1353 | } |
| 1354 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1355 | DEFUN (no_ip_route_flags_distance, |
| 1356 | no_ip_route_flags_distance_cmd, |
| 1357 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 1358 | NO_STR |
| 1359 | IP_STR |
| 1360 | "Establish static routes\n" |
| 1361 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1362 | "IP gateway address\n" |
| 1363 | "IP gateway interface name\n" |
| 1364 | "Emit an ICMP unreachable when matched\n" |
| 1365 | "Silently discard pkts when matched\n" |
| 1366 | "Distance value for this route\n") |
| 1367 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1368 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, |
| 1369 | argv[1], argv[2], NULL, argv[3], NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1370 | } |
| 1371 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1372 | DEFUN (no_ip_route_flags_tag_distance, |
| 1373 | no_ip_route_flags_tag_distance_cmd, |
| 1374 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 1375 | NO_STR |
| 1376 | IP_STR |
| 1377 | "Establish static routes\n" |
| 1378 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1379 | "IP gateway address\n" |
| 1380 | "IP gateway interface name\n" |
| 1381 | "Emit an ICMP unreachable when matched\n" |
| 1382 | "Silently discard pkts when matched\n" |
| 1383 | "Tag of this route\n" |
| 1384 | "Tag value\n" |
| 1385 | "Distance value for this route\n") |
| 1386 | { |
| 1387 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1388 | argv[2], argv[3], argv[4], NULL); |
| 1389 | } |
| 1390 | |
| 1391 | DEFUN (no_ip_route_flags_tag_distance_vrf, |
| 1392 | no_ip_route_flags_tag_distance_vrf_cmd, |
| 1393 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1394 | NO_STR |
| 1395 | IP_STR |
| 1396 | "Establish static routes\n" |
| 1397 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1398 | "IP gateway address\n" |
| 1399 | "IP gateway interface name\n" |
| 1400 | "Emit an ICMP unreachable when matched\n" |
| 1401 | "Silently discard pkts when matched\n" |
| 1402 | "Tag of this route\n" |
| 1403 | "Tag value\n" |
| 1404 | "Distance value for this route\n" |
| 1405 | VRF_CMD_HELP_STR) |
| 1406 | { |
| 1407 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1408 | argv[2], argv[3], argv[4], argv[5]); |
| 1409 | } |
| 1410 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1411 | DEFUN (no_ip_route_flags_distance2, |
| 1412 | no_ip_route_flags_distance2_cmd, |
| 1413 | "no ip route A.B.C.D/M (reject|blackhole) <1-255>", |
| 1414 | NO_STR |
| 1415 | IP_STR |
| 1416 | "Establish static routes\n" |
| 1417 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1418 | "Emit an ICMP unreachable when matched\n" |
| 1419 | "Silently discard pkts when matched\n" |
| 1420 | "Distance value for this route\n") |
| 1421 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1422 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1423 | argv[1], NULL, argv[2], NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1424 | } |
| 1425 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1426 | DEFUN (no_ip_route_flags_tag_distance2, |
| 1427 | no_ip_route_flags_tag_distance2_cmd, |
| 1428 | "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>", |
| 1429 | NO_STR |
| 1430 | IP_STR |
| 1431 | "Establish static routes\n" |
| 1432 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1433 | "Emit an ICMP unreachable when matched\n" |
| 1434 | "Silently discard pkts when matched\n" |
| 1435 | "Tag of this route\n" |
| 1436 | "Tag value\n" |
| 1437 | "Distance value for this route\n") |
| 1438 | { |
| 1439 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1440 | argv[1], argv[2] , argv[3], NULL); |
| 1441 | } |
| 1442 | |
| 1443 | DEFUN (no_ip_route_flags_tag_distance2_vrf, |
| 1444 | no_ip_route_flags_tag_distance2_vrf_cmd, |
| 1445 | "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1446 | NO_STR |
| 1447 | IP_STR |
| 1448 | "Establish static routes\n" |
| 1449 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1450 | "Emit an ICMP unreachable when matched\n" |
| 1451 | "Silently discard pkts when matched\n" |
| 1452 | "Tag of this route\n" |
| 1453 | "Tag value\n" |
| 1454 | "Distance value for this route\n" |
| 1455 | VRF_CMD_HELP_STR) |
| 1456 | { |
| 1457 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1458 | argv[1], argv[2] , argv[3], argv[4]); |
| 1459 | } |
| 1460 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1461 | DEFUN (no_ip_route_mask_distance, |
| 1462 | no_ip_route_mask_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1463 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1464 | NO_STR |
| 1465 | IP_STR |
| 1466 | "Establish static routes\n" |
| 1467 | "IP destination prefix\n" |
| 1468 | "IP destination prefix mask\n" |
| 1469 | "IP gateway address\n" |
| 1470 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 1471 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1472 | "Distance value for this route\n") |
| 1473 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1474 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1475 | argv[2], NULL, NULL, argv[3], NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1476 | } |
| 1477 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1478 | DEFUN (no_ip_route_mask_tag_distance, |
| 1479 | no_ip_route_mask_tag_distance_cmd, |
| 1480 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", |
| 1481 | NO_STR |
| 1482 | IP_STR |
| 1483 | "Establish static routes\n" |
| 1484 | "IP destination prefix\n" |
| 1485 | "IP destination prefix mask\n" |
| 1486 | "IP gateway address\n" |
| 1487 | "IP gateway interface name\n" |
| 1488 | "Null interface\n" |
| 1489 | "Tag of this route\n" |
| 1490 | "Tag value\n" |
| 1491 | "Distance value for this route\n") |
| 1492 | { |
| 1493 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1494 | argv[2], NULL, argv[3], argv[4], NULL); |
| 1495 | } |
| 1496 | |
| 1497 | DEFUN (no_ip_route_mask_tag_distance_vrf, |
| 1498 | no_ip_route_mask_tag_distance_vrf_cmd, |
| 1499 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1500 | NO_STR |
| 1501 | IP_STR |
| 1502 | "Establish static routes\n" |
| 1503 | "IP destination prefix\n" |
| 1504 | "IP destination prefix mask\n" |
| 1505 | "IP gateway address\n" |
| 1506 | "IP gateway interface name\n" |
| 1507 | "Null interface\n" |
| 1508 | "Tag of this route\n" |
| 1509 | "Tag value\n" |
| 1510 | "Distance value for this route\n" |
| 1511 | VRF_CMD_HELP_STR) |
| 1512 | { |
| 1513 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1514 | argv[2], NULL, argv[3], argv[4], argv[5]); |
| 1515 | } |
| 1516 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1517 | DEFUN (no_ip_route_mask_flags_distance, |
| 1518 | no_ip_route_mask_flags_distance_cmd, |
| 1519 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 1520 | NO_STR |
| 1521 | IP_STR |
| 1522 | "Establish static routes\n" |
| 1523 | "IP destination prefix\n" |
| 1524 | "IP destination prefix mask\n" |
| 1525 | "IP gateway address\n" |
| 1526 | "IP gateway interface name\n" |
| 1527 | "Emit an ICMP unreachable when matched\n" |
| 1528 | "Silently discard pkts when matched\n" |
| 1529 | "Distance value for this route\n") |
| 1530 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1531 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1532 | argv[2], argv[3], NULL, argv[4], NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1533 | } |
| 1534 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1535 | DEFUN (no_ip_route_mask_flags_tag_distance, |
| 1536 | no_ip_route_mask_flags_tag_distance_cmd, |
| 1537 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 1538 | NO_STR |
| 1539 | IP_STR |
| 1540 | "Establish static routes\n" |
| 1541 | "IP destination prefix\n" |
| 1542 | "IP destination prefix mask\n" |
| 1543 | "IP gateway address\n" |
| 1544 | "IP gateway interface name\n" |
| 1545 | "Emit an ICMP unreachable when matched\n" |
| 1546 | "Silently discard pkts when matched\n" |
| 1547 | "Tag of this route\n" |
| 1548 | "Tag value\n" |
| 1549 | "Distance value for this route\n") |
| 1550 | { |
| 1551 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], |
| 1552 | argv[4], argv[5], NULL); |
| 1553 | } |
| 1554 | |
| 1555 | DEFUN (no_ip_route_mask_flags_tag_distance_vrf, |
| 1556 | no_ip_route_mask_flags_tag_distance_vrf_cmd, |
| 1557 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 1558 | NO_STR |
| 1559 | IP_STR |
| 1560 | "Establish static routes\n" |
| 1561 | "IP destination prefix\n" |
| 1562 | "IP destination prefix mask\n" |
| 1563 | "IP gateway address\n" |
| 1564 | "IP gateway interface name\n" |
| 1565 | "Emit an ICMP unreachable when matched\n" |
| 1566 | "Silently discard pkts when matched\n" |
| 1567 | "Tag of this route\n" |
| 1568 | "Tag value\n" |
| 1569 | "Distance value for this route\n" |
| 1570 | VRF_CMD_HELP_STR) |
| 1571 | { |
| 1572 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], |
| 1573 | argv[4], argv[5], argv[6]); |
| 1574 | } |
| 1575 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1576 | DEFUN (no_ip_route_mask_flags_distance2, |
| 1577 | no_ip_route_mask_flags_distance2_cmd, |
| 1578 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", |
| 1579 | NO_STR |
| 1580 | IP_STR |
| 1581 | "Establish static routes\n" |
| 1582 | "IP destination prefix\n" |
| 1583 | "IP destination prefix mask\n" |
| 1584 | "Emit an ICMP unreachable when matched\n" |
| 1585 | "Silently discard pkts when matched\n" |
| 1586 | "Distance value for this route\n") |
| 1587 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1588 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1589 | NULL, argv[2], NULL, argv[3], NULL); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1590 | } |
| 1591 | |
| 1592 | DEFUN (ip_route_vrf, |
| 1593 | ip_route_vrf_cmd, |
| 1594 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1595 | IP_STR |
| 1596 | "Establish static routes\n" |
| 1597 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1598 | "IP gateway address\n" |
| 1599 | "IP gateway interface name\n" |
| 1600 | "Null interface\n" |
| 1601 | VRF_CMD_HELP_STR) |
| 1602 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1603 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1604 | argv[1], NULL, NULL, NULL, argv[2]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1605 | } |
| 1606 | |
| 1607 | DEFUN (ip_route_flags_vrf, |
| 1608 | ip_route_flags_vrf_cmd, |
| 1609 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1610 | IP_STR |
| 1611 | "Establish static routes\n" |
| 1612 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1613 | "IP gateway address\n" |
| 1614 | "IP gateway interface name\n" |
| 1615 | "Emit an ICMP unreachable when matched\n" |
| 1616 | "Silently discard pkts when matched\n" |
| 1617 | VRF_CMD_HELP_STR) |
| 1618 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1619 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1620 | argv[1], argv[2], NULL, NULL, argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1621 | } |
| 1622 | |
| 1623 | DEFUN (ip_route_flags2_vrf, |
| 1624 | ip_route_flags2_vrf_cmd, |
| 1625 | "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, |
| 1626 | IP_STR |
| 1627 | "Establish static routes\n" |
| 1628 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1629 | "Emit an ICMP unreachable when matched\n" |
| 1630 | "Silently discard pkts when matched\n" |
| 1631 | VRF_CMD_HELP_STR) |
| 1632 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1633 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1634 | NULL, argv[1], NULL, NULL, argv[2]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1635 | } |
| 1636 | |
| 1637 | /* Mask as A.B.C.D format. */ |
| 1638 | DEFUN (ip_route_mask_vrf, |
| 1639 | ip_route_mask_vrf_cmd, |
| 1640 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1641 | IP_STR |
| 1642 | "Establish static routes\n" |
| 1643 | "IP destination prefix\n" |
| 1644 | "IP destination prefix mask\n" |
| 1645 | "IP gateway address\n" |
| 1646 | "IP gateway interface name\n" |
| 1647 | "Null interface\n" |
| 1648 | VRF_CMD_HELP_STR) |
| 1649 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1650 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1651 | argv[2], NULL, NULL, NULL, argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1652 | } |
| 1653 | |
| 1654 | DEFUN (ip_route_mask_flags_vrf, |
| 1655 | ip_route_mask_flags_vrf_cmd, |
| 1656 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1657 | IP_STR |
| 1658 | "Establish static routes\n" |
| 1659 | "IP destination prefix\n" |
| 1660 | "IP destination prefix mask\n" |
| 1661 | "IP gateway address\n" |
| 1662 | "IP gateway interface name\n" |
| 1663 | "Emit an ICMP unreachable when matched\n" |
| 1664 | "Silently discard pkts when matched\n" |
| 1665 | VRF_CMD_HELP_STR) |
| 1666 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1667 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1668 | argv[2], argv[3], NULL, NULL, argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1669 | } |
| 1670 | |
| 1671 | DEFUN (ip_route_mask_flags2_vrf, |
| 1672 | ip_route_mask_flags2_vrf_cmd, |
| 1673 | "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, |
| 1674 | IP_STR |
| 1675 | "Establish static routes\n" |
| 1676 | "IP destination prefix\n" |
| 1677 | "IP destination prefix mask\n" |
| 1678 | "Emit an ICMP unreachable when matched\n" |
| 1679 | "Silently discard pkts when matched\n" |
| 1680 | VRF_CMD_HELP_STR) |
| 1681 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1682 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1683 | NULL, argv[2], NULL, NULL, argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1684 | } |
| 1685 | |
| 1686 | /* Distance option value. */ |
| 1687 | DEFUN (ip_route_distance_vrf, |
| 1688 | ip_route_distance_vrf_cmd, |
| 1689 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1690 | IP_STR |
| 1691 | "Establish static routes\n" |
| 1692 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1693 | "IP gateway address\n" |
| 1694 | "IP gateway interface name\n" |
| 1695 | "Null interface\n" |
| 1696 | "Distance value for this route\n" |
| 1697 | VRF_CMD_HELP_STR) |
| 1698 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1699 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1700 | argv[1], NULL, NULL, argv[2], argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1701 | } |
| 1702 | |
| 1703 | DEFUN (ip_route_flags_distance_vrf, |
| 1704 | ip_route_flags_distance_vrf_cmd, |
| 1705 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1706 | IP_STR |
| 1707 | "Establish static routes\n" |
| 1708 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1709 | "IP gateway address\n" |
| 1710 | "IP gateway interface name\n" |
| 1711 | "Emit an ICMP unreachable when matched\n" |
| 1712 | "Silently discard pkts when matched\n" |
| 1713 | "Distance value for this route\n" |
| 1714 | VRF_CMD_HELP_STR) |
| 1715 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1716 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1717 | argv[1], argv[2], NULL, argv[3], argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1718 | } |
| 1719 | |
| 1720 | DEFUN (ip_route_flags_distance2_vrf, |
| 1721 | ip_route_flags_distance2_vrf_cmd, |
| 1722 | "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1723 | IP_STR |
| 1724 | "Establish static routes\n" |
| 1725 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1726 | "Emit an ICMP unreachable when matched\n" |
| 1727 | "Silently discard pkts when matched\n" |
| 1728 | "Distance value for this route\n" |
| 1729 | VRF_CMD_HELP_STR) |
| 1730 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1731 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, |
| 1732 | NULL, argv[1], NULL, argv[2], argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1733 | } |
| 1734 | |
| 1735 | DEFUN (ip_route_mask_distance_vrf, |
| 1736 | ip_route_mask_distance_vrf_cmd, |
| 1737 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1738 | IP_STR |
| 1739 | "Establish static routes\n" |
| 1740 | "IP destination prefix\n" |
| 1741 | "IP destination prefix mask\n" |
| 1742 | "IP gateway address\n" |
| 1743 | "IP gateway interface name\n" |
| 1744 | "Null interface\n" |
| 1745 | "Distance value for this route\n" |
| 1746 | VRF_CMD_HELP_STR) |
| 1747 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1748 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1749 | argv[2], NULL, NULL, argv[3], argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1750 | } |
| 1751 | |
| 1752 | DEFUN (ip_route_mask_flags_distance_vrf, |
| 1753 | ip_route_mask_flags_distance_vrf_cmd, |
| 1754 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1755 | IP_STR |
| 1756 | "Establish static routes\n" |
| 1757 | "IP destination prefix\n" |
| 1758 | "IP destination prefix mask\n" |
| 1759 | "IP gateway address\n" |
| 1760 | "IP gateway interface name\n" |
| 1761 | "Emit an ICMP unreachable when matched\n" |
| 1762 | "Silently discard pkts when matched\n" |
| 1763 | "Distance value for this route\n" |
| 1764 | VRF_CMD_HELP_STR) |
| 1765 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1766 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1767 | argv[2], argv[3], NULL, argv[4], argv[5]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1768 | } |
| 1769 | |
| 1770 | DEFUN (ip_route_mask_flags_distance2_vrf, |
| 1771 | ip_route_mask_flags_distance2_vrf_cmd, |
| 1772 | "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1773 | IP_STR |
| 1774 | "Establish static routes\n" |
| 1775 | "IP destination prefix\n" |
| 1776 | "IP destination prefix mask\n" |
| 1777 | "Emit an ICMP unreachable when matched\n" |
| 1778 | "Silently discard pkts when matched\n" |
| 1779 | "Distance value for this route\n" |
| 1780 | VRF_CMD_HELP_STR) |
| 1781 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1782 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], |
| 1783 | NULL, argv[2], NULL, argv[3], argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1784 | } |
| 1785 | |
| 1786 | DEFUN (no_ip_route_vrf, |
| 1787 | no_ip_route_vrf_cmd, |
| 1788 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1789 | NO_STR |
| 1790 | IP_STR |
| 1791 | "Establish static routes\n" |
| 1792 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1793 | "IP gateway address\n" |
| 1794 | "IP gateway interface name\n" |
| 1795 | "Null interface\n" |
| 1796 | VRF_CMD_HELP_STR) |
| 1797 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1798 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], |
| 1799 | NULL, argv[1], NULL, NULL, NULL, |
| 1800 | (argc > 3) ? argv[3] : argv[2]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1801 | } |
| 1802 | |
| 1803 | ALIAS (no_ip_route_vrf, |
| 1804 | no_ip_route_flags_vrf_cmd, |
| 1805 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1806 | NO_STR |
| 1807 | IP_STR |
| 1808 | "Establish static routes\n" |
| 1809 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1810 | "IP gateway address\n" |
| 1811 | "IP gateway interface name\n" |
| 1812 | "Emit an ICMP unreachable when matched\n" |
| 1813 | "Silently discard pkts when matched\n" |
| 1814 | VRF_CMD_HELP_STR) |
| 1815 | |
| 1816 | DEFUN (no_ip_route_flags2_vrf, |
| 1817 | no_ip_route_flags2_vrf_cmd, |
| 1818 | "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, |
| 1819 | NO_STR |
| 1820 | IP_STR |
| 1821 | "Establish static routes\n" |
| 1822 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1823 | "Emit an ICMP unreachable when matched\n" |
| 1824 | "Silently discard pkts when matched\n" |
| 1825 | VRF_CMD_HELP_STR) |
| 1826 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1827 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], |
| 1828 | NULL, NULL, NULL, NULL, NULL, argv[2]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1829 | } |
| 1830 | |
| 1831 | DEFUN (no_ip_route_mask_vrf, |
| 1832 | no_ip_route_mask_vrf_cmd, |
| 1833 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1834 | NO_STR |
| 1835 | IP_STR |
| 1836 | "Establish static routes\n" |
| 1837 | "IP destination prefix\n" |
| 1838 | "IP destination prefix mask\n" |
| 1839 | "IP gateway address\n" |
| 1840 | "IP gateway interface name\n" |
| 1841 | "Null interface\n" |
| 1842 | VRF_CMD_HELP_STR) |
| 1843 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1844 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1845 | argv[2], NULL, NULL, NULL, |
| 1846 | (argc > 4) ? argv[4] : argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1847 | } |
| 1848 | |
| 1849 | ALIAS (no_ip_route_mask_vrf, |
| 1850 | no_ip_route_mask_flags_vrf_cmd, |
| 1851 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1852 | NO_STR |
| 1853 | IP_STR |
| 1854 | "Establish static routes\n" |
| 1855 | "IP destination prefix\n" |
| 1856 | "IP destination prefix mask\n" |
| 1857 | "IP gateway address\n" |
| 1858 | "IP gateway interface name\n" |
| 1859 | "Emit an ICMP unreachable when matched\n" |
| 1860 | "Silently discard pkts when matched\n" |
| 1861 | VRF_CMD_HELP_STR) |
| 1862 | |
| 1863 | DEFUN (no_ip_route_mask_flags2_vrf, |
| 1864 | no_ip_route_mask_flags2_vrf_cmd, |
| 1865 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, |
| 1866 | NO_STR |
| 1867 | IP_STR |
| 1868 | "Establish static routes\n" |
| 1869 | "IP destination prefix\n" |
| 1870 | "IP destination prefix mask\n" |
| 1871 | "Emit an ICMP unreachable when matched\n" |
| 1872 | "Silently discard pkts when matched\n" |
| 1873 | VRF_CMD_HELP_STR) |
| 1874 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1875 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1876 | NULL, NULL, NULL, NULL, argv[2]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1877 | } |
| 1878 | |
| 1879 | DEFUN (no_ip_route_distance_vrf, |
| 1880 | no_ip_route_distance_vrf_cmd, |
| 1881 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1882 | NO_STR |
| 1883 | IP_STR |
| 1884 | "Establish static routes\n" |
| 1885 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1886 | "IP gateway address\n" |
| 1887 | "IP gateway interface name\n" |
| 1888 | "Null interface\n" |
| 1889 | "Distance value for this route\n" |
| 1890 | VRF_CMD_HELP_STR) |
| 1891 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1892 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, |
| 1893 | argv[1], NULL, NULL, argv[2], argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1894 | } |
| 1895 | |
| 1896 | DEFUN (no_ip_route_flags_distance_vrf, |
| 1897 | no_ip_route_flags_distance_vrf_cmd, |
| 1898 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1899 | NO_STR |
| 1900 | IP_STR |
| 1901 | "Establish static routes\n" |
| 1902 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1903 | "IP gateway address\n" |
| 1904 | "IP gateway interface name\n" |
| 1905 | "Emit an ICMP unreachable when matched\n" |
| 1906 | "Silently discard pkts when matched\n" |
| 1907 | "Distance value for this route\n" |
| 1908 | VRF_CMD_HELP_STR) |
| 1909 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1910 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], |
| 1911 | argv[2], NULL, argv[3], argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1912 | } |
| 1913 | |
| 1914 | DEFUN (no_ip_route_flags_distance2_vrf, |
| 1915 | no_ip_route_flags_distance2_vrf_cmd, |
| 1916 | "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1917 | NO_STR |
| 1918 | IP_STR |
| 1919 | "Establish static routes\n" |
| 1920 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1921 | "Emit an ICMP unreachable when matched\n" |
| 1922 | "Silently discard pkts when matched\n" |
| 1923 | "Distance value for this route\n" |
| 1924 | VRF_CMD_HELP_STR) |
| 1925 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1926 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, |
| 1927 | argv[1], NULL, argv[2], argv[3]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1928 | } |
| 1929 | |
| 1930 | DEFUN (no_ip_route_mask_distance_vrf, |
| 1931 | no_ip_route_mask_distance_vrf_cmd, |
| 1932 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1933 | NO_STR |
| 1934 | IP_STR |
| 1935 | "Establish static routes\n" |
| 1936 | "IP destination prefix\n" |
| 1937 | "IP destination prefix mask\n" |
| 1938 | "IP gateway address\n" |
| 1939 | "IP gateway interface name\n" |
| 1940 | "Null interface\n" |
| 1941 | "Distance value for this route\n" |
| 1942 | VRF_CMD_HELP_STR) |
| 1943 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1944 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], |
| 1945 | argv[2], NULL, NULL, argv[3], argv[4]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | DEFUN (no_ip_route_mask_flags_distance_vrf, |
| 1949 | no_ip_route_mask_flags_distance_vrf_cmd, |
| 1950 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1951 | NO_STR |
| 1952 | IP_STR |
| 1953 | "Establish static routes\n" |
| 1954 | "IP destination prefix\n" |
| 1955 | "IP destination prefix mask\n" |
| 1956 | "IP gateway address\n" |
| 1957 | "IP gateway interface name\n" |
| 1958 | "Emit an ICMP unreachable when matched\n" |
| 1959 | "Silently discard pkts when matched\n" |
| 1960 | "Distance value for this route\n" |
| 1961 | VRF_CMD_HELP_STR) |
| 1962 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1963 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], |
| 1964 | argv[3], NULL, argv[4], argv[5]); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 1965 | } |
| 1966 | |
| 1967 | DEFUN (no_ip_route_mask_flags_distance2_vrf, |
| 1968 | no_ip_route_mask_flags_distance2_vrf_cmd, |
| 1969 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1970 | NO_STR |
| 1971 | IP_STR |
| 1972 | "Establish static routes\n" |
| 1973 | "IP destination prefix\n" |
| 1974 | "IP destination prefix mask\n" |
| 1975 | "Emit an ICMP unreachable when matched\n" |
| 1976 | "Silently discard pkts when matched\n" |
| 1977 | "Distance value for this route\n" |
| 1978 | VRF_CMD_HELP_STR) |
| 1979 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 1980 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, |
| 1981 | argv[2], NULL, argv[3], argv[4]); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1982 | } |
| 1983 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 1984 | DEFUN (no_ip_route_mask_flags_tag_distance2, |
| 1985 | no_ip_route_mask_flags_tag_distance2_cmd, |
| 1986 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>", |
| 1987 | NO_STR |
| 1988 | IP_STR |
| 1989 | "Establish static routes\n" |
| 1990 | "IP destination prefix\n" |
| 1991 | "IP destination prefix mask\n" |
| 1992 | "Emit an ICMP unreachable when matched\n" |
| 1993 | "Silently discard pkts when matched\n" |
| 1994 | "Tag of this route\n" |
| 1995 | "Tag value\n" |
| 1996 | "Distance value for this route\n") |
| 1997 | { |
| 1998 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, |
| 1999 | argv[2], argv[3], argv[4], NULL); |
| 2000 | } |
| 2001 | |
| 2002 | DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, |
| 2003 | no_ip_route_mask_flags_tag_distance2_vrf_cmd, |
| 2004 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 2005 | NO_STR |
| 2006 | IP_STR |
| 2007 | "Establish static routes\n" |
| 2008 | "IP destination prefix\n" |
| 2009 | "IP destination prefix mask\n" |
| 2010 | "Emit an ICMP unreachable when matched\n" |
| 2011 | "Silently discard pkts when matched\n" |
| 2012 | "Tag of this route\n" |
| 2013 | "Tag value\n" |
| 2014 | "Distance value for this route\n" |
| 2015 | VRF_CMD_HELP_STR) |
| 2016 | { |
| 2017 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, |
| 2018 | argv[2], argv[3], argv[4], argv[5]); |
| 2019 | } |
| 2020 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2021 | char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1]; /* "any" == ZEBRA_ROUTE_MAX */ |
| 2022 | |
| 2023 | DEFUN (ip_protocol, |
| 2024 | ip_protocol_cmd, |
| 2025 | "ip protocol PROTO route-map ROUTE-MAP", |
| 2026 | NO_STR |
| 2027 | "Apply route map to PROTO\n" |
| 2028 | "Protocol name\n" |
| 2029 | "Route map name\n") |
| 2030 | { |
| 2031 | int i; |
| 2032 | |
| 2033 | if (strcasecmp(argv[0], "any") == 0) |
| 2034 | i = ZEBRA_ROUTE_MAX; |
| 2035 | else |
| 2036 | i = proto_name2num(argv[0]); |
| 2037 | if (i < 0) |
| 2038 | { |
| 2039 | vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", |
| 2040 | VTY_NEWLINE); |
| 2041 | return CMD_WARNING; |
| 2042 | } |
| 2043 | if (proto_rm[AFI_IP][i]) |
| 2044 | XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); |
| 2045 | proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); |
| 2046 | return CMD_SUCCESS; |
| 2047 | } |
| 2048 | |
| 2049 | DEFUN (no_ip_protocol, |
| 2050 | no_ip_protocol_cmd, |
| 2051 | "no ip protocol PROTO", |
| 2052 | NO_STR |
| 2053 | "Remove route map from PROTO\n" |
| 2054 | "Protocol name\n") |
| 2055 | { |
| 2056 | int i; |
| 2057 | |
| 2058 | if (strcasecmp(argv[0], "any") == 0) |
| 2059 | i = ZEBRA_ROUTE_MAX; |
| 2060 | else |
| 2061 | i = proto_name2num(argv[0]); |
| 2062 | if (i < 0) |
| 2063 | { |
| 2064 | vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", |
| 2065 | VTY_NEWLINE); |
| 2066 | return CMD_WARNING; |
| 2067 | } |
| 2068 | if (proto_rm[AFI_IP][i]) |
| 2069 | XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); |
| 2070 | proto_rm[AFI_IP][i] = NULL; |
| 2071 | return CMD_SUCCESS; |
| 2072 | } |
| 2073 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2074 | /* New RIB. Detailed information for IPv4 route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2075 | static void |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 2076 | vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2077 | { |
| 2078 | struct rib *rib; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2079 | struct nexthop *nexthop, *tnexthop; |
| 2080 | int recursing; |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2081 | char buf[PREFIX_STRLEN]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2082 | |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2083 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2084 | { |
David Lamparter | b7cce95 | 2015-03-07 08:40:48 +0100 | [diff] [blame] | 2085 | const char *mcast_info = ""; |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 2086 | if (mcast) |
| 2087 | { |
| 2088 | rib_table_info_t *info = rn->table->info; |
| 2089 | mcast_info = (info->safi == SAFI_MULTICAST) |
| 2090 | ? " using Multicast RIB" |
| 2091 | : " using Unicast RIB"; |
| 2092 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2093 | vty_out (vty, "Routing entry for %s%s%s", |
| 2094 | prefix2str (&rn->p, buf, sizeof(buf)), mcast_info, |
| 2095 | VTY_NEWLINE); |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 2096 | vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 2097 | vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); |
Timo Teräs | b11f3b5 | 2015-11-02 16:50:07 +0200 | [diff] [blame] | 2098 | if (rib->mtu) |
| 2099 | vty_out (vty, ", mtu %u", rib->mtu); |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 2100 | vty_out (vty, ", tag %d", rib->tag); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2101 | vty_out (vty, ", vrf %u", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2102 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2103 | vty_out (vty, ", best"); |
Timo Teräs | 325823a | 2016-01-15 17:36:31 +0200 | [diff] [blame] | 2104 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE)) |
| 2105 | vty_out (vty, ", fib-override"); |
| 2106 | if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB)) |
| 2107 | vty_out (vty, ", fib"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2108 | if (rib->refcnt) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2109 | vty_out (vty, ", refcnt %ld", rib->refcnt); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2110 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 2111 | vty_out (vty, ", blackhole"); |
| 2112 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 2113 | vty_out (vty, ", reject"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2114 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2115 | |
| 2116 | #define ONE_DAY_SECOND 60*60*24 |
| 2117 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 2118 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2119 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 2120 | || rib->type == ZEBRA_ROUTE_OSPF |
| 2121 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 2122 | || rib->type == ZEBRA_ROUTE_BABEL |
| 2123 | || rib->type == ZEBRA_ROUTE_ISIS |
| 2124 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2125 | { |
| 2126 | time_t uptime; |
| 2127 | struct tm *tm; |
| 2128 | |
| 2129 | uptime = time (NULL); |
| 2130 | uptime -= rib->uptime; |
| 2131 | tm = gmtime (&uptime); |
| 2132 | |
| 2133 | vty_out (vty, " Last update "); |
| 2134 | |
| 2135 | if (uptime < ONE_DAY_SECOND) |
| 2136 | vty_out (vty, "%02d:%02d:%02d", |
| 2137 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 2138 | else if (uptime < ONE_WEEK_SECOND) |
| 2139 | vty_out (vty, "%dd%02dh%02dm", |
| 2140 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 2141 | else |
| 2142 | vty_out (vty, "%02dw%dd%02dh", |
| 2143 | tm->tm_yday/7, |
| 2144 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 2145 | vty_out (vty, " ago%s", VTY_NEWLINE); |
| 2146 | } |
| 2147 | |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2148 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2149 | { |
Timo Teräs | 7e73eb7 | 2016-04-09 17:22:32 +0300 | [diff] [blame] | 2150 | vty_out (vty, " %c%c%s", |
| 2151 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? '>' : ' ', |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2152 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ', |
| 2153 | recursing ? " " : ""); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2154 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2155 | switch (nexthop->type) |
| 2156 | { |
| 2157 | case NEXTHOP_TYPE_IPV4: |
| 2158 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 2159 | vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4)); |
| 2160 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2161 | vty_out (vty, ", via %s", |
| 2162 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2163 | break; |
| 2164 | case NEXTHOP_TYPE_IPV6: |
| 2165 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 2166 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 2167 | vty_out (vty, " %s", |
| 2168 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf))); |
| 2169 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 2170 | vty_out (vty, ", %s", nexthop->ifname); |
| 2171 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2172 | vty_out (vty, ", via %s", |
| 2173 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2174 | break; |
| 2175 | case NEXTHOP_TYPE_IFINDEX: |
| 2176 | vty_out (vty, " directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2177 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2178 | break; |
| 2179 | case NEXTHOP_TYPE_IFNAME: |
| 2180 | vty_out (vty, " directly connected, %s", nexthop->ifname); |
| 2181 | break; |
| 2182 | case NEXTHOP_TYPE_BLACKHOLE: |
| 2183 | vty_out (vty, " directly connected, Null0"); |
| 2184 | break; |
| 2185 | default: |
| 2186 | break; |
| 2187 | } |
| 2188 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
| 2189 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2190 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2191 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
| 2192 | vty_out (vty, " onlink"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2193 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2194 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
| 2195 | vty_out (vty, " (recursive)"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 2196 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2197 | switch (nexthop->type) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2198 | { |
| 2199 | case NEXTHOP_TYPE_IPV4: |
| 2200 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 2201 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 2202 | if (nexthop->src.ipv4.s_addr) |
| 2203 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2204 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
| 2205 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2206 | } |
| 2207 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2208 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2209 | case NEXTHOP_TYPE_IPV6: |
| 2210 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 2211 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 2212 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 2213 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2214 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
| 2215 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2216 | } |
| 2217 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2218 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2219 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2220 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2221 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2222 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2223 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2224 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2225 | } |
| 2226 | } |
| 2227 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2228 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2229 | vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib) |
| 2230 | { |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2231 | struct nexthop *nexthop, *tnexthop; |
| 2232 | int recursing; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2233 | int len = 0; |
| 2234 | char buf[BUFSIZ]; |
| 2235 | |
| 2236 | /* Nexthop information. */ |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2237 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2238 | { |
| 2239 | if (nexthop == rib->nexthop) |
| 2240 | { |
| 2241 | /* Prefix information. */ |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2242 | len = vty_out (vty, "%c%c%c %s", |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 2243 | zebra_route_char (rib->type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2244 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) |
| 2245 | ? '>' : ' ', |
| 2246 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 2247 | ? '*' : ' ', |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2248 | prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2249 | |
| 2250 | /* Distance and metric display. */ |
| 2251 | if (rib->type != ZEBRA_ROUTE_CONNECT |
| 2252 | && rib->type != ZEBRA_ROUTE_KERNEL) |
| 2253 | len += vty_out (vty, " [%d/%d]", rib->distance, |
| 2254 | rib->metric); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2255 | |
| 2256 | if (rib->vrf_id != VRF_DEFAULT) |
| 2257 | len += vty_out (vty, " [vrf %u]", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2258 | } |
| 2259 | else |
| 2260 | vty_out (vty, " %c%*c", |
| 2261 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 2262 | ? '*' : ' ', |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2263 | len - 3 + (2 * recursing), ' '); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2264 | |
| 2265 | switch (nexthop->type) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2266 | { |
| 2267 | case NEXTHOP_TYPE_IPV4: |
| 2268 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 2269 | vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4)); |
| 2270 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2271 | vty_out (vty, ", %s", |
| 2272 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2273 | break; |
| 2274 | case NEXTHOP_TYPE_IPV6: |
| 2275 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 2276 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 2277 | vty_out (vty, " via %s", |
| 2278 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ)); |
| 2279 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 2280 | vty_out (vty, ", %s", nexthop->ifname); |
| 2281 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2282 | vty_out (vty, ", %s", |
| 2283 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2284 | break; |
| 2285 | case NEXTHOP_TYPE_IFINDEX: |
| 2286 | vty_out (vty, " is directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 2287 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2288 | break; |
| 2289 | case NEXTHOP_TYPE_IFNAME: |
| 2290 | vty_out (vty, " is directly connected, %s", nexthop->ifname); |
| 2291 | break; |
| 2292 | case NEXTHOP_TYPE_BLACKHOLE: |
| 2293 | vty_out (vty, " is directly connected, Null0"); |
| 2294 | break; |
| 2295 | default: |
| 2296 | break; |
| 2297 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2298 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2299 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2300 | |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 2301 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2302 | vty_out (vty, " onlink"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 2303 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2304 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2305 | vty_out (vty, " (recursive)"); |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2306 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2307 | switch (nexthop->type) |
| 2308 | { |
| 2309 | case NEXTHOP_TYPE_IPV4: |
| 2310 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 2311 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 2312 | if (nexthop->src.ipv4.s_addr) |
| 2313 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2314 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2315 | vty_out (vty, ", src %s", buf); |
| 2316 | } |
| 2317 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2318 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2319 | case NEXTHOP_TYPE_IPV6: |
| 2320 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 2321 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 2322 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 2323 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2324 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2325 | vty_out (vty, ", src %s", buf); |
| 2326 | } |
| 2327 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2328 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2329 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2330 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 2331 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2332 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2333 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 2334 | vty_out (vty, ", bh"); |
| 2335 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 2336 | vty_out (vty, ", rej"); |
| 2337 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2338 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 2339 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 2340 | || rib->type == ZEBRA_ROUTE_OSPF |
| 2341 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 2342 | || rib->type == ZEBRA_ROUTE_BABEL |
| 2343 | || rib->type == ZEBRA_ROUTE_ISIS |
| 2344 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2345 | { |
| 2346 | time_t uptime; |
| 2347 | struct tm *tm; |
| 2348 | |
| 2349 | uptime = time (NULL); |
| 2350 | uptime -= rib->uptime; |
| 2351 | tm = gmtime (&uptime); |
| 2352 | |
| 2353 | #define ONE_DAY_SECOND 60*60*24 |
| 2354 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 2355 | |
| 2356 | if (uptime < ONE_DAY_SECOND) |
| 2357 | vty_out (vty, ", %02d:%02d:%02d", |
| 2358 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 2359 | else if (uptime < ONE_WEEK_SECOND) |
| 2360 | vty_out (vty, ", %dd%02dh%02dm", |
| 2361 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 2362 | else |
| 2363 | vty_out (vty, ", %02dw%dd%02dh", |
| 2364 | tm->tm_yday/7, |
| 2365 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 2366 | } |
| 2367 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2368 | } |
| 2369 | } |
| 2370 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2371 | DEFUN (show_ip_route, |
| 2372 | show_ip_route_cmd, |
| 2373 | "show ip route", |
| 2374 | SHOW_STR |
| 2375 | IP_STR |
| 2376 | "IP routing table\n") |
| 2377 | { |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2378 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 2379 | |
| 2380 | if (argc > 0) |
| 2381 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2382 | |
| 2383 | return do_show_ip_route(vty, SAFI_UNICAST, vrf_id); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 2384 | } |
| 2385 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2386 | static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id) |
| 2387 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2388 | struct route_table *table; |
| 2389 | struct route_node *rn; |
| 2390 | struct rib *rib; |
| 2391 | int first = 1; |
| 2392 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2393 | table = zebra_vrf_table (AFI_IP, safi, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2394 | if (! table) |
| 2395 | return CMD_SUCCESS; |
| 2396 | |
| 2397 | /* Show all IPv4 routes. */ |
| 2398 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2399 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2400 | { |
| 2401 | if (first) |
| 2402 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2403 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2404 | first = 0; |
| 2405 | } |
| 2406 | vty_show_ip_route (vty, rn, rib); |
| 2407 | } |
| 2408 | return CMD_SUCCESS; |
| 2409 | } |
| 2410 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2411 | ALIAS (show_ip_route, |
| 2412 | show_ip_route_vrf_cmd, |
| 2413 | "show ip route " VRF_CMD_STR, |
| 2414 | SHOW_STR |
| 2415 | IP_STR |
| 2416 | "IP routing table\n" |
| 2417 | VRF_CMD_HELP_STR) |
| 2418 | |
Pradosh Mohapatra | 60cc959 | 2015-11-09 20:21:41 -0500 | [diff] [blame] | 2419 | DEFUN (show_ip_nht, |
| 2420 | show_ip_nht_cmd, |
| 2421 | "show ip nht", |
| 2422 | SHOW_STR |
| 2423 | IP_STR |
| 2424 | "IP nexthop tracking table\n") |
| 2425 | { |
| 2426 | zebra_print_rnh_table(0, AF_INET, vty); |
| 2427 | return CMD_SUCCESS; |
| 2428 | } |
| 2429 | |
| 2430 | DEFUN (show_ipv6_nht, |
| 2431 | show_ipv6_nht_cmd, |
| 2432 | "show ipv6 nht", |
| 2433 | SHOW_STR |
| 2434 | IP_STR |
| 2435 | "IPv6 nexthop tracking table\n") |
| 2436 | { |
| 2437 | zebra_print_rnh_table(0, AF_INET6, vty); |
| 2438 | return CMD_SUCCESS; |
| 2439 | } |
| 2440 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 2441 | DEFUN (show_ip_route_tag, |
| 2442 | show_ip_route_tag_cmd, |
| 2443 | "show ip route tag <1-65535>", |
| 2444 | SHOW_STR |
| 2445 | IP_STR |
| 2446 | "IP routing table\n" |
| 2447 | "Show only routes with tag\n" |
| 2448 | "Tag value\n") |
| 2449 | { |
| 2450 | struct route_table *table; |
| 2451 | struct route_node *rn; |
| 2452 | struct rib *rib; |
| 2453 | int first = 1; |
Paul Jakma | 96d1060 | 2016-07-01 14:23:45 +0100 | [diff] [blame] | 2454 | route_tag_t tag = 0; |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 2455 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 2456 | |
| 2457 | if (argv[0]) |
| 2458 | tag = atoi(argv[0]); |
| 2459 | |
| 2460 | if (argc == 2) |
| 2461 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 2462 | |
| 2463 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
| 2464 | if (! table) |
| 2465 | return CMD_SUCCESS; |
| 2466 | |
| 2467 | /* Show all IPv4 routes with matching tag value. */ |
| 2468 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2469 | RNODE_FOREACH_RIB (rn, rib) |
| 2470 | { |
| 2471 | if (rib->tag != tag) |
| 2472 | continue; |
| 2473 | |
| 2474 | if (first) |
| 2475 | { |
| 2476 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2477 | first = 0; |
| 2478 | } |
| 2479 | vty_show_ip_route (vty, rn, rib); |
| 2480 | } |
| 2481 | return CMD_SUCCESS; |
| 2482 | } |
| 2483 | |
| 2484 | ALIAS (show_ip_route_tag, |
| 2485 | show_ip_route_tag_vrf_cmd, |
| 2486 | "show ip route tag <1-65535>" VRF_CMD_STR, |
| 2487 | SHOW_STR |
| 2488 | IP_STR |
| 2489 | "IP routing table\n" |
| 2490 | "Show only routes with tag\n" |
| 2491 | "Tag value\n" |
| 2492 | VRF_CMD_HELP_STR) |
| 2493 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2494 | DEFUN (show_ip_route_prefix_longer, |
| 2495 | show_ip_route_prefix_longer_cmd, |
| 2496 | "show ip route A.B.C.D/M longer-prefixes", |
| 2497 | SHOW_STR |
| 2498 | IP_STR |
| 2499 | "IP routing table\n" |
| 2500 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2501 | "Show route matching the specified Network/Mask pair only\n") |
| 2502 | { |
| 2503 | struct route_table *table; |
| 2504 | struct route_node *rn; |
| 2505 | struct rib *rib; |
| 2506 | struct prefix p; |
| 2507 | int ret; |
| 2508 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2509 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2510 | |
| 2511 | ret = str2prefix (argv[0], &p); |
| 2512 | if (! ret) |
| 2513 | { |
| 2514 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 2515 | return CMD_WARNING; |
| 2516 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2517 | |
| 2518 | if (argc > 1) |
| 2519 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 2520 | |
| 2521 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2522 | if (! table) |
| 2523 | return CMD_SUCCESS; |
| 2524 | |
| 2525 | /* Show matched type IPv4 routes. */ |
| 2526 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2527 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2528 | if (prefix_match (&p, &rn->p)) |
| 2529 | { |
| 2530 | if (first) |
| 2531 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2532 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2533 | first = 0; |
| 2534 | } |
| 2535 | vty_show_ip_route (vty, rn, rib); |
| 2536 | } |
| 2537 | return CMD_SUCCESS; |
| 2538 | } |
| 2539 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2540 | ALIAS (show_ip_route_prefix_longer, |
| 2541 | show_ip_route_prefix_longer_vrf_cmd, |
| 2542 | "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR, |
| 2543 | SHOW_STR |
| 2544 | IP_STR |
| 2545 | "IP routing table\n" |
| 2546 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2547 | "Show route matching the specified Network/Mask pair only\n" |
| 2548 | VRF_CMD_HELP_STR) |
| 2549 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2550 | DEFUN (show_ip_route_supernets, |
| 2551 | show_ip_route_supernets_cmd, |
| 2552 | "show ip route supernets-only", |
| 2553 | SHOW_STR |
| 2554 | IP_STR |
| 2555 | "IP routing table\n" |
| 2556 | "Show supernet entries only\n") |
| 2557 | { |
| 2558 | struct route_table *table; |
| 2559 | struct route_node *rn; |
| 2560 | struct rib *rib; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2561 | u_int32_t addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2562 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2563 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2564 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2565 | if (argc > 0) |
| 2566 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2567 | |
| 2568 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2569 | if (! table) |
| 2570 | return CMD_SUCCESS; |
| 2571 | |
| 2572 | /* Show matched type IPv4 routes. */ |
| 2573 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2574 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2575 | { |
| 2576 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 2577 | |
| 2578 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 2579 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2580 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2581 | { |
| 2582 | if (first) |
| 2583 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2584 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2585 | first = 0; |
| 2586 | } |
| 2587 | vty_show_ip_route (vty, rn, rib); |
| 2588 | } |
| 2589 | } |
| 2590 | return CMD_SUCCESS; |
| 2591 | } |
| 2592 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2593 | ALIAS (show_ip_route_supernets, |
| 2594 | show_ip_route_supernets_vrf_cmd, |
| 2595 | "show ip route supernets-only " VRF_CMD_STR, |
| 2596 | SHOW_STR |
| 2597 | IP_STR |
| 2598 | "IP routing table\n" |
| 2599 | "Show supernet entries only\n" |
| 2600 | VRF_CMD_HELP_STR) |
| 2601 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2602 | DEFUN (show_ip_route_protocol, |
| 2603 | show_ip_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2604 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2605 | SHOW_STR |
| 2606 | IP_STR |
| 2607 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2608 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2609 | { |
| 2610 | int type; |
| 2611 | struct route_table *table; |
| 2612 | struct route_node *rn; |
| 2613 | struct rib *rib; |
| 2614 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2615 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2616 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2617 | type = proto_redistnum (AFI_IP, argv[0]); |
| 2618 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2619 | { |
| 2620 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 2621 | return CMD_WARNING; |
| 2622 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2623 | |
| 2624 | if (argc > 1) |
| 2625 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 2626 | |
| 2627 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2628 | if (! table) |
| 2629 | return CMD_SUCCESS; |
| 2630 | |
| 2631 | /* Show matched type IPv4 routes. */ |
| 2632 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2633 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2634 | if (rib->type == type) |
| 2635 | { |
| 2636 | if (first) |
| 2637 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 2638 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2639 | first = 0; |
| 2640 | } |
| 2641 | vty_show_ip_route (vty, rn, rib); |
| 2642 | } |
| 2643 | return CMD_SUCCESS; |
| 2644 | } |
| 2645 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2646 | ALIAS (show_ip_route_protocol, |
| 2647 | show_ip_route_protocol_vrf_cmd, |
| 2648 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 2649 | SHOW_STR |
| 2650 | IP_STR |
| 2651 | "IP routing table\n" |
| 2652 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 2653 | VRF_CMD_HELP_STR) |
| 2654 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2655 | DEFUN (show_ip_route_addr, |
| 2656 | show_ip_route_addr_cmd, |
| 2657 | "show ip route A.B.C.D", |
| 2658 | SHOW_STR |
| 2659 | IP_STR |
| 2660 | "IP routing table\n" |
| 2661 | "Network in the IP routing table to display\n") |
| 2662 | { |
| 2663 | int ret; |
| 2664 | struct prefix_ipv4 p; |
| 2665 | struct route_table *table; |
| 2666 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2667 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2668 | |
| 2669 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2670 | if (ret <= 0) |
| 2671 | { |
| 2672 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2673 | return CMD_WARNING; |
| 2674 | } |
| 2675 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2676 | if (argc > 1) |
| 2677 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 2678 | |
| 2679 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2680 | if (! table) |
| 2681 | return CMD_SUCCESS; |
| 2682 | |
| 2683 | rn = route_node_match (table, (struct prefix *) &p); |
| 2684 | if (! rn) |
| 2685 | { |
| 2686 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 2687 | return CMD_WARNING; |
| 2688 | } |
| 2689 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 2690 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2691 | |
| 2692 | route_unlock_node (rn); |
| 2693 | |
| 2694 | return CMD_SUCCESS; |
| 2695 | } |
| 2696 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2697 | ALIAS (show_ip_route_addr, |
| 2698 | show_ip_route_addr_vrf_cmd, |
| 2699 | "show ip route A.B.C.D " VRF_CMD_STR, |
| 2700 | SHOW_STR |
| 2701 | IP_STR |
| 2702 | "IP routing table\n" |
| 2703 | "Network in the IP routing table to display\n" |
| 2704 | VRF_CMD_HELP_STR) |
| 2705 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2706 | DEFUN (show_ip_route_prefix, |
| 2707 | show_ip_route_prefix_cmd, |
| 2708 | "show ip route A.B.C.D/M", |
| 2709 | SHOW_STR |
| 2710 | IP_STR |
| 2711 | "IP routing table\n" |
| 2712 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") |
| 2713 | { |
| 2714 | int ret; |
| 2715 | struct prefix_ipv4 p; |
| 2716 | struct route_table *table; |
| 2717 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2718 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2719 | |
| 2720 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2721 | if (ret <= 0) |
| 2722 | { |
| 2723 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2724 | return CMD_WARNING; |
| 2725 | } |
| 2726 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2727 | if (argc > 1) |
| 2728 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 2729 | |
| 2730 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2731 | if (! table) |
| 2732 | return CMD_SUCCESS; |
| 2733 | |
| 2734 | rn = route_node_match (table, (struct prefix *) &p); |
| 2735 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 2736 | { |
| 2737 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 2738 | if (rn) |
| 2739 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2740 | return CMD_WARNING; |
| 2741 | } |
| 2742 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 2743 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2744 | |
| 2745 | route_unlock_node (rn); |
| 2746 | |
| 2747 | return CMD_SUCCESS; |
| 2748 | } |
| 2749 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2750 | ALIAS (show_ip_route_prefix, |
| 2751 | show_ip_route_prefix_vrf_cmd, |
| 2752 | "show ip route A.B.C.D/M " VRF_CMD_STR, |
| 2753 | SHOW_STR |
| 2754 | IP_STR |
| 2755 | "IP routing table\n" |
| 2756 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2757 | VRF_CMD_HELP_STR) |
| 2758 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2759 | static void |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2760 | vty_show_ip_route_summary (struct vty *vty, struct route_table *table) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2761 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2762 | struct route_node *rn; |
| 2763 | struct rib *rib; |
| 2764 | struct nexthop *nexthop; |
| 2765 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 2766 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 2767 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 2768 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 2769 | u_int32_t i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2770 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2771 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 2772 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 2773 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 2774 | RNODE_FOREACH_RIB (rn, rib) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2775 | for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) |
| 2776 | { |
| 2777 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 2778 | rib_cnt[rib->type]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2779 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 2780 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2781 | { |
| 2782 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 2783 | fib_cnt[rib->type]++; |
| 2784 | } |
| 2785 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 2786 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 2787 | { |
| 2788 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 2789 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 2790 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2791 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 2792 | } |
| 2793 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2794 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2795 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 2796 | "Route Source", "Routes", "FIB", |
| 2797 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 2798 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2799 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2800 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 2801 | { |
| 2802 | if (rib_cnt[i] > 0) |
| 2803 | { |
| 2804 | if (i == ZEBRA_ROUTE_BGP) |
| 2805 | { |
| 2806 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 2807 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 2808 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2809 | VTY_NEWLINE); |
| 2810 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 2811 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2812 | VTY_NEWLINE); |
| 2813 | } |
| 2814 | else |
| 2815 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 2816 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 2817 | } |
| 2818 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2819 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2820 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 2821 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 2822 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2823 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2824 | } |
| 2825 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2826 | /* |
| 2827 | * Implementation of the ip route summary prefix command. |
| 2828 | * |
| 2829 | * This command prints the primary prefixes that have been installed by various |
| 2830 | * protocols on the box. |
| 2831 | * |
| 2832 | */ |
| 2833 | static void |
| 2834 | vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) |
| 2835 | { |
| 2836 | struct route_node *rn; |
| 2837 | struct rib *rib; |
| 2838 | struct nexthop *nexthop; |
| 2839 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 2840 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 2841 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 2842 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 2843 | u_int32_t i; |
| 2844 | int cnt; |
| 2845 | |
| 2846 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 2847 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 2848 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2849 | RNODE_FOREACH_RIB (rn, rib) |
| 2850 | { |
| 2851 | |
| 2852 | /* |
| 2853 | * In case of ECMP, count only once. |
| 2854 | */ |
| 2855 | cnt = 0; |
| 2856 | for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next) |
| 2857 | { |
| 2858 | cnt++; |
| 2859 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 2860 | rib_cnt[rib->type]++; |
| 2861 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 2862 | { |
| 2863 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 2864 | fib_cnt[rib->type]++; |
| 2865 | } |
| 2866 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 2867 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 2868 | { |
| 2869 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 2870 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 2871 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 2872 | } |
| 2873 | } |
| 2874 | } |
| 2875 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2876 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 2877 | "Route Source", "Prefix Routes", "FIB", |
| 2878 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 2879 | VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2880 | |
| 2881 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 2882 | { |
| 2883 | if (rib_cnt[i] > 0) |
| 2884 | { |
| 2885 | if (i == ZEBRA_ROUTE_BGP) |
| 2886 | { |
| 2887 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 2888 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 2889 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2890 | VTY_NEWLINE); |
| 2891 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 2892 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2893 | VTY_NEWLINE); |
| 2894 | } |
| 2895 | else |
| 2896 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 2897 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 2898 | } |
| 2899 | } |
| 2900 | |
| 2901 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 2902 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 2903 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2904 | vty_out (vty, "%s", VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2905 | } |
| 2906 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2907 | /* Show route summary. */ |
| 2908 | DEFUN (show_ip_route_summary, |
| 2909 | show_ip_route_summary_cmd, |
| 2910 | "show ip route summary", |
| 2911 | SHOW_STR |
| 2912 | IP_STR |
| 2913 | "IP routing table\n" |
| 2914 | "Summary of all routes\n") |
| 2915 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2916 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2917 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2918 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2919 | if (argc > 0) |
| 2920 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2921 | |
| 2922 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2923 | if (! table) |
| 2924 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2925 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2926 | vty_show_ip_route_summary (vty, table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2927 | |
| 2928 | return CMD_SUCCESS; |
| 2929 | } |
| 2930 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2931 | ALIAS (show_ip_route_summary, |
| 2932 | show_ip_route_summary_vrf_cmd, |
| 2933 | "show ip route summary " VRF_CMD_STR, |
| 2934 | SHOW_STR |
| 2935 | IP_STR |
| 2936 | "IP routing table\n" |
| 2937 | "Summary of all routes\n" |
| 2938 | VRF_CMD_HELP_STR) |
| 2939 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2940 | /* Show route summary prefix. */ |
| 2941 | DEFUN (show_ip_route_summary_prefix, |
| 2942 | show_ip_route_summary_prefix_cmd, |
| 2943 | "show ip route summary prefix", |
| 2944 | SHOW_STR |
| 2945 | IP_STR |
| 2946 | "IP routing table\n" |
| 2947 | "Summary of all routes\n" |
| 2948 | "Prefix routes\n") |
| 2949 | { |
| 2950 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2951 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2952 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2953 | if (argc > 0) |
| 2954 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2955 | |
| 2956 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2957 | if (! table) |
| 2958 | return CMD_SUCCESS; |
| 2959 | |
| 2960 | vty_show_ip_route_summary_prefix (vty, table); |
| 2961 | |
| 2962 | return CMD_SUCCESS; |
| 2963 | } |
| 2964 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2965 | ALIAS (show_ip_route_summary_prefix, |
| 2966 | show_ip_route_summary_prefix_vrf_cmd, |
| 2967 | "show ip route summary prefix " VRF_CMD_STR, |
| 2968 | SHOW_STR |
| 2969 | IP_STR |
| 2970 | "IP routing table\n" |
| 2971 | "Summary of all routes\n" |
| 2972 | "Prefix routes\n" |
| 2973 | VRF_CMD_HELP_STR) |
| 2974 | |
| 2975 | DEFUN (show_ip_route_vrf_all, |
| 2976 | show_ip_route_vrf_all_cmd, |
| 2977 | "show ip route " VRF_ALL_CMD_STR, |
| 2978 | SHOW_STR |
| 2979 | IP_STR |
| 2980 | "IP routing table\n" |
| 2981 | VRF_ALL_CMD_HELP_STR) |
| 2982 | { |
| 2983 | struct route_table *table; |
| 2984 | struct route_node *rn; |
| 2985 | struct rib *rib; |
| 2986 | struct zebra_vrf *zvrf; |
| 2987 | vrf_iter_t iter; |
| 2988 | int first = 1; |
| 2989 | |
| 2990 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2991 | { |
| 2992 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2993 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2994 | continue; |
| 2995 | |
| 2996 | /* Show all IPv4 routes. */ |
| 2997 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2998 | RNODE_FOREACH_RIB (rn, rib) |
| 2999 | { |
| 3000 | if (first) |
| 3001 | { |
| 3002 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 3003 | first = 0; |
| 3004 | } |
| 3005 | vty_show_ip_route (vty, rn, rib); |
| 3006 | } |
| 3007 | } |
| 3008 | |
| 3009 | return CMD_SUCCESS; |
| 3010 | } |
| 3011 | |
| 3012 | DEFUN (show_ip_route_prefix_longer_vrf_all, |
| 3013 | show_ip_route_prefix_longer_vrf_all_cmd, |
| 3014 | "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR, |
| 3015 | SHOW_STR |
| 3016 | IP_STR |
| 3017 | "IP routing table\n" |
| 3018 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 3019 | "Show route matching the specified Network/Mask pair only\n" |
| 3020 | VRF_ALL_CMD_HELP_STR) |
| 3021 | { |
| 3022 | struct route_table *table; |
| 3023 | struct route_node *rn; |
| 3024 | struct rib *rib; |
| 3025 | struct prefix p; |
| 3026 | struct zebra_vrf *zvrf; |
| 3027 | vrf_iter_t iter; |
| 3028 | int ret; |
| 3029 | int first = 1; |
| 3030 | |
| 3031 | ret = str2prefix (argv[0], &p); |
| 3032 | if (! ret) |
| 3033 | { |
| 3034 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 3035 | return CMD_WARNING; |
| 3036 | } |
| 3037 | |
| 3038 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3039 | { |
| 3040 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3041 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 3042 | continue; |
| 3043 | |
| 3044 | /* Show matched type IPv4 routes. */ |
| 3045 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3046 | RNODE_FOREACH_RIB (rn, rib) |
| 3047 | if (prefix_match (&p, &rn->p)) |
| 3048 | { |
| 3049 | if (first) |
| 3050 | { |
| 3051 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 3052 | first = 0; |
| 3053 | } |
| 3054 | vty_show_ip_route (vty, rn, rib); |
| 3055 | } |
| 3056 | } |
| 3057 | |
| 3058 | return CMD_SUCCESS; |
| 3059 | } |
| 3060 | |
| 3061 | DEFUN (show_ip_route_supernets_vrf_all, |
| 3062 | show_ip_route_supernets_vrf_all_cmd, |
| 3063 | "show ip route supernets-only " VRF_ALL_CMD_STR, |
| 3064 | SHOW_STR |
| 3065 | IP_STR |
| 3066 | "IP routing table\n" |
| 3067 | "Show supernet entries only\n" |
| 3068 | VRF_ALL_CMD_HELP_STR) |
| 3069 | { |
| 3070 | struct route_table *table; |
| 3071 | struct route_node *rn; |
| 3072 | struct rib *rib; |
| 3073 | struct zebra_vrf *zvrf; |
| 3074 | vrf_iter_t iter; |
| 3075 | u_int32_t addr; |
| 3076 | int first = 1; |
| 3077 | |
| 3078 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3079 | { |
| 3080 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3081 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 3082 | continue; |
| 3083 | |
| 3084 | /* Show matched type IPv4 routes. */ |
| 3085 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3086 | RNODE_FOREACH_RIB (rn, rib) |
| 3087 | { |
| 3088 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 3089 | |
| 3090 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 3091 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
| 3092 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
| 3093 | { |
| 3094 | if (first) |
| 3095 | { |
| 3096 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 3097 | first = 0; |
| 3098 | } |
| 3099 | vty_show_ip_route (vty, rn, rib); |
| 3100 | } |
| 3101 | } |
| 3102 | } |
| 3103 | |
| 3104 | return CMD_SUCCESS; |
| 3105 | } |
| 3106 | |
| 3107 | DEFUN (show_ip_route_protocol_vrf_all, |
| 3108 | show_ip_route_protocol_vrf_all_cmd, |
| 3109 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 3110 | SHOW_STR |
| 3111 | IP_STR |
| 3112 | "IP routing table\n" |
| 3113 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 3114 | VRF_ALL_CMD_HELP_STR) |
| 3115 | { |
| 3116 | int type; |
| 3117 | struct route_table *table; |
| 3118 | struct route_node *rn; |
| 3119 | struct rib *rib; |
| 3120 | struct zebra_vrf *zvrf; |
| 3121 | vrf_iter_t iter; |
| 3122 | int first = 1; |
| 3123 | |
| 3124 | type = proto_redistnum (AFI_IP, argv[0]); |
| 3125 | if (type < 0) |
| 3126 | { |
| 3127 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 3128 | return CMD_WARNING; |
| 3129 | } |
| 3130 | |
| 3131 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3132 | { |
| 3133 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3134 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 3135 | continue; |
| 3136 | |
| 3137 | /* Show matched type IPv4 routes. */ |
| 3138 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3139 | RNODE_FOREACH_RIB (rn, rib) |
| 3140 | if (rib->type == type) |
| 3141 | { |
| 3142 | if (first) |
| 3143 | { |
| 3144 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 3145 | first = 0; |
| 3146 | } |
| 3147 | vty_show_ip_route (vty, rn, rib); |
| 3148 | } |
| 3149 | } |
| 3150 | |
| 3151 | return CMD_SUCCESS; |
| 3152 | } |
| 3153 | |
| 3154 | DEFUN (show_ip_route_addr_vrf_all, |
| 3155 | show_ip_route_addr_vrf_all_cmd, |
| 3156 | "show ip route A.B.C.D " VRF_ALL_CMD_STR, |
| 3157 | SHOW_STR |
| 3158 | IP_STR |
| 3159 | "IP routing table\n" |
| 3160 | "Network in the IP routing table to display\n" |
| 3161 | VRF_ALL_CMD_HELP_STR) |
| 3162 | { |
| 3163 | int ret; |
| 3164 | struct prefix_ipv4 p; |
| 3165 | struct route_table *table; |
| 3166 | struct route_node *rn; |
| 3167 | struct zebra_vrf *zvrf; |
| 3168 | vrf_iter_t iter; |
| 3169 | |
| 3170 | ret = str2prefix_ipv4 (argv[0], &p); |
| 3171 | if (ret <= 0) |
| 3172 | { |
| 3173 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 3174 | return CMD_WARNING; |
| 3175 | } |
| 3176 | |
| 3177 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3178 | { |
| 3179 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3180 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 3181 | continue; |
| 3182 | |
| 3183 | rn = route_node_match (table, (struct prefix *) &p); |
| 3184 | if (! rn) |
| 3185 | continue; |
| 3186 | |
| 3187 | vty_show_ip_route_detail (vty, rn, 0); |
| 3188 | |
| 3189 | route_unlock_node (rn); |
| 3190 | } |
| 3191 | |
| 3192 | return CMD_SUCCESS; |
| 3193 | } |
| 3194 | |
| 3195 | DEFUN (show_ip_route_prefix_vrf_all, |
| 3196 | show_ip_route_prefix_vrf_all_cmd, |
| 3197 | "show ip route A.B.C.D/M " VRF_ALL_CMD_STR, |
| 3198 | SHOW_STR |
| 3199 | IP_STR |
| 3200 | "IP routing table\n" |
| 3201 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 3202 | VRF_ALL_CMD_HELP_STR) |
| 3203 | { |
| 3204 | int ret; |
| 3205 | struct prefix_ipv4 p; |
| 3206 | struct route_table *table; |
| 3207 | struct route_node *rn; |
| 3208 | struct zebra_vrf *zvrf; |
| 3209 | vrf_iter_t iter; |
| 3210 | |
| 3211 | ret = str2prefix_ipv4 (argv[0], &p); |
| 3212 | if (ret <= 0) |
| 3213 | { |
| 3214 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 3215 | return CMD_WARNING; |
| 3216 | } |
| 3217 | |
| 3218 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3219 | { |
| 3220 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3221 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 3222 | continue; |
| 3223 | |
| 3224 | rn = route_node_match (table, (struct prefix *) &p); |
| 3225 | if (! rn) |
| 3226 | continue; |
| 3227 | if (rn->p.prefixlen != p.prefixlen) |
| 3228 | { |
| 3229 | route_unlock_node (rn); |
| 3230 | continue; |
| 3231 | } |
| 3232 | |
| 3233 | vty_show_ip_route_detail (vty, rn, 0); |
| 3234 | |
| 3235 | route_unlock_node (rn); |
| 3236 | } |
| 3237 | |
| 3238 | return CMD_SUCCESS; |
| 3239 | } |
| 3240 | |
| 3241 | DEFUN (show_ip_route_summary_vrf_all, |
| 3242 | show_ip_route_summary_vrf_all_cmd, |
| 3243 | "show ip route summary " VRF_ALL_CMD_STR, |
| 3244 | SHOW_STR |
| 3245 | IP_STR |
| 3246 | "IP routing table\n" |
| 3247 | "Summary of all routes\n" |
| 3248 | VRF_ALL_CMD_HELP_STR) |
| 3249 | { |
| 3250 | struct zebra_vrf *zvrf; |
| 3251 | vrf_iter_t iter; |
| 3252 | |
| 3253 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3254 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3255 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 3256 | |
| 3257 | return CMD_SUCCESS; |
| 3258 | } |
| 3259 | |
| 3260 | DEFUN (show_ip_route_summary_prefix_vrf_all, |
| 3261 | show_ip_route_summary_prefix_vrf_all_cmd, |
| 3262 | "show ip route summary prefix " VRF_ALL_CMD_STR, |
| 3263 | SHOW_STR |
| 3264 | IP_STR |
| 3265 | "IP routing table\n" |
| 3266 | "Summary of all routes\n" |
| 3267 | "Prefix routes\n" |
| 3268 | VRF_ALL_CMD_HELP_STR) |
| 3269 | { |
| 3270 | struct zebra_vrf *zvrf; |
| 3271 | vrf_iter_t iter; |
| 3272 | |
| 3273 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3274 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3275 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 3276 | |
| 3277 | return CMD_SUCCESS; |
| 3278 | } |
| 3279 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3280 | /* Write IPv4 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3281 | static int |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3282 | static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3283 | { |
| 3284 | struct route_node *rn; |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3285 | struct static_route *si; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3286 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3287 | struct zebra_vrf *zvrf; |
| 3288 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3289 | int write; |
| 3290 | |
| 3291 | write = 0; |
| 3292 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3293 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3294 | { |
| 3295 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3296 | (stable = zvrf->stable[AFI_IP][safi]) == NULL) |
| 3297 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3298 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3299 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 3300 | for (si = rn->info; si; si = si->next) |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 3301 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3302 | vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4), |
| 3303 | rn->p.prefixlen); |
| 3304 | |
| 3305 | switch (si->type) |
| 3306 | { |
| 3307 | case STATIC_IPV4_GATEWAY: |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3308 | vty_out (vty, " %s", inet_ntoa (si->addr.ipv4)); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3309 | break; |
| 3310 | case STATIC_IPV4_IFNAME: |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3311 | vty_out (vty, " %s", si->ifname); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3312 | break; |
| 3313 | case STATIC_IPV4_BLACKHOLE: |
| 3314 | vty_out (vty, " Null0"); |
| 3315 | break; |
| 3316 | } |
| 3317 | |
| 3318 | /* flags are incompatible with STATIC_IPV4_BLACKHOLE */ |
| 3319 | if (si->type != STATIC_IPV4_BLACKHOLE) |
| 3320 | { |
| 3321 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 3322 | vty_out (vty, " %s", "reject"); |
| 3323 | |
| 3324 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 3325 | vty_out (vty, " %s", "blackhole"); |
| 3326 | } |
| 3327 | |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3328 | if (si->tag) |
| 3329 | vty_out (vty, " tag %d", si->tag); |
| 3330 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3331 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 3332 | vty_out (vty, " %d", si->distance); |
| 3333 | |
| 3334 | if (si->vrf_id != VRF_DEFAULT) |
| 3335 | vty_out (vty, " vrf %u", si->vrf_id); |
| 3336 | |
| 3337 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3338 | |
| 3339 | write = 1; |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 3340 | } |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3341 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3342 | return write; |
| 3343 | } |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 3344 | |
| 3345 | DEFUN (show_ip_protocol, |
| 3346 | show_ip_protocol_cmd, |
| 3347 | "show ip protocol", |
| 3348 | SHOW_STR |
| 3349 | IP_STR |
| 3350 | "IP protocol filtering status\n") |
| 3351 | { |
| 3352 | int i; |
| 3353 | |
| 3354 | vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE); |
| 3355 | vty_out(vty, "------------------------%s", VTY_NEWLINE); |
| 3356 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 3357 | { |
| 3358 | if (proto_rm[AFI_IP][i]) |
| 3359 | vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i), |
| 3360 | proto_rm[AFI_IP][i], |
| 3361 | VTY_NEWLINE); |
| 3362 | else |
| 3363 | vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE); |
| 3364 | } |
| 3365 | if (proto_rm[AFI_IP][i]) |
| 3366 | vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i], |
| 3367 | VTY_NEWLINE); |
| 3368 | else |
| 3369 | vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE); |
| 3370 | |
| 3371 | return CMD_SUCCESS; |
| 3372 | } |
| 3373 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3374 | /* General fucntion for IPv6 static route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3375 | static int |
hasso | 39db97e | 2004-10-12 20:50:58 +0000 | [diff] [blame] | 3376 | static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, |
| 3377 | const char *gate_str, const char *ifname, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3378 | const char *flag_str, const char *tag_str, |
| 3379 | const char *distance_str, const char *vrf_id_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3380 | { |
| 3381 | int ret; |
| 3382 | u_char distance; |
| 3383 | struct prefix p; |
| 3384 | struct in6_addr *gate = NULL; |
| 3385 | struct in6_addr gate_addr; |
| 3386 | u_char type = 0; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3387 | vrf_id_t vrf_id = VRF_DEFAULT; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3388 | u_char flag = 0; |
Paul Jakma | 96d1060 | 2016-07-01 14:23:45 +0100 | [diff] [blame] | 3389 | route_tag_t tag = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3390 | |
| 3391 | ret = str2prefix (dest_str, &p); |
| 3392 | if (ret <= 0) |
| 3393 | { |
| 3394 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 3395 | return CMD_WARNING; |
| 3396 | } |
| 3397 | |
| 3398 | /* Apply mask for given prefix. */ |
| 3399 | apply_mask (&p); |
| 3400 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3401 | /* Route flags */ |
| 3402 | if (flag_str) { |
| 3403 | switch(flag_str[0]) { |
| 3404 | case 'r': |
| 3405 | case 'R': /* XXX */ |
| 3406 | SET_FLAG (flag, ZEBRA_FLAG_REJECT); |
| 3407 | break; |
| 3408 | case 'b': |
| 3409 | case 'B': /* XXX */ |
| 3410 | SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE); |
| 3411 | break; |
| 3412 | default: |
| 3413 | vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 3414 | return CMD_WARNING; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3415 | } |
| 3416 | } |
| 3417 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3418 | /* Administrative distance. */ |
| 3419 | if (distance_str) |
| 3420 | distance = atoi (distance_str); |
| 3421 | else |
| 3422 | distance = ZEBRA_STATIC_DISTANCE_DEFAULT; |
| 3423 | |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3424 | /* tag */ |
| 3425 | if (tag_str) |
| 3426 | tag = atoi (tag_str); |
| 3427 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3428 | /* tag */ |
| 3429 | if (tag_str) |
| 3430 | tag = atoi(tag_str); |
| 3431 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3432 | /* When gateway is valid IPv6 addrees, then gate is treated as |
| 3433 | nexthop address other case gate is treated as interface name. */ |
| 3434 | ret = inet_pton (AF_INET6, gate_str, &gate_addr); |
| 3435 | |
| 3436 | if (ifname) |
| 3437 | { |
| 3438 | /* When ifname is specified. It must be come with gateway |
| 3439 | address. */ |
| 3440 | if (ret != 1) |
| 3441 | { |
| 3442 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 3443 | return CMD_WARNING; |
| 3444 | } |
| 3445 | type = STATIC_IPV6_GATEWAY_IFNAME; |
| 3446 | gate = &gate_addr; |
| 3447 | } |
| 3448 | else |
| 3449 | { |
| 3450 | if (ret == 1) |
| 3451 | { |
| 3452 | type = STATIC_IPV6_GATEWAY; |
| 3453 | gate = &gate_addr; |
| 3454 | } |
| 3455 | else |
| 3456 | { |
| 3457 | type = STATIC_IPV6_IFNAME; |
| 3458 | ifname = gate_str; |
| 3459 | } |
| 3460 | } |
| 3461 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3462 | /* VRF id */ |
| 3463 | if (vrf_id_str) |
| 3464 | VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str); |
| 3465 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3466 | if (add_cmd) |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3467 | static_add_ipv6 (&p, type, gate, ifname, flag, tag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3468 | else |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3469 | static_delete_ipv6 (&p, type, gate, ifname, tag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3470 | |
| 3471 | return CMD_SUCCESS; |
| 3472 | } |
| 3473 | |
| 3474 | DEFUN (ipv6_route, |
| 3475 | ipv6_route_cmd, |
| 3476 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 3477 | IP_STR |
| 3478 | "Establish static routes\n" |
| 3479 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3480 | "IPv6 gateway address\n" |
| 3481 | "IPv6 gateway interface name\n") |
| 3482 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3483 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3484 | NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3485 | } |
| 3486 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3487 | DEFUN (ipv6_route_tag, |
| 3488 | ipv6_route_tag_cmd, |
| 3489 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>", |
| 3490 | IP_STR |
| 3491 | "Establish static routes\n" |
| 3492 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3493 | "IPv6 gateway address\n" |
| 3494 | "IPv6 gateway interface name\n" |
| 3495 | "Set tag for this route\n" |
| 3496 | "Tag value\n") |
| 3497 | { |
| 3498 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); |
| 3499 | } |
| 3500 | |
| 3501 | DEFUN (ipv6_route_tag_vrf, |
| 3502 | ipv6_route_tag_vrf_cmd, |
| 3503 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR, |
| 3504 | IP_STR |
| 3505 | "Establish static routes\n" |
| 3506 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3507 | "IPv6 gateway address\n" |
| 3508 | "IPv6 gateway interface name\n" |
| 3509 | "Set tag for this route\n" |
| 3510 | "Tag value\n" |
| 3511 | VRF_CMD_HELP_STR) |
| 3512 | { |
| 3513 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); |
| 3514 | } |
| 3515 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3516 | DEFUN (ipv6_route_flags, |
| 3517 | ipv6_route_flags_cmd, |
| 3518 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 3519 | IP_STR |
| 3520 | "Establish static routes\n" |
| 3521 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3522 | "IPv6 gateway address\n" |
| 3523 | "IPv6 gateway interface name\n" |
| 3524 | "Emit an ICMP unreachable when matched\n" |
| 3525 | "Silently discard pkts when matched\n") |
| 3526 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3527 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3528 | NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3529 | } |
| 3530 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3531 | DEFUN (ipv6_route_flags_tag, |
| 3532 | ipv6_route_flags_tag_cmd, |
| 3533 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 3534 | IP_STR |
| 3535 | "Establish static routes\n" |
| 3536 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3537 | "IPv6 gateway address\n" |
| 3538 | "IPv6 gateway interface name\n" |
| 3539 | "Emit an ICMP unreachable when matched\n" |
| 3540 | "Silently discard pkts when matched\n" |
| 3541 | "Set tag for this route\n" |
| 3542 | "Tag value\n") |
| 3543 | { |
| 3544 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); |
| 3545 | } |
| 3546 | |
| 3547 | DEFUN (ipv6_route_flags_tag_vrf, |
| 3548 | ipv6_route_flags_tag_vrf_cmd, |
| 3549 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 3550 | IP_STR |
| 3551 | "Establish static routes\n" |
| 3552 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3553 | "IPv6 gateway address\n" |
| 3554 | "IPv6 gateway interface name\n" |
| 3555 | "Emit an ICMP unreachable when matched\n" |
| 3556 | "Silently discard pkts when matched\n" |
| 3557 | "Set tag for this route\n" |
| 3558 | "Tag value\n" |
| 3559 | VRF_CMD_HELP_STR) |
| 3560 | { |
| 3561 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); |
| 3562 | } |
| 3563 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3564 | DEFUN (ipv6_route_ifname, |
| 3565 | ipv6_route_ifname_cmd, |
| 3566 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 3567 | IP_STR |
| 3568 | "Establish static routes\n" |
| 3569 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3570 | "IPv6 gateway address\n" |
| 3571 | "IPv6 gateway interface name\n") |
| 3572 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3573 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3574 | NULL, NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3575 | } |
| 3576 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3577 | DEFUN (ipv6_route_ifname_tag, |
| 3578 | ipv6_route_ifname_tag_cmd, |
| 3579 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>", |
| 3580 | IP_STR |
| 3581 | "Establish static routes\n" |
| 3582 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3583 | "IPv6 gateway address\n" |
| 3584 | "IPv6 gateway interface name\n" |
| 3585 | "Set tag for this route\n" |
| 3586 | "Tag value\n") |
| 3587 | { |
| 3588 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); |
| 3589 | } |
| 3590 | |
| 3591 | DEFUN (ipv6_route_ifname_tag_vrf, |
| 3592 | ipv6_route_ifname_tag_vrf_cmd, |
| 3593 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR, |
| 3594 | IP_STR |
| 3595 | "Establish static routes\n" |
| 3596 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3597 | "IPv6 gateway address\n" |
| 3598 | "IPv6 gateway interface name\n" |
| 3599 | "Set tag for this route\n" |
| 3600 | "Tag value\n" |
| 3601 | VRF_CMD_HELP_STR) |
| 3602 | { |
| 3603 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); |
| 3604 | } |
| 3605 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3606 | DEFUN (ipv6_route_ifname_flags, |
| 3607 | ipv6_route_ifname_flags_cmd, |
| 3608 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 3609 | IP_STR |
| 3610 | "Establish static routes\n" |
| 3611 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3612 | "IPv6 gateway address\n" |
| 3613 | "IPv6 gateway interface name\n" |
| 3614 | "Emit an ICMP unreachable when matched\n" |
| 3615 | "Silently discard pkts when matched\n") |
| 3616 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3617 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3618 | NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3619 | } |
| 3620 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3621 | DEFUN (ipv6_route_ifname_flags_tag, |
| 3622 | ipv6_route_ifname_flags_tag_cmd, |
| 3623 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>", |
| 3624 | IP_STR |
| 3625 | "Establish static routes\n" |
| 3626 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3627 | "IPv6 gateway address\n" |
| 3628 | "IPv6 gateway interface name\n" |
| 3629 | "Emit an ICMP unreachable when matched\n" |
| 3630 | "Silently discard pkts when matched\n" |
| 3631 | "Set tag for this route\n" |
| 3632 | "Tag value\n") |
| 3633 | { |
| 3634 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); |
| 3635 | } |
| 3636 | |
| 3637 | DEFUN (ipv6_route_ifname_flags_tag_vrf, |
| 3638 | ipv6_route_ifname_flags_tag_vrf_cmd, |
| 3639 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>" VRF_CMD_STR, |
| 3640 | IP_STR |
| 3641 | "Establish static routes\n" |
| 3642 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3643 | "IPv6 gateway address\n" |
| 3644 | "IPv6 gateway interface name\n" |
| 3645 | "Emit an ICMP unreachable when matched\n" |
| 3646 | "Silently discard pkts when matched\n" |
| 3647 | "Set tag for this route\n" |
| 3648 | "Tag value\n" |
| 3649 | VRF_CMD_HELP_STR) |
| 3650 | { |
| 3651 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); |
| 3652 | } |
| 3653 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3654 | DEFUN (ipv6_route_pref, |
| 3655 | ipv6_route_pref_cmd, |
| 3656 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 3657 | IP_STR |
| 3658 | "Establish static routes\n" |
| 3659 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3660 | "IPv6 gateway address\n" |
| 3661 | "IPv6 gateway interface name\n" |
| 3662 | "Distance value for this prefix\n") |
| 3663 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3664 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3665 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3666 | } |
| 3667 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3668 | DEFUN (ipv6_route_pref_tag, |
| 3669 | ipv6_route_pref_tag_cmd, |
| 3670 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>", |
| 3671 | IP_STR |
| 3672 | "Establish static routes\n" |
| 3673 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3674 | "IPv6 gateway address\n" |
| 3675 | "IPv6 gateway interface name\n" |
| 3676 | "Set tag for this route\n" |
| 3677 | "Tag value\n" |
| 3678 | "Distance value for this prefix\n") |
| 3679 | { |
| 3680 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); |
| 3681 | } |
| 3682 | |
| 3683 | DEFUN (ipv6_route_pref_tag_vrf, |
| 3684 | ipv6_route_pref_tag_vrf_cmd, |
| 3685 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 3686 | IP_STR |
| 3687 | "Establish static routes\n" |
| 3688 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3689 | "IPv6 gateway address\n" |
| 3690 | "IPv6 gateway interface name\n" |
| 3691 | "Set tag for this route\n" |
| 3692 | "Tag value\n" |
| 3693 | "Distance value for this prefix\n" |
| 3694 | VRF_CMD_HELP_STR) |
| 3695 | { |
| 3696 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); |
| 3697 | } |
| 3698 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3699 | DEFUN (ipv6_route_flags_pref, |
| 3700 | ipv6_route_flags_pref_cmd, |
| 3701 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 3702 | IP_STR |
| 3703 | "Establish static routes\n" |
| 3704 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3705 | "IPv6 gateway address\n" |
| 3706 | "IPv6 gateway interface name\n" |
| 3707 | "Emit an ICMP unreachable when matched\n" |
| 3708 | "Silently discard pkts when matched\n" |
| 3709 | "Distance value for this prefix\n") |
| 3710 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3711 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3712 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3713 | } |
| 3714 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3715 | DEFUN (ipv6_route_flags_pref_tag, |
| 3716 | ipv6_route_flags_pref_tag_cmd, |
| 3717 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 3718 | IP_STR |
| 3719 | "Establish static routes\n" |
| 3720 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3721 | "IPv6 gateway address\n" |
| 3722 | "IPv6 gateway interface name\n" |
| 3723 | "Emit an ICMP unreachable when matched\n" |
| 3724 | "Silently discard pkts when matched\n" |
| 3725 | "Set tag for this route\n" |
| 3726 | "Tag value\n" |
| 3727 | "Distance value for this prefix\n") |
| 3728 | { |
| 3729 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); |
| 3730 | } |
| 3731 | |
| 3732 | DEFUN (ipv6_route_flags_pref_tag_vrf, |
| 3733 | ipv6_route_flags_pref_tag_vrf_cmd, |
| 3734 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 3735 | IP_STR |
| 3736 | "Establish static routes\n" |
| 3737 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3738 | "IPv6 gateway address\n" |
| 3739 | "IPv6 gateway interface name\n" |
| 3740 | "Emit an ICMP unreachable when matched\n" |
| 3741 | "Silently discard pkts when matched\n" |
| 3742 | "Set tag for this route\n" |
| 3743 | "Tag value\n" |
| 3744 | "Distance value for this prefix\n" |
| 3745 | VRF_CMD_HELP_STR) |
| 3746 | { |
| 3747 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); |
| 3748 | } |
| 3749 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3750 | DEFUN (ipv6_route_ifname_pref, |
| 3751 | ipv6_route_ifname_pref_cmd, |
| 3752 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 3753 | IP_STR |
| 3754 | "Establish static routes\n" |
| 3755 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3756 | "IPv6 gateway address\n" |
| 3757 | "IPv6 gateway interface name\n" |
| 3758 | "Distance value for this prefix\n") |
| 3759 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3760 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3761 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3762 | } |
| 3763 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3764 | DEFUN (ipv6_route_ifname_pref_tag, |
| 3765 | ipv6_route_ifname_pref_tag_cmd, |
| 3766 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>", |
| 3767 | IP_STR |
| 3768 | "Establish static routes\n" |
| 3769 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3770 | "IPv6 gateway address\n" |
| 3771 | "IPv6 gateway interface name\n" |
| 3772 | "Set tag for this route\n" |
| 3773 | "Tag value\n" |
| 3774 | "Distance value for this prefix\n") |
| 3775 | { |
| 3776 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); |
| 3777 | } |
| 3778 | |
| 3779 | DEFUN (ipv6_route_ifname_pref_tag_vrf, |
| 3780 | ipv6_route_ifname_pref_tag_vrf_cmd, |
| 3781 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR, |
| 3782 | IP_STR |
| 3783 | "Establish static routes\n" |
| 3784 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3785 | "IPv6 gateway address\n" |
| 3786 | "IPv6 gateway interface name\n" |
| 3787 | "Set tag for this route\n" |
| 3788 | "Tag value\n" |
| 3789 | "Distance value for this prefix\n" |
| 3790 | VRF_CMD_HELP_STR) |
| 3791 | { |
| 3792 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); |
| 3793 | } |
| 3794 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3795 | DEFUN (ipv6_route_ifname_flags_pref, |
| 3796 | ipv6_route_ifname_flags_pref_cmd, |
| 3797 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 3798 | IP_STR |
| 3799 | "Establish static routes\n" |
| 3800 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3801 | "IPv6 gateway address\n" |
| 3802 | "IPv6 gateway interface name\n" |
| 3803 | "Emit an ICMP unreachable when matched\n" |
| 3804 | "Silently discard pkts when matched\n" |
| 3805 | "Distance value for this prefix\n") |
| 3806 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3807 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3808 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3809 | } |
| 3810 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3811 | DEFUN (ipv6_route_ifname_flags_pref_tag, |
| 3812 | ipv6_route_ifname_flags_pref_tag_cmd, |
| 3813 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>", |
| 3814 | IP_STR |
| 3815 | "Establish static routes\n" |
| 3816 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3817 | "IPv6 gateway address\n" |
| 3818 | "IPv6 gateway interface name\n" |
| 3819 | "Emit an ICMP unreachable when matched\n" |
| 3820 | "Silently discard pkts when matched\n" |
| 3821 | "Set tag for this route\n" |
| 3822 | "Tag value\n" |
| 3823 | "Distance value for this prefix\n") |
| 3824 | { |
| 3825 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); |
| 3826 | } |
| 3827 | |
| 3828 | DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, |
| 3829 | ipv6_route_ifname_flags_pref_tag_vrf_cmd, |
| 3830 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 3831 | IP_STR |
| 3832 | "Establish static routes\n" |
| 3833 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3834 | "IPv6 gateway address\n" |
| 3835 | "IPv6 gateway interface name\n" |
| 3836 | "Emit an ICMP unreachable when matched\n" |
| 3837 | "Silently discard pkts when matched\n" |
| 3838 | "Set tag for this route\n" |
| 3839 | "Tag value\n" |
| 3840 | "Distance value for this prefix\n" |
| 3841 | VRF_CMD_HELP_STR) |
| 3842 | { |
| 3843 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); |
| 3844 | } |
| 3845 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3846 | DEFUN (no_ipv6_route, |
| 3847 | no_ipv6_route_cmd, |
| 3848 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 3849 | NO_STR |
| 3850 | IP_STR |
| 3851 | "Establish static routes\n" |
| 3852 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3853 | "IPv6 gateway address\n" |
| 3854 | "IPv6 gateway interface name\n") |
| 3855 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3856 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3857 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3858 | } |
| 3859 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3860 | DEFUN (no_ipv6_route_tag, |
| 3861 | no_ipv6_route_tag_cmd, |
| 3862 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>", |
| 3863 | NO_STR |
| 3864 | IP_STR |
| 3865 | "Establish static routes\n" |
| 3866 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3867 | "IPv6 gateway address\n" |
| 3868 | "IPv6 gateway interface name\n" |
| 3869 | "Set tag for this route\n" |
| 3870 | "Tag value\n") |
| 3871 | { |
| 3872 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); |
| 3873 | } |
| 3874 | |
| 3875 | DEFUN (no_ipv6_route_tag_vrf, |
| 3876 | no_ipv6_route_tag_vrf_cmd, |
| 3877 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR, |
| 3878 | NO_STR |
| 3879 | IP_STR |
| 3880 | "Establish static routes\n" |
| 3881 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3882 | "IPv6 gateway address\n" |
| 3883 | "IPv6 gateway interface name\n" |
| 3884 | "Set tag for this route\n" |
| 3885 | "Tag value\n" |
| 3886 | VRF_CMD_HELP_STR) |
| 3887 | { |
| 3888 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); |
| 3889 | } |
| 3890 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3891 | ALIAS (no_ipv6_route, |
| 3892 | no_ipv6_route_flags_cmd, |
| 3893 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 3894 | NO_STR |
| 3895 | IP_STR |
| 3896 | "Establish static routes\n" |
| 3897 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3898 | "IPv6 gateway address\n" |
| 3899 | "IPv6 gateway interface name\n" |
| 3900 | "Emit an ICMP unreachable when matched\n" |
| 3901 | "Silently discard pkts when matched\n") |
| 3902 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3903 | ALIAS (no_ipv6_route_tag, |
| 3904 | no_ipv6_route_flags_tag_cmd, |
| 3905 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>", |
| 3906 | NO_STR |
| 3907 | IP_STR |
| 3908 | "Establish static routes\n" |
| 3909 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3910 | "IPv6 gateway address\n" |
| 3911 | "IPv6 gateway interface name\n" |
| 3912 | "Emit an ICMP unreachable when matched\n" |
| 3913 | "Silently discard pkts when matched\n" |
| 3914 | "Set tag for this route\n" |
| 3915 | "Tag value\n") |
| 3916 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3917 | DEFUN (no_ipv6_route_ifname, |
| 3918 | no_ipv6_route_ifname_cmd, |
| 3919 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 3920 | NO_STR |
| 3921 | IP_STR |
| 3922 | "Establish static routes\n" |
| 3923 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3924 | "IPv6 gateway address\n" |
| 3925 | "IPv6 gateway interface name\n") |
| 3926 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3927 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3928 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3929 | } |
| 3930 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3931 | DEFUN (no_ipv6_route_ifname_tag, |
| 3932 | no_ipv6_route_ifname_tag_cmd, |
| 3933 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>", |
| 3934 | NO_STR |
| 3935 | IP_STR |
| 3936 | "Establish static routes\n" |
| 3937 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3938 | "IPv6 gateway address\n" |
| 3939 | "IPv6 gateway interface name\n" |
| 3940 | "Set tag for this route\n" |
| 3941 | "Tag value\n") |
| 3942 | { |
| 3943 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); |
| 3944 | } |
| 3945 | |
| 3946 | DEFUN (no_ipv6_route_ifname_tag_vrf, |
| 3947 | no_ipv6_route_ifname_tag_vrf_cmd, |
| 3948 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR, |
| 3949 | NO_STR |
| 3950 | IP_STR |
| 3951 | "Establish static routes\n" |
| 3952 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3953 | "IPv6 gateway address\n" |
| 3954 | "IPv6 gateway interface name\n" |
| 3955 | "Set tag for this route\n" |
| 3956 | "Tag value\n" |
| 3957 | VRF_CMD_HELP_STR) |
| 3958 | { |
| 3959 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); |
| 3960 | } |
| 3961 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3962 | ALIAS (no_ipv6_route_ifname, |
| 3963 | no_ipv6_route_ifname_flags_cmd, |
| 3964 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 3965 | NO_STR |
| 3966 | IP_STR |
| 3967 | "Establish static routes\n" |
| 3968 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3969 | "IPv6 gateway address\n" |
| 3970 | "IPv6 gateway interface name\n" |
| 3971 | "Emit an ICMP unreachable when matched\n" |
| 3972 | "Silently discard pkts when matched\n") |
| 3973 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 3974 | ALIAS (no_ipv6_route_ifname_tag, |
| 3975 | no_ipv6_route_ifname_flags_tag_cmd, |
| 3976 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>", |
| 3977 | NO_STR |
| 3978 | IP_STR |
| 3979 | "Establish static routes\n" |
| 3980 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3981 | "IPv6 gateway address\n" |
| 3982 | "IPv6 gateway interface name\n" |
| 3983 | "Emit an ICMP unreachable when matched\n" |
| 3984 | "Silently discard pkts when matched\n" |
| 3985 | "Set tag for this route\n" |
| 3986 | "Tag value\n") |
| 3987 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | DEFUN (no_ipv6_route_pref, |
| 3989 | no_ipv6_route_pref_cmd, |
| 3990 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 3991 | NO_STR |
| 3992 | IP_STR |
| 3993 | "Establish static routes\n" |
| 3994 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3995 | "IPv6 gateway address\n" |
| 3996 | "IPv6 gateway interface name\n" |
| 3997 | "Distance value for this prefix\n") |
| 3998 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 3999 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4000 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 4001 | } |
| 4002 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4003 | DEFUN (no_ipv6_route_pref_tag, |
| 4004 | no_ipv6_route_pref_tag_cmd, |
| 4005 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>", |
| 4006 | NO_STR |
| 4007 | IP_STR |
| 4008 | "Establish static routes\n" |
| 4009 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4010 | "IPv6 gateway address\n" |
| 4011 | "IPv6 gateway interface name\n" |
| 4012 | "Set tag for this route\n" |
| 4013 | "Tag value\n" |
| 4014 | "Distance value for this prefix\n") |
| 4015 | { |
| 4016 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); |
| 4017 | } |
| 4018 | |
| 4019 | DEFUN (no_ipv6_route_pref_tag_vrf, |
| 4020 | no_ipv6_route_pref_tag_vrf_cmd, |
| 4021 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 4022 | NO_STR |
| 4023 | IP_STR |
| 4024 | "Establish static routes\n" |
| 4025 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4026 | "IPv6 gateway address\n" |
| 4027 | "IPv6 gateway interface name\n" |
| 4028 | "Set tag for this route\n" |
| 4029 | "Tag value\n" |
| 4030 | "Distance value for this prefix\n" |
| 4031 | VRF_CMD_HELP_STR) |
| 4032 | { |
| 4033 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); |
| 4034 | } |
| 4035 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 4036 | DEFUN (no_ipv6_route_flags_pref, |
| 4037 | no_ipv6_route_flags_pref_cmd, |
| 4038 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 4039 | NO_STR |
| 4040 | IP_STR |
| 4041 | "Establish static routes\n" |
| 4042 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4043 | "IPv6 gateway address\n" |
| 4044 | "IPv6 gateway interface name\n" |
| 4045 | "Emit an ICMP unreachable when matched\n" |
| 4046 | "Silently discard pkts when matched\n" |
| 4047 | "Distance value for this prefix\n") |
| 4048 | { |
| 4049 | /* We do not care about argv[2] */ |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4050 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4051 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4052 | } |
| 4053 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4054 | DEFUN (no_ipv6_route_flags_pref_tag, |
| 4055 | no_ipv6_route_flags_pref_tag_cmd, |
| 4056 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", |
| 4057 | NO_STR |
| 4058 | IP_STR |
| 4059 | "Establish static routes\n" |
| 4060 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4061 | "IPv6 gateway address\n" |
| 4062 | "IPv6 gateway interface name\n" |
| 4063 | "Emit an ICMP unreachable when matched\n" |
| 4064 | "Silently discard pkts when matched\n" |
| 4065 | "Set tag for this route\n" |
| 4066 | "Tag value\n" |
| 4067 | "Distance value for this prefix\n") |
| 4068 | { |
| 4069 | /* We do not care about argv[2] */ |
| 4070 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); |
| 4071 | } |
| 4072 | |
| 4073 | DEFUN (no_ipv6_route_flags_pref_tag_vrf, |
| 4074 | no_ipv6_route_flags_pref_tag_vrf_cmd, |
| 4075 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 4076 | NO_STR |
| 4077 | IP_STR |
| 4078 | "Establish static routes\n" |
| 4079 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4080 | "IPv6 gateway address\n" |
| 4081 | "IPv6 gateway interface name\n" |
| 4082 | "Emit an ICMP unreachable when matched\n" |
| 4083 | "Silently discard pkts when matched\n" |
| 4084 | "Set tag for this route\n" |
| 4085 | "Tag value\n" |
| 4086 | "Distance value for this prefix\n" |
| 4087 | VRF_CMD_HELP_STR) |
| 4088 | { |
| 4089 | /* We do not care about argv[2] */ |
| 4090 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); |
| 4091 | } |
| 4092 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4093 | DEFUN (no_ipv6_route_ifname_pref, |
| 4094 | no_ipv6_route_ifname_pref_cmd, |
| 4095 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 4096 | NO_STR |
| 4097 | IP_STR |
| 4098 | "Establish static routes\n" |
| 4099 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4100 | "IPv6 gateway address\n" |
| 4101 | "IPv6 gateway interface name\n" |
| 4102 | "Distance value for this prefix\n") |
| 4103 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4104 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4105 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 4106 | } |
| 4107 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4108 | DEFUN (no_ipv6_route_ifname_pref_tag, |
| 4109 | no_ipv6_route_ifname_pref_tag_cmd, |
| 4110 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>", |
| 4111 | NO_STR |
| 4112 | IP_STR |
| 4113 | "Establish static routes\n" |
| 4114 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4115 | "IPv6 gateway address\n" |
| 4116 | "IPv6 gateway interface name\n" |
| 4117 | "Set tag for this route\n" |
| 4118 | "Tag value\n" |
| 4119 | "Distance value for this prefix\n") |
| 4120 | { |
| 4121 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); |
| 4122 | } |
| 4123 | |
| 4124 | DEFUN (no_ipv6_route_ifname_pref_tag_vrf, |
| 4125 | no_ipv6_route_ifname_pref_tag_vrf_cmd, |
| 4126 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR, |
| 4127 | NO_STR |
| 4128 | IP_STR |
| 4129 | "Establish static routes\n" |
| 4130 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4131 | "IPv6 gateway address\n" |
| 4132 | "IPv6 gateway interface name\n" |
| 4133 | "Set tag for this route\n" |
| 4134 | "Tag value\n" |
| 4135 | "Distance value for this prefix\n" |
| 4136 | VRF_CMD_HELP_STR) |
| 4137 | { |
| 4138 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); |
| 4139 | } |
| 4140 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 4141 | DEFUN (no_ipv6_route_ifname_flags_pref, |
| 4142 | no_ipv6_route_ifname_flags_pref_cmd, |
| 4143 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 4144 | NO_STR |
| 4145 | IP_STR |
| 4146 | "Establish static routes\n" |
| 4147 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4148 | "IPv6 gateway address\n" |
| 4149 | "IPv6 gateway interface name\n" |
| 4150 | "Emit an ICMP unreachable when matched\n" |
| 4151 | "Silently discard pkts when matched\n" |
| 4152 | "Distance value for this prefix\n") |
| 4153 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4154 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4155 | NULL); |
| 4156 | } |
| 4157 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4158 | DEFUN (no_ipv6_route_ifname_flags_pref_tag, |
| 4159 | no_ipv6_route_ifname_flags_pref_tag_cmd, |
| 4160 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>", |
| 4161 | NO_STR |
| 4162 | IP_STR |
| 4163 | "Establish static routes\n" |
| 4164 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4165 | "IPv6 gateway address\n" |
| 4166 | "IPv6 gateway interface name\n" |
| 4167 | "Emit an ICMP unreachable when matched\n" |
| 4168 | "Silently discard pkts when matched\n" |
| 4169 | "Set tag for this route\n" |
| 4170 | "Tag value\n" |
| 4171 | "Distance value for this prefix\n") |
| 4172 | { |
| 4173 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); |
| 4174 | } |
| 4175 | |
| 4176 | DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, |
| 4177 | no_ipv6_route_ifname_flags_pref_tag_vrf_cmd, |
| 4178 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR, |
| 4179 | NO_STR |
| 4180 | IP_STR |
| 4181 | "Establish static routes\n" |
| 4182 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4183 | "IPv6 gateway address\n" |
| 4184 | "IPv6 gateway interface name\n" |
| 4185 | "Emit an ICMP unreachable when matched\n" |
| 4186 | "Silently discard pkts when matched\n" |
| 4187 | "Set tag for this route\n" |
| 4188 | "Tag value\n" |
| 4189 | "Distance value for this prefix\n" |
| 4190 | VRF_CMD_HELP_STR) |
| 4191 | { |
| 4192 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); |
| 4193 | } |
| 4194 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4195 | DEFUN (ipv6_route_vrf, |
| 4196 | ipv6_route_vrf_cmd, |
| 4197 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 4198 | IP_STR |
| 4199 | "Establish static routes\n" |
| 4200 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4201 | "IPv6 gateway address\n" |
| 4202 | "IPv6 gateway interface name\n" |
| 4203 | VRF_CMD_HELP_STR) |
| 4204 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4205 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4206 | argv[2]); |
| 4207 | } |
| 4208 | |
| 4209 | DEFUN (ipv6_route_flags_vrf, |
| 4210 | ipv6_route_flags_vrf_cmd, |
| 4211 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 4212 | IP_STR |
| 4213 | "Establish static routes\n" |
| 4214 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4215 | "IPv6 gateway address\n" |
| 4216 | "IPv6 gateway interface name\n" |
| 4217 | "Emit an ICMP unreachable when matched\n" |
| 4218 | "Silently discard pkts when matched\n" |
| 4219 | VRF_CMD_HELP_STR) |
| 4220 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4221 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4222 | argv[3]); |
| 4223 | } |
| 4224 | |
| 4225 | DEFUN (ipv6_route_ifname_vrf, |
| 4226 | ipv6_route_ifname_vrf_cmd, |
| 4227 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 4228 | IP_STR |
| 4229 | "Establish static routes\n" |
| 4230 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4231 | "IPv6 gateway address\n" |
| 4232 | "IPv6 gateway interface name\n" |
| 4233 | VRF_CMD_HELP_STR) |
| 4234 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4235 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4236 | argv[3]); |
| 4237 | } |
| 4238 | |
| 4239 | DEFUN (ipv6_route_ifname_flags_vrf, |
| 4240 | ipv6_route_ifname_flags_vrf_cmd, |
| 4241 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 4242 | IP_STR |
| 4243 | "Establish static routes\n" |
| 4244 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4245 | "IPv6 gateway address\n" |
| 4246 | "IPv6 gateway interface name\n" |
| 4247 | "Emit an ICMP unreachable when matched\n" |
| 4248 | "Silently discard pkts when matched\n" |
| 4249 | VRF_CMD_HELP_STR) |
| 4250 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4251 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4252 | argv[4]); |
| 4253 | } |
| 4254 | |
| 4255 | DEFUN (ipv6_route_pref_vrf, |
| 4256 | ipv6_route_pref_vrf_cmd, |
| 4257 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 4258 | IP_STR |
| 4259 | "Establish static routes\n" |
| 4260 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4261 | "IPv6 gateway address\n" |
| 4262 | "IPv6 gateway interface name\n" |
| 4263 | "Distance value for this prefix\n" |
| 4264 | VRF_CMD_HELP_STR) |
| 4265 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4266 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4267 | argv[3]); |
| 4268 | } |
| 4269 | |
| 4270 | DEFUN (ipv6_route_flags_pref_vrf, |
| 4271 | ipv6_route_flags_pref_vrf_cmd, |
| 4272 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 4273 | IP_STR |
| 4274 | "Establish static routes\n" |
| 4275 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4276 | "IPv6 gateway address\n" |
| 4277 | "IPv6 gateway interface name\n" |
| 4278 | "Emit an ICMP unreachable when matched\n" |
| 4279 | "Silently discard pkts when matched\n" |
| 4280 | "Distance value for this prefix\n" |
| 4281 | VRF_CMD_HELP_STR) |
| 4282 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4283 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4284 | argv[4]); |
| 4285 | } |
| 4286 | |
| 4287 | DEFUN (ipv6_route_ifname_pref_vrf, |
| 4288 | ipv6_route_ifname_pref_vrf_cmd, |
| 4289 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 4290 | IP_STR |
| 4291 | "Establish static routes\n" |
| 4292 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4293 | "IPv6 gateway address\n" |
| 4294 | "IPv6 gateway interface name\n" |
| 4295 | "Distance value for this prefix\n" |
| 4296 | VRF_CMD_HELP_STR) |
| 4297 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4298 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4299 | argv[4]); |
| 4300 | } |
| 4301 | |
| 4302 | DEFUN (ipv6_route_ifname_flags_pref_vrf, |
| 4303 | ipv6_route_ifname_flags_pref_vrf_cmd, |
| 4304 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 4305 | IP_STR |
| 4306 | "Establish static routes\n" |
| 4307 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4308 | "IPv6 gateway address\n" |
| 4309 | "IPv6 gateway interface name\n" |
| 4310 | "Emit an ICMP unreachable when matched\n" |
| 4311 | "Silently discard pkts when matched\n" |
| 4312 | "Distance value for this prefix\n" |
| 4313 | VRF_CMD_HELP_STR) |
| 4314 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4315 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4316 | argv[5]); |
| 4317 | } |
| 4318 | |
| 4319 | DEFUN (no_ipv6_route_vrf, |
| 4320 | no_ipv6_route_vrf_cmd, |
| 4321 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 4322 | NO_STR |
| 4323 | IP_STR |
| 4324 | "Establish static routes\n" |
| 4325 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4326 | "IPv6 gateway address\n" |
| 4327 | "IPv6 gateway interface name\n" |
| 4328 | VRF_CMD_HELP_STR) |
| 4329 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4330 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4331 | (argc > 3) ? argv[3] : argv[2]); |
| 4332 | } |
| 4333 | |
| 4334 | ALIAS (no_ipv6_route_vrf, |
| 4335 | no_ipv6_route_flags_vrf_cmd, |
| 4336 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 4337 | NO_STR |
| 4338 | IP_STR |
| 4339 | "Establish static routes\n" |
| 4340 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4341 | "IPv6 gateway address\n" |
| 4342 | "IPv6 gateway interface name\n" |
| 4343 | "Emit an ICMP unreachable when matched\n" |
| 4344 | "Silently discard pkts when matched\n" |
| 4345 | VRF_CMD_HELP_STR) |
| 4346 | |
| 4347 | DEFUN (no_ipv6_route_ifname_vrf, |
| 4348 | no_ipv6_route_ifname_vrf_cmd, |
| 4349 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 4350 | NO_STR |
| 4351 | IP_STR |
| 4352 | "Establish static routes\n" |
| 4353 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4354 | "IPv6 gateway address\n" |
| 4355 | "IPv6 gateway interface name\n" |
| 4356 | VRF_CMD_HELP_STR) |
| 4357 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4358 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4359 | (argc > 4) ? argv[4] : argv[3]); |
| 4360 | } |
| 4361 | |
| 4362 | ALIAS (no_ipv6_route_ifname_vrf, |
| 4363 | no_ipv6_route_ifname_flags_vrf_cmd, |
| 4364 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 4365 | NO_STR |
| 4366 | IP_STR |
| 4367 | "Establish static routes\n" |
| 4368 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4369 | "IPv6 gateway address\n" |
| 4370 | "IPv6 gateway interface name\n" |
| 4371 | "Emit an ICMP unreachable when matched\n" |
| 4372 | "Silently discard pkts when matched\n" |
| 4373 | VRF_CMD_HELP_STR) |
| 4374 | |
| 4375 | DEFUN (no_ipv6_route_pref_vrf, |
| 4376 | no_ipv6_route_pref_vrf_cmd, |
| 4377 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 4378 | NO_STR |
| 4379 | IP_STR |
| 4380 | "Establish static routes\n" |
| 4381 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4382 | "IPv6 gateway address\n" |
| 4383 | "IPv6 gateway interface name\n" |
| 4384 | "Distance value for this prefix\n" |
| 4385 | VRF_CMD_HELP_STR) |
| 4386 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4387 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4388 | argv[3]); |
| 4389 | } |
| 4390 | |
| 4391 | DEFUN (no_ipv6_route_flags_pref_vrf, |
| 4392 | no_ipv6_route_flags_pref_vrf_cmd, |
| 4393 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 4394 | NO_STR |
| 4395 | IP_STR |
| 4396 | "Establish static routes\n" |
| 4397 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4398 | "IPv6 gateway address\n" |
| 4399 | "IPv6 gateway interface name\n" |
| 4400 | "Emit an ICMP unreachable when matched\n" |
| 4401 | "Silently discard pkts when matched\n" |
| 4402 | "Distance value for this prefix\n" |
| 4403 | VRF_CMD_HELP_STR) |
| 4404 | { |
| 4405 | /* We do not care about argv[2] */ |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4406 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4407 | argv[4]); |
| 4408 | } |
| 4409 | |
| 4410 | DEFUN (no_ipv6_route_ifname_pref_vrf, |
| 4411 | no_ipv6_route_ifname_pref_vrf_cmd, |
| 4412 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 4413 | NO_STR |
| 4414 | IP_STR |
| 4415 | "Establish static routes\n" |
| 4416 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4417 | "IPv6 gateway address\n" |
| 4418 | "IPv6 gateway interface name\n" |
| 4419 | "Distance value for this prefix\n" |
| 4420 | VRF_CMD_HELP_STR) |
| 4421 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4422 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4423 | argv[4]); |
| 4424 | } |
| 4425 | |
| 4426 | DEFUN (no_ipv6_route_ifname_flags_pref_vrf, |
| 4427 | no_ipv6_route_ifname_flags_pref_vrf_cmd, |
| 4428 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 4429 | NO_STR |
| 4430 | IP_STR |
| 4431 | "Establish static routes\n" |
| 4432 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 4433 | "IPv6 gateway address\n" |
| 4434 | "IPv6 gateway interface name\n" |
| 4435 | "Emit an ICMP unreachable when matched\n" |
| 4436 | "Silently discard pkts when matched\n" |
| 4437 | "Distance value for this prefix\n" |
| 4438 | VRF_CMD_HELP_STR) |
| 4439 | { |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 4440 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4441 | argv[5]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4442 | } |
| 4443 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4444 | DEFUN (show_ipv6_route, |
| 4445 | show_ipv6_route_cmd, |
| 4446 | "show ipv6 route", |
| 4447 | SHOW_STR |
| 4448 | IP_STR |
| 4449 | "IPv6 routing table\n") |
| 4450 | { |
| 4451 | struct route_table *table; |
| 4452 | struct route_node *rn; |
| 4453 | struct rib *rib; |
| 4454 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4455 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4456 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4457 | if (argc > 0) |
| 4458 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 4459 | |
| 4460 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4461 | if (! table) |
| 4462 | return CMD_SUCCESS; |
| 4463 | |
| 4464 | /* Show all IPv6 route. */ |
| 4465 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 4466 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4467 | { |
| 4468 | if (first) |
| 4469 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4470 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4471 | first = 0; |
| 4472 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4473 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4474 | } |
| 4475 | return CMD_SUCCESS; |
| 4476 | } |
| 4477 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4478 | ALIAS (show_ipv6_route, |
| 4479 | show_ipv6_route_vrf_cmd, |
| 4480 | "show ipv6 route " VRF_CMD_STR, |
| 4481 | SHOW_STR |
| 4482 | IP_STR |
| 4483 | "IPv6 routing table\n" |
| 4484 | VRF_CMD_HELP_STR) |
| 4485 | |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4486 | DEFUN (show_ipv6_route_tag, |
| 4487 | show_ipv6_route_tag_cmd, |
| 4488 | "show ipv6 route tag <1-65535>", |
| 4489 | SHOW_STR |
| 4490 | IP_STR |
| 4491 | "IPv6 routing table\n" |
| 4492 | "Show only routes with tag\n" |
| 4493 | "Tag value\n") |
| 4494 | { |
| 4495 | struct route_table *table; |
| 4496 | struct route_node *rn; |
| 4497 | struct rib *rib; |
| 4498 | int first = 1; |
Paul Jakma | 96d1060 | 2016-07-01 14:23:45 +0100 | [diff] [blame] | 4499 | route_tag_t tag = 0; |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 4500 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 4501 | |
| 4502 | if (argv[0]) |
| 4503 | tag = atoi(argv[0]); |
| 4504 | |
| 4505 | if (argc == 2) |
| 4506 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 4507 | |
| 4508 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
| 4509 | if (! table) |
| 4510 | return CMD_SUCCESS; |
| 4511 | |
| 4512 | /* Show all IPv6 routes with matching tag value. */ |
| 4513 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 4514 | RNODE_FOREACH_RIB (rn, rib) |
| 4515 | { |
| 4516 | if (rib->tag != tag) |
| 4517 | continue; |
| 4518 | |
| 4519 | if (first) |
| 4520 | { |
| 4521 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 4522 | first = 0; |
| 4523 | } |
| 4524 | vty_show_ip_route (vty, rn, rib); |
| 4525 | } |
| 4526 | return CMD_SUCCESS; |
| 4527 | } |
| 4528 | |
| 4529 | ALIAS (show_ipv6_route_tag, |
| 4530 | show_ipv6_route_tag_vrf_cmd, |
| 4531 | "show ipv6 route tag <1-65535>" VRF_CMD_STR, |
| 4532 | SHOW_STR |
| 4533 | IP_STR |
| 4534 | "IPv6 routing table\n" |
| 4535 | "Show only routes with tag\n" |
| 4536 | "Tag value\n" |
| 4537 | VRF_CMD_HELP_STR) |
| 4538 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4539 | DEFUN (show_ipv6_route_prefix_longer, |
| 4540 | show_ipv6_route_prefix_longer_cmd, |
| 4541 | "show ipv6 route X:X::X:X/M longer-prefixes", |
| 4542 | SHOW_STR |
| 4543 | IP_STR |
| 4544 | "IPv6 routing table\n" |
| 4545 | "IPv6 prefix\n" |
| 4546 | "Show route matching the specified Network/Mask pair only\n") |
| 4547 | { |
| 4548 | struct route_table *table; |
| 4549 | struct route_node *rn; |
| 4550 | struct rib *rib; |
| 4551 | struct prefix p; |
| 4552 | int ret; |
| 4553 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4554 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4555 | |
| 4556 | ret = str2prefix (argv[0], &p); |
| 4557 | if (! ret) |
| 4558 | { |
| 4559 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 4560 | return CMD_WARNING; |
| 4561 | } |
| 4562 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4563 | if (argc > 1) |
| 4564 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 4565 | |
| 4566 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
| 4567 | if (! table) |
| 4568 | return CMD_SUCCESS; |
| 4569 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4570 | /* Show matched type IPv6 routes. */ |
| 4571 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 4572 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4573 | if (prefix_match (&p, &rn->p)) |
| 4574 | { |
| 4575 | if (first) |
| 4576 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4577 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4578 | first = 0; |
| 4579 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4580 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4581 | } |
| 4582 | return CMD_SUCCESS; |
| 4583 | } |
| 4584 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4585 | ALIAS (show_ipv6_route_prefix_longer, |
| 4586 | show_ipv6_route_prefix_longer_vrf_cmd, |
| 4587 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR, |
| 4588 | SHOW_STR |
| 4589 | IP_STR |
| 4590 | "IPv6 routing table\n" |
| 4591 | "IPv6 prefix\n" |
| 4592 | "Show route matching the specified Network/Mask pair only\n" |
| 4593 | VRF_CMD_HELP_STR) |
| 4594 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4595 | DEFUN (show_ipv6_route_protocol, |
| 4596 | show_ipv6_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4597 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4598 | SHOW_STR |
| 4599 | IP_STR |
| 4600 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4601 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4602 | { |
| 4603 | int type; |
| 4604 | struct route_table *table; |
| 4605 | struct route_node *rn; |
| 4606 | struct rib *rib; |
| 4607 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4608 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4609 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4610 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 4611 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4612 | { |
| 4613 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 4614 | return CMD_WARNING; |
| 4615 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4616 | |
| 4617 | if (argc > 1) |
| 4618 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 4619 | |
| 4620 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4621 | if (! table) |
| 4622 | return CMD_SUCCESS; |
| 4623 | |
| 4624 | /* Show matched type IPv6 routes. */ |
| 4625 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 4626 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4627 | if (rib->type == type) |
| 4628 | { |
| 4629 | if (first) |
| 4630 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 4631 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4632 | first = 0; |
| 4633 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4634 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4635 | } |
| 4636 | return CMD_SUCCESS; |
| 4637 | } |
| 4638 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4639 | ALIAS (show_ipv6_route_protocol, |
| 4640 | show_ipv6_route_protocol_vrf_cmd, |
| 4641 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 4642 | SHOW_STR |
| 4643 | IP_STR |
| 4644 | "IP routing table\n" |
| 4645 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 4646 | VRF_CMD_HELP_STR) |
| 4647 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4648 | DEFUN (show_ipv6_route_addr, |
| 4649 | show_ipv6_route_addr_cmd, |
| 4650 | "show ipv6 route X:X::X:X", |
| 4651 | SHOW_STR |
| 4652 | IP_STR |
| 4653 | "IPv6 routing table\n" |
| 4654 | "IPv6 Address\n") |
| 4655 | { |
| 4656 | int ret; |
| 4657 | struct prefix_ipv6 p; |
| 4658 | struct route_table *table; |
| 4659 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4660 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4661 | |
| 4662 | ret = str2prefix_ipv6 (argv[0], &p); |
| 4663 | if (ret <= 0) |
| 4664 | { |
| 4665 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 4666 | return CMD_WARNING; |
| 4667 | } |
| 4668 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4669 | if (argc > 1) |
| 4670 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 4671 | |
| 4672 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4673 | if (! table) |
| 4674 | return CMD_SUCCESS; |
| 4675 | |
| 4676 | rn = route_node_match (table, (struct prefix *) &p); |
| 4677 | if (! rn) |
| 4678 | { |
| 4679 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 4680 | return CMD_WARNING; |
| 4681 | } |
| 4682 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4683 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4684 | |
| 4685 | route_unlock_node (rn); |
| 4686 | |
| 4687 | return CMD_SUCCESS; |
| 4688 | } |
| 4689 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4690 | ALIAS (show_ipv6_route_addr, |
| 4691 | show_ipv6_route_addr_vrf_cmd, |
| 4692 | "show ipv6 route X:X::X:X " VRF_CMD_STR, |
| 4693 | SHOW_STR |
| 4694 | IP_STR |
| 4695 | "IPv6 routing table\n" |
| 4696 | "IPv6 Address\n" |
| 4697 | VRF_CMD_HELP_STR) |
| 4698 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4699 | DEFUN (show_ipv6_route_prefix, |
| 4700 | show_ipv6_route_prefix_cmd, |
| 4701 | "show ipv6 route X:X::X:X/M", |
| 4702 | SHOW_STR |
| 4703 | IP_STR |
| 4704 | "IPv6 routing table\n" |
| 4705 | "IPv6 prefix\n") |
| 4706 | { |
| 4707 | int ret; |
| 4708 | struct prefix_ipv6 p; |
| 4709 | struct route_table *table; |
| 4710 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4711 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4712 | |
| 4713 | ret = str2prefix_ipv6 (argv[0], &p); |
| 4714 | if (ret <= 0) |
| 4715 | { |
| 4716 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 4717 | return CMD_WARNING; |
| 4718 | } |
| 4719 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4720 | if (argc > 1) |
| 4721 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 4722 | |
| 4723 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4724 | if (! table) |
| 4725 | return CMD_SUCCESS; |
| 4726 | |
| 4727 | rn = route_node_match (table, (struct prefix *) &p); |
| 4728 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 4729 | { |
| 4730 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 4731 | if (rn) |
| 4732 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4733 | return CMD_WARNING; |
| 4734 | } |
| 4735 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4736 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4737 | |
| 4738 | route_unlock_node (rn); |
| 4739 | |
| 4740 | return CMD_SUCCESS; |
| 4741 | } |
| 4742 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4743 | ALIAS (show_ipv6_route_prefix, |
| 4744 | show_ipv6_route_prefix_vrf_cmd, |
| 4745 | "show ipv6 route X:X::X:X/M " VRF_CMD_STR, |
| 4746 | SHOW_STR |
| 4747 | IP_STR |
| 4748 | "IPv6 routing table\n" |
| 4749 | "IPv6 prefix\n" |
| 4750 | VRF_CMD_HELP_STR) |
| 4751 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 4752 | /* Show route summary. */ |
| 4753 | DEFUN (show_ipv6_route_summary, |
| 4754 | show_ipv6_route_summary_cmd, |
| 4755 | "show ipv6 route summary", |
| 4756 | SHOW_STR |
| 4757 | IP_STR |
| 4758 | "IPv6 routing table\n" |
| 4759 | "Summary of all IPv6 routes\n") |
| 4760 | { |
| 4761 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4762 | vrf_id_t vrf_id = VRF_DEFAULT; |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 4763 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4764 | if (argc > 0) |
| 4765 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 4766 | |
| 4767 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 4768 | if (! table) |
| 4769 | return CMD_SUCCESS; |
| 4770 | |
| 4771 | vty_show_ip_route_summary (vty, table); |
| 4772 | |
| 4773 | return CMD_SUCCESS; |
| 4774 | } |
| 4775 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4776 | ALIAS (show_ipv6_route_summary, |
| 4777 | show_ipv6_route_summary_vrf_cmd, |
| 4778 | "show ipv6 route summary " VRF_CMD_STR, |
| 4779 | SHOW_STR |
| 4780 | IP_STR |
| 4781 | "IPv6 routing table\n" |
| 4782 | "Summary of all IPv6 routes\n" |
| 4783 | VRF_CMD_HELP_STR) |
| 4784 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 4785 | /* Show ipv6 route summary prefix. */ |
| 4786 | DEFUN (show_ipv6_route_summary_prefix, |
| 4787 | show_ipv6_route_summary_prefix_cmd, |
| 4788 | "show ipv6 route summary prefix", |
| 4789 | SHOW_STR |
| 4790 | IP_STR |
| 4791 | "IPv6 routing table\n" |
| 4792 | "Summary of all IPv6 routes\n" |
| 4793 | "Prefix routes\n") |
| 4794 | { |
| 4795 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4796 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 4797 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4798 | if (argc > 0) |
| 4799 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 4800 | |
| 4801 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 4802 | if (! table) |
| 4803 | return CMD_SUCCESS; |
| 4804 | |
| 4805 | vty_show_ip_route_summary_prefix (vty, table); |
| 4806 | |
| 4807 | return CMD_SUCCESS; |
| 4808 | } |
| 4809 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4810 | ALIAS (show_ipv6_route_summary_prefix, |
| 4811 | show_ipv6_route_summary_prefix_vrf_cmd, |
| 4812 | "show ipv6 route summary prefix " VRF_CMD_STR, |
| 4813 | SHOW_STR |
| 4814 | IP_STR |
| 4815 | "IPv6 routing table\n" |
| 4816 | "Summary of all IPv6 routes\n" |
| 4817 | "Prefix routes\n" |
| 4818 | VRF_CMD_HELP_STR) |
| 4819 | |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4820 | /* |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4821 | * Show IPv6 mroute command.Used to dump |
| 4822 | * the Multicast routing table. |
| 4823 | */ |
| 4824 | |
| 4825 | DEFUN (show_ipv6_mroute, |
| 4826 | show_ipv6_mroute_cmd, |
| 4827 | "show ipv6 mroute", |
| 4828 | SHOW_STR |
| 4829 | IP_STR |
| 4830 | "IPv6 Multicast routing table\n") |
| 4831 | { |
| 4832 | struct route_table *table; |
| 4833 | struct route_node *rn; |
| 4834 | struct rib *rib; |
| 4835 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4836 | vrf_id_t vrf_id = VRF_DEFAULT; |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4837 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4838 | if (argc > 0) |
| 4839 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 4840 | |
| 4841 | table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4842 | if (! table) |
| 4843 | return CMD_SUCCESS; |
| 4844 | |
| 4845 | /* Show all IPv6 route. */ |
| 4846 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 4847 | RNODE_FOREACH_RIB (rn, rib) |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4848 | { |
| 4849 | if (first) |
| 4850 | { |
G.Balaji | cb32fd6 | 2011-11-27 20:09:40 +0530 | [diff] [blame] | 4851 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4852 | first = 0; |
| 4853 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 4854 | vty_show_ip_route (vty, rn, rib); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4855 | } |
| 4856 | return CMD_SUCCESS; |
| 4857 | } |
| 4858 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4859 | ALIAS (show_ipv6_mroute, |
| 4860 | show_ipv6_mroute_vrf_cmd, |
| 4861 | "show ipv6 mroute " VRF_CMD_STR, |
| 4862 | SHOW_STR |
| 4863 | IP_STR |
| 4864 | "IPv6 Multicast routing table\n" |
| 4865 | VRF_CMD_HELP_STR) |
| 4866 | |
| 4867 | DEFUN (show_ipv6_route_vrf_all, |
| 4868 | show_ipv6_route_vrf_all_cmd, |
| 4869 | "show ipv6 route " VRF_ALL_CMD_STR, |
| 4870 | SHOW_STR |
| 4871 | IP_STR |
| 4872 | "IPv6 routing table\n" |
| 4873 | VRF_ALL_CMD_HELP_STR) |
| 4874 | { |
| 4875 | struct route_table *table; |
| 4876 | struct route_node *rn; |
| 4877 | struct rib *rib; |
| 4878 | struct zebra_vrf *zvrf; |
| 4879 | vrf_iter_t iter; |
| 4880 | int first = 1; |
| 4881 | |
| 4882 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 4883 | { |
| 4884 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 4885 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 4886 | continue; |
| 4887 | |
| 4888 | /* Show all IPv6 route. */ |
| 4889 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 4890 | RNODE_FOREACH_RIB (rn, rib) |
| 4891 | { |
| 4892 | if (first) |
| 4893 | { |
| 4894 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 4895 | first = 0; |
| 4896 | } |
| 4897 | vty_show_ip_route (vty, rn, rib); |
| 4898 | } |
| 4899 | } |
| 4900 | |
| 4901 | return CMD_SUCCESS; |
| 4902 | } |
| 4903 | |
| 4904 | DEFUN (show_ipv6_route_prefix_longer_vrf_all, |
| 4905 | show_ipv6_route_prefix_longer_vrf_all_cmd, |
| 4906 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR, |
| 4907 | SHOW_STR |
| 4908 | IP_STR |
| 4909 | "IPv6 routing table\n" |
| 4910 | "IPv6 prefix\n" |
| 4911 | "Show route matching the specified Network/Mask pair only\n" |
| 4912 | VRF_ALL_CMD_HELP_STR) |
| 4913 | { |
| 4914 | struct route_table *table; |
| 4915 | struct route_node *rn; |
| 4916 | struct rib *rib; |
| 4917 | struct prefix p; |
| 4918 | struct zebra_vrf *zvrf; |
| 4919 | vrf_iter_t iter; |
| 4920 | int ret; |
| 4921 | int first = 1; |
| 4922 | |
| 4923 | ret = str2prefix (argv[0], &p); |
| 4924 | if (! ret) |
| 4925 | { |
| 4926 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 4927 | return CMD_WARNING; |
| 4928 | } |
| 4929 | |
| 4930 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 4931 | { |
| 4932 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 4933 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 4934 | continue; |
| 4935 | |
| 4936 | /* Show matched type IPv6 routes. */ |
| 4937 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 4938 | RNODE_FOREACH_RIB (rn, rib) |
| 4939 | if (prefix_match (&p, &rn->p)) |
| 4940 | { |
| 4941 | if (first) |
| 4942 | { |
| 4943 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 4944 | first = 0; |
| 4945 | } |
| 4946 | vty_show_ip_route (vty, rn, rib); |
| 4947 | } |
| 4948 | } |
| 4949 | |
| 4950 | return CMD_SUCCESS; |
| 4951 | } |
| 4952 | |
| 4953 | DEFUN (show_ipv6_route_protocol_vrf_all, |
| 4954 | show_ipv6_route_protocol_vrf_all_cmd, |
| 4955 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 4956 | SHOW_STR |
| 4957 | IP_STR |
| 4958 | "IP routing table\n" |
| 4959 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 4960 | VRF_ALL_CMD_HELP_STR) |
| 4961 | { |
| 4962 | int type; |
| 4963 | struct route_table *table; |
| 4964 | struct route_node *rn; |
| 4965 | struct rib *rib; |
| 4966 | struct zebra_vrf *zvrf; |
| 4967 | vrf_iter_t iter; |
| 4968 | int first = 1; |
| 4969 | |
| 4970 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 4971 | if (type < 0) |
| 4972 | { |
| 4973 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 4974 | return CMD_WARNING; |
| 4975 | } |
| 4976 | |
| 4977 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 4978 | { |
| 4979 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 4980 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 4981 | continue; |
| 4982 | |
| 4983 | /* Show matched type IPv6 routes. */ |
| 4984 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 4985 | RNODE_FOREACH_RIB (rn, rib) |
| 4986 | if (rib->type == type) |
| 4987 | { |
| 4988 | if (first) |
| 4989 | { |
| 4990 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 4991 | first = 0; |
| 4992 | } |
| 4993 | vty_show_ip_route (vty, rn, rib); |
| 4994 | } |
| 4995 | } |
| 4996 | |
| 4997 | return CMD_SUCCESS; |
| 4998 | } |
| 4999 | |
| 5000 | DEFUN (show_ipv6_route_addr_vrf_all, |
| 5001 | show_ipv6_route_addr_vrf_all_cmd, |
| 5002 | "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR, |
| 5003 | SHOW_STR |
| 5004 | IP_STR |
| 5005 | "IPv6 routing table\n" |
| 5006 | "IPv6 Address\n" |
| 5007 | VRF_ALL_CMD_HELP_STR) |
| 5008 | { |
| 5009 | int ret; |
| 5010 | struct prefix_ipv6 p; |
| 5011 | struct route_table *table; |
| 5012 | struct route_node *rn; |
| 5013 | struct zebra_vrf *zvrf; |
| 5014 | vrf_iter_t iter; |
| 5015 | |
| 5016 | ret = str2prefix_ipv6 (argv[0], &p); |
| 5017 | if (ret <= 0) |
| 5018 | { |
| 5019 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 5020 | return CMD_WARNING; |
| 5021 | } |
| 5022 | |
| 5023 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5024 | { |
| 5025 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 5026 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 5027 | continue; |
| 5028 | |
| 5029 | rn = route_node_match (table, (struct prefix *) &p); |
| 5030 | if (! rn) |
| 5031 | continue; |
| 5032 | |
| 5033 | vty_show_ip_route_detail (vty, rn, 0); |
| 5034 | |
| 5035 | route_unlock_node (rn); |
| 5036 | } |
| 5037 | |
| 5038 | return CMD_SUCCESS; |
| 5039 | } |
| 5040 | |
| 5041 | DEFUN (show_ipv6_route_prefix_vrf_all, |
| 5042 | show_ipv6_route_prefix_vrf_all_cmd, |
| 5043 | "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR, |
| 5044 | SHOW_STR |
| 5045 | IP_STR |
| 5046 | "IPv6 routing table\n" |
| 5047 | "IPv6 prefix\n" |
| 5048 | VRF_ALL_CMD_HELP_STR) |
| 5049 | { |
| 5050 | int ret; |
| 5051 | struct prefix_ipv6 p; |
| 5052 | struct route_table *table; |
| 5053 | struct route_node *rn; |
| 5054 | struct zebra_vrf *zvrf; |
| 5055 | vrf_iter_t iter; |
| 5056 | |
| 5057 | ret = str2prefix_ipv6 (argv[0], &p); |
| 5058 | if (ret <= 0) |
| 5059 | { |
| 5060 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 5061 | return CMD_WARNING; |
| 5062 | } |
| 5063 | |
| 5064 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5065 | { |
| 5066 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 5067 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 5068 | continue; |
| 5069 | |
| 5070 | rn = route_node_match (table, (struct prefix *) &p); |
| 5071 | if (! rn) |
| 5072 | continue; |
| 5073 | if (rn->p.prefixlen != p.prefixlen) |
| 5074 | { |
| 5075 | route_unlock_node (rn); |
| 5076 | continue; |
| 5077 | } |
| 5078 | |
| 5079 | vty_show_ip_route_detail (vty, rn, 0); |
| 5080 | |
| 5081 | route_unlock_node (rn); |
| 5082 | } |
| 5083 | |
| 5084 | return CMD_SUCCESS; |
| 5085 | } |
| 5086 | |
| 5087 | /* Show route summary. */ |
| 5088 | DEFUN (show_ipv6_route_summary_vrf_all, |
| 5089 | show_ipv6_route_summary_vrf_all_cmd, |
| 5090 | "show ipv6 route summary " VRF_ALL_CMD_STR, |
| 5091 | SHOW_STR |
| 5092 | IP_STR |
| 5093 | "IPv6 routing table\n" |
| 5094 | "Summary of all IPv6 routes\n" |
| 5095 | VRF_ALL_CMD_HELP_STR) |
| 5096 | { |
| 5097 | struct zebra_vrf *zvrf; |
| 5098 | vrf_iter_t iter; |
| 5099 | |
| 5100 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5101 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 5102 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 5103 | |
| 5104 | return CMD_SUCCESS; |
| 5105 | } |
| 5106 | |
| 5107 | DEFUN (show_ipv6_mroute_vrf_all, |
| 5108 | show_ipv6_mroute_vrf_all_cmd, |
| 5109 | "show ipv6 mroute " VRF_ALL_CMD_STR, |
| 5110 | SHOW_STR |
| 5111 | IP_STR |
| 5112 | "IPv6 Multicast routing table\n" |
| 5113 | VRF_ALL_CMD_HELP_STR) |
| 5114 | { |
| 5115 | struct route_table *table; |
| 5116 | struct route_node *rn; |
| 5117 | struct rib *rib; |
| 5118 | struct zebra_vrf *zvrf; |
| 5119 | vrf_iter_t iter; |
| 5120 | int first = 1; |
| 5121 | |
| 5122 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5123 | { |
| 5124 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 5125 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 5126 | continue; |
| 5127 | |
| 5128 | /* Show all IPv6 route. */ |
| 5129 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 5130 | RNODE_FOREACH_RIB (rn, rib) |
| 5131 | { |
| 5132 | if (first) |
| 5133 | { |
| 5134 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 5135 | first = 0; |
| 5136 | } |
| 5137 | vty_show_ip_route (vty, rn, rib); |
| 5138 | } |
| 5139 | } |
| 5140 | return CMD_SUCCESS; |
| 5141 | } |
| 5142 | |
| 5143 | DEFUN (show_ipv6_route_summary_prefix_vrf_all, |
| 5144 | show_ipv6_route_summary_prefix_vrf_all_cmd, |
| 5145 | "show ipv6 route summary prefix " VRF_ALL_CMD_STR, |
| 5146 | SHOW_STR |
| 5147 | IP_STR |
| 5148 | "IPv6 routing table\n" |
| 5149 | "Summary of all IPv6 routes\n" |
| 5150 | "Prefix routes\n" |
| 5151 | VRF_ALL_CMD_HELP_STR) |
| 5152 | { |
| 5153 | struct zebra_vrf *zvrf; |
| 5154 | vrf_iter_t iter; |
| 5155 | |
| 5156 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5157 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 5158 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 5159 | |
| 5160 | return CMD_SUCCESS; |
| 5161 | } |
| 5162 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5163 | /* Write IPv6 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 5164 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5165 | static_config_ipv6 (struct vty *vty) |
| 5166 | { |
| 5167 | struct route_node *rn; |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 5168 | struct static_route *si; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5169 | int write; |
| 5170 | char buf[BUFSIZ]; |
| 5171 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5172 | struct zebra_vrf *zvrf; |
| 5173 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5174 | |
| 5175 | write = 0; |
| 5176 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5177 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 5178 | { |
| 5179 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 5180 | (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 5181 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5182 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5183 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 5184 | for (si = rn->info; si; si = si->next) |
| 5185 | { |
| 5186 | vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5187 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5188 | switch (si->type) |
| 5189 | { |
| 5190 | case STATIC_IPV6_GATEWAY: |
| 5191 | vty_out (vty, " %s", |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 5192 | inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ)); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5193 | break; |
| 5194 | case STATIC_IPV6_IFNAME: |
| 5195 | vty_out (vty, " %s", si->ifname); |
| 5196 | break; |
| 5197 | case STATIC_IPV6_GATEWAY_IFNAME: |
| 5198 | vty_out (vty, " %s %s", |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 5199 | inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ), |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5200 | si->ifname); |
| 5201 | break; |
| 5202 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5203 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5204 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 5205 | vty_out (vty, " %s", "reject"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5206 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5207 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 5208 | vty_out (vty, " %s", "blackhole"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5209 | |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 5210 | if (si->tag) |
| 5211 | vty_out (vty, " tag %d", si->tag); |
| 5212 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5213 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 5214 | vty_out (vty, " %d", si->distance); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5215 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5216 | if (si->vrf_id != VRF_DEFAULT) |
| 5217 | vty_out (vty, " vrf %u", si->vrf_id); |
| 5218 | |
| 5219 | vty_out (vty, "%s", VTY_NEWLINE); |
| 5220 | |
| 5221 | write = 1; |
| 5222 | } |
| 5223 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5224 | return write; |
| 5225 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5226 | |
| 5227 | /* Static ip route configuration write function. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 5228 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5229 | zebra_ip_config (struct vty *vty) |
| 5230 | { |
| 5231 | int write = 0; |
| 5232 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 5233 | write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); |
| 5234 | write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5235 | #ifdef HAVE_IPV6 |
| 5236 | write += static_config_ipv6 (vty); |
| 5237 | #endif /* HAVE_IPV6 */ |
| 5238 | |
| 5239 | return write; |
| 5240 | } |
| 5241 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 5242 | static int config_write_vty(struct vty *vty) |
| 5243 | { |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 5244 | int i; |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 5245 | enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get (); |
| 5246 | |
| 5247 | if (ipv4_multicast_mode != MCAST_NO_CONFIG) |
| 5248 | vty_out (vty, "ip multicast rpf-lookup-mode %s%s", |
| 5249 | ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" : |
| 5250 | ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" : |
| 5251 | ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" : |
| 5252 | ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" : |
| 5253 | "longer-prefix", |
| 5254 | VTY_NEWLINE); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 5255 | |
| 5256 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 5257 | { |
| 5258 | if (proto_rm[AFI_IP][i]) |
| 5259 | vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i), |
| 5260 | proto_rm[AFI_IP][i], VTY_NEWLINE); |
| 5261 | } |
| 5262 | if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX]) |
| 5263 | vty_out (vty, "ip protocol %s route-map %s%s", "any", |
| 5264 | proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE); |
| 5265 | |
| 5266 | return 1; |
| 5267 | } |
| 5268 | |
| 5269 | /* table node for protocol filtering */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 5270 | static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 }; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 5271 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5272 | /* IP node for static routes. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 5273 | static struct cmd_node ip_node = { IP_NODE, "", 1 }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5274 | |
| 5275 | /* Route VTY. */ |
| 5276 | void |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 5277 | zebra_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5278 | { |
| 5279 | install_node (&ip_node, zebra_ip_config); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 5280 | install_node (&protocol_node, config_write_vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5281 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 5282 | install_element (CONFIG_NODE, &ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 5283 | install_element (CONFIG_NODE, &ip_mroute_dist_cmd); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 5284 | install_element (CONFIG_NODE, &no_ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 5285 | install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 5286 | install_element (CONFIG_NODE, &ip_multicast_mode_cmd); |
| 5287 | install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd); |
| 5288 | install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 5289 | install_element (CONFIG_NODE, &ip_protocol_cmd); |
| 5290 | install_element (CONFIG_NODE, &no_ip_protocol_cmd); |
| 5291 | install_element (VIEW_NODE, &show_ip_protocol_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5292 | install_element (CONFIG_NODE, &ip_route_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5293 | install_element (CONFIG_NODE, &ip_route_tag_cmd); |
| 5294 | install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5295 | install_element (CONFIG_NODE, &ip_route_flags_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5296 | install_element (CONFIG_NODE, &ip_route_flags_tag_cmd); |
| 5297 | install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5298 | install_element (CONFIG_NODE, &ip_route_flags2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5299 | install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd); |
| 5300 | install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5301 | install_element (CONFIG_NODE, &ip_route_mask_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5302 | install_element (CONFIG_NODE, &ip_route_mask_tag_cmd); |
| 5303 | install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5304 | install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5305 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd); |
| 5306 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5307 | install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5308 | install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd); |
| 5309 | install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5310 | install_element (CONFIG_NODE, &no_ip_route_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5311 | install_element (CONFIG_NODE, &no_ip_route_tag_cmd); |
| 5312 | install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5313 | install_element (CONFIG_NODE, &no_ip_route_flags_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5314 | install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5315 | install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5316 | install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd); |
| 5317 | install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5318 | install_element (CONFIG_NODE, &no_ip_route_mask_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5319 | install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5320 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5321 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5322 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5323 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd); |
| 5324 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5325 | install_element (CONFIG_NODE, &ip_route_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5326 | install_element (CONFIG_NODE, &ip_route_tag_distance_cmd); |
| 5327 | install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5328 | install_element (CONFIG_NODE, &ip_route_flags_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5329 | install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd); |
| 5330 | install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5331 | install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5332 | install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd); |
| 5333 | install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5334 | install_element (CONFIG_NODE, &ip_route_mask_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5335 | install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd); |
| 5336 | install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5337 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5338 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd); |
| 5339 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5340 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5341 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd); |
| 5342 | install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5343 | install_element (CONFIG_NODE, &no_ip_route_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5344 | install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd); |
| 5345 | install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5346 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5347 | install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd); |
| 5348 | install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5349 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5350 | install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd); |
| 5351 | install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd); |
Igor Ryzhov | 5f67888 | 2016-04-22 17:38:24 +0300 | [diff] [blame] | 5352 | install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5353 | install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd); |
| 5354 | install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5355 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5356 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd); |
| 5357 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 5358 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5359 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd); |
| 5360 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5361 | |
| 5362 | install_element (VIEW_NODE, &show_ip_route_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5363 | install_element (VIEW_NODE, &show_ip_route_tag_cmd); |
| 5364 | install_element (VIEW_NODE, &show_ip_route_tag_vrf_cmd); |
Pradosh Mohapatra | 60cc959 | 2015-11-09 20:21:41 -0500 | [diff] [blame] | 5365 | install_element (VIEW_NODE, &show_ip_nht_cmd); |
| 5366 | install_element (VIEW_NODE, &show_ipv6_nht_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5367 | install_element (VIEW_NODE, &show_ip_route_addr_cmd); |
| 5368 | install_element (VIEW_NODE, &show_ip_route_prefix_cmd); |
| 5369 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd); |
| 5370 | install_element (VIEW_NODE, &show_ip_route_protocol_cmd); |
| 5371 | install_element (VIEW_NODE, &show_ip_route_supernets_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 5372 | install_element (VIEW_NODE, &show_ip_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 5373 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5374 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 5375 | install_element (VIEW_NODE, &show_ip_rpf_cmd); |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 5376 | install_element (VIEW_NODE, &show_ip_rpf_addr_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 5377 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5378 | /* Commands for VRF */ |
| 5379 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5380 | install_element (CONFIG_NODE, &ip_mroute_vrf_cmd); |
| 5381 | install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd); |
| 5382 | install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd); |
| 5383 | install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd); |
| 5384 | |
| 5385 | install_element (CONFIG_NODE, &ip_route_vrf_cmd); |
| 5386 | install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd); |
| 5387 | install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd); |
| 5388 | install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd); |
| 5389 | install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd); |
| 5390 | install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd); |
| 5391 | install_element (CONFIG_NODE, &no_ip_route_vrf_cmd); |
| 5392 | install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd); |
| 5393 | install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd); |
| 5394 | install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd); |
| 5395 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd); |
| 5396 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd); |
| 5397 | install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd); |
| 5398 | install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd); |
| 5399 | install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd); |
| 5400 | install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd); |
| 5401 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd); |
| 5402 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd); |
| 5403 | install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd); |
| 5404 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); |
| 5405 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd); |
Igor Ryzhov | 5f67888 | 2016-04-22 17:38:24 +0300 | [diff] [blame] | 5406 | install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5407 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd); |
| 5408 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd); |
| 5409 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5410 | install_element (VIEW_NODE, &show_ip_route_vrf_cmd); |
| 5411 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd); |
| 5412 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd); |
| 5413 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd); |
| 5414 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd); |
| 5415 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd); |
| 5416 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd); |
| 5417 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5418 | |
| 5419 | install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd); |
| 5420 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd); |
| 5421 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd); |
| 5422 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd); |
| 5423 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd); |
| 5424 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd); |
| 5425 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd); |
| 5426 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5427 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5428 | install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd); |
| 5429 | install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd); |
| 5430 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd); |
| 5431 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5432 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5433 | install_element (CONFIG_NODE, &ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5434 | install_element (CONFIG_NODE, &ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5435 | install_element (CONFIG_NODE, &ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5436 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5437 | install_element (CONFIG_NODE, &no_ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5438 | install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5439 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5440 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5441 | install_element (CONFIG_NODE, &ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5442 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5443 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5444 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5445 | install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5446 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5447 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 5448 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5449 | install_element (CONFIG_NODE, &ipv6_route_tag_cmd); |
| 5450 | install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd); |
| 5451 | install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd); |
| 5452 | install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd); |
| 5453 | install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd); |
| 5454 | install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd); |
| 5455 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd); |
| 5456 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd); |
| 5457 | install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd); |
| 5458 | install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd); |
| 5459 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd); |
| 5460 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd); |
| 5461 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd); |
| 5462 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd); |
| 5463 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd); |
| 5464 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd); |
| 5465 | install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd); |
| 5466 | install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd); |
| 5467 | install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd); |
| 5468 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd); |
| 5469 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd); |
| 5470 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd); |
| 5471 | install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd); |
| 5472 | install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd); |
| 5473 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd); |
| 5474 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd); |
| 5475 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd); |
| 5476 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd); |
| 5477 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd); |
| 5478 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5479 | install_element (VIEW_NODE, &show_ipv6_route_cmd); |
Piotr Chytła | fb21447 | 2015-12-01 13:47:06 -0500 | [diff] [blame] | 5480 | install_element (VIEW_NODE, &show_ipv6_route_tag_cmd); |
| 5481 | install_element (VIEW_NODE, &show_ipv6_route_tag_vrf_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 5482 | install_element (VIEW_NODE, &show_ipv6_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 5483 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5484 | install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd); |
| 5485 | install_element (VIEW_NODE, &show_ipv6_route_addr_cmd); |
| 5486 | install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd); |
| 5487 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 5488 | |
| 5489 | install_element (VIEW_NODE, &show_ipv6_mroute_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5490 | |
| 5491 | /* Commands for VRF */ |
| 5492 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 5493 | install_element (CONFIG_NODE, &ipv6_route_vrf_cmd); |
| 5494 | install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd); |
| 5495 | install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd); |
| 5496 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd); |
| 5497 | install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd); |
| 5498 | install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd); |
| 5499 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd); |
| 5500 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd); |
| 5501 | install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd); |
| 5502 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd); |
| 5503 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd); |
| 5504 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd); |
| 5505 | install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd); |
| 5506 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd); |
| 5507 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd); |
| 5508 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd); |
| 5509 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5510 | install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd); |
| 5511 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd); |
| 5512 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd); |
| 5513 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd); |
| 5514 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd); |
| 5515 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd); |
| 5516 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5517 | |
| 5518 | install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); |
| 5519 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd); |
| 5520 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd); |
| 5521 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd); |
| 5522 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd); |
| 5523 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd); |
| 5524 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5525 | |
| 5526 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 5527 | |
| 5528 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); |
Piotr Chytła | de24f82 | 2007-06-28 00:09:28 +0200 | [diff] [blame] | 5529 | install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5530 | } |