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" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 31 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 32 | #include "zebra/zserv.h" |
| 33 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 34 | 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] | 35 | static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, |
| 36 | int mcast); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 37 | static void vty_show_ip_route (struct vty *vty, struct route_node *rn, |
| 38 | struct rib *rib); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 39 | |
| 40 | /* General function for static route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 41 | static int |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 42 | zebra_static_ipv4_safi (struct vty *vty, safi_t safi, int add_cmd, |
| 43 | const char *dest_str, const char *mask_str, |
| 44 | const char *gate_str, const char *flag_str, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 45 | const char *distance_str, const char *vrf_id_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 46 | { |
| 47 | int ret; |
| 48 | u_char distance; |
| 49 | struct prefix p; |
| 50 | struct in_addr gate; |
| 51 | struct in_addr mask; |
hasso | 39db97e | 2004-10-12 20:50:58 +0000 | [diff] [blame] | 52 | const char *ifname; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 53 | u_char flag = 0; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 54 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | |
| 56 | ret = str2prefix (dest_str, &p); |
| 57 | if (ret <= 0) |
| 58 | { |
| 59 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 60 | return CMD_WARNING; |
| 61 | } |
| 62 | |
| 63 | /* Cisco like mask notation. */ |
| 64 | if (mask_str) |
| 65 | { |
| 66 | ret = inet_aton (mask_str, &mask); |
| 67 | if (ret == 0) |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 68 | { |
| 69 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 70 | return CMD_WARNING; |
| 71 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | p.prefixlen = ip_masklen (mask); |
| 73 | } |
| 74 | |
| 75 | /* Apply mask for given prefix. */ |
| 76 | apply_mask (&p); |
| 77 | |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 78 | /* Administrative distance. */ |
| 79 | if (distance_str) |
| 80 | distance = atoi (distance_str); |
| 81 | else |
| 82 | distance = ZEBRA_STATIC_DISTANCE_DEFAULT; |
| 83 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 84 | /* VRF id */ |
| 85 | if (vrf_id_str) |
| 86 | VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str); |
| 87 | |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 88 | /* Null0 static route. */ |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 89 | if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0)) |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 90 | { |
| 91 | if (flag_str) |
| 92 | { |
| 93 | vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE); |
| 94 | return CMD_WARNING; |
| 95 | } |
| 96 | if (add_cmd) |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 97 | static_add_ipv4_safi (safi, &p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, distance, vrf_id); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 98 | else |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 99 | static_delete_ipv4_safi (safi, &p, NULL, NULL, distance, vrf_id); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 100 | return CMD_SUCCESS; |
| 101 | } |
| 102 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 103 | /* Route flags */ |
| 104 | if (flag_str) { |
| 105 | switch(flag_str[0]) { |
| 106 | case 'r': |
| 107 | case 'R': /* XXX */ |
| 108 | SET_FLAG (flag, ZEBRA_FLAG_REJECT); |
| 109 | break; |
| 110 | case 'b': |
| 111 | case 'B': /* XXX */ |
| 112 | SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE); |
| 113 | break; |
| 114 | default: |
| 115 | vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 116 | return CMD_WARNING; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 117 | } |
| 118 | } |
| 119 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 120 | if (gate_str == NULL) |
| 121 | { |
| 122 | if (add_cmd) |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 123 | static_add_ipv4_safi (safi, &p, NULL, NULL, flag, distance, vrf_id); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 124 | else |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 125 | static_delete_ipv4_safi (safi, &p, NULL, NULL, distance, vrf_id); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 126 | |
| 127 | return CMD_SUCCESS; |
| 128 | } |
| 129 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 130 | /* When gateway is A.B.C.D format, gate is treated as nexthop |
| 131 | address other case gate is treated as interface name. */ |
| 132 | ret = inet_aton (gate_str, &gate); |
| 133 | if (ret) |
| 134 | ifname = NULL; |
| 135 | else |
| 136 | ifname = gate_str; |
| 137 | |
| 138 | if (add_cmd) |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 139 | static_add_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, flag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 140 | else |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 141 | static_delete_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 142 | |
| 143 | return CMD_SUCCESS; |
| 144 | } |
| 145 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 146 | static int |
| 147 | zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str, |
| 148 | const char *mask_str, const char *gate_str, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 149 | const char *flag_str, const char *distance_str, |
| 150 | const char *vrf_id_str) |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 151 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 152 | return zebra_static_ipv4_safi (vty, SAFI_UNICAST, add_cmd, dest_str, mask_str, |
| 153 | gate_str, flag_str, distance_str, vrf_id_str); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | /* Static unicast routes for multicast RPF lookup. */ |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 157 | DEFUN (ip_mroute_dist, |
| 158 | ip_mroute_dist_cmd, |
| 159 | "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] | 160 | IP_STR |
| 161 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 162 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 163 | "Nexthop address\n" |
| 164 | "Nexthop interface name\n" |
| 165 | "Distance\n") |
| 166 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 167 | VTY_WARN_EXPERIMENTAL(); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 168 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 169 | NULL, argc > 2 ? argv[2] : NULL, NULL); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 170 | } |
| 171 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 172 | ALIAS (ip_mroute_dist, |
| 173 | ip_mroute_cmd, |
| 174 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", |
| 175 | IP_STR |
| 176 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 177 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 178 | "Nexthop address\n" |
| 179 | "Nexthop interface name\n") |
| 180 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 181 | DEFUN (ip_mroute_dist_vrf, |
| 182 | ip_mroute_dist_vrf_cmd, |
| 183 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR, |
| 184 | IP_STR |
| 185 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 186 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 187 | "Nexthop address\n" |
| 188 | "Nexthop interface name\n" |
| 189 | "Distance\n" |
| 190 | VRF_CMD_HELP_STR) |
| 191 | { |
| 192 | VTY_WARN_EXPERIMENTAL(); |
| 193 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], |
| 194 | NULL, argc > 3 ? argv[2] : NULL, |
| 195 | argc > 3 ? argv[3] : argv[2]); |
| 196 | } |
| 197 | |
| 198 | ALIAS (ip_mroute_dist_vrf, |
| 199 | ip_mroute_vrf_cmd, |
| 200 | "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) "VRF_CMD_STR, |
| 201 | IP_STR |
| 202 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 203 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 204 | "Nexthop address\n" |
| 205 | "Nexthop interface name\n" |
| 206 | VRF_CMD_HELP_STR) |
| 207 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 208 | DEFUN (no_ip_mroute_dist, |
| 209 | no_ip_mroute_dist_cmd, |
| 210 | "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] | 211 | IP_STR |
| 212 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 213 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 214 | "Nexthop address\n" |
| 215 | "Nexthop interface name\n" |
| 216 | "Distance\n") |
| 217 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 218 | VTY_WARN_EXPERIMENTAL(); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 219 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 220 | NULL, argc > 2 ? argv[2] : NULL, NULL); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 221 | } |
| 222 | |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 223 | ALIAS (no_ip_mroute_dist, |
| 224 | no_ip_mroute_cmd, |
| 225 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", |
| 226 | NO_STR |
| 227 | IP_STR |
| 228 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 229 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 230 | "Nexthop address\n" |
| 231 | "Nexthop interface name\n") |
| 232 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 233 | DEFUN (no_ip_mroute_dist_vrf, |
| 234 | no_ip_mroute_dist_vrf_cmd, |
| 235 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR, |
| 236 | IP_STR |
| 237 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 238 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 239 | "Nexthop address\n" |
| 240 | "Nexthop interface name\n" |
| 241 | "Distance\n" |
| 242 | VRF_CMD_HELP_STR) |
| 243 | { |
| 244 | VTY_WARN_EXPERIMENTAL(); |
| 245 | return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], |
| 246 | NULL, argc > 3 ? argv[2] : NULL, |
| 247 | argc > 3 ? argv[3] : argv[2]); |
| 248 | } |
| 249 | |
| 250 | ALIAS (no_ip_mroute_dist_vrf, |
| 251 | no_ip_mroute_vrf_cmd, |
| 252 | "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) " VRF_CMD_STR, |
| 253 | NO_STR |
| 254 | IP_STR |
| 255 | "Configure static unicast route into MRIB for multicast RPF lookup\n" |
| 256 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 257 | "Nexthop address\n" |
| 258 | "Nexthop interface name\n" |
| 259 | VRF_CMD_HELP_STR) |
| 260 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 261 | DEFUN (ip_multicast_mode, |
| 262 | ip_multicast_mode_cmd, |
| 263 | "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", |
| 264 | IP_STR |
| 265 | "Multicast options\n" |
| 266 | "RPF lookup behavior\n" |
| 267 | "Lookup in unicast RIB only\n" |
| 268 | "Lookup in multicast RIB only\n" |
| 269 | "Try multicast RIB first, fall back to unicast RIB\n" |
| 270 | "Lookup both, use entry with lower distance\n" |
| 271 | "Lookup both, use entry with longer prefix\n") |
| 272 | { |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 273 | VTY_WARN_EXPERIMENTAL(); |
| 274 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 275 | if (!strncmp (argv[0], "u", 1)) |
| 276 | multicast_mode_ipv4_set (MCAST_URIB_ONLY); |
| 277 | else if (!strncmp (argv[0], "mrib-o", 6)) |
| 278 | multicast_mode_ipv4_set (MCAST_MRIB_ONLY); |
| 279 | else if (!strncmp (argv[0], "mrib-t", 6)) |
| 280 | multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); |
| 281 | else if (!strncmp (argv[0], "low", 3)) |
| 282 | multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); |
| 283 | else if (!strncmp (argv[0], "lon", 3)) |
| 284 | multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); |
| 285 | else |
| 286 | { |
| 287 | vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE); |
| 288 | return CMD_WARNING; |
| 289 | } |
| 290 | |
| 291 | return CMD_SUCCESS; |
| 292 | } |
| 293 | |
| 294 | DEFUN (no_ip_multicast_mode, |
| 295 | no_ip_multicast_mode_cmd, |
| 296 | "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", |
| 297 | NO_STR |
| 298 | IP_STR |
| 299 | "Multicast options\n" |
| 300 | "RPF lookup behavior\n" |
| 301 | "Lookup in unicast RIB only\n" |
| 302 | "Lookup in multicast RIB only\n" |
| 303 | "Try multicast RIB first, fall back to unicast RIB\n" |
| 304 | "Lookup both, use entry with lower distance\n" |
| 305 | "Lookup both, use entry with longer prefix\n") |
| 306 | { |
| 307 | multicast_mode_ipv4_set (MCAST_NO_CONFIG); |
| 308 | return CMD_SUCCESS; |
| 309 | } |
| 310 | |
| 311 | ALIAS (no_ip_multicast_mode, |
| 312 | no_ip_multicast_mode_noarg_cmd, |
| 313 | "no ip multicast rpf-lookup-mode", |
| 314 | NO_STR |
| 315 | IP_STR |
| 316 | "Multicast options\n" |
| 317 | "RPF lookup behavior\n") |
| 318 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 319 | DEFUN (show_ip_rpf, |
| 320 | show_ip_rpf_cmd, |
| 321 | "show ip rpf", |
| 322 | SHOW_STR |
| 323 | IP_STR |
| 324 | "Display RPF information for multicast source\n") |
| 325 | { |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 326 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 327 | |
| 328 | if (argc > 0) |
| 329 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 330 | |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 331 | VTY_WARN_EXPERIMENTAL(); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 332 | return do_show_ip_route(vty, SAFI_MULTICAST, vrf_id); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 333 | } |
| 334 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 335 | ALIAS (show_ip_rpf, |
| 336 | show_ip_rpf_vrf_cmd, |
| 337 | "show ip rpf " VRF_CMD_STR, |
| 338 | SHOW_STR |
| 339 | IP_STR |
| 340 | "Display RPF information for multicast source\n" |
| 341 | VRF_CMD_HELP_STR) |
| 342 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 343 | DEFUN (show_ip_rpf_addr, |
| 344 | show_ip_rpf_addr_cmd, |
| 345 | "show ip rpf A.B.C.D", |
| 346 | SHOW_STR |
| 347 | IP_STR |
| 348 | "Display RPF information for multicast source\n" |
| 349 | "IP multicast source address (e.g. 10.0.0.0)\n") |
| 350 | { |
| 351 | struct in_addr addr; |
| 352 | struct route_node *rn; |
| 353 | struct rib *rib; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 354 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 355 | int ret; |
| 356 | |
| 357 | if (argc > 1) |
| 358 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 359 | |
| 360 | VTY_WARN_EXPERIMENTAL(); |
| 361 | |
| 362 | ret = inet_aton (argv[0], &addr); |
| 363 | if (ret == 0) |
| 364 | { |
| 365 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 366 | return CMD_WARNING; |
| 367 | } |
| 368 | |
| 369 | rib = rib_match_ipv4_multicast (addr, &rn, vrf_id); |
| 370 | |
| 371 | if (rib) |
| 372 | vty_show_ip_route_detail (vty, rn, 1); |
| 373 | else |
| 374 | vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE); |
| 375 | |
| 376 | return CMD_SUCCESS; |
| 377 | } |
| 378 | |
| 379 | ALIAS (show_ip_rpf_addr, |
| 380 | show_ip_rpf_addr_vrf_cmd, |
| 381 | "show ip rpf A.B.C.D " VRF_CMD_STR, |
| 382 | SHOW_STR |
| 383 | IP_STR |
| 384 | "Display RPF information for multicast source\n" |
| 385 | "IP multicast source address (e.g. 10.0.0.0)\n" |
| 386 | VRF_CMD_HELP_STR) |
| 387 | |
| 388 | DEFUN (show_ip_rpf_vrf_all, |
| 389 | show_ip_rpf_vrf_all_cmd, |
| 390 | "show ip rpf " VRF_ALL_CMD_STR, |
| 391 | SHOW_STR |
| 392 | IP_STR |
| 393 | "Display RPF information for multicast source\n" |
| 394 | VRF_ALL_CMD_HELP_STR) |
| 395 | { |
| 396 | struct zebra_vrf *zvrf; |
| 397 | struct route_table *table; |
| 398 | struct route_node *rn; |
| 399 | struct rib *rib; |
| 400 | vrf_iter_t iter; |
| 401 | int first = 1; |
| 402 | |
| 403 | VTY_WARN_EXPERIMENTAL(); |
| 404 | |
| 405 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 406 | { |
| 407 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 408 | (table = zvrf->table[AFI_IP][SAFI_MULTICAST]) == NULL) |
| 409 | continue; |
| 410 | |
| 411 | /* Show all IPv4 routes. */ |
| 412 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 413 | RNODE_FOREACH_RIB (rn, rib) |
| 414 | { |
| 415 | if (first) |
| 416 | { |
| 417 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 418 | first = 0; |
| 419 | } |
| 420 | vty_show_ip_route (vty, rn, rib); |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | return CMD_SUCCESS; |
| 425 | } |
| 426 | |
| 427 | DEFUN (show_ip_rpf_addr_vrf_all, |
| 428 | show_ip_rpf_addr_vrf_all_cmd, |
| 429 | "show ip rpf A.B.C.D " VRF_ALL_CMD_STR, |
| 430 | SHOW_STR |
| 431 | IP_STR |
| 432 | "Display RPF information for multicast source\n" |
| 433 | "IP multicast source address (e.g. 10.0.0.0)\n" |
| 434 | VRF_ALL_CMD_HELP_STR) |
| 435 | { |
| 436 | struct in_addr addr; |
| 437 | struct route_node *rn; |
| 438 | vrf_iter_t iter; |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 439 | int ret; |
| 440 | |
David Lamparter | 863f20c | 2015-01-27 20:24:15 +0100 | [diff] [blame] | 441 | VTY_WARN_EXPERIMENTAL(); |
| 442 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 443 | ret = inet_aton (argv[0], &addr); |
| 444 | if (ret == 0) |
| 445 | { |
| 446 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 447 | return CMD_WARNING; |
| 448 | } |
| 449 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 450 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 451 | { |
| 452 | if (rib_match_ipv4_multicast (addr, &rn, vrf_iter2id (iter))) |
| 453 | vty_show_ip_route_detail (vty, rn, 1); |
| 454 | } |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 455 | |
| 456 | return CMD_SUCCESS; |
| 457 | } |
| 458 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 459 | /* Static route configuration. */ |
| 460 | DEFUN (ip_route, |
| 461 | ip_route_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 462 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 463 | IP_STR |
| 464 | "Establish static routes\n" |
| 465 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 466 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 467 | "IP gateway interface name\n" |
| 468 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 469 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 470 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL, |
| 471 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | DEFUN (ip_route_flags, |
| 475 | ip_route_flags_cmd, |
| 476 | "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] | 477 | IP_STR |
| 478 | "Establish static routes\n" |
| 479 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 480 | "IP gateway address\n" |
| 481 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 482 | "Emit an ICMP unreachable when matched\n" |
| 483 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 484 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 485 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL, |
| 486 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 487 | } |
| 488 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 489 | DEFUN (ip_route_flags2, |
| 490 | ip_route_flags2_cmd, |
| 491 | "ip route A.B.C.D/M (reject|blackhole)", |
| 492 | IP_STR |
| 493 | "Establish static routes\n" |
| 494 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 495 | "Emit an ICMP unreachable when matched\n" |
| 496 | "Silently discard pkts when matched\n") |
| 497 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 498 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL, |
| 499 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 500 | } |
| 501 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 502 | /* Mask as A.B.C.D format. */ |
| 503 | DEFUN (ip_route_mask, |
| 504 | ip_route_mask_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 505 | "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] | 506 | IP_STR |
| 507 | "Establish static routes\n" |
| 508 | "IP destination prefix\n" |
| 509 | "IP destination prefix mask\n" |
| 510 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 511 | "IP gateway interface name\n" |
| 512 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 513 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 514 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 515 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | DEFUN (ip_route_mask_flags, |
| 519 | ip_route_mask_flags_cmd, |
| 520 | "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] | 521 | IP_STR |
| 522 | "Establish static routes\n" |
| 523 | "IP destination prefix\n" |
| 524 | "IP destination prefix mask\n" |
| 525 | "IP gateway address\n" |
| 526 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 527 | "Emit an ICMP unreachable when matched\n" |
| 528 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 529 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 530 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 531 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 532 | } |
| 533 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 534 | DEFUN (ip_route_mask_flags2, |
| 535 | ip_route_mask_flags2_cmd, |
| 536 | "ip route A.B.C.D A.B.C.D (reject|blackhole)", |
| 537 | IP_STR |
| 538 | "Establish static routes\n" |
| 539 | "IP destination prefix\n" |
| 540 | "IP destination prefix mask\n" |
| 541 | "Emit an ICMP unreachable when matched\n" |
| 542 | "Silently discard pkts when matched\n") |
| 543 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 544 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 545 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 546 | } |
| 547 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 548 | /* Distance option value. */ |
| 549 | DEFUN (ip_route_distance, |
| 550 | ip_route_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 551 | "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] | 552 | IP_STR |
| 553 | "Establish static routes\n" |
| 554 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 555 | "IP gateway address\n" |
| 556 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 557 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 558 | "Distance value for this route\n") |
| 559 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 560 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2], |
| 561 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | DEFUN (ip_route_flags_distance, |
| 565 | ip_route_flags_distance_cmd, |
| 566 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 567 | IP_STR |
| 568 | "Establish static routes\n" |
| 569 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 570 | "IP gateway address\n" |
| 571 | "IP gateway interface name\n" |
| 572 | "Emit an ICMP unreachable when matched\n" |
| 573 | "Silently discard pkts when matched\n" |
| 574 | "Distance value for this route\n") |
| 575 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 576 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3], |
| 577 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 578 | } |
| 579 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 580 | DEFUN (ip_route_flags_distance2, |
| 581 | ip_route_flags_distance2_cmd, |
| 582 | "ip route A.B.C.D/M (reject|blackhole) <1-255>", |
| 583 | IP_STR |
| 584 | "Establish static routes\n" |
| 585 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 586 | "Emit an ICMP unreachable when matched\n" |
| 587 | "Silently discard pkts when matched\n" |
| 588 | "Distance value for this route\n") |
| 589 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 590 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2], |
| 591 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 592 | } |
| 593 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | DEFUN (ip_route_mask_distance, |
| 595 | ip_route_mask_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 596 | "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] | 597 | IP_STR |
| 598 | "Establish static routes\n" |
| 599 | "IP destination prefix\n" |
| 600 | "IP destination prefix mask\n" |
| 601 | "IP gateway address\n" |
| 602 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 603 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 604 | "Distance value for this route\n") |
| 605 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 606 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 607 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | DEFUN (ip_route_mask_flags_distance, |
| 611 | ip_route_mask_flags_distance_cmd, |
| 612 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 613 | IP_STR |
| 614 | "Establish static routes\n" |
| 615 | "IP destination prefix\n" |
| 616 | "IP destination prefix mask\n" |
| 617 | "IP gateway address\n" |
| 618 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 619 | "Emit an ICMP unreachable when matched\n" |
Christian Franke | 2b00515 | 2013-09-30 12:27:49 +0000 | [diff] [blame] | 620 | "Silently discard pkts when matched\n" |
| 621 | "Distance value for this route\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 622 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 623 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 624 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 625 | } |
| 626 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 627 | DEFUN (ip_route_mask_flags_distance2, |
| 628 | ip_route_mask_flags_distance2_cmd, |
| 629 | "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", |
| 630 | IP_STR |
| 631 | "Establish static routes\n" |
| 632 | "IP destination prefix\n" |
| 633 | "IP destination prefix mask\n" |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 634 | "Emit an ICMP unreachable when matched\n" |
Christian Franke | 2b00515 | 2013-09-30 12:27:49 +0000 | [diff] [blame] | 635 | "Silently discard pkts when matched\n" |
| 636 | "Distance value for this route\n") |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 637 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 638 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 639 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 640 | } |
| 641 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 642 | DEFUN (no_ip_route, |
| 643 | no_ip_route_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 644 | "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] | 645 | NO_STR |
| 646 | IP_STR |
| 647 | "Establish static routes\n" |
| 648 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 649 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 650 | "IP gateway interface name\n" |
| 651 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 652 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 653 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL, |
| 654 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | ALIAS (no_ip_route, |
| 658 | no_ip_route_flags_cmd, |
| 659 | "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] | 660 | NO_STR |
| 661 | IP_STR |
| 662 | "Establish static routes\n" |
| 663 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 664 | "IP gateway address\n" |
| 665 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 666 | "Emit an ICMP unreachable when matched\n" |
| 667 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 668 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 669 | DEFUN (no_ip_route_flags2, |
| 670 | no_ip_route_flags2_cmd, |
| 671 | "no ip route A.B.C.D/M (reject|blackhole)", |
| 672 | NO_STR |
| 673 | IP_STR |
| 674 | "Establish static routes\n" |
| 675 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 676 | "Emit an ICMP unreachable when matched\n" |
| 677 | "Silently discard pkts when matched\n") |
| 678 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 679 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL, |
| 680 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 681 | } |
| 682 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 683 | DEFUN (no_ip_route_mask, |
| 684 | no_ip_route_mask_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 685 | "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] | 686 | NO_STR |
| 687 | IP_STR |
| 688 | "Establish static routes\n" |
| 689 | "IP destination prefix\n" |
| 690 | "IP destination prefix mask\n" |
| 691 | "IP gateway address\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 692 | "IP gateway interface name\n" |
| 693 | "Null interface\n") |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 694 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 695 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 696 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | ALIAS (no_ip_route_mask, |
| 700 | no_ip_route_mask_flags_cmd, |
| 701 | "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] | 702 | NO_STR |
| 703 | IP_STR |
| 704 | "Establish static routes\n" |
| 705 | "IP destination prefix\n" |
| 706 | "IP destination prefix mask\n" |
| 707 | "IP gateway address\n" |
| 708 | "IP gateway interface name\n" |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 709 | "Emit an ICMP unreachable when matched\n" |
| 710 | "Silently discard pkts when matched\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 711 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 712 | DEFUN (no_ip_route_mask_flags2, |
| 713 | no_ip_route_mask_flags2_cmd, |
| 714 | "no ip route A.B.C.D A.B.C.D (reject|blackhole)", |
| 715 | NO_STR |
| 716 | IP_STR |
| 717 | "Establish static routes\n" |
| 718 | "IP destination prefix\n" |
| 719 | "IP destination prefix mask\n" |
| 720 | "Emit an ICMP unreachable when matched\n" |
| 721 | "Silently discard pkts when matched\n") |
| 722 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 723 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 724 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 725 | } |
| 726 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 727 | DEFUN (no_ip_route_distance, |
| 728 | no_ip_route_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 729 | "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] | 730 | NO_STR |
| 731 | IP_STR |
| 732 | "Establish static routes\n" |
| 733 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 734 | "IP gateway address\n" |
| 735 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 736 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 737 | "Distance value for this route\n") |
| 738 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 739 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2], |
| 740 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 741 | } |
| 742 | |
| 743 | DEFUN (no_ip_route_flags_distance, |
| 744 | no_ip_route_flags_distance_cmd, |
| 745 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 746 | NO_STR |
| 747 | IP_STR |
| 748 | "Establish static routes\n" |
| 749 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 750 | "IP gateway address\n" |
| 751 | "IP gateway interface name\n" |
| 752 | "Emit an ICMP unreachable when matched\n" |
| 753 | "Silently discard pkts when matched\n" |
| 754 | "Distance value for this route\n") |
| 755 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 756 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3], |
| 757 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 758 | } |
| 759 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 760 | DEFUN (no_ip_route_flags_distance2, |
| 761 | no_ip_route_flags_distance2_cmd, |
| 762 | "no ip route A.B.C.D/M (reject|blackhole) <1-255>", |
| 763 | NO_STR |
| 764 | IP_STR |
| 765 | "Establish static routes\n" |
| 766 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 767 | "Emit an ICMP unreachable when matched\n" |
| 768 | "Silently discard pkts when matched\n" |
| 769 | "Distance value for this route\n") |
| 770 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 771 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2], |
| 772 | NULL); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 773 | } |
| 774 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 775 | DEFUN (no_ip_route_mask_distance, |
| 776 | no_ip_route_mask_distance_cmd, |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 777 | "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] | 778 | NO_STR |
| 779 | IP_STR |
| 780 | "Establish static routes\n" |
| 781 | "IP destination prefix\n" |
| 782 | "IP destination prefix mask\n" |
| 783 | "IP gateway address\n" |
| 784 | "IP gateway interface name\n" |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 785 | "Null interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 786 | "Distance value for this route\n") |
| 787 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 788 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 789 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | DEFUN (no_ip_route_mask_flags_distance, |
| 793 | no_ip_route_mask_flags_distance_cmd, |
| 794 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", |
| 795 | NO_STR |
| 796 | IP_STR |
| 797 | "Establish static routes\n" |
| 798 | "IP destination prefix\n" |
| 799 | "IP destination prefix mask\n" |
| 800 | "IP gateway address\n" |
| 801 | "IP gateway interface name\n" |
| 802 | "Emit an ICMP unreachable when matched\n" |
| 803 | "Silently discard pkts when matched\n" |
| 804 | "Distance value for this route\n") |
| 805 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 806 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 807 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 808 | } |
| 809 | |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 810 | DEFUN (no_ip_route_mask_flags_distance2, |
| 811 | no_ip_route_mask_flags_distance2_cmd, |
| 812 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", |
| 813 | NO_STR |
| 814 | IP_STR |
| 815 | "Establish static routes\n" |
| 816 | "IP destination prefix\n" |
| 817 | "IP destination prefix mask\n" |
| 818 | "Emit an ICMP unreachable when matched\n" |
| 819 | "Silently discard pkts when matched\n" |
| 820 | "Distance value for this route\n") |
| 821 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 822 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 823 | NULL); |
| 824 | } |
| 825 | |
| 826 | DEFUN (ip_route_vrf, |
| 827 | ip_route_vrf_cmd, |
| 828 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 829 | IP_STR |
| 830 | "Establish static routes\n" |
| 831 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 832 | "IP gateway address\n" |
| 833 | "IP gateway interface name\n" |
| 834 | "Null interface\n" |
| 835 | VRF_CMD_HELP_STR) |
| 836 | { |
| 837 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL, |
| 838 | argv[2]); |
| 839 | } |
| 840 | |
| 841 | DEFUN (ip_route_flags_vrf, |
| 842 | ip_route_flags_vrf_cmd, |
| 843 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " 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 | VRF_CMD_HELP_STR) |
| 852 | { |
| 853 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL, |
| 854 | argv[3]); |
| 855 | } |
| 856 | |
| 857 | DEFUN (ip_route_flags2_vrf, |
| 858 | ip_route_flags2_vrf_cmd, |
| 859 | "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, |
| 860 | IP_STR |
| 861 | "Establish static routes\n" |
| 862 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 863 | "Emit an ICMP unreachable when matched\n" |
| 864 | "Silently discard pkts when matched\n" |
| 865 | VRF_CMD_HELP_STR) |
| 866 | { |
| 867 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL, |
| 868 | argv[2]); |
| 869 | } |
| 870 | |
| 871 | /* Mask as A.B.C.D format. */ |
| 872 | DEFUN (ip_route_mask_vrf, |
| 873 | ip_route_mask_vrf_cmd, |
| 874 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 875 | IP_STR |
| 876 | "Establish static routes\n" |
| 877 | "IP destination prefix\n" |
| 878 | "IP destination prefix mask\n" |
| 879 | "IP gateway address\n" |
| 880 | "IP gateway interface name\n" |
| 881 | "Null interface\n" |
| 882 | VRF_CMD_HELP_STR) |
| 883 | { |
| 884 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 885 | argv[3]); |
| 886 | } |
| 887 | |
| 888 | DEFUN (ip_route_mask_flags_vrf, |
| 889 | ip_route_mask_flags_vrf_cmd, |
| 890 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 891 | IP_STR |
| 892 | "Establish static routes\n" |
| 893 | "IP destination prefix\n" |
| 894 | "IP destination prefix mask\n" |
| 895 | "IP gateway address\n" |
| 896 | "IP gateway interface name\n" |
| 897 | "Emit an ICMP unreachable when matched\n" |
| 898 | "Silently discard pkts when matched\n" |
| 899 | VRF_CMD_HELP_STR) |
| 900 | { |
| 901 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 902 | argv[4]); |
| 903 | } |
| 904 | |
| 905 | DEFUN (ip_route_mask_flags2_vrf, |
| 906 | ip_route_mask_flags2_vrf_cmd, |
| 907 | "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, |
| 908 | IP_STR |
| 909 | "Establish static routes\n" |
| 910 | "IP destination prefix\n" |
| 911 | "IP destination prefix mask\n" |
| 912 | "Emit an ICMP unreachable when matched\n" |
| 913 | "Silently discard pkts when matched\n" |
| 914 | VRF_CMD_HELP_STR) |
| 915 | { |
| 916 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 917 | argv[3]); |
| 918 | } |
| 919 | |
| 920 | /* Distance option value. */ |
| 921 | DEFUN (ip_route_distance_vrf, |
| 922 | ip_route_distance_vrf_cmd, |
| 923 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 924 | IP_STR |
| 925 | "Establish static routes\n" |
| 926 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 927 | "IP gateway address\n" |
| 928 | "IP gateway interface name\n" |
| 929 | "Null interface\n" |
| 930 | "Distance value for this route\n" |
| 931 | VRF_CMD_HELP_STR) |
| 932 | { |
| 933 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2], |
| 934 | argv[3]); |
| 935 | } |
| 936 | |
| 937 | DEFUN (ip_route_flags_distance_vrf, |
| 938 | ip_route_flags_distance_vrf_cmd, |
| 939 | "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 940 | IP_STR |
| 941 | "Establish static routes\n" |
| 942 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 943 | "IP gateway address\n" |
| 944 | "IP gateway interface name\n" |
| 945 | "Emit an ICMP unreachable when matched\n" |
| 946 | "Silently discard pkts when matched\n" |
| 947 | "Distance value for this route\n" |
| 948 | VRF_CMD_HELP_STR) |
| 949 | { |
| 950 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3], |
| 951 | argv[4]); |
| 952 | } |
| 953 | |
| 954 | DEFUN (ip_route_flags_distance2_vrf, |
| 955 | ip_route_flags_distance2_vrf_cmd, |
| 956 | "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 957 | IP_STR |
| 958 | "Establish static routes\n" |
| 959 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 960 | "Emit an ICMP unreachable when matched\n" |
| 961 | "Silently discard pkts when matched\n" |
| 962 | "Distance value for this route\n" |
| 963 | VRF_CMD_HELP_STR) |
| 964 | { |
| 965 | return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2], |
| 966 | argv[3]); |
| 967 | } |
| 968 | |
| 969 | DEFUN (ip_route_mask_distance_vrf, |
| 970 | ip_route_mask_distance_vrf_cmd, |
| 971 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 972 | IP_STR |
| 973 | "Establish static routes\n" |
| 974 | "IP destination prefix\n" |
| 975 | "IP destination prefix mask\n" |
| 976 | "IP gateway address\n" |
| 977 | "IP gateway interface name\n" |
| 978 | "Null interface\n" |
| 979 | "Distance value for this route\n" |
| 980 | VRF_CMD_HELP_STR) |
| 981 | { |
| 982 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 983 | argv[4]); |
| 984 | } |
| 985 | |
| 986 | DEFUN (ip_route_mask_flags_distance_vrf, |
| 987 | ip_route_mask_flags_distance_vrf_cmd, |
| 988 | "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 989 | IP_STR |
| 990 | "Establish static routes\n" |
| 991 | "IP destination prefix\n" |
| 992 | "IP destination prefix mask\n" |
| 993 | "IP gateway address\n" |
| 994 | "IP gateway interface name\n" |
| 995 | "Emit an ICMP unreachable when matched\n" |
| 996 | "Silently discard pkts when matched\n" |
| 997 | "Distance value for this route\n" |
| 998 | VRF_CMD_HELP_STR) |
| 999 | { |
| 1000 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 1001 | argv[5]); |
| 1002 | } |
| 1003 | |
| 1004 | DEFUN (ip_route_mask_flags_distance2_vrf, |
| 1005 | ip_route_mask_flags_distance2_vrf_cmd, |
| 1006 | "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1007 | IP_STR |
| 1008 | "Establish static routes\n" |
| 1009 | "IP destination prefix\n" |
| 1010 | "IP destination prefix mask\n" |
| 1011 | "Emit an ICMP unreachable when matched\n" |
| 1012 | "Silently discard pkts when matched\n" |
| 1013 | "Distance value for this route\n" |
| 1014 | VRF_CMD_HELP_STR) |
| 1015 | { |
| 1016 | return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 1017 | argv[4]); |
| 1018 | } |
| 1019 | |
| 1020 | DEFUN (no_ip_route_vrf, |
| 1021 | no_ip_route_vrf_cmd, |
| 1022 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1023 | NO_STR |
| 1024 | IP_STR |
| 1025 | "Establish static routes\n" |
| 1026 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1027 | "IP gateway address\n" |
| 1028 | "IP gateway interface name\n" |
| 1029 | "Null interface\n" |
| 1030 | VRF_CMD_HELP_STR) |
| 1031 | { |
| 1032 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL, |
| 1033 | (argc > 3) ? argv[3] : argv[2]); |
| 1034 | } |
| 1035 | |
| 1036 | ALIAS (no_ip_route_vrf, |
| 1037 | no_ip_route_flags_vrf_cmd, |
| 1038 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1039 | NO_STR |
| 1040 | IP_STR |
| 1041 | "Establish static routes\n" |
| 1042 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1043 | "IP gateway address\n" |
| 1044 | "IP gateway interface name\n" |
| 1045 | "Emit an ICMP unreachable when matched\n" |
| 1046 | "Silently discard pkts when matched\n" |
| 1047 | VRF_CMD_HELP_STR) |
| 1048 | |
| 1049 | DEFUN (no_ip_route_flags2_vrf, |
| 1050 | no_ip_route_flags2_vrf_cmd, |
| 1051 | "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, |
| 1052 | NO_STR |
| 1053 | IP_STR |
| 1054 | "Establish static routes\n" |
| 1055 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1056 | "Emit an ICMP unreachable when matched\n" |
| 1057 | "Silently discard pkts when matched\n" |
| 1058 | VRF_CMD_HELP_STR) |
| 1059 | { |
| 1060 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL, |
| 1061 | argv[2]); |
| 1062 | } |
| 1063 | |
| 1064 | DEFUN (no_ip_route_mask_vrf, |
| 1065 | no_ip_route_mask_vrf_cmd, |
| 1066 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, |
| 1067 | NO_STR |
| 1068 | IP_STR |
| 1069 | "Establish static routes\n" |
| 1070 | "IP destination prefix\n" |
| 1071 | "IP destination prefix mask\n" |
| 1072 | "IP gateway address\n" |
| 1073 | "IP gateway interface name\n" |
| 1074 | "Null interface\n" |
| 1075 | VRF_CMD_HELP_STR) |
| 1076 | { |
| 1077 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 1078 | (argc > 4) ? argv[4] : argv[3]); |
| 1079 | } |
| 1080 | |
| 1081 | ALIAS (no_ip_route_mask_vrf, |
| 1082 | no_ip_route_mask_flags_vrf_cmd, |
| 1083 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 1084 | NO_STR |
| 1085 | IP_STR |
| 1086 | "Establish static routes\n" |
| 1087 | "IP destination prefix\n" |
| 1088 | "IP destination prefix mask\n" |
| 1089 | "IP gateway address\n" |
| 1090 | "IP gateway interface name\n" |
| 1091 | "Emit an ICMP unreachable when matched\n" |
| 1092 | "Silently discard pkts when matched\n" |
| 1093 | VRF_CMD_HELP_STR) |
| 1094 | |
| 1095 | DEFUN (no_ip_route_mask_flags2_vrf, |
| 1096 | no_ip_route_mask_flags2_vrf_cmd, |
| 1097 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, |
| 1098 | NO_STR |
| 1099 | IP_STR |
| 1100 | "Establish static routes\n" |
| 1101 | "IP destination prefix\n" |
| 1102 | "IP destination prefix mask\n" |
| 1103 | "Emit an ICMP unreachable when matched\n" |
| 1104 | "Silently discard pkts when matched\n" |
| 1105 | VRF_CMD_HELP_STR) |
| 1106 | { |
| 1107 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 1108 | argv[2]); |
| 1109 | } |
| 1110 | |
| 1111 | DEFUN (no_ip_route_distance_vrf, |
| 1112 | no_ip_route_distance_vrf_cmd, |
| 1113 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1114 | NO_STR |
| 1115 | IP_STR |
| 1116 | "Establish static routes\n" |
| 1117 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1118 | "IP gateway address\n" |
| 1119 | "IP gateway interface name\n" |
| 1120 | "Null interface\n" |
| 1121 | "Distance value for this route\n" |
| 1122 | VRF_CMD_HELP_STR) |
| 1123 | { |
| 1124 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2], |
| 1125 | argv[3]); |
| 1126 | } |
| 1127 | |
| 1128 | DEFUN (no_ip_route_flags_distance_vrf, |
| 1129 | no_ip_route_flags_distance_vrf_cmd, |
| 1130 | "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1131 | NO_STR |
| 1132 | IP_STR |
| 1133 | "Establish static routes\n" |
| 1134 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1135 | "IP gateway address\n" |
| 1136 | "IP gateway interface name\n" |
| 1137 | "Emit an ICMP unreachable when matched\n" |
| 1138 | "Silently discard pkts when matched\n" |
| 1139 | "Distance value for this route\n" |
| 1140 | VRF_CMD_HELP_STR) |
| 1141 | { |
| 1142 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3], |
| 1143 | argv[4]); |
| 1144 | } |
| 1145 | |
| 1146 | DEFUN (no_ip_route_flags_distance2_vrf, |
| 1147 | no_ip_route_flags_distance2_vrf_cmd, |
| 1148 | "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1149 | NO_STR |
| 1150 | IP_STR |
| 1151 | "Establish static routes\n" |
| 1152 | "IP destination prefix (e.g. 10.0.0.0/8)\n" |
| 1153 | "Emit an ICMP unreachable when matched\n" |
| 1154 | "Silently discard pkts when matched\n" |
| 1155 | "Distance value for this route\n" |
| 1156 | VRF_CMD_HELP_STR) |
| 1157 | { |
| 1158 | return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2], |
| 1159 | argv[3]); |
| 1160 | } |
| 1161 | |
| 1162 | DEFUN (no_ip_route_mask_distance_vrf, |
| 1163 | no_ip_route_mask_distance_vrf_cmd, |
| 1164 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, |
| 1165 | NO_STR |
| 1166 | IP_STR |
| 1167 | "Establish static routes\n" |
| 1168 | "IP destination prefix\n" |
| 1169 | "IP destination prefix mask\n" |
| 1170 | "IP gateway address\n" |
| 1171 | "IP gateway interface name\n" |
| 1172 | "Null interface\n" |
| 1173 | "Distance value for this route\n" |
| 1174 | VRF_CMD_HELP_STR) |
| 1175 | { |
| 1176 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 1177 | argv[4]); |
| 1178 | } |
| 1179 | |
| 1180 | DEFUN (no_ip_route_mask_flags_distance_vrf, |
| 1181 | no_ip_route_mask_flags_distance_vrf_cmd, |
| 1182 | "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1183 | NO_STR |
| 1184 | IP_STR |
| 1185 | "Establish static routes\n" |
| 1186 | "IP destination prefix\n" |
| 1187 | "IP destination prefix mask\n" |
| 1188 | "IP gateway address\n" |
| 1189 | "IP gateway interface name\n" |
| 1190 | "Emit an ICMP unreachable when matched\n" |
| 1191 | "Silently discard pkts when matched\n" |
| 1192 | "Distance value for this route\n" |
| 1193 | VRF_CMD_HELP_STR) |
| 1194 | { |
| 1195 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 1196 | argv[5]); |
| 1197 | } |
| 1198 | |
| 1199 | DEFUN (no_ip_route_mask_flags_distance2_vrf, |
| 1200 | no_ip_route_mask_flags_distance2_vrf_cmd, |
| 1201 | "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 1202 | NO_STR |
| 1203 | IP_STR |
| 1204 | "Establish static routes\n" |
| 1205 | "IP destination prefix\n" |
| 1206 | "IP destination prefix mask\n" |
| 1207 | "Emit an ICMP unreachable when matched\n" |
| 1208 | "Silently discard pkts when matched\n" |
| 1209 | "Distance value for this route\n" |
| 1210 | VRF_CMD_HELP_STR) |
| 1211 | { |
| 1212 | return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 1213 | argv[4]); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 1214 | } |
| 1215 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1216 | char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1]; /* "any" == ZEBRA_ROUTE_MAX */ |
| 1217 | |
| 1218 | DEFUN (ip_protocol, |
| 1219 | ip_protocol_cmd, |
| 1220 | "ip protocol PROTO route-map ROUTE-MAP", |
| 1221 | NO_STR |
| 1222 | "Apply route map to PROTO\n" |
| 1223 | "Protocol name\n" |
| 1224 | "Route map name\n") |
| 1225 | { |
| 1226 | int i; |
| 1227 | |
| 1228 | if (strcasecmp(argv[0], "any") == 0) |
| 1229 | i = ZEBRA_ROUTE_MAX; |
| 1230 | else |
| 1231 | i = proto_name2num(argv[0]); |
| 1232 | if (i < 0) |
| 1233 | { |
| 1234 | vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", |
| 1235 | VTY_NEWLINE); |
| 1236 | return CMD_WARNING; |
| 1237 | } |
| 1238 | if (proto_rm[AFI_IP][i]) |
| 1239 | XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); |
| 1240 | proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); |
| 1241 | return CMD_SUCCESS; |
| 1242 | } |
| 1243 | |
| 1244 | DEFUN (no_ip_protocol, |
| 1245 | no_ip_protocol_cmd, |
| 1246 | "no ip protocol PROTO", |
| 1247 | NO_STR |
| 1248 | "Remove route map from PROTO\n" |
| 1249 | "Protocol name\n") |
| 1250 | { |
| 1251 | int i; |
| 1252 | |
| 1253 | if (strcasecmp(argv[0], "any") == 0) |
| 1254 | i = ZEBRA_ROUTE_MAX; |
| 1255 | else |
| 1256 | i = proto_name2num(argv[0]); |
| 1257 | if (i < 0) |
| 1258 | { |
| 1259 | vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", |
| 1260 | VTY_NEWLINE); |
| 1261 | return CMD_WARNING; |
| 1262 | } |
| 1263 | if (proto_rm[AFI_IP][i]) |
| 1264 | XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); |
| 1265 | proto_rm[AFI_IP][i] = NULL; |
| 1266 | return CMD_SUCCESS; |
| 1267 | } |
| 1268 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1269 | /* New RIB. Detailed information for IPv4 route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 1270 | static void |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1271 | 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] | 1272 | { |
| 1273 | struct rib *rib; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1274 | struct nexthop *nexthop, *tnexthop; |
| 1275 | int recursing; |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1276 | char buf[PREFIX_STRLEN]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1277 | |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1278 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1279 | { |
David Lamparter | b7cce95 | 2015-03-07 08:40:48 +0100 | [diff] [blame] | 1280 | const char *mcast_info = ""; |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1281 | if (mcast) |
| 1282 | { |
| 1283 | rib_table_info_t *info = rn->table->info; |
| 1284 | mcast_info = (info->safi == SAFI_MULTICAST) |
| 1285 | ? " using Multicast RIB" |
| 1286 | : " using Unicast RIB"; |
| 1287 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1288 | vty_out (vty, "Routing entry for %s%s%s", |
| 1289 | prefix2str (&rn->p, buf, sizeof(buf)), mcast_info, |
| 1290 | VTY_NEWLINE); |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 1291 | vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 1292 | vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1293 | vty_out (vty, ", vrf %u", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1294 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1295 | vty_out (vty, ", best"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1296 | if (rib->refcnt) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1297 | vty_out (vty, ", refcnt %ld", rib->refcnt); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1298 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 1299 | vty_out (vty, ", blackhole"); |
| 1300 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 1301 | vty_out (vty, ", reject"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1302 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1303 | |
| 1304 | #define ONE_DAY_SECOND 60*60*24 |
| 1305 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 1306 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1307 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 1308 | || rib->type == ZEBRA_ROUTE_OSPF |
| 1309 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 1310 | || rib->type == ZEBRA_ROUTE_BABEL |
| 1311 | || rib->type == ZEBRA_ROUTE_ISIS |
| 1312 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1313 | { |
| 1314 | time_t uptime; |
| 1315 | struct tm *tm; |
| 1316 | |
| 1317 | uptime = time (NULL); |
| 1318 | uptime -= rib->uptime; |
| 1319 | tm = gmtime (&uptime); |
| 1320 | |
| 1321 | vty_out (vty, " Last update "); |
| 1322 | |
| 1323 | if (uptime < ONE_DAY_SECOND) |
| 1324 | vty_out (vty, "%02d:%02d:%02d", |
| 1325 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 1326 | else if (uptime < ONE_WEEK_SECOND) |
| 1327 | vty_out (vty, "%dd%02dh%02dm", |
| 1328 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 1329 | else |
| 1330 | vty_out (vty, "%02dw%dd%02dh", |
| 1331 | tm->tm_yday/7, |
| 1332 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 1333 | vty_out (vty, " ago%s", VTY_NEWLINE); |
| 1334 | } |
| 1335 | |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1336 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1337 | { |
| 1338 | vty_out (vty, " %c%s", |
| 1339 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ', |
| 1340 | recursing ? " " : ""); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1341 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1342 | switch (nexthop->type) |
| 1343 | { |
| 1344 | case NEXTHOP_TYPE_IPV4: |
| 1345 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1346 | vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4)); |
| 1347 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1348 | vty_out (vty, ", via %s", |
| 1349 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1350 | break; |
| 1351 | case NEXTHOP_TYPE_IPV6: |
| 1352 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1353 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1354 | vty_out (vty, " %s", |
| 1355 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf))); |
| 1356 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 1357 | vty_out (vty, ", %s", nexthop->ifname); |
| 1358 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1359 | vty_out (vty, ", via %s", |
| 1360 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1361 | break; |
| 1362 | case NEXTHOP_TYPE_IFINDEX: |
| 1363 | vty_out (vty, " directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1364 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1365 | break; |
| 1366 | case NEXTHOP_TYPE_IFNAME: |
| 1367 | vty_out (vty, " directly connected, %s", nexthop->ifname); |
| 1368 | break; |
| 1369 | case NEXTHOP_TYPE_BLACKHOLE: |
| 1370 | vty_out (vty, " directly connected, Null0"); |
| 1371 | break; |
| 1372 | default: |
| 1373 | break; |
| 1374 | } |
| 1375 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
| 1376 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1377 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1378 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
| 1379 | vty_out (vty, " onlink"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1380 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1381 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
| 1382 | vty_out (vty, " (recursive)"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1383 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1384 | switch (nexthop->type) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1385 | { |
| 1386 | case NEXTHOP_TYPE_IPV4: |
| 1387 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1388 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 1389 | if (nexthop->src.ipv4.s_addr) |
| 1390 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1391 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
| 1392 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1393 | } |
| 1394 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1395 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1396 | case NEXTHOP_TYPE_IPV6: |
| 1397 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1398 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1399 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 1400 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1401 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
| 1402 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1403 | } |
| 1404 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1405 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1406 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1407 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1408 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1409 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1410 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1411 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1412 | } |
| 1413 | } |
| 1414 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 1415 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1416 | vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib) |
| 1417 | { |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1418 | struct nexthop *nexthop, *tnexthop; |
| 1419 | int recursing; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1420 | int len = 0; |
| 1421 | char buf[BUFSIZ]; |
| 1422 | |
| 1423 | /* Nexthop information. */ |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1424 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1425 | { |
| 1426 | if (nexthop == rib->nexthop) |
| 1427 | { |
| 1428 | /* Prefix information. */ |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1429 | len = vty_out (vty, "%c%c%c %s", |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 1430 | zebra_route_char (rib->type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1431 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) |
| 1432 | ? '>' : ' ', |
| 1433 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1434 | ? '*' : ' ', |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1435 | prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1436 | |
| 1437 | /* Distance and metric display. */ |
| 1438 | if (rib->type != ZEBRA_ROUTE_CONNECT |
| 1439 | && rib->type != ZEBRA_ROUTE_KERNEL) |
| 1440 | len += vty_out (vty, " [%d/%d]", rib->distance, |
| 1441 | rib->metric); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1442 | |
| 1443 | if (rib->vrf_id != VRF_DEFAULT) |
| 1444 | len += vty_out (vty, " [vrf %u]", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1445 | } |
| 1446 | else |
| 1447 | vty_out (vty, " %c%*c", |
| 1448 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1449 | ? '*' : ' ', |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1450 | len - 3 + (2 * recursing), ' '); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1451 | |
| 1452 | switch (nexthop->type) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1453 | { |
| 1454 | case NEXTHOP_TYPE_IPV4: |
| 1455 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1456 | vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4)); |
| 1457 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1458 | vty_out (vty, ", %s", |
| 1459 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1460 | break; |
| 1461 | case NEXTHOP_TYPE_IPV6: |
| 1462 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1463 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1464 | vty_out (vty, " via %s", |
| 1465 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ)); |
| 1466 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 1467 | vty_out (vty, ", %s", nexthop->ifname); |
| 1468 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1469 | vty_out (vty, ", %s", |
| 1470 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1471 | break; |
| 1472 | case NEXTHOP_TYPE_IFINDEX: |
| 1473 | vty_out (vty, " is directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1474 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1475 | break; |
| 1476 | case NEXTHOP_TYPE_IFNAME: |
| 1477 | vty_out (vty, " is directly connected, %s", nexthop->ifname); |
| 1478 | break; |
| 1479 | case NEXTHOP_TYPE_BLACKHOLE: |
| 1480 | vty_out (vty, " is directly connected, Null0"); |
| 1481 | break; |
| 1482 | default: |
| 1483 | break; |
| 1484 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1485 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1486 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1487 | |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1488 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1489 | vty_out (vty, " onlink"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1490 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1491 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1492 | vty_out (vty, " (recursive)"); |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1493 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1494 | switch (nexthop->type) |
| 1495 | { |
| 1496 | case NEXTHOP_TYPE_IPV4: |
| 1497 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1498 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 1499 | if (nexthop->src.ipv4.s_addr) |
| 1500 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1501 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1502 | vty_out (vty, ", src %s", buf); |
| 1503 | } |
| 1504 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1505 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1506 | case NEXTHOP_TYPE_IPV6: |
| 1507 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1508 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1509 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 1510 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1511 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1512 | vty_out (vty, ", src %s", buf); |
| 1513 | } |
| 1514 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1515 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1516 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1517 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1518 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1519 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1520 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 1521 | vty_out (vty, ", bh"); |
| 1522 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 1523 | vty_out (vty, ", rej"); |
| 1524 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1525 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1526 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 1527 | || rib->type == ZEBRA_ROUTE_OSPF |
| 1528 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 1529 | || rib->type == ZEBRA_ROUTE_BABEL |
| 1530 | || rib->type == ZEBRA_ROUTE_ISIS |
| 1531 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1532 | { |
| 1533 | time_t uptime; |
| 1534 | struct tm *tm; |
| 1535 | |
| 1536 | uptime = time (NULL); |
| 1537 | uptime -= rib->uptime; |
| 1538 | tm = gmtime (&uptime); |
| 1539 | |
| 1540 | #define ONE_DAY_SECOND 60*60*24 |
| 1541 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 1542 | |
| 1543 | if (uptime < ONE_DAY_SECOND) |
| 1544 | vty_out (vty, ", %02d:%02d:%02d", |
| 1545 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 1546 | else if (uptime < ONE_WEEK_SECOND) |
| 1547 | vty_out (vty, ", %dd%02dh%02dm", |
| 1548 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 1549 | else |
| 1550 | vty_out (vty, ", %02dw%dd%02dh", |
| 1551 | tm->tm_yday/7, |
| 1552 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 1553 | } |
| 1554 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1555 | } |
| 1556 | } |
| 1557 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1558 | DEFUN (show_ip_route, |
| 1559 | show_ip_route_cmd, |
| 1560 | "show ip route", |
| 1561 | SHOW_STR |
| 1562 | IP_STR |
| 1563 | "IP routing table\n") |
| 1564 | { |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1565 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 1566 | |
| 1567 | if (argc > 0) |
| 1568 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 1569 | |
| 1570 | return do_show_ip_route(vty, SAFI_UNICAST, vrf_id); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 1571 | } |
| 1572 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1573 | static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id) |
| 1574 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1575 | struct route_table *table; |
| 1576 | struct route_node *rn; |
| 1577 | struct rib *rib; |
| 1578 | int first = 1; |
| 1579 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1580 | table = zebra_vrf_table (AFI_IP, safi, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1581 | if (! table) |
| 1582 | return CMD_SUCCESS; |
| 1583 | |
| 1584 | /* Show all IPv4 routes. */ |
| 1585 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1586 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1587 | { |
| 1588 | if (first) |
| 1589 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1590 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1591 | first = 0; |
| 1592 | } |
| 1593 | vty_show_ip_route (vty, rn, rib); |
| 1594 | } |
| 1595 | return CMD_SUCCESS; |
| 1596 | } |
| 1597 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1598 | ALIAS (show_ip_route, |
| 1599 | show_ip_route_vrf_cmd, |
| 1600 | "show ip route " VRF_CMD_STR, |
| 1601 | SHOW_STR |
| 1602 | IP_STR |
| 1603 | "IP routing table\n" |
| 1604 | VRF_CMD_HELP_STR) |
| 1605 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1606 | DEFUN (show_ip_route_prefix_longer, |
| 1607 | show_ip_route_prefix_longer_cmd, |
| 1608 | "show ip route A.B.C.D/M longer-prefixes", |
| 1609 | SHOW_STR |
| 1610 | IP_STR |
| 1611 | "IP routing table\n" |
| 1612 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1613 | "Show route matching the specified Network/Mask pair only\n") |
| 1614 | { |
| 1615 | struct route_table *table; |
| 1616 | struct route_node *rn; |
| 1617 | struct rib *rib; |
| 1618 | struct prefix p; |
| 1619 | int ret; |
| 1620 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1621 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1622 | |
| 1623 | ret = str2prefix (argv[0], &p); |
| 1624 | if (! ret) |
| 1625 | { |
| 1626 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 1627 | return CMD_WARNING; |
| 1628 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1629 | |
| 1630 | if (argc > 1) |
| 1631 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1632 | |
| 1633 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1634 | if (! table) |
| 1635 | return CMD_SUCCESS; |
| 1636 | |
| 1637 | /* Show matched type IPv4 routes. */ |
| 1638 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1639 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1640 | if (prefix_match (&p, &rn->p)) |
| 1641 | { |
| 1642 | if (first) |
| 1643 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1644 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1645 | first = 0; |
| 1646 | } |
| 1647 | vty_show_ip_route (vty, rn, rib); |
| 1648 | } |
| 1649 | return CMD_SUCCESS; |
| 1650 | } |
| 1651 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1652 | ALIAS (show_ip_route_prefix_longer, |
| 1653 | show_ip_route_prefix_longer_vrf_cmd, |
| 1654 | "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR, |
| 1655 | SHOW_STR |
| 1656 | IP_STR |
| 1657 | "IP routing table\n" |
| 1658 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1659 | "Show route matching the specified Network/Mask pair only\n" |
| 1660 | VRF_CMD_HELP_STR) |
| 1661 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1662 | DEFUN (show_ip_route_supernets, |
| 1663 | show_ip_route_supernets_cmd, |
| 1664 | "show ip route supernets-only", |
| 1665 | SHOW_STR |
| 1666 | IP_STR |
| 1667 | "IP routing table\n" |
| 1668 | "Show supernet entries only\n") |
| 1669 | { |
| 1670 | struct route_table *table; |
| 1671 | struct route_node *rn; |
| 1672 | struct rib *rib; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1673 | u_int32_t addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1674 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1675 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1676 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1677 | if (argc > 0) |
| 1678 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 1679 | |
| 1680 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1681 | if (! table) |
| 1682 | return CMD_SUCCESS; |
| 1683 | |
| 1684 | /* Show matched type IPv4 routes. */ |
| 1685 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1686 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1687 | { |
| 1688 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 1689 | |
| 1690 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 1691 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1692 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1693 | { |
| 1694 | if (first) |
| 1695 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1696 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1697 | first = 0; |
| 1698 | } |
| 1699 | vty_show_ip_route (vty, rn, rib); |
| 1700 | } |
| 1701 | } |
| 1702 | return CMD_SUCCESS; |
| 1703 | } |
| 1704 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1705 | ALIAS (show_ip_route_supernets, |
| 1706 | show_ip_route_supernets_vrf_cmd, |
| 1707 | "show ip route supernets-only " VRF_CMD_STR, |
| 1708 | SHOW_STR |
| 1709 | IP_STR |
| 1710 | "IP routing table\n" |
| 1711 | "Show supernet entries only\n" |
| 1712 | VRF_CMD_HELP_STR) |
| 1713 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1714 | DEFUN (show_ip_route_protocol, |
| 1715 | show_ip_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1716 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1717 | SHOW_STR |
| 1718 | IP_STR |
| 1719 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1720 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1721 | { |
| 1722 | int type; |
| 1723 | struct route_table *table; |
| 1724 | struct route_node *rn; |
| 1725 | struct rib *rib; |
| 1726 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1727 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1728 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1729 | type = proto_redistnum (AFI_IP, argv[0]); |
| 1730 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1731 | { |
| 1732 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 1733 | return CMD_WARNING; |
| 1734 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1735 | |
| 1736 | if (argc > 1) |
| 1737 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1738 | |
| 1739 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1740 | if (! table) |
| 1741 | return CMD_SUCCESS; |
| 1742 | |
| 1743 | /* Show matched type IPv4 routes. */ |
| 1744 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1745 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1746 | if (rib->type == type) |
| 1747 | { |
| 1748 | if (first) |
| 1749 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1750 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1751 | first = 0; |
| 1752 | } |
| 1753 | vty_show_ip_route (vty, rn, rib); |
| 1754 | } |
| 1755 | return CMD_SUCCESS; |
| 1756 | } |
| 1757 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1758 | ALIAS (show_ip_route_protocol, |
| 1759 | show_ip_route_protocol_vrf_cmd, |
| 1760 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 1761 | SHOW_STR |
| 1762 | IP_STR |
| 1763 | "IP routing table\n" |
| 1764 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 1765 | VRF_CMD_HELP_STR) |
| 1766 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1767 | DEFUN (show_ip_route_addr, |
| 1768 | show_ip_route_addr_cmd, |
| 1769 | "show ip route A.B.C.D", |
| 1770 | SHOW_STR |
| 1771 | IP_STR |
| 1772 | "IP routing table\n" |
| 1773 | "Network in the IP routing table to display\n") |
| 1774 | { |
| 1775 | int ret; |
| 1776 | struct prefix_ipv4 p; |
| 1777 | struct route_table *table; |
| 1778 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1779 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1780 | |
| 1781 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1782 | if (ret <= 0) |
| 1783 | { |
| 1784 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 1785 | return CMD_WARNING; |
| 1786 | } |
| 1787 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1788 | if (argc > 1) |
| 1789 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1790 | |
| 1791 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1792 | if (! table) |
| 1793 | return CMD_SUCCESS; |
| 1794 | |
| 1795 | rn = route_node_match (table, (struct prefix *) &p); |
| 1796 | if (! rn) |
| 1797 | { |
| 1798 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 1799 | return CMD_WARNING; |
| 1800 | } |
| 1801 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1802 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1803 | |
| 1804 | route_unlock_node (rn); |
| 1805 | |
| 1806 | return CMD_SUCCESS; |
| 1807 | } |
| 1808 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1809 | ALIAS (show_ip_route_addr, |
| 1810 | show_ip_route_addr_vrf_cmd, |
| 1811 | "show ip route A.B.C.D " VRF_CMD_STR, |
| 1812 | SHOW_STR |
| 1813 | IP_STR |
| 1814 | "IP routing table\n" |
| 1815 | "Network in the IP routing table to display\n" |
| 1816 | VRF_CMD_HELP_STR) |
| 1817 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1818 | DEFUN (show_ip_route_prefix, |
| 1819 | show_ip_route_prefix_cmd, |
| 1820 | "show ip route A.B.C.D/M", |
| 1821 | SHOW_STR |
| 1822 | IP_STR |
| 1823 | "IP routing table\n" |
| 1824 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") |
| 1825 | { |
| 1826 | int ret; |
| 1827 | struct prefix_ipv4 p; |
| 1828 | struct route_table *table; |
| 1829 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1830 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1831 | |
| 1832 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1833 | if (ret <= 0) |
| 1834 | { |
| 1835 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 1836 | return CMD_WARNING; |
| 1837 | } |
| 1838 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1839 | if (argc > 1) |
| 1840 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1841 | |
| 1842 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1843 | if (! table) |
| 1844 | return CMD_SUCCESS; |
| 1845 | |
| 1846 | rn = route_node_match (table, (struct prefix *) &p); |
| 1847 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 1848 | { |
| 1849 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 1850 | if (rn) |
| 1851 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1852 | return CMD_WARNING; |
| 1853 | } |
| 1854 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1855 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1856 | |
| 1857 | route_unlock_node (rn); |
| 1858 | |
| 1859 | return CMD_SUCCESS; |
| 1860 | } |
| 1861 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1862 | ALIAS (show_ip_route_prefix, |
| 1863 | show_ip_route_prefix_vrf_cmd, |
| 1864 | "show ip route A.B.C.D/M " VRF_CMD_STR, |
| 1865 | SHOW_STR |
| 1866 | IP_STR |
| 1867 | "IP routing table\n" |
| 1868 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1869 | VRF_CMD_HELP_STR) |
| 1870 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 1871 | static void |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1872 | vty_show_ip_route_summary (struct vty *vty, struct route_table *table) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1873 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1874 | struct route_node *rn; |
| 1875 | struct rib *rib; |
| 1876 | struct nexthop *nexthop; |
| 1877 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 1878 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 1879 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1880 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1881 | u_int32_t i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1882 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1883 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 1884 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 1885 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1886 | RNODE_FOREACH_RIB (rn, rib) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1887 | for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) |
| 1888 | { |
| 1889 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1890 | rib_cnt[rib->type]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1891 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1892 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1893 | { |
| 1894 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1895 | fib_cnt[rib->type]++; |
| 1896 | } |
| 1897 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 1898 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 1899 | { |
| 1900 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1901 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1902 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1903 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1904 | } |
| 1905 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1906 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1907 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 1908 | "Route Source", "Routes", "FIB", |
| 1909 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 1910 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1911 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1912 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 1913 | { |
| 1914 | if (rib_cnt[i] > 0) |
| 1915 | { |
| 1916 | if (i == ZEBRA_ROUTE_BGP) |
| 1917 | { |
| 1918 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 1919 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 1920 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 1921 | VTY_NEWLINE); |
| 1922 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 1923 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 1924 | VTY_NEWLINE); |
| 1925 | } |
| 1926 | else |
| 1927 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 1928 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 1929 | } |
| 1930 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1931 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1932 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 1933 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 1934 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1935 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1936 | } |
| 1937 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 1938 | /* |
| 1939 | * Implementation of the ip route summary prefix command. |
| 1940 | * |
| 1941 | * This command prints the primary prefixes that have been installed by various |
| 1942 | * protocols on the box. |
| 1943 | * |
| 1944 | */ |
| 1945 | static void |
| 1946 | vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) |
| 1947 | { |
| 1948 | struct route_node *rn; |
| 1949 | struct rib *rib; |
| 1950 | struct nexthop *nexthop; |
| 1951 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 1952 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 1953 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1954 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1955 | u_int32_t i; |
| 1956 | int cnt; |
| 1957 | |
| 1958 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 1959 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 1960 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 1961 | RNODE_FOREACH_RIB (rn, rib) |
| 1962 | { |
| 1963 | |
| 1964 | /* |
| 1965 | * In case of ECMP, count only once. |
| 1966 | */ |
| 1967 | cnt = 0; |
| 1968 | for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next) |
| 1969 | { |
| 1970 | cnt++; |
| 1971 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1972 | rib_cnt[rib->type]++; |
| 1973 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 1974 | { |
| 1975 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1976 | fib_cnt[rib->type]++; |
| 1977 | } |
| 1978 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 1979 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 1980 | { |
| 1981 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1982 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 1983 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1984 | } |
| 1985 | } |
| 1986 | } |
| 1987 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1988 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 1989 | "Route Source", "Prefix Routes", "FIB", |
| 1990 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 1991 | VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 1992 | |
| 1993 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 1994 | { |
| 1995 | if (rib_cnt[i] > 0) |
| 1996 | { |
| 1997 | if (i == ZEBRA_ROUTE_BGP) |
| 1998 | { |
| 1999 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 2000 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 2001 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2002 | VTY_NEWLINE); |
| 2003 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 2004 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2005 | VTY_NEWLINE); |
| 2006 | } |
| 2007 | else |
| 2008 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 2009 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 2010 | } |
| 2011 | } |
| 2012 | |
| 2013 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 2014 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 2015 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2016 | vty_out (vty, "%s", VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2017 | } |
| 2018 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2019 | /* Show route summary. */ |
| 2020 | DEFUN (show_ip_route_summary, |
| 2021 | show_ip_route_summary_cmd, |
| 2022 | "show ip route summary", |
| 2023 | SHOW_STR |
| 2024 | IP_STR |
| 2025 | "IP routing table\n" |
| 2026 | "Summary of all routes\n") |
| 2027 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2028 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2029 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2030 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2031 | if (argc > 0) |
| 2032 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2033 | |
| 2034 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2035 | if (! table) |
| 2036 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2037 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2038 | vty_show_ip_route_summary (vty, table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2039 | |
| 2040 | return CMD_SUCCESS; |
| 2041 | } |
| 2042 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2043 | ALIAS (show_ip_route_summary, |
| 2044 | show_ip_route_summary_vrf_cmd, |
| 2045 | "show ip route summary " VRF_CMD_STR, |
| 2046 | SHOW_STR |
| 2047 | IP_STR |
| 2048 | "IP routing table\n" |
| 2049 | "Summary of all routes\n" |
| 2050 | VRF_CMD_HELP_STR) |
| 2051 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2052 | /* Show route summary prefix. */ |
| 2053 | DEFUN (show_ip_route_summary_prefix, |
| 2054 | show_ip_route_summary_prefix_cmd, |
| 2055 | "show ip route summary prefix", |
| 2056 | SHOW_STR |
| 2057 | IP_STR |
| 2058 | "IP routing table\n" |
| 2059 | "Summary of all routes\n" |
| 2060 | "Prefix routes\n") |
| 2061 | { |
| 2062 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2063 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2064 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2065 | if (argc > 0) |
| 2066 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2067 | |
| 2068 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2069 | if (! table) |
| 2070 | return CMD_SUCCESS; |
| 2071 | |
| 2072 | vty_show_ip_route_summary_prefix (vty, table); |
| 2073 | |
| 2074 | return CMD_SUCCESS; |
| 2075 | } |
| 2076 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2077 | ALIAS (show_ip_route_summary_prefix, |
| 2078 | show_ip_route_summary_prefix_vrf_cmd, |
| 2079 | "show ip route summary prefix " VRF_CMD_STR, |
| 2080 | SHOW_STR |
| 2081 | IP_STR |
| 2082 | "IP routing table\n" |
| 2083 | "Summary of all routes\n" |
| 2084 | "Prefix routes\n" |
| 2085 | VRF_CMD_HELP_STR) |
| 2086 | |
| 2087 | DEFUN (show_ip_route_vrf_all, |
| 2088 | show_ip_route_vrf_all_cmd, |
| 2089 | "show ip route " VRF_ALL_CMD_STR, |
| 2090 | SHOW_STR |
| 2091 | IP_STR |
| 2092 | "IP routing table\n" |
| 2093 | VRF_ALL_CMD_HELP_STR) |
| 2094 | { |
| 2095 | struct route_table *table; |
| 2096 | struct route_node *rn; |
| 2097 | struct rib *rib; |
| 2098 | struct zebra_vrf *zvrf; |
| 2099 | vrf_iter_t iter; |
| 2100 | int first = 1; |
| 2101 | |
| 2102 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2103 | { |
| 2104 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2105 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2106 | continue; |
| 2107 | |
| 2108 | /* Show all IPv4 routes. */ |
| 2109 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2110 | RNODE_FOREACH_RIB (rn, rib) |
| 2111 | { |
| 2112 | if (first) |
| 2113 | { |
| 2114 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2115 | first = 0; |
| 2116 | } |
| 2117 | vty_show_ip_route (vty, rn, rib); |
| 2118 | } |
| 2119 | } |
| 2120 | |
| 2121 | return CMD_SUCCESS; |
| 2122 | } |
| 2123 | |
| 2124 | DEFUN (show_ip_route_prefix_longer_vrf_all, |
| 2125 | show_ip_route_prefix_longer_vrf_all_cmd, |
| 2126 | "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR, |
| 2127 | SHOW_STR |
| 2128 | IP_STR |
| 2129 | "IP routing table\n" |
| 2130 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2131 | "Show route matching the specified Network/Mask pair only\n" |
| 2132 | VRF_ALL_CMD_HELP_STR) |
| 2133 | { |
| 2134 | struct route_table *table; |
| 2135 | struct route_node *rn; |
| 2136 | struct rib *rib; |
| 2137 | struct prefix p; |
| 2138 | struct zebra_vrf *zvrf; |
| 2139 | vrf_iter_t iter; |
| 2140 | int ret; |
| 2141 | int first = 1; |
| 2142 | |
| 2143 | ret = str2prefix (argv[0], &p); |
| 2144 | if (! ret) |
| 2145 | { |
| 2146 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 2147 | return CMD_WARNING; |
| 2148 | } |
| 2149 | |
| 2150 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2151 | { |
| 2152 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2153 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2154 | continue; |
| 2155 | |
| 2156 | /* Show matched type IPv4 routes. */ |
| 2157 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2158 | RNODE_FOREACH_RIB (rn, rib) |
| 2159 | if (prefix_match (&p, &rn->p)) |
| 2160 | { |
| 2161 | if (first) |
| 2162 | { |
| 2163 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2164 | first = 0; |
| 2165 | } |
| 2166 | vty_show_ip_route (vty, rn, rib); |
| 2167 | } |
| 2168 | } |
| 2169 | |
| 2170 | return CMD_SUCCESS; |
| 2171 | } |
| 2172 | |
| 2173 | DEFUN (show_ip_route_supernets_vrf_all, |
| 2174 | show_ip_route_supernets_vrf_all_cmd, |
| 2175 | "show ip route supernets-only " VRF_ALL_CMD_STR, |
| 2176 | SHOW_STR |
| 2177 | IP_STR |
| 2178 | "IP routing table\n" |
| 2179 | "Show supernet entries only\n" |
| 2180 | VRF_ALL_CMD_HELP_STR) |
| 2181 | { |
| 2182 | struct route_table *table; |
| 2183 | struct route_node *rn; |
| 2184 | struct rib *rib; |
| 2185 | struct zebra_vrf *zvrf; |
| 2186 | vrf_iter_t iter; |
| 2187 | u_int32_t addr; |
| 2188 | int first = 1; |
| 2189 | |
| 2190 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2191 | { |
| 2192 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2193 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2194 | continue; |
| 2195 | |
| 2196 | /* Show matched type IPv4 routes. */ |
| 2197 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2198 | RNODE_FOREACH_RIB (rn, rib) |
| 2199 | { |
| 2200 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 2201 | |
| 2202 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 2203 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
| 2204 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
| 2205 | { |
| 2206 | if (first) |
| 2207 | { |
| 2208 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2209 | first = 0; |
| 2210 | } |
| 2211 | vty_show_ip_route (vty, rn, rib); |
| 2212 | } |
| 2213 | } |
| 2214 | } |
| 2215 | |
| 2216 | return CMD_SUCCESS; |
| 2217 | } |
| 2218 | |
| 2219 | DEFUN (show_ip_route_protocol_vrf_all, |
| 2220 | show_ip_route_protocol_vrf_all_cmd, |
| 2221 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 2222 | SHOW_STR |
| 2223 | IP_STR |
| 2224 | "IP routing table\n" |
| 2225 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 2226 | VRF_ALL_CMD_HELP_STR) |
| 2227 | { |
| 2228 | int type; |
| 2229 | struct route_table *table; |
| 2230 | struct route_node *rn; |
| 2231 | struct rib *rib; |
| 2232 | struct zebra_vrf *zvrf; |
| 2233 | vrf_iter_t iter; |
| 2234 | int first = 1; |
| 2235 | |
| 2236 | type = proto_redistnum (AFI_IP, argv[0]); |
| 2237 | if (type < 0) |
| 2238 | { |
| 2239 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 2240 | return CMD_WARNING; |
| 2241 | } |
| 2242 | |
| 2243 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2244 | { |
| 2245 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2246 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2247 | continue; |
| 2248 | |
| 2249 | /* Show matched type IPv4 routes. */ |
| 2250 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2251 | RNODE_FOREACH_RIB (rn, rib) |
| 2252 | if (rib->type == type) |
| 2253 | { |
| 2254 | if (first) |
| 2255 | { |
| 2256 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2257 | first = 0; |
| 2258 | } |
| 2259 | vty_show_ip_route (vty, rn, rib); |
| 2260 | } |
| 2261 | } |
| 2262 | |
| 2263 | return CMD_SUCCESS; |
| 2264 | } |
| 2265 | |
| 2266 | DEFUN (show_ip_route_addr_vrf_all, |
| 2267 | show_ip_route_addr_vrf_all_cmd, |
| 2268 | "show ip route A.B.C.D " VRF_ALL_CMD_STR, |
| 2269 | SHOW_STR |
| 2270 | IP_STR |
| 2271 | "IP routing table\n" |
| 2272 | "Network in the IP routing table to display\n" |
| 2273 | VRF_ALL_CMD_HELP_STR) |
| 2274 | { |
| 2275 | int ret; |
| 2276 | struct prefix_ipv4 p; |
| 2277 | struct route_table *table; |
| 2278 | struct route_node *rn; |
| 2279 | struct zebra_vrf *zvrf; |
| 2280 | vrf_iter_t iter; |
| 2281 | |
| 2282 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2283 | if (ret <= 0) |
| 2284 | { |
| 2285 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2286 | return CMD_WARNING; |
| 2287 | } |
| 2288 | |
| 2289 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2290 | { |
| 2291 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2292 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2293 | continue; |
| 2294 | |
| 2295 | rn = route_node_match (table, (struct prefix *) &p); |
| 2296 | if (! rn) |
| 2297 | continue; |
| 2298 | |
| 2299 | vty_show_ip_route_detail (vty, rn, 0); |
| 2300 | |
| 2301 | route_unlock_node (rn); |
| 2302 | } |
| 2303 | |
| 2304 | return CMD_SUCCESS; |
| 2305 | } |
| 2306 | |
| 2307 | DEFUN (show_ip_route_prefix_vrf_all, |
| 2308 | show_ip_route_prefix_vrf_all_cmd, |
| 2309 | "show ip route A.B.C.D/M " VRF_ALL_CMD_STR, |
| 2310 | SHOW_STR |
| 2311 | IP_STR |
| 2312 | "IP routing table\n" |
| 2313 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2314 | VRF_ALL_CMD_HELP_STR) |
| 2315 | { |
| 2316 | int ret; |
| 2317 | struct prefix_ipv4 p; |
| 2318 | struct route_table *table; |
| 2319 | struct route_node *rn; |
| 2320 | struct zebra_vrf *zvrf; |
| 2321 | vrf_iter_t iter; |
| 2322 | |
| 2323 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2324 | if (ret <= 0) |
| 2325 | { |
| 2326 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2327 | return CMD_WARNING; |
| 2328 | } |
| 2329 | |
| 2330 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2331 | { |
| 2332 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2333 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2334 | continue; |
| 2335 | |
| 2336 | rn = route_node_match (table, (struct prefix *) &p); |
| 2337 | if (! rn) |
| 2338 | continue; |
| 2339 | if (rn->p.prefixlen != p.prefixlen) |
| 2340 | { |
| 2341 | route_unlock_node (rn); |
| 2342 | continue; |
| 2343 | } |
| 2344 | |
| 2345 | vty_show_ip_route_detail (vty, rn, 0); |
| 2346 | |
| 2347 | route_unlock_node (rn); |
| 2348 | } |
| 2349 | |
| 2350 | return CMD_SUCCESS; |
| 2351 | } |
| 2352 | |
| 2353 | DEFUN (show_ip_route_summary_vrf_all, |
| 2354 | show_ip_route_summary_vrf_all_cmd, |
| 2355 | "show ip route summary " VRF_ALL_CMD_STR, |
| 2356 | SHOW_STR |
| 2357 | IP_STR |
| 2358 | "IP routing table\n" |
| 2359 | "Summary of all routes\n" |
| 2360 | VRF_ALL_CMD_HELP_STR) |
| 2361 | { |
| 2362 | struct zebra_vrf *zvrf; |
| 2363 | vrf_iter_t iter; |
| 2364 | |
| 2365 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2366 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 2367 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 2368 | |
| 2369 | return CMD_SUCCESS; |
| 2370 | } |
| 2371 | |
| 2372 | DEFUN (show_ip_route_summary_prefix_vrf_all, |
| 2373 | show_ip_route_summary_prefix_vrf_all_cmd, |
| 2374 | "show ip route summary prefix " VRF_ALL_CMD_STR, |
| 2375 | SHOW_STR |
| 2376 | IP_STR |
| 2377 | "IP routing table\n" |
| 2378 | "Summary of all routes\n" |
| 2379 | "Prefix routes\n" |
| 2380 | VRF_ALL_CMD_HELP_STR) |
| 2381 | { |
| 2382 | struct zebra_vrf *zvrf; |
| 2383 | vrf_iter_t iter; |
| 2384 | |
| 2385 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2386 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 2387 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 2388 | |
| 2389 | return CMD_SUCCESS; |
| 2390 | } |
| 2391 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2392 | /* Write IPv4 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2393 | static int |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 2394 | static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2395 | { |
| 2396 | struct route_node *rn; |
| 2397 | struct static_ipv4 *si; |
| 2398 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2399 | struct zebra_vrf *zvrf; |
| 2400 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2401 | int write; |
| 2402 | |
| 2403 | write = 0; |
| 2404 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2405 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2406 | { |
| 2407 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2408 | (stable = zvrf->stable[AFI_IP][safi]) == NULL) |
| 2409 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2410 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2411 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 2412 | for (si = rn->info; si; si = si->next) |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 2413 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2414 | vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4), |
| 2415 | rn->p.prefixlen); |
| 2416 | |
| 2417 | switch (si->type) |
| 2418 | { |
| 2419 | case STATIC_IPV4_GATEWAY: |
| 2420 | vty_out (vty, " %s", inet_ntoa (si->gate.ipv4)); |
| 2421 | break; |
| 2422 | case STATIC_IPV4_IFNAME: |
| 2423 | vty_out (vty, " %s", si->gate.ifname); |
| 2424 | break; |
| 2425 | case STATIC_IPV4_BLACKHOLE: |
| 2426 | vty_out (vty, " Null0"); |
| 2427 | break; |
| 2428 | } |
| 2429 | |
| 2430 | /* flags are incompatible with STATIC_IPV4_BLACKHOLE */ |
| 2431 | if (si->type != STATIC_IPV4_BLACKHOLE) |
| 2432 | { |
| 2433 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 2434 | vty_out (vty, " %s", "reject"); |
| 2435 | |
| 2436 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 2437 | vty_out (vty, " %s", "blackhole"); |
| 2438 | } |
| 2439 | |
| 2440 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 2441 | vty_out (vty, " %d", si->distance); |
| 2442 | |
| 2443 | if (si->vrf_id != VRF_DEFAULT) |
| 2444 | vty_out (vty, " vrf %u", si->vrf_id); |
| 2445 | |
| 2446 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2447 | |
| 2448 | write = 1; |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 2449 | } |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2450 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2451 | return write; |
| 2452 | } |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2453 | |
| 2454 | DEFUN (show_ip_protocol, |
| 2455 | show_ip_protocol_cmd, |
| 2456 | "show ip protocol", |
| 2457 | SHOW_STR |
| 2458 | IP_STR |
| 2459 | "IP protocol filtering status\n") |
| 2460 | { |
| 2461 | int i; |
| 2462 | |
| 2463 | vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE); |
| 2464 | vty_out(vty, "------------------------%s", VTY_NEWLINE); |
| 2465 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 2466 | { |
| 2467 | if (proto_rm[AFI_IP][i]) |
| 2468 | vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i), |
| 2469 | proto_rm[AFI_IP][i], |
| 2470 | VTY_NEWLINE); |
| 2471 | else |
| 2472 | vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE); |
| 2473 | } |
| 2474 | if (proto_rm[AFI_IP][i]) |
| 2475 | vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i], |
| 2476 | VTY_NEWLINE); |
| 2477 | else |
| 2478 | vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE); |
| 2479 | |
| 2480 | return CMD_SUCCESS; |
| 2481 | } |
| 2482 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2483 | #ifdef HAVE_IPV6 |
| 2484 | /* General fucntion for IPv6 static route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2485 | static int |
hasso | 39db97e | 2004-10-12 20:50:58 +0000 | [diff] [blame] | 2486 | static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, |
| 2487 | const char *gate_str, const char *ifname, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2488 | const char *flag_str, const char *distance_str, |
| 2489 | const char *vrf_id_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2490 | { |
| 2491 | int ret; |
| 2492 | u_char distance; |
| 2493 | struct prefix p; |
| 2494 | struct in6_addr *gate = NULL; |
| 2495 | struct in6_addr gate_addr; |
| 2496 | u_char type = 0; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2497 | vrf_id_t vrf_id = VRF_DEFAULT; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2498 | u_char flag = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2499 | |
| 2500 | ret = str2prefix (dest_str, &p); |
| 2501 | if (ret <= 0) |
| 2502 | { |
| 2503 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 2504 | return CMD_WARNING; |
| 2505 | } |
| 2506 | |
| 2507 | /* Apply mask for given prefix. */ |
| 2508 | apply_mask (&p); |
| 2509 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2510 | /* Route flags */ |
| 2511 | if (flag_str) { |
| 2512 | switch(flag_str[0]) { |
| 2513 | case 'r': |
| 2514 | case 'R': /* XXX */ |
| 2515 | SET_FLAG (flag, ZEBRA_FLAG_REJECT); |
| 2516 | break; |
| 2517 | case 'b': |
| 2518 | case 'B': /* XXX */ |
| 2519 | SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE); |
| 2520 | break; |
| 2521 | default: |
| 2522 | vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 2523 | return CMD_WARNING; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2524 | } |
| 2525 | } |
| 2526 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2527 | /* Administrative distance. */ |
| 2528 | if (distance_str) |
| 2529 | distance = atoi (distance_str); |
| 2530 | else |
| 2531 | distance = ZEBRA_STATIC_DISTANCE_DEFAULT; |
| 2532 | |
| 2533 | /* When gateway is valid IPv6 addrees, then gate is treated as |
| 2534 | nexthop address other case gate is treated as interface name. */ |
| 2535 | ret = inet_pton (AF_INET6, gate_str, &gate_addr); |
| 2536 | |
| 2537 | if (ifname) |
| 2538 | { |
| 2539 | /* When ifname is specified. It must be come with gateway |
| 2540 | address. */ |
| 2541 | if (ret != 1) |
| 2542 | { |
| 2543 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 2544 | return CMD_WARNING; |
| 2545 | } |
| 2546 | type = STATIC_IPV6_GATEWAY_IFNAME; |
| 2547 | gate = &gate_addr; |
| 2548 | } |
| 2549 | else |
| 2550 | { |
| 2551 | if (ret == 1) |
| 2552 | { |
| 2553 | type = STATIC_IPV6_GATEWAY; |
| 2554 | gate = &gate_addr; |
| 2555 | } |
| 2556 | else |
| 2557 | { |
| 2558 | type = STATIC_IPV6_IFNAME; |
| 2559 | ifname = gate_str; |
| 2560 | } |
| 2561 | } |
| 2562 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2563 | /* VRF id */ |
| 2564 | if (vrf_id_str) |
| 2565 | VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str); |
| 2566 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2567 | if (add_cmd) |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2568 | static_add_ipv6 (&p, type, gate, ifname, flag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2569 | else |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2570 | static_delete_ipv6 (&p, type, gate, ifname, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2571 | |
| 2572 | return CMD_SUCCESS; |
| 2573 | } |
| 2574 | |
| 2575 | DEFUN (ipv6_route, |
| 2576 | ipv6_route_cmd, |
| 2577 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 2578 | IP_STR |
| 2579 | "Establish static routes\n" |
| 2580 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2581 | "IPv6 gateway address\n" |
| 2582 | "IPv6 gateway interface name\n") |
| 2583 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2584 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, |
| 2585 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2586 | } |
| 2587 | |
| 2588 | DEFUN (ipv6_route_flags, |
| 2589 | ipv6_route_flags_cmd, |
| 2590 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 2591 | IP_STR |
| 2592 | "Establish static routes\n" |
| 2593 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2594 | "IPv6 gateway address\n" |
| 2595 | "IPv6 gateway interface name\n" |
| 2596 | "Emit an ICMP unreachable when matched\n" |
| 2597 | "Silently discard pkts when matched\n") |
| 2598 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2599 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 2600 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2601 | } |
| 2602 | |
| 2603 | DEFUN (ipv6_route_ifname, |
| 2604 | ipv6_route_ifname_cmd, |
| 2605 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 2606 | IP_STR |
| 2607 | "Establish static routes\n" |
| 2608 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2609 | "IPv6 gateway address\n" |
| 2610 | "IPv6 gateway interface name\n") |
| 2611 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2612 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 2613 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2614 | } |
| 2615 | |
| 2616 | DEFUN (ipv6_route_ifname_flags, |
| 2617 | ipv6_route_ifname_flags_cmd, |
| 2618 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 2619 | IP_STR |
| 2620 | "Establish static routes\n" |
| 2621 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2622 | "IPv6 gateway address\n" |
| 2623 | "IPv6 gateway interface name\n" |
| 2624 | "Emit an ICMP unreachable when matched\n" |
| 2625 | "Silently discard pkts when matched\n") |
| 2626 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2627 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 2628 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2629 | } |
| 2630 | |
| 2631 | DEFUN (ipv6_route_pref, |
| 2632 | ipv6_route_pref_cmd, |
| 2633 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 2634 | IP_STR |
| 2635 | "Establish static routes\n" |
| 2636 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2637 | "IPv6 gateway address\n" |
| 2638 | "IPv6 gateway interface name\n" |
| 2639 | "Distance value for this prefix\n") |
| 2640 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2641 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], |
| 2642 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2643 | } |
| 2644 | |
| 2645 | DEFUN (ipv6_route_flags_pref, |
| 2646 | ipv6_route_flags_pref_cmd, |
| 2647 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 2648 | IP_STR |
| 2649 | "Establish static routes\n" |
| 2650 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2651 | "IPv6 gateway address\n" |
| 2652 | "IPv6 gateway interface name\n" |
| 2653 | "Emit an ICMP unreachable when matched\n" |
| 2654 | "Silently discard pkts when matched\n" |
| 2655 | "Distance value for this prefix\n") |
| 2656 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2657 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2658 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2659 | } |
| 2660 | |
| 2661 | DEFUN (ipv6_route_ifname_pref, |
| 2662 | ipv6_route_ifname_pref_cmd, |
| 2663 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 2664 | IP_STR |
| 2665 | "Establish static routes\n" |
| 2666 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2667 | "IPv6 gateway address\n" |
| 2668 | "IPv6 gateway interface name\n" |
| 2669 | "Distance value for this prefix\n") |
| 2670 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2671 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2672 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2673 | } |
| 2674 | |
| 2675 | DEFUN (ipv6_route_ifname_flags_pref, |
| 2676 | ipv6_route_ifname_flags_pref_cmd, |
| 2677 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 2678 | IP_STR |
| 2679 | "Establish static routes\n" |
| 2680 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2681 | "IPv6 gateway address\n" |
| 2682 | "IPv6 gateway interface name\n" |
| 2683 | "Emit an ICMP unreachable when matched\n" |
| 2684 | "Silently discard pkts when matched\n" |
| 2685 | "Distance value for this prefix\n") |
| 2686 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2687 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2688 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2689 | } |
| 2690 | |
| 2691 | DEFUN (no_ipv6_route, |
| 2692 | no_ipv6_route_cmd, |
| 2693 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 2694 | NO_STR |
| 2695 | IP_STR |
| 2696 | "Establish static routes\n" |
| 2697 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2698 | "IPv6 gateway address\n" |
| 2699 | "IPv6 gateway interface name\n") |
| 2700 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2701 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 2702 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2703 | } |
| 2704 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2705 | ALIAS (no_ipv6_route, |
| 2706 | no_ipv6_route_flags_cmd, |
| 2707 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 2708 | NO_STR |
| 2709 | IP_STR |
| 2710 | "Establish static routes\n" |
| 2711 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2712 | "IPv6 gateway address\n" |
| 2713 | "IPv6 gateway interface name\n" |
| 2714 | "Emit an ICMP unreachable when matched\n" |
| 2715 | "Silently discard pkts when matched\n") |
| 2716 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2717 | DEFUN (no_ipv6_route_ifname, |
| 2718 | no_ipv6_route_ifname_cmd, |
| 2719 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 2720 | NO_STR |
| 2721 | IP_STR |
| 2722 | "Establish static routes\n" |
| 2723 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2724 | "IPv6 gateway address\n" |
| 2725 | "IPv6 gateway interface name\n") |
| 2726 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2727 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 2728 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2729 | } |
| 2730 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2731 | ALIAS (no_ipv6_route_ifname, |
| 2732 | no_ipv6_route_ifname_flags_cmd, |
| 2733 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 2734 | NO_STR |
| 2735 | IP_STR |
| 2736 | "Establish static routes\n" |
| 2737 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2738 | "IPv6 gateway address\n" |
| 2739 | "IPv6 gateway interface name\n" |
| 2740 | "Emit an ICMP unreachable when matched\n" |
| 2741 | "Silently discard pkts when matched\n") |
| 2742 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2743 | DEFUN (no_ipv6_route_pref, |
| 2744 | no_ipv6_route_pref_cmd, |
| 2745 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 2746 | NO_STR |
| 2747 | IP_STR |
| 2748 | "Establish static routes\n" |
| 2749 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2750 | "IPv6 gateway address\n" |
| 2751 | "IPv6 gateway interface name\n" |
| 2752 | "Distance value for this prefix\n") |
| 2753 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2754 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], |
| 2755 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2756 | } |
| 2757 | |
| 2758 | DEFUN (no_ipv6_route_flags_pref, |
| 2759 | no_ipv6_route_flags_pref_cmd, |
| 2760 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 2761 | NO_STR |
| 2762 | IP_STR |
| 2763 | "Establish static routes\n" |
| 2764 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2765 | "IPv6 gateway address\n" |
| 2766 | "IPv6 gateway interface name\n" |
| 2767 | "Emit an ICMP unreachable when matched\n" |
| 2768 | "Silently discard pkts when matched\n" |
| 2769 | "Distance value for this prefix\n") |
| 2770 | { |
| 2771 | /* We do not care about argv[2] */ |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2772 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2773 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2774 | } |
| 2775 | |
| 2776 | DEFUN (no_ipv6_route_ifname_pref, |
| 2777 | no_ipv6_route_ifname_pref_cmd, |
| 2778 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 2779 | NO_STR |
| 2780 | IP_STR |
| 2781 | "Establish static routes\n" |
| 2782 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2783 | "IPv6 gateway address\n" |
| 2784 | "IPv6 gateway interface name\n" |
| 2785 | "Distance value for this prefix\n") |
| 2786 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2787 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2788 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2789 | } |
| 2790 | |
| 2791 | DEFUN (no_ipv6_route_ifname_flags_pref, |
| 2792 | no_ipv6_route_ifname_flags_pref_cmd, |
| 2793 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 2794 | NO_STR |
| 2795 | IP_STR |
| 2796 | "Establish static routes\n" |
| 2797 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2798 | "IPv6 gateway address\n" |
| 2799 | "IPv6 gateway interface name\n" |
| 2800 | "Emit an ICMP unreachable when matched\n" |
| 2801 | "Silently discard pkts when matched\n" |
| 2802 | "Distance value for this prefix\n") |
| 2803 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2804 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2805 | NULL); |
| 2806 | } |
| 2807 | |
| 2808 | DEFUN (ipv6_route_vrf, |
| 2809 | ipv6_route_vrf_cmd, |
| 2810 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 2811 | IP_STR |
| 2812 | "Establish static routes\n" |
| 2813 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2814 | "IPv6 gateway address\n" |
| 2815 | "IPv6 gateway interface name\n" |
| 2816 | VRF_CMD_HELP_STR) |
| 2817 | { |
| 2818 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, |
| 2819 | argv[2]); |
| 2820 | } |
| 2821 | |
| 2822 | DEFUN (ipv6_route_flags_vrf, |
| 2823 | ipv6_route_flags_vrf_cmd, |
| 2824 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 2825 | IP_STR |
| 2826 | "Establish static routes\n" |
| 2827 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2828 | "IPv6 gateway address\n" |
| 2829 | "IPv6 gateway interface name\n" |
| 2830 | "Emit an ICMP unreachable when matched\n" |
| 2831 | "Silently discard pkts when matched\n" |
| 2832 | VRF_CMD_HELP_STR) |
| 2833 | { |
| 2834 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 2835 | argv[3]); |
| 2836 | } |
| 2837 | |
| 2838 | DEFUN (ipv6_route_ifname_vrf, |
| 2839 | ipv6_route_ifname_vrf_cmd, |
| 2840 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 2841 | IP_STR |
| 2842 | "Establish static routes\n" |
| 2843 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2844 | "IPv6 gateway address\n" |
| 2845 | "IPv6 gateway interface name\n" |
| 2846 | VRF_CMD_HELP_STR) |
| 2847 | { |
| 2848 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 2849 | argv[3]); |
| 2850 | } |
| 2851 | |
| 2852 | DEFUN (ipv6_route_ifname_flags_vrf, |
| 2853 | ipv6_route_ifname_flags_vrf_cmd, |
| 2854 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 2855 | IP_STR |
| 2856 | "Establish static routes\n" |
| 2857 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2858 | "IPv6 gateway address\n" |
| 2859 | "IPv6 gateway interface name\n" |
| 2860 | "Emit an ICMP unreachable when matched\n" |
| 2861 | "Silently discard pkts when matched\n" |
| 2862 | VRF_CMD_HELP_STR) |
| 2863 | { |
| 2864 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 2865 | argv[4]); |
| 2866 | } |
| 2867 | |
| 2868 | DEFUN (ipv6_route_pref_vrf, |
| 2869 | ipv6_route_pref_vrf_cmd, |
| 2870 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 2871 | IP_STR |
| 2872 | "Establish static routes\n" |
| 2873 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2874 | "IPv6 gateway address\n" |
| 2875 | "IPv6 gateway interface name\n" |
| 2876 | "Distance value for this prefix\n" |
| 2877 | VRF_CMD_HELP_STR) |
| 2878 | { |
| 2879 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], |
| 2880 | argv[3]); |
| 2881 | } |
| 2882 | |
| 2883 | DEFUN (ipv6_route_flags_pref_vrf, |
| 2884 | ipv6_route_flags_pref_vrf_cmd, |
| 2885 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 2886 | IP_STR |
| 2887 | "Establish static routes\n" |
| 2888 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2889 | "IPv6 gateway address\n" |
| 2890 | "IPv6 gateway interface name\n" |
| 2891 | "Emit an ICMP unreachable when matched\n" |
| 2892 | "Silently discard pkts when matched\n" |
| 2893 | "Distance value for this prefix\n" |
| 2894 | VRF_CMD_HELP_STR) |
| 2895 | { |
| 2896 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2897 | argv[4]); |
| 2898 | } |
| 2899 | |
| 2900 | DEFUN (ipv6_route_ifname_pref_vrf, |
| 2901 | ipv6_route_ifname_pref_vrf_cmd, |
| 2902 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 2903 | IP_STR |
| 2904 | "Establish static routes\n" |
| 2905 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2906 | "IPv6 gateway address\n" |
| 2907 | "IPv6 gateway interface name\n" |
| 2908 | "Distance value for this prefix\n" |
| 2909 | VRF_CMD_HELP_STR) |
| 2910 | { |
| 2911 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2912 | argv[4]); |
| 2913 | } |
| 2914 | |
| 2915 | DEFUN (ipv6_route_ifname_flags_pref_vrf, |
| 2916 | ipv6_route_ifname_flags_pref_vrf_cmd, |
| 2917 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 2918 | IP_STR |
| 2919 | "Establish static routes\n" |
| 2920 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2921 | "IPv6 gateway address\n" |
| 2922 | "IPv6 gateway interface name\n" |
| 2923 | "Emit an ICMP unreachable when matched\n" |
| 2924 | "Silently discard pkts when matched\n" |
| 2925 | "Distance value for this prefix\n" |
| 2926 | VRF_CMD_HELP_STR) |
| 2927 | { |
| 2928 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2929 | argv[5]); |
| 2930 | } |
| 2931 | |
| 2932 | DEFUN (no_ipv6_route_vrf, |
| 2933 | no_ipv6_route_vrf_cmd, |
| 2934 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 2935 | NO_STR |
| 2936 | IP_STR |
| 2937 | "Establish static routes\n" |
| 2938 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2939 | "IPv6 gateway address\n" |
| 2940 | "IPv6 gateway interface name\n" |
| 2941 | VRF_CMD_HELP_STR) |
| 2942 | { |
| 2943 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 2944 | (argc > 3) ? argv[3] : argv[2]); |
| 2945 | } |
| 2946 | |
| 2947 | ALIAS (no_ipv6_route_vrf, |
| 2948 | no_ipv6_route_flags_vrf_cmd, |
| 2949 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 2950 | NO_STR |
| 2951 | IP_STR |
| 2952 | "Establish static routes\n" |
| 2953 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2954 | "IPv6 gateway address\n" |
| 2955 | "IPv6 gateway interface name\n" |
| 2956 | "Emit an ICMP unreachable when matched\n" |
| 2957 | "Silently discard pkts when matched\n" |
| 2958 | VRF_CMD_HELP_STR) |
| 2959 | |
| 2960 | DEFUN (no_ipv6_route_ifname_vrf, |
| 2961 | no_ipv6_route_ifname_vrf_cmd, |
| 2962 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 2963 | NO_STR |
| 2964 | IP_STR |
| 2965 | "Establish static routes\n" |
| 2966 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2967 | "IPv6 gateway address\n" |
| 2968 | "IPv6 gateway interface name\n" |
| 2969 | VRF_CMD_HELP_STR) |
| 2970 | { |
| 2971 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 2972 | (argc > 4) ? argv[4] : argv[3]); |
| 2973 | } |
| 2974 | |
| 2975 | ALIAS (no_ipv6_route_ifname_vrf, |
| 2976 | no_ipv6_route_ifname_flags_vrf_cmd, |
| 2977 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 2978 | NO_STR |
| 2979 | IP_STR |
| 2980 | "Establish static routes\n" |
| 2981 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2982 | "IPv6 gateway address\n" |
| 2983 | "IPv6 gateway interface name\n" |
| 2984 | "Emit an ICMP unreachable when matched\n" |
| 2985 | "Silently discard pkts when matched\n" |
| 2986 | VRF_CMD_HELP_STR) |
| 2987 | |
| 2988 | DEFUN (no_ipv6_route_pref_vrf, |
| 2989 | no_ipv6_route_pref_vrf_cmd, |
| 2990 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 2991 | NO_STR |
| 2992 | IP_STR |
| 2993 | "Establish static routes\n" |
| 2994 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2995 | "IPv6 gateway address\n" |
| 2996 | "IPv6 gateway interface name\n" |
| 2997 | "Distance value for this prefix\n" |
| 2998 | VRF_CMD_HELP_STR) |
| 2999 | { |
| 3000 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], |
| 3001 | argv[3]); |
| 3002 | } |
| 3003 | |
| 3004 | DEFUN (no_ipv6_route_flags_pref_vrf, |
| 3005 | no_ipv6_route_flags_pref_vrf_cmd, |
| 3006 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 3007 | NO_STR |
| 3008 | IP_STR |
| 3009 | "Establish static routes\n" |
| 3010 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3011 | "IPv6 gateway address\n" |
| 3012 | "IPv6 gateway interface name\n" |
| 3013 | "Emit an ICMP unreachable when matched\n" |
| 3014 | "Silently discard pkts when matched\n" |
| 3015 | "Distance value for this prefix\n" |
| 3016 | VRF_CMD_HELP_STR) |
| 3017 | { |
| 3018 | /* We do not care about argv[2] */ |
| 3019 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 3020 | argv[4]); |
| 3021 | } |
| 3022 | |
| 3023 | DEFUN (no_ipv6_route_ifname_pref_vrf, |
| 3024 | no_ipv6_route_ifname_pref_vrf_cmd, |
| 3025 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 3026 | NO_STR |
| 3027 | IP_STR |
| 3028 | "Establish static routes\n" |
| 3029 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3030 | "IPv6 gateway address\n" |
| 3031 | "IPv6 gateway interface name\n" |
| 3032 | "Distance value for this prefix\n" |
| 3033 | VRF_CMD_HELP_STR) |
| 3034 | { |
| 3035 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 3036 | argv[4]); |
| 3037 | } |
| 3038 | |
| 3039 | DEFUN (no_ipv6_route_ifname_flags_pref_vrf, |
| 3040 | no_ipv6_route_ifname_flags_pref_vrf_cmd, |
| 3041 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 3042 | NO_STR |
| 3043 | IP_STR |
| 3044 | "Establish static routes\n" |
| 3045 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3046 | "IPv6 gateway address\n" |
| 3047 | "IPv6 gateway interface name\n" |
| 3048 | "Emit an ICMP unreachable when matched\n" |
| 3049 | "Silently discard pkts when matched\n" |
| 3050 | "Distance value for this prefix\n" |
| 3051 | VRF_CMD_HELP_STR) |
| 3052 | { |
| 3053 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 3054 | argv[5]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3055 | } |
| 3056 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3057 | DEFUN (show_ipv6_route, |
| 3058 | show_ipv6_route_cmd, |
| 3059 | "show ipv6 route", |
| 3060 | SHOW_STR |
| 3061 | IP_STR |
| 3062 | "IPv6 routing table\n") |
| 3063 | { |
| 3064 | struct route_table *table; |
| 3065 | struct route_node *rn; |
| 3066 | struct rib *rib; |
| 3067 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3068 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3069 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3070 | if (argc > 0) |
| 3071 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3072 | |
| 3073 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3074 | if (! table) |
| 3075 | return CMD_SUCCESS; |
| 3076 | |
| 3077 | /* Show all IPv6 route. */ |
| 3078 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3079 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3080 | { |
| 3081 | if (first) |
| 3082 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3083 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3084 | first = 0; |
| 3085 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3086 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3087 | } |
| 3088 | return CMD_SUCCESS; |
| 3089 | } |
| 3090 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3091 | ALIAS (show_ipv6_route, |
| 3092 | show_ipv6_route_vrf_cmd, |
| 3093 | "show ipv6 route " VRF_CMD_STR, |
| 3094 | SHOW_STR |
| 3095 | IP_STR |
| 3096 | "IPv6 routing table\n" |
| 3097 | VRF_CMD_HELP_STR) |
| 3098 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3099 | DEFUN (show_ipv6_route_prefix_longer, |
| 3100 | show_ipv6_route_prefix_longer_cmd, |
| 3101 | "show ipv6 route X:X::X:X/M longer-prefixes", |
| 3102 | SHOW_STR |
| 3103 | IP_STR |
| 3104 | "IPv6 routing table\n" |
| 3105 | "IPv6 prefix\n" |
| 3106 | "Show route matching the specified Network/Mask pair only\n") |
| 3107 | { |
| 3108 | struct route_table *table; |
| 3109 | struct route_node *rn; |
| 3110 | struct rib *rib; |
| 3111 | struct prefix p; |
| 3112 | int ret; |
| 3113 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3114 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3115 | |
| 3116 | ret = str2prefix (argv[0], &p); |
| 3117 | if (! ret) |
| 3118 | { |
| 3119 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 3120 | return CMD_WARNING; |
| 3121 | } |
| 3122 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3123 | if (argc > 1) |
| 3124 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3125 | |
| 3126 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
| 3127 | if (! table) |
| 3128 | return CMD_SUCCESS; |
| 3129 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3130 | /* Show matched type IPv6 routes. */ |
| 3131 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3132 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3133 | if (prefix_match (&p, &rn->p)) |
| 3134 | { |
| 3135 | if (first) |
| 3136 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3137 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3138 | first = 0; |
| 3139 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3140 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3141 | } |
| 3142 | return CMD_SUCCESS; |
| 3143 | } |
| 3144 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3145 | ALIAS (show_ipv6_route_prefix_longer, |
| 3146 | show_ipv6_route_prefix_longer_vrf_cmd, |
| 3147 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR, |
| 3148 | SHOW_STR |
| 3149 | IP_STR |
| 3150 | "IPv6 routing table\n" |
| 3151 | "IPv6 prefix\n" |
| 3152 | "Show route matching the specified Network/Mask pair only\n" |
| 3153 | VRF_CMD_HELP_STR) |
| 3154 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3155 | DEFUN (show_ipv6_route_protocol, |
| 3156 | show_ipv6_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3157 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3158 | SHOW_STR |
| 3159 | IP_STR |
| 3160 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3161 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3162 | { |
| 3163 | int type; |
| 3164 | struct route_table *table; |
| 3165 | struct route_node *rn; |
| 3166 | struct rib *rib; |
| 3167 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3168 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3169 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3170 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 3171 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3172 | { |
| 3173 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 3174 | return CMD_WARNING; |
| 3175 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3176 | |
| 3177 | if (argc > 1) |
| 3178 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3179 | |
| 3180 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3181 | if (! table) |
| 3182 | return CMD_SUCCESS; |
| 3183 | |
| 3184 | /* Show matched type IPv6 routes. */ |
| 3185 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3186 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3187 | if (rib->type == type) |
| 3188 | { |
| 3189 | if (first) |
| 3190 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3191 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3192 | first = 0; |
| 3193 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3194 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3195 | } |
| 3196 | return CMD_SUCCESS; |
| 3197 | } |
| 3198 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3199 | ALIAS (show_ipv6_route_protocol, |
| 3200 | show_ipv6_route_protocol_vrf_cmd, |
| 3201 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 3202 | SHOW_STR |
| 3203 | IP_STR |
| 3204 | "IP routing table\n" |
| 3205 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 3206 | VRF_CMD_HELP_STR) |
| 3207 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3208 | DEFUN (show_ipv6_route_addr, |
| 3209 | show_ipv6_route_addr_cmd, |
| 3210 | "show ipv6 route X:X::X:X", |
| 3211 | SHOW_STR |
| 3212 | IP_STR |
| 3213 | "IPv6 routing table\n" |
| 3214 | "IPv6 Address\n") |
| 3215 | { |
| 3216 | int ret; |
| 3217 | struct prefix_ipv6 p; |
| 3218 | struct route_table *table; |
| 3219 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3220 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3221 | |
| 3222 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3223 | if (ret <= 0) |
| 3224 | { |
| 3225 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 3226 | return CMD_WARNING; |
| 3227 | } |
| 3228 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3229 | if (argc > 1) |
| 3230 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3231 | |
| 3232 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3233 | if (! table) |
| 3234 | return CMD_SUCCESS; |
| 3235 | |
| 3236 | rn = route_node_match (table, (struct prefix *) &p); |
| 3237 | if (! rn) |
| 3238 | { |
| 3239 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 3240 | return CMD_WARNING; |
| 3241 | } |
| 3242 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3243 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3244 | |
| 3245 | route_unlock_node (rn); |
| 3246 | |
| 3247 | return CMD_SUCCESS; |
| 3248 | } |
| 3249 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3250 | ALIAS (show_ipv6_route_addr, |
| 3251 | show_ipv6_route_addr_vrf_cmd, |
| 3252 | "show ipv6 route X:X::X:X " VRF_CMD_STR, |
| 3253 | SHOW_STR |
| 3254 | IP_STR |
| 3255 | "IPv6 routing table\n" |
| 3256 | "IPv6 Address\n" |
| 3257 | VRF_CMD_HELP_STR) |
| 3258 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3259 | DEFUN (show_ipv6_route_prefix, |
| 3260 | show_ipv6_route_prefix_cmd, |
| 3261 | "show ipv6 route X:X::X:X/M", |
| 3262 | SHOW_STR |
| 3263 | IP_STR |
| 3264 | "IPv6 routing table\n" |
| 3265 | "IPv6 prefix\n") |
| 3266 | { |
| 3267 | int ret; |
| 3268 | struct prefix_ipv6 p; |
| 3269 | struct route_table *table; |
| 3270 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3271 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3272 | |
| 3273 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3274 | if (ret <= 0) |
| 3275 | { |
| 3276 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 3277 | return CMD_WARNING; |
| 3278 | } |
| 3279 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3280 | if (argc > 1) |
| 3281 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3282 | |
| 3283 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3284 | if (! table) |
| 3285 | return CMD_SUCCESS; |
| 3286 | |
| 3287 | rn = route_node_match (table, (struct prefix *) &p); |
| 3288 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 3289 | { |
| 3290 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 3291 | if (rn) |
| 3292 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3293 | return CMD_WARNING; |
| 3294 | } |
| 3295 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3296 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3297 | |
| 3298 | route_unlock_node (rn); |
| 3299 | |
| 3300 | return CMD_SUCCESS; |
| 3301 | } |
| 3302 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3303 | ALIAS (show_ipv6_route_prefix, |
| 3304 | show_ipv6_route_prefix_vrf_cmd, |
| 3305 | "show ipv6 route X:X::X:X/M " VRF_CMD_STR, |
| 3306 | SHOW_STR |
| 3307 | IP_STR |
| 3308 | "IPv6 routing table\n" |
| 3309 | "IPv6 prefix\n" |
| 3310 | VRF_CMD_HELP_STR) |
| 3311 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3312 | /* Show route summary. */ |
| 3313 | DEFUN (show_ipv6_route_summary, |
| 3314 | show_ipv6_route_summary_cmd, |
| 3315 | "show ipv6 route summary", |
| 3316 | SHOW_STR |
| 3317 | IP_STR |
| 3318 | "IPv6 routing table\n" |
| 3319 | "Summary of all IPv6 routes\n") |
| 3320 | { |
| 3321 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3322 | vrf_id_t vrf_id = VRF_DEFAULT; |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3323 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3324 | if (argc > 0) |
| 3325 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3326 | |
| 3327 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3328 | if (! table) |
| 3329 | return CMD_SUCCESS; |
| 3330 | |
| 3331 | vty_show_ip_route_summary (vty, table); |
| 3332 | |
| 3333 | return CMD_SUCCESS; |
| 3334 | } |
| 3335 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3336 | ALIAS (show_ipv6_route_summary, |
| 3337 | show_ipv6_route_summary_vrf_cmd, |
| 3338 | "show ipv6 route summary " VRF_CMD_STR, |
| 3339 | SHOW_STR |
| 3340 | IP_STR |
| 3341 | "IPv6 routing table\n" |
| 3342 | "Summary of all IPv6 routes\n" |
| 3343 | VRF_CMD_HELP_STR) |
| 3344 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3345 | /* Show ipv6 route summary prefix. */ |
| 3346 | DEFUN (show_ipv6_route_summary_prefix, |
| 3347 | show_ipv6_route_summary_prefix_cmd, |
| 3348 | "show ipv6 route summary prefix", |
| 3349 | SHOW_STR |
| 3350 | IP_STR |
| 3351 | "IPv6 routing table\n" |
| 3352 | "Summary of all IPv6 routes\n" |
| 3353 | "Prefix routes\n") |
| 3354 | { |
| 3355 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3356 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3357 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3358 | if (argc > 0) |
| 3359 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3360 | |
| 3361 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3362 | if (! table) |
| 3363 | return CMD_SUCCESS; |
| 3364 | |
| 3365 | vty_show_ip_route_summary_prefix (vty, table); |
| 3366 | |
| 3367 | return CMD_SUCCESS; |
| 3368 | } |
| 3369 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3370 | ALIAS (show_ipv6_route_summary_prefix, |
| 3371 | show_ipv6_route_summary_prefix_vrf_cmd, |
| 3372 | "show ipv6 route summary prefix " VRF_CMD_STR, |
| 3373 | SHOW_STR |
| 3374 | IP_STR |
| 3375 | "IPv6 routing table\n" |
| 3376 | "Summary of all IPv6 routes\n" |
| 3377 | "Prefix routes\n" |
| 3378 | VRF_CMD_HELP_STR) |
| 3379 | |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3380 | /* |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3381 | * Show IPv6 mroute command.Used to dump |
| 3382 | * the Multicast routing table. |
| 3383 | */ |
| 3384 | |
| 3385 | DEFUN (show_ipv6_mroute, |
| 3386 | show_ipv6_mroute_cmd, |
| 3387 | "show ipv6 mroute", |
| 3388 | SHOW_STR |
| 3389 | IP_STR |
| 3390 | "IPv6 Multicast routing table\n") |
| 3391 | { |
| 3392 | struct route_table *table; |
| 3393 | struct route_node *rn; |
| 3394 | struct rib *rib; |
| 3395 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3396 | vrf_id_t vrf_id = VRF_DEFAULT; |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3397 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3398 | if (argc > 0) |
| 3399 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3400 | |
| 3401 | table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3402 | if (! table) |
| 3403 | return CMD_SUCCESS; |
| 3404 | |
| 3405 | /* Show all IPv6 route. */ |
| 3406 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3407 | RNODE_FOREACH_RIB (rn, rib) |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3408 | { |
| 3409 | if (first) |
| 3410 | { |
G.Balaji | cb32fd6 | 2011-11-27 20:09:40 +0530 | [diff] [blame] | 3411 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3412 | first = 0; |
| 3413 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3414 | vty_show_ip_route (vty, rn, rib); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3415 | } |
| 3416 | return CMD_SUCCESS; |
| 3417 | } |
| 3418 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3419 | ALIAS (show_ipv6_mroute, |
| 3420 | show_ipv6_mroute_vrf_cmd, |
| 3421 | "show ipv6 mroute " VRF_CMD_STR, |
| 3422 | SHOW_STR |
| 3423 | IP_STR |
| 3424 | "IPv6 Multicast routing table\n" |
| 3425 | VRF_CMD_HELP_STR) |
| 3426 | |
| 3427 | DEFUN (show_ipv6_route_vrf_all, |
| 3428 | show_ipv6_route_vrf_all_cmd, |
| 3429 | "show ipv6 route " VRF_ALL_CMD_STR, |
| 3430 | SHOW_STR |
| 3431 | IP_STR |
| 3432 | "IPv6 routing table\n" |
| 3433 | VRF_ALL_CMD_HELP_STR) |
| 3434 | { |
| 3435 | struct route_table *table; |
| 3436 | struct route_node *rn; |
| 3437 | struct rib *rib; |
| 3438 | struct zebra_vrf *zvrf; |
| 3439 | vrf_iter_t iter; |
| 3440 | int first = 1; |
| 3441 | |
| 3442 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3443 | { |
| 3444 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3445 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3446 | continue; |
| 3447 | |
| 3448 | /* Show all IPv6 route. */ |
| 3449 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3450 | RNODE_FOREACH_RIB (rn, rib) |
| 3451 | { |
| 3452 | if (first) |
| 3453 | { |
| 3454 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3455 | first = 0; |
| 3456 | } |
| 3457 | vty_show_ip_route (vty, rn, rib); |
| 3458 | } |
| 3459 | } |
| 3460 | |
| 3461 | return CMD_SUCCESS; |
| 3462 | } |
| 3463 | |
| 3464 | DEFUN (show_ipv6_route_prefix_longer_vrf_all, |
| 3465 | show_ipv6_route_prefix_longer_vrf_all_cmd, |
| 3466 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR, |
| 3467 | SHOW_STR |
| 3468 | IP_STR |
| 3469 | "IPv6 routing table\n" |
| 3470 | "IPv6 prefix\n" |
| 3471 | "Show route matching the specified Network/Mask pair only\n" |
| 3472 | VRF_ALL_CMD_HELP_STR) |
| 3473 | { |
| 3474 | struct route_table *table; |
| 3475 | struct route_node *rn; |
| 3476 | struct rib *rib; |
| 3477 | struct prefix p; |
| 3478 | struct zebra_vrf *zvrf; |
| 3479 | vrf_iter_t iter; |
| 3480 | int ret; |
| 3481 | int first = 1; |
| 3482 | |
| 3483 | ret = str2prefix (argv[0], &p); |
| 3484 | if (! ret) |
| 3485 | { |
| 3486 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 3487 | return CMD_WARNING; |
| 3488 | } |
| 3489 | |
| 3490 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3491 | { |
| 3492 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3493 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3494 | continue; |
| 3495 | |
| 3496 | /* Show matched type IPv6 routes. */ |
| 3497 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3498 | RNODE_FOREACH_RIB (rn, rib) |
| 3499 | if (prefix_match (&p, &rn->p)) |
| 3500 | { |
| 3501 | if (first) |
| 3502 | { |
| 3503 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3504 | first = 0; |
| 3505 | } |
| 3506 | vty_show_ip_route (vty, rn, rib); |
| 3507 | } |
| 3508 | } |
| 3509 | |
| 3510 | return CMD_SUCCESS; |
| 3511 | } |
| 3512 | |
| 3513 | DEFUN (show_ipv6_route_protocol_vrf_all, |
| 3514 | show_ipv6_route_protocol_vrf_all_cmd, |
| 3515 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 3516 | SHOW_STR |
| 3517 | IP_STR |
| 3518 | "IP routing table\n" |
| 3519 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 3520 | VRF_ALL_CMD_HELP_STR) |
| 3521 | { |
| 3522 | int type; |
| 3523 | struct route_table *table; |
| 3524 | struct route_node *rn; |
| 3525 | struct rib *rib; |
| 3526 | struct zebra_vrf *zvrf; |
| 3527 | vrf_iter_t iter; |
| 3528 | int first = 1; |
| 3529 | |
| 3530 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 3531 | if (type < 0) |
| 3532 | { |
| 3533 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 3534 | return CMD_WARNING; |
| 3535 | } |
| 3536 | |
| 3537 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3538 | { |
| 3539 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3540 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3541 | continue; |
| 3542 | |
| 3543 | /* Show matched type IPv6 routes. */ |
| 3544 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3545 | RNODE_FOREACH_RIB (rn, rib) |
| 3546 | if (rib->type == type) |
| 3547 | { |
| 3548 | if (first) |
| 3549 | { |
| 3550 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3551 | first = 0; |
| 3552 | } |
| 3553 | vty_show_ip_route (vty, rn, rib); |
| 3554 | } |
| 3555 | } |
| 3556 | |
| 3557 | return CMD_SUCCESS; |
| 3558 | } |
| 3559 | |
| 3560 | DEFUN (show_ipv6_route_addr_vrf_all, |
| 3561 | show_ipv6_route_addr_vrf_all_cmd, |
| 3562 | "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR, |
| 3563 | SHOW_STR |
| 3564 | IP_STR |
| 3565 | "IPv6 routing table\n" |
| 3566 | "IPv6 Address\n" |
| 3567 | VRF_ALL_CMD_HELP_STR) |
| 3568 | { |
| 3569 | int ret; |
| 3570 | struct prefix_ipv6 p; |
| 3571 | struct route_table *table; |
| 3572 | struct route_node *rn; |
| 3573 | struct zebra_vrf *zvrf; |
| 3574 | vrf_iter_t iter; |
| 3575 | |
| 3576 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3577 | if (ret <= 0) |
| 3578 | { |
| 3579 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 3580 | return CMD_WARNING; |
| 3581 | } |
| 3582 | |
| 3583 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3584 | { |
| 3585 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3586 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3587 | continue; |
| 3588 | |
| 3589 | rn = route_node_match (table, (struct prefix *) &p); |
| 3590 | if (! rn) |
| 3591 | continue; |
| 3592 | |
| 3593 | vty_show_ip_route_detail (vty, rn, 0); |
| 3594 | |
| 3595 | route_unlock_node (rn); |
| 3596 | } |
| 3597 | |
| 3598 | return CMD_SUCCESS; |
| 3599 | } |
| 3600 | |
| 3601 | DEFUN (show_ipv6_route_prefix_vrf_all, |
| 3602 | show_ipv6_route_prefix_vrf_all_cmd, |
| 3603 | "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR, |
| 3604 | SHOW_STR |
| 3605 | IP_STR |
| 3606 | "IPv6 routing table\n" |
| 3607 | "IPv6 prefix\n" |
| 3608 | VRF_ALL_CMD_HELP_STR) |
| 3609 | { |
| 3610 | int ret; |
| 3611 | struct prefix_ipv6 p; |
| 3612 | struct route_table *table; |
| 3613 | struct route_node *rn; |
| 3614 | struct zebra_vrf *zvrf; |
| 3615 | vrf_iter_t iter; |
| 3616 | |
| 3617 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3618 | if (ret <= 0) |
| 3619 | { |
| 3620 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 3621 | return CMD_WARNING; |
| 3622 | } |
| 3623 | |
| 3624 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3625 | { |
| 3626 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3627 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3628 | continue; |
| 3629 | |
| 3630 | rn = route_node_match (table, (struct prefix *) &p); |
| 3631 | if (! rn) |
| 3632 | continue; |
| 3633 | if (rn->p.prefixlen != p.prefixlen) |
| 3634 | { |
| 3635 | route_unlock_node (rn); |
| 3636 | continue; |
| 3637 | } |
| 3638 | |
| 3639 | vty_show_ip_route_detail (vty, rn, 0); |
| 3640 | |
| 3641 | route_unlock_node (rn); |
| 3642 | } |
| 3643 | |
| 3644 | return CMD_SUCCESS; |
| 3645 | } |
| 3646 | |
| 3647 | /* Show route summary. */ |
| 3648 | DEFUN (show_ipv6_route_summary_vrf_all, |
| 3649 | show_ipv6_route_summary_vrf_all_cmd, |
| 3650 | "show ipv6 route summary " VRF_ALL_CMD_STR, |
| 3651 | SHOW_STR |
| 3652 | IP_STR |
| 3653 | "IPv6 routing table\n" |
| 3654 | "Summary of all IPv6 routes\n" |
| 3655 | VRF_ALL_CMD_HELP_STR) |
| 3656 | { |
| 3657 | struct zebra_vrf *zvrf; |
| 3658 | vrf_iter_t iter; |
| 3659 | |
| 3660 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3661 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3662 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 3663 | |
| 3664 | return CMD_SUCCESS; |
| 3665 | } |
| 3666 | |
| 3667 | DEFUN (show_ipv6_mroute_vrf_all, |
| 3668 | show_ipv6_mroute_vrf_all_cmd, |
| 3669 | "show ipv6 mroute " VRF_ALL_CMD_STR, |
| 3670 | SHOW_STR |
| 3671 | IP_STR |
| 3672 | "IPv6 Multicast routing table\n" |
| 3673 | VRF_ALL_CMD_HELP_STR) |
| 3674 | { |
| 3675 | struct route_table *table; |
| 3676 | struct route_node *rn; |
| 3677 | struct rib *rib; |
| 3678 | struct zebra_vrf *zvrf; |
| 3679 | vrf_iter_t iter; |
| 3680 | int first = 1; |
| 3681 | |
| 3682 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3683 | { |
| 3684 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3685 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3686 | continue; |
| 3687 | |
| 3688 | /* Show all IPv6 route. */ |
| 3689 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3690 | RNODE_FOREACH_RIB (rn, rib) |
| 3691 | { |
| 3692 | if (first) |
| 3693 | { |
| 3694 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3695 | first = 0; |
| 3696 | } |
| 3697 | vty_show_ip_route (vty, rn, rib); |
| 3698 | } |
| 3699 | } |
| 3700 | return CMD_SUCCESS; |
| 3701 | } |
| 3702 | |
| 3703 | DEFUN (show_ipv6_route_summary_prefix_vrf_all, |
| 3704 | show_ipv6_route_summary_prefix_vrf_all_cmd, |
| 3705 | "show ipv6 route summary prefix " VRF_ALL_CMD_STR, |
| 3706 | SHOW_STR |
| 3707 | IP_STR |
| 3708 | "IPv6 routing table\n" |
| 3709 | "Summary of all IPv6 routes\n" |
| 3710 | "Prefix routes\n" |
| 3711 | VRF_ALL_CMD_HELP_STR) |
| 3712 | { |
| 3713 | struct zebra_vrf *zvrf; |
| 3714 | vrf_iter_t iter; |
| 3715 | |
| 3716 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3717 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3718 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 3719 | |
| 3720 | return CMD_SUCCESS; |
| 3721 | } |
| 3722 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3723 | /* Write IPv6 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3724 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3725 | static_config_ipv6 (struct vty *vty) |
| 3726 | { |
| 3727 | struct route_node *rn; |
| 3728 | struct static_ipv6 *si; |
| 3729 | int write; |
| 3730 | char buf[BUFSIZ]; |
| 3731 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3732 | struct zebra_vrf *zvrf; |
| 3733 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3734 | |
| 3735 | write = 0; |
| 3736 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3737 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3738 | { |
| 3739 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3740 | (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3741 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3742 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3743 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 3744 | for (si = rn->info; si; si = si->next) |
| 3745 | { |
| 3746 | vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3747 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3748 | switch (si->type) |
| 3749 | { |
| 3750 | case STATIC_IPV6_GATEWAY: |
| 3751 | vty_out (vty, " %s", |
| 3752 | inet_ntop (AF_INET6, &si->ipv6, buf, BUFSIZ)); |
| 3753 | break; |
| 3754 | case STATIC_IPV6_IFNAME: |
| 3755 | vty_out (vty, " %s", si->ifname); |
| 3756 | break; |
| 3757 | case STATIC_IPV6_GATEWAY_IFNAME: |
| 3758 | vty_out (vty, " %s %s", |
| 3759 | inet_ntop (AF_INET6, &si->ipv6, buf, BUFSIZ), |
| 3760 | si->ifname); |
| 3761 | break; |
| 3762 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3763 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3764 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 3765 | vty_out (vty, " %s", "reject"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3766 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3767 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 3768 | vty_out (vty, " %s", "blackhole"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3769 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3770 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 3771 | vty_out (vty, " %d", si->distance); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3772 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3773 | if (si->vrf_id != VRF_DEFAULT) |
| 3774 | vty_out (vty, " vrf %u", si->vrf_id); |
| 3775 | |
| 3776 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3777 | |
| 3778 | write = 1; |
| 3779 | } |
| 3780 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3781 | return write; |
| 3782 | } |
| 3783 | #endif /* HAVE_IPV6 */ |
| 3784 | |
| 3785 | /* Static ip route configuration write function. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3786 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3787 | zebra_ip_config (struct vty *vty) |
| 3788 | { |
| 3789 | int write = 0; |
| 3790 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3791 | write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); |
| 3792 | write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3793 | #ifdef HAVE_IPV6 |
| 3794 | write += static_config_ipv6 (vty); |
| 3795 | #endif /* HAVE_IPV6 */ |
| 3796 | |
| 3797 | return write; |
| 3798 | } |
| 3799 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3800 | static int config_write_vty(struct vty *vty) |
| 3801 | { |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3802 | int i; |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3803 | enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get (); |
| 3804 | |
| 3805 | if (ipv4_multicast_mode != MCAST_NO_CONFIG) |
| 3806 | vty_out (vty, "ip multicast rpf-lookup-mode %s%s", |
| 3807 | ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" : |
| 3808 | ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" : |
| 3809 | ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" : |
| 3810 | ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" : |
| 3811 | "longer-prefix", |
| 3812 | VTY_NEWLINE); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3813 | |
| 3814 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 3815 | { |
| 3816 | if (proto_rm[AFI_IP][i]) |
| 3817 | vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i), |
| 3818 | proto_rm[AFI_IP][i], VTY_NEWLINE); |
| 3819 | } |
| 3820 | if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX]) |
| 3821 | vty_out (vty, "ip protocol %s route-map %s%s", "any", |
| 3822 | proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE); |
| 3823 | |
| 3824 | return 1; |
| 3825 | } |
| 3826 | |
| 3827 | /* table node for protocol filtering */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 3828 | static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 }; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3829 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3830 | /* IP node for static routes. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 3831 | static struct cmd_node ip_node = { IP_NODE, "", 1 }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3832 | |
| 3833 | /* Route VTY. */ |
| 3834 | void |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3835 | zebra_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3836 | { |
| 3837 | install_node (&ip_node, zebra_ip_config); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3838 | install_node (&protocol_node, config_write_vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3839 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3840 | install_element (CONFIG_NODE, &ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 3841 | install_element (CONFIG_NODE, &ip_mroute_dist_cmd); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3842 | install_element (CONFIG_NODE, &no_ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 3843 | install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3844 | install_element (CONFIG_NODE, &ip_multicast_mode_cmd); |
| 3845 | install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd); |
| 3846 | install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3847 | install_element (CONFIG_NODE, &ip_protocol_cmd); |
| 3848 | install_element (CONFIG_NODE, &no_ip_protocol_cmd); |
| 3849 | install_element (VIEW_NODE, &show_ip_protocol_cmd); |
| 3850 | install_element (ENABLE_NODE, &show_ip_protocol_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3851 | install_element (CONFIG_NODE, &ip_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3852 | install_element (CONFIG_NODE, &ip_route_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3853 | install_element (CONFIG_NODE, &ip_route_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3854 | install_element (CONFIG_NODE, &ip_route_mask_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3855 | install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3856 | install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3857 | install_element (CONFIG_NODE, &no_ip_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3858 | install_element (CONFIG_NODE, &no_ip_route_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3859 | install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3860 | install_element (CONFIG_NODE, &no_ip_route_mask_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3861 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3862 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3863 | install_element (CONFIG_NODE, &ip_route_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3864 | install_element (CONFIG_NODE, &ip_route_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3865 | install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3866 | install_element (CONFIG_NODE, &ip_route_mask_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3867 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3868 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3869 | install_element (CONFIG_NODE, &no_ip_route_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3870 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3871 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3872 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3873 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3874 | |
| 3875 | install_element (VIEW_NODE, &show_ip_route_cmd); |
| 3876 | install_element (VIEW_NODE, &show_ip_route_addr_cmd); |
| 3877 | install_element (VIEW_NODE, &show_ip_route_prefix_cmd); |
| 3878 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd); |
| 3879 | install_element (VIEW_NODE, &show_ip_route_protocol_cmd); |
| 3880 | install_element (VIEW_NODE, &show_ip_route_supernets_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3881 | install_element (VIEW_NODE, &show_ip_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3882 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3883 | install_element (ENABLE_NODE, &show_ip_route_cmd); |
| 3884 | install_element (ENABLE_NODE, &show_ip_route_addr_cmd); |
| 3885 | install_element (ENABLE_NODE, &show_ip_route_prefix_cmd); |
| 3886 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_cmd); |
| 3887 | install_element (ENABLE_NODE, &show_ip_route_protocol_cmd); |
| 3888 | install_element (ENABLE_NODE, &show_ip_route_supernets_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3889 | install_element (ENABLE_NODE, &show_ip_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3890 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3891 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3892 | install_element (VIEW_NODE, &show_ip_rpf_cmd); |
| 3893 | install_element (ENABLE_NODE, &show_ip_rpf_cmd); |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 3894 | install_element (VIEW_NODE, &show_ip_rpf_addr_cmd); |
| 3895 | install_element (ENABLE_NODE, &show_ip_rpf_addr_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3896 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3897 | /* Commands for VRF */ |
| 3898 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3899 | install_element (CONFIG_NODE, &ip_mroute_vrf_cmd); |
| 3900 | install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd); |
| 3901 | install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd); |
| 3902 | install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd); |
| 3903 | |
| 3904 | install_element (CONFIG_NODE, &ip_route_vrf_cmd); |
| 3905 | install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd); |
| 3906 | install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd); |
| 3907 | install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd); |
| 3908 | install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd); |
| 3909 | install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd); |
| 3910 | install_element (CONFIG_NODE, &no_ip_route_vrf_cmd); |
| 3911 | install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd); |
| 3912 | install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd); |
| 3913 | install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd); |
| 3914 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd); |
| 3915 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd); |
| 3916 | install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd); |
| 3917 | install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd); |
| 3918 | install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd); |
| 3919 | install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd); |
| 3920 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd); |
| 3921 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd); |
| 3922 | install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd); |
| 3923 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); |
| 3924 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd); |
| 3925 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd); |
| 3926 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd); |
| 3927 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3928 | install_element (VIEW_NODE, &show_ip_route_vrf_cmd); |
| 3929 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd); |
| 3930 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd); |
| 3931 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd); |
| 3932 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd); |
| 3933 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd); |
| 3934 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd); |
| 3935 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd); |
| 3936 | install_element (ENABLE_NODE, &show_ip_route_vrf_cmd); |
| 3937 | install_element (ENABLE_NODE, &show_ip_route_addr_vrf_cmd); |
| 3938 | install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_cmd); |
| 3939 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_cmd); |
| 3940 | install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_cmd); |
| 3941 | install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_cmd); |
| 3942 | install_element (ENABLE_NODE, &show_ip_route_summary_vrf_cmd); |
| 3943 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_cmd); |
| 3944 | |
| 3945 | install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd); |
| 3946 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd); |
| 3947 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd); |
| 3948 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd); |
| 3949 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd); |
| 3950 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd); |
| 3951 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd); |
| 3952 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd); |
| 3953 | install_element (ENABLE_NODE, &show_ip_route_vrf_all_cmd); |
| 3954 | install_element (ENABLE_NODE, &show_ip_route_addr_vrf_all_cmd); |
| 3955 | install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_all_cmd); |
| 3956 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_all_cmd); |
| 3957 | install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_all_cmd); |
| 3958 | install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_all_cmd); |
| 3959 | install_element (ENABLE_NODE, &show_ip_route_summary_vrf_all_cmd); |
| 3960 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_all_cmd); |
| 3961 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3962 | install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd); |
| 3963 | install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd); |
| 3964 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd); |
| 3965 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd); |
| 3966 | install_element (ENABLE_NODE, &show_ip_rpf_vrf_cmd); |
| 3967 | install_element (ENABLE_NODE, &show_ip_rpf_vrf_all_cmd); |
| 3968 | install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_cmd); |
| 3969 | install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_all_cmd); |
| 3970 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3971 | #ifdef HAVE_IPV6 |
| 3972 | install_element (CONFIG_NODE, &ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3973 | install_element (CONFIG_NODE, &ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3974 | install_element (CONFIG_NODE, &ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3975 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3976 | install_element (CONFIG_NODE, &no_ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3977 | install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3978 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3979 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3980 | install_element (CONFIG_NODE, &ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3981 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3982 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3983 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3984 | install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3985 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3986 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3987 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | install_element (VIEW_NODE, &show_ipv6_route_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3989 | install_element (VIEW_NODE, &show_ipv6_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3990 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3991 | install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd); |
| 3992 | install_element (VIEW_NODE, &show_ipv6_route_addr_cmd); |
| 3993 | install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd); |
| 3994 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd); |
| 3995 | install_element (ENABLE_NODE, &show_ipv6_route_cmd); |
| 3996 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_cmd); |
| 3997 | install_element (ENABLE_NODE, &show_ipv6_route_addr_cmd); |
| 3998 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_cmd); |
| 3999 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 4000 | install_element (ENABLE_NODE, &show_ipv6_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 4001 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4002 | |
| 4003 | install_element (VIEW_NODE, &show_ipv6_mroute_cmd); |
| 4004 | install_element (ENABLE_NODE, &show_ipv6_mroute_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4005 | |
| 4006 | /* Commands for VRF */ |
| 4007 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4008 | install_element (CONFIG_NODE, &ipv6_route_vrf_cmd); |
| 4009 | install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd); |
| 4010 | install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd); |
| 4011 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd); |
| 4012 | install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd); |
| 4013 | install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd); |
| 4014 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd); |
| 4015 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd); |
| 4016 | install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd); |
| 4017 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd); |
| 4018 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd); |
| 4019 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd); |
| 4020 | install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd); |
| 4021 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd); |
| 4022 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd); |
| 4023 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd); |
| 4024 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4025 | install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd); |
| 4026 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd); |
| 4027 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd); |
| 4028 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd); |
| 4029 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd); |
| 4030 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd); |
| 4031 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd); |
| 4032 | install_element (ENABLE_NODE, &show_ipv6_route_vrf_cmd); |
| 4033 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_cmd); |
| 4034 | install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_cmd); |
| 4035 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_cmd); |
| 4036 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_cmd); |
| 4037 | install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_cmd); |
| 4038 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_cmd); |
| 4039 | |
| 4040 | install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); |
| 4041 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd); |
| 4042 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd); |
| 4043 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd); |
| 4044 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd); |
| 4045 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd); |
| 4046 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd); |
| 4047 | install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_cmd); |
| 4048 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_all_cmd); |
| 4049 | install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_all_cmd); |
| 4050 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_all_cmd); |
| 4051 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd); |
| 4052 | install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_all_cmd); |
| 4053 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd); |
| 4054 | |
| 4055 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd); |
| 4056 | install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_cmd); |
| 4057 | |
| 4058 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); |
| 4059 | install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4060 | #endif /* HAVE_IPV6 */ |
| 4061 | } |