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); |
Timo Teräs | b11f3b5 | 2015-11-02 16:50:07 +0200 | [diff] [blame] | 1293 | if (rib->mtu) |
| 1294 | vty_out (vty, ", mtu %u", rib->mtu); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1295 | vty_out (vty, ", vrf %u", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1296 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1297 | vty_out (vty, ", best"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1298 | if (rib->refcnt) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1299 | vty_out (vty, ", refcnt %ld", rib->refcnt); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1300 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 1301 | vty_out (vty, ", blackhole"); |
| 1302 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 1303 | vty_out (vty, ", reject"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1304 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1305 | |
| 1306 | #define ONE_DAY_SECOND 60*60*24 |
| 1307 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 1308 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1309 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 1310 | || rib->type == ZEBRA_ROUTE_OSPF |
| 1311 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 1312 | || rib->type == ZEBRA_ROUTE_BABEL |
| 1313 | || rib->type == ZEBRA_ROUTE_ISIS |
| 1314 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1315 | { |
| 1316 | time_t uptime; |
| 1317 | struct tm *tm; |
| 1318 | |
| 1319 | uptime = time (NULL); |
| 1320 | uptime -= rib->uptime; |
| 1321 | tm = gmtime (&uptime); |
| 1322 | |
| 1323 | vty_out (vty, " Last update "); |
| 1324 | |
| 1325 | if (uptime < ONE_DAY_SECOND) |
| 1326 | vty_out (vty, "%02d:%02d:%02d", |
| 1327 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 1328 | else if (uptime < ONE_WEEK_SECOND) |
| 1329 | vty_out (vty, "%dd%02dh%02dm", |
| 1330 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 1331 | else |
| 1332 | vty_out (vty, "%02dw%dd%02dh", |
| 1333 | tm->tm_yday/7, |
| 1334 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 1335 | vty_out (vty, " ago%s", VTY_NEWLINE); |
| 1336 | } |
| 1337 | |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1338 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1339 | { |
| 1340 | vty_out (vty, " %c%s", |
| 1341 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ', |
| 1342 | recursing ? " " : ""); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1343 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1344 | switch (nexthop->type) |
| 1345 | { |
| 1346 | case NEXTHOP_TYPE_IPV4: |
| 1347 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1348 | vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4)); |
| 1349 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1350 | vty_out (vty, ", via %s", |
| 1351 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1352 | break; |
| 1353 | case NEXTHOP_TYPE_IPV6: |
| 1354 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1355 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1356 | vty_out (vty, " %s", |
| 1357 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf))); |
| 1358 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 1359 | vty_out (vty, ", %s", nexthop->ifname); |
| 1360 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1361 | vty_out (vty, ", via %s", |
| 1362 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1363 | break; |
| 1364 | case NEXTHOP_TYPE_IFINDEX: |
| 1365 | vty_out (vty, " directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1366 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1367 | break; |
| 1368 | case NEXTHOP_TYPE_IFNAME: |
| 1369 | vty_out (vty, " directly connected, %s", nexthop->ifname); |
| 1370 | break; |
| 1371 | case NEXTHOP_TYPE_BLACKHOLE: |
| 1372 | vty_out (vty, " directly connected, Null0"); |
| 1373 | break; |
| 1374 | default: |
| 1375 | break; |
| 1376 | } |
| 1377 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
| 1378 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1379 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1380 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
| 1381 | vty_out (vty, " onlink"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1382 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1383 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
| 1384 | vty_out (vty, " (recursive)"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1385 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1386 | switch (nexthop->type) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1387 | { |
| 1388 | case NEXTHOP_TYPE_IPV4: |
| 1389 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1390 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 1391 | if (nexthop->src.ipv4.s_addr) |
| 1392 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1393 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
| 1394 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1395 | } |
| 1396 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1397 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1398 | case NEXTHOP_TYPE_IPV6: |
| 1399 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1400 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1401 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 1402 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1403 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
| 1404 | vty_out (vty, ", src %s", buf); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1405 | } |
| 1406 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1407 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1408 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1409 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1410 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1411 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1412 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1413 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1414 | } |
| 1415 | } |
| 1416 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 1417 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1418 | vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib) |
| 1419 | { |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1420 | struct nexthop *nexthop, *tnexthop; |
| 1421 | int recursing; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1422 | int len = 0; |
| 1423 | char buf[BUFSIZ]; |
| 1424 | |
| 1425 | /* Nexthop information. */ |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1426 | for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1427 | { |
| 1428 | if (nexthop == rib->nexthop) |
| 1429 | { |
| 1430 | /* Prefix information. */ |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1431 | len = vty_out (vty, "%c%c%c %s", |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 1432 | zebra_route_char (rib->type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1433 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) |
| 1434 | ? '>' : ' ', |
| 1435 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1436 | ? '*' : ' ', |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1437 | prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1438 | |
| 1439 | /* Distance and metric display. */ |
| 1440 | if (rib->type != ZEBRA_ROUTE_CONNECT |
| 1441 | && rib->type != ZEBRA_ROUTE_KERNEL) |
| 1442 | len += vty_out (vty, " [%d/%d]", rib->distance, |
| 1443 | rib->metric); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1444 | |
| 1445 | if (rib->vrf_id != VRF_DEFAULT) |
| 1446 | len += vty_out (vty, " [vrf %u]", rib->vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1447 | } |
| 1448 | else |
| 1449 | vty_out (vty, " %c%*c", |
| 1450 | CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1451 | ? '*' : ' ', |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1452 | len - 3 + (2 * recursing), ' '); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1453 | |
| 1454 | switch (nexthop->type) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1455 | { |
| 1456 | case NEXTHOP_TYPE_IPV4: |
| 1457 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1458 | vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4)); |
| 1459 | if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1460 | vty_out (vty, ", %s", |
| 1461 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1462 | break; |
| 1463 | case NEXTHOP_TYPE_IPV6: |
| 1464 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1465 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1466 | vty_out (vty, " via %s", |
| 1467 | inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ)); |
| 1468 | if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) |
| 1469 | vty_out (vty, ", %s", nexthop->ifname); |
| 1470 | else if (nexthop->ifindex) |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1471 | vty_out (vty, ", %s", |
| 1472 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1473 | break; |
| 1474 | case NEXTHOP_TYPE_IFINDEX: |
| 1475 | vty_out (vty, " is directly connected, %s", |
Feng Lu | 0d0686f | 2015-05-22 11:40:02 +0200 | [diff] [blame] | 1476 | ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id)); |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1477 | break; |
| 1478 | case NEXTHOP_TYPE_IFNAME: |
| 1479 | vty_out (vty, " is directly connected, %s", nexthop->ifname); |
| 1480 | break; |
| 1481 | case NEXTHOP_TYPE_BLACKHOLE: |
| 1482 | vty_out (vty, " is directly connected, Null0"); |
| 1483 | break; |
| 1484 | default: |
| 1485 | break; |
| 1486 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1487 | if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1488 | vty_out (vty, " inactive"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1489 | |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1490 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1491 | vty_out (vty, " onlink"); |
Christian Franke | e8d3d29 | 2013-07-05 15:35:39 +0000 | [diff] [blame] | 1492 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1493 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1494 | vty_out (vty, " (recursive)"); |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1495 | |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1496 | switch (nexthop->type) |
| 1497 | { |
| 1498 | case NEXTHOP_TYPE_IPV4: |
| 1499 | case NEXTHOP_TYPE_IPV4_IFINDEX: |
| 1500 | case NEXTHOP_TYPE_IPV4_IFNAME: |
| 1501 | if (nexthop->src.ipv4.s_addr) |
| 1502 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1503 | if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1504 | vty_out (vty, ", src %s", buf); |
| 1505 | } |
| 1506 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1507 | #ifdef HAVE_IPV6 |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1508 | case NEXTHOP_TYPE_IPV6: |
| 1509 | case NEXTHOP_TYPE_IPV6_IFINDEX: |
| 1510 | case NEXTHOP_TYPE_IPV6_IFNAME: |
| 1511 | if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any)) |
| 1512 | { |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1513 | if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf)) |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1514 | vty_out (vty, ", src %s", buf); |
| 1515 | } |
| 1516 | break; |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 1517 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1518 | default: |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1519 | break; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 1520 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1521 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 1522 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 1523 | vty_out (vty, ", bh"); |
| 1524 | if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) |
| 1525 | vty_out (vty, ", rej"); |
| 1526 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1527 | if (rib->type == ZEBRA_ROUTE_RIP |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 1528 | || rib->type == ZEBRA_ROUTE_RIPNG |
| 1529 | || rib->type == ZEBRA_ROUTE_OSPF |
| 1530 | || rib->type == ZEBRA_ROUTE_OSPF6 |
| 1531 | || rib->type == ZEBRA_ROUTE_BABEL |
| 1532 | || rib->type == ZEBRA_ROUTE_ISIS |
| 1533 | || rib->type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1534 | { |
| 1535 | time_t uptime; |
| 1536 | struct tm *tm; |
| 1537 | |
| 1538 | uptime = time (NULL); |
| 1539 | uptime -= rib->uptime; |
| 1540 | tm = gmtime (&uptime); |
| 1541 | |
| 1542 | #define ONE_DAY_SECOND 60*60*24 |
| 1543 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 1544 | |
| 1545 | if (uptime < ONE_DAY_SECOND) |
| 1546 | vty_out (vty, ", %02d:%02d:%02d", |
| 1547 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 1548 | else if (uptime < ONE_WEEK_SECOND) |
| 1549 | vty_out (vty, ", %dd%02dh%02dm", |
| 1550 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 1551 | else |
| 1552 | vty_out (vty, ", %02dw%dd%02dh", |
| 1553 | tm->tm_yday/7, |
| 1554 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 1555 | } |
| 1556 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1557 | } |
| 1558 | } |
| 1559 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1560 | DEFUN (show_ip_route, |
| 1561 | show_ip_route_cmd, |
| 1562 | "show ip route", |
| 1563 | SHOW_STR |
| 1564 | IP_STR |
| 1565 | "IP routing table\n") |
| 1566 | { |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1567 | vrf_id_t vrf_id = VRF_DEFAULT; |
| 1568 | |
| 1569 | if (argc > 0) |
| 1570 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 1571 | |
| 1572 | return do_show_ip_route(vty, SAFI_UNICAST, vrf_id); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 1573 | } |
| 1574 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1575 | static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id) |
| 1576 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1577 | struct route_table *table; |
| 1578 | struct route_node *rn; |
| 1579 | struct rib *rib; |
| 1580 | int first = 1; |
| 1581 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1582 | table = zebra_vrf_table (AFI_IP, safi, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1583 | if (! table) |
| 1584 | return CMD_SUCCESS; |
| 1585 | |
| 1586 | /* Show all IPv4 routes. */ |
| 1587 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1588 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1589 | { |
| 1590 | if (first) |
| 1591 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1592 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1593 | first = 0; |
| 1594 | } |
| 1595 | vty_show_ip_route (vty, rn, rib); |
| 1596 | } |
| 1597 | return CMD_SUCCESS; |
| 1598 | } |
| 1599 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1600 | ALIAS (show_ip_route, |
| 1601 | show_ip_route_vrf_cmd, |
| 1602 | "show ip route " VRF_CMD_STR, |
| 1603 | SHOW_STR |
| 1604 | IP_STR |
| 1605 | "IP routing table\n" |
| 1606 | VRF_CMD_HELP_STR) |
| 1607 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1608 | DEFUN (show_ip_route_prefix_longer, |
| 1609 | show_ip_route_prefix_longer_cmd, |
| 1610 | "show ip route A.B.C.D/M longer-prefixes", |
| 1611 | SHOW_STR |
| 1612 | IP_STR |
| 1613 | "IP routing table\n" |
| 1614 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1615 | "Show route matching the specified Network/Mask pair only\n") |
| 1616 | { |
| 1617 | struct route_table *table; |
| 1618 | struct route_node *rn; |
| 1619 | struct rib *rib; |
| 1620 | struct prefix p; |
| 1621 | int ret; |
| 1622 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1623 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1624 | |
| 1625 | ret = str2prefix (argv[0], &p); |
| 1626 | if (! ret) |
| 1627 | { |
| 1628 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 1629 | return CMD_WARNING; |
| 1630 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1631 | |
| 1632 | if (argc > 1) |
| 1633 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1634 | |
| 1635 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1636 | if (! table) |
| 1637 | return CMD_SUCCESS; |
| 1638 | |
| 1639 | /* Show matched type IPv4 routes. */ |
| 1640 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1641 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1642 | if (prefix_match (&p, &rn->p)) |
| 1643 | { |
| 1644 | if (first) |
| 1645 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1646 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1647 | first = 0; |
| 1648 | } |
| 1649 | vty_show_ip_route (vty, rn, rib); |
| 1650 | } |
| 1651 | return CMD_SUCCESS; |
| 1652 | } |
| 1653 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1654 | ALIAS (show_ip_route_prefix_longer, |
| 1655 | show_ip_route_prefix_longer_vrf_cmd, |
| 1656 | "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR, |
| 1657 | SHOW_STR |
| 1658 | IP_STR |
| 1659 | "IP routing table\n" |
| 1660 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1661 | "Show route matching the specified Network/Mask pair only\n" |
| 1662 | VRF_CMD_HELP_STR) |
| 1663 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1664 | DEFUN (show_ip_route_supernets, |
| 1665 | show_ip_route_supernets_cmd, |
| 1666 | "show ip route supernets-only", |
| 1667 | SHOW_STR |
| 1668 | IP_STR |
| 1669 | "IP routing table\n" |
| 1670 | "Show supernet entries only\n") |
| 1671 | { |
| 1672 | struct route_table *table; |
| 1673 | struct route_node *rn; |
| 1674 | struct rib *rib; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1675 | u_int32_t addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1676 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1677 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1678 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1679 | if (argc > 0) |
| 1680 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 1681 | |
| 1682 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1683 | if (! table) |
| 1684 | return CMD_SUCCESS; |
| 1685 | |
| 1686 | /* Show matched type IPv4 routes. */ |
| 1687 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1688 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1689 | { |
| 1690 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 1691 | |
| 1692 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 1693 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1694 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1695 | { |
| 1696 | if (first) |
| 1697 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1698 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1699 | first = 0; |
| 1700 | } |
| 1701 | vty_show_ip_route (vty, rn, rib); |
| 1702 | } |
| 1703 | } |
| 1704 | return CMD_SUCCESS; |
| 1705 | } |
| 1706 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1707 | ALIAS (show_ip_route_supernets, |
| 1708 | show_ip_route_supernets_vrf_cmd, |
| 1709 | "show ip route supernets-only " VRF_CMD_STR, |
| 1710 | SHOW_STR |
| 1711 | IP_STR |
| 1712 | "IP routing table\n" |
| 1713 | "Show supernet entries only\n" |
| 1714 | VRF_CMD_HELP_STR) |
| 1715 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1716 | DEFUN (show_ip_route_protocol, |
| 1717 | show_ip_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1718 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1719 | SHOW_STR |
| 1720 | IP_STR |
| 1721 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1722 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1723 | { |
| 1724 | int type; |
| 1725 | struct route_table *table; |
| 1726 | struct route_node *rn; |
| 1727 | struct rib *rib; |
| 1728 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1729 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1730 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1731 | type = proto_redistnum (AFI_IP, argv[0]); |
| 1732 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1733 | { |
| 1734 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 1735 | return CMD_WARNING; |
| 1736 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1737 | |
| 1738 | if (argc > 1) |
| 1739 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1740 | |
| 1741 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1742 | if (! table) |
| 1743 | return CMD_SUCCESS; |
| 1744 | |
| 1745 | /* Show matched type IPv4 routes. */ |
| 1746 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1747 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1748 | if (rib->type == type) |
| 1749 | { |
| 1750 | if (first) |
| 1751 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 1752 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1753 | first = 0; |
| 1754 | } |
| 1755 | vty_show_ip_route (vty, rn, rib); |
| 1756 | } |
| 1757 | return CMD_SUCCESS; |
| 1758 | } |
| 1759 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1760 | ALIAS (show_ip_route_protocol, |
| 1761 | show_ip_route_protocol_vrf_cmd, |
| 1762 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 1763 | SHOW_STR |
| 1764 | IP_STR |
| 1765 | "IP routing table\n" |
| 1766 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 1767 | VRF_CMD_HELP_STR) |
| 1768 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1769 | DEFUN (show_ip_route_addr, |
| 1770 | show_ip_route_addr_cmd, |
| 1771 | "show ip route A.B.C.D", |
| 1772 | SHOW_STR |
| 1773 | IP_STR |
| 1774 | "IP routing table\n" |
| 1775 | "Network in the IP routing table to display\n") |
| 1776 | { |
| 1777 | int ret; |
| 1778 | struct prefix_ipv4 p; |
| 1779 | struct route_table *table; |
| 1780 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1781 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1782 | |
| 1783 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1784 | if (ret <= 0) |
| 1785 | { |
| 1786 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 1787 | return CMD_WARNING; |
| 1788 | } |
| 1789 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1790 | if (argc > 1) |
| 1791 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1792 | |
| 1793 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1794 | if (! table) |
| 1795 | return CMD_SUCCESS; |
| 1796 | |
| 1797 | rn = route_node_match (table, (struct prefix *) &p); |
| 1798 | if (! rn) |
| 1799 | { |
| 1800 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 1801 | return CMD_WARNING; |
| 1802 | } |
| 1803 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1804 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1805 | |
| 1806 | route_unlock_node (rn); |
| 1807 | |
| 1808 | return CMD_SUCCESS; |
| 1809 | } |
| 1810 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1811 | ALIAS (show_ip_route_addr, |
| 1812 | show_ip_route_addr_vrf_cmd, |
| 1813 | "show ip route A.B.C.D " VRF_CMD_STR, |
| 1814 | SHOW_STR |
| 1815 | IP_STR |
| 1816 | "IP routing table\n" |
| 1817 | "Network in the IP routing table to display\n" |
| 1818 | VRF_CMD_HELP_STR) |
| 1819 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1820 | DEFUN (show_ip_route_prefix, |
| 1821 | show_ip_route_prefix_cmd, |
| 1822 | "show ip route A.B.C.D/M", |
| 1823 | SHOW_STR |
| 1824 | IP_STR |
| 1825 | "IP routing table\n" |
| 1826 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") |
| 1827 | { |
| 1828 | int ret; |
| 1829 | struct prefix_ipv4 p; |
| 1830 | struct route_table *table; |
| 1831 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1832 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1833 | |
| 1834 | ret = str2prefix_ipv4 (argv[0], &p); |
| 1835 | if (ret <= 0) |
| 1836 | { |
| 1837 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 1838 | return CMD_WARNING; |
| 1839 | } |
| 1840 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1841 | if (argc > 1) |
| 1842 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 1843 | |
| 1844 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1845 | if (! table) |
| 1846 | return CMD_SUCCESS; |
| 1847 | |
| 1848 | rn = route_node_match (table, (struct prefix *) &p); |
| 1849 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 1850 | { |
| 1851 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 1852 | if (rn) |
| 1853 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1854 | return CMD_WARNING; |
| 1855 | } |
| 1856 | |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 1857 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1858 | |
| 1859 | route_unlock_node (rn); |
| 1860 | |
| 1861 | return CMD_SUCCESS; |
| 1862 | } |
| 1863 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1864 | ALIAS (show_ip_route_prefix, |
| 1865 | show_ip_route_prefix_vrf_cmd, |
| 1866 | "show ip route A.B.C.D/M " VRF_CMD_STR, |
| 1867 | SHOW_STR |
| 1868 | IP_STR |
| 1869 | "IP routing table\n" |
| 1870 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 1871 | VRF_CMD_HELP_STR) |
| 1872 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 1873 | static void |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1874 | vty_show_ip_route_summary (struct vty *vty, struct route_table *table) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1875 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1876 | struct route_node *rn; |
| 1877 | struct rib *rib; |
| 1878 | struct nexthop *nexthop; |
| 1879 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 1880 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 1881 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1882 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1883 | u_int32_t i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1884 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1885 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 1886 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 1887 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 1888 | RNODE_FOREACH_RIB (rn, rib) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1889 | for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) |
| 1890 | { |
| 1891 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1892 | rib_cnt[rib->type]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1893 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1894 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1895 | { |
| 1896 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1897 | fib_cnt[rib->type]++; |
| 1898 | } |
| 1899 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 1900 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 1901 | { |
| 1902 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
Christian Franke | fa713d9 | 2013-07-05 15:35:37 +0000 | [diff] [blame] | 1903 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) |
| 1904 | || nexthop_has_fib_child(nexthop)) |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1905 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1906 | } |
| 1907 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1908 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1909 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 1910 | "Route Source", "Routes", "FIB", |
| 1911 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 1912 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1913 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1914 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 1915 | { |
| 1916 | if (rib_cnt[i] > 0) |
| 1917 | { |
| 1918 | if (i == ZEBRA_ROUTE_BGP) |
| 1919 | { |
| 1920 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 1921 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 1922 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 1923 | VTY_NEWLINE); |
| 1924 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 1925 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 1926 | VTY_NEWLINE); |
| 1927 | } |
| 1928 | else |
| 1929 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 1930 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 1931 | } |
| 1932 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1933 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 1934 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 1935 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 1936 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1937 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1938 | } |
| 1939 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 1940 | /* |
| 1941 | * Implementation of the ip route summary prefix command. |
| 1942 | * |
| 1943 | * This command prints the primary prefixes that have been installed by various |
| 1944 | * protocols on the box. |
| 1945 | * |
| 1946 | */ |
| 1947 | static void |
| 1948 | vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) |
| 1949 | { |
| 1950 | struct route_node *rn; |
| 1951 | struct rib *rib; |
| 1952 | struct nexthop *nexthop; |
| 1953 | #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX |
| 1954 | #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) |
| 1955 | u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1956 | u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; |
| 1957 | u_int32_t i; |
| 1958 | int cnt; |
| 1959 | |
| 1960 | memset (&rib_cnt, 0, sizeof(rib_cnt)); |
| 1961 | memset (&fib_cnt, 0, sizeof(fib_cnt)); |
| 1962 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 1963 | RNODE_FOREACH_RIB (rn, rib) |
| 1964 | { |
| 1965 | |
| 1966 | /* |
| 1967 | * In case of ECMP, count only once. |
| 1968 | */ |
| 1969 | cnt = 0; |
| 1970 | for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next) |
| 1971 | { |
| 1972 | cnt++; |
| 1973 | rib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1974 | rib_cnt[rib->type]++; |
| 1975 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 1976 | { |
| 1977 | fib_cnt[ZEBRA_ROUTE_TOTAL]++; |
| 1978 | fib_cnt[rib->type]++; |
| 1979 | } |
| 1980 | if (rib->type == ZEBRA_ROUTE_BGP && |
| 1981 | CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) |
| 1982 | { |
| 1983 | rib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1984 | if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) |
| 1985 | fib_cnt[ZEBRA_ROUTE_IBGP]++; |
| 1986 | } |
| 1987 | } |
| 1988 | } |
| 1989 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 1990 | vty_out (vty, "%-20s %-20s %s (vrf %u)%s", |
| 1991 | "Route Source", "Prefix Routes", "FIB", |
| 1992 | ((rib_table_info_t *)table->info)->zvrf->vrf_id, |
| 1993 | VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 1994 | |
| 1995 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 1996 | { |
| 1997 | if (rib_cnt[i] > 0) |
| 1998 | { |
| 1999 | if (i == ZEBRA_ROUTE_BGP) |
| 2000 | { |
| 2001 | vty_out (vty, "%-20s %-20d %-20d %s", "ebgp", |
| 2002 | rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP], |
| 2003 | fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2004 | VTY_NEWLINE); |
| 2005 | vty_out (vty, "%-20s %-20d %-20d %s", "ibgp", |
| 2006 | rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP], |
| 2007 | VTY_NEWLINE); |
| 2008 | } |
| 2009 | else |
| 2010 | vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i), |
| 2011 | rib_cnt[i], fib_cnt[i], VTY_NEWLINE); |
| 2012 | } |
| 2013 | } |
| 2014 | |
| 2015 | vty_out (vty, "------%s", VTY_NEWLINE); |
| 2016 | vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], |
| 2017 | fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2018 | vty_out (vty, "%s", VTY_NEWLINE); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2019 | } |
| 2020 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2021 | /* Show route summary. */ |
| 2022 | DEFUN (show_ip_route_summary, |
| 2023 | show_ip_route_summary_cmd, |
| 2024 | "show ip route summary", |
| 2025 | SHOW_STR |
| 2026 | IP_STR |
| 2027 | "IP routing table\n" |
| 2028 | "Summary of all routes\n") |
| 2029 | { |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2030 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2031 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2032 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2033 | if (argc > 0) |
| 2034 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2035 | |
| 2036 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2037 | if (! table) |
| 2038 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2039 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 2040 | vty_show_ip_route_summary (vty, table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2041 | |
| 2042 | return CMD_SUCCESS; |
| 2043 | } |
| 2044 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2045 | ALIAS (show_ip_route_summary, |
| 2046 | show_ip_route_summary_vrf_cmd, |
| 2047 | "show ip route summary " VRF_CMD_STR, |
| 2048 | SHOW_STR |
| 2049 | IP_STR |
| 2050 | "IP routing table\n" |
| 2051 | "Summary of all routes\n" |
| 2052 | VRF_CMD_HELP_STR) |
| 2053 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2054 | /* Show route summary prefix. */ |
| 2055 | DEFUN (show_ip_route_summary_prefix, |
| 2056 | show_ip_route_summary_prefix_cmd, |
| 2057 | "show ip route summary prefix", |
| 2058 | SHOW_STR |
| 2059 | IP_STR |
| 2060 | "IP routing table\n" |
| 2061 | "Summary of all routes\n" |
| 2062 | "Prefix routes\n") |
| 2063 | { |
| 2064 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2065 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2066 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2067 | if (argc > 0) |
| 2068 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 2069 | |
| 2070 | table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 2071 | if (! table) |
| 2072 | return CMD_SUCCESS; |
| 2073 | |
| 2074 | vty_show_ip_route_summary_prefix (vty, table); |
| 2075 | |
| 2076 | return CMD_SUCCESS; |
| 2077 | } |
| 2078 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 2079 | ALIAS (show_ip_route_summary_prefix, |
| 2080 | show_ip_route_summary_prefix_vrf_cmd, |
| 2081 | "show ip route summary prefix " VRF_CMD_STR, |
| 2082 | SHOW_STR |
| 2083 | IP_STR |
| 2084 | "IP routing table\n" |
| 2085 | "Summary of all routes\n" |
| 2086 | "Prefix routes\n" |
| 2087 | VRF_CMD_HELP_STR) |
| 2088 | |
| 2089 | DEFUN (show_ip_route_vrf_all, |
| 2090 | show_ip_route_vrf_all_cmd, |
| 2091 | "show ip route " VRF_ALL_CMD_STR, |
| 2092 | SHOW_STR |
| 2093 | IP_STR |
| 2094 | "IP routing table\n" |
| 2095 | VRF_ALL_CMD_HELP_STR) |
| 2096 | { |
| 2097 | struct route_table *table; |
| 2098 | struct route_node *rn; |
| 2099 | struct rib *rib; |
| 2100 | struct zebra_vrf *zvrf; |
| 2101 | vrf_iter_t iter; |
| 2102 | int first = 1; |
| 2103 | |
| 2104 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2105 | { |
| 2106 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2107 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2108 | continue; |
| 2109 | |
| 2110 | /* Show all IPv4 routes. */ |
| 2111 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2112 | RNODE_FOREACH_RIB (rn, rib) |
| 2113 | { |
| 2114 | if (first) |
| 2115 | { |
| 2116 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2117 | first = 0; |
| 2118 | } |
| 2119 | vty_show_ip_route (vty, rn, rib); |
| 2120 | } |
| 2121 | } |
| 2122 | |
| 2123 | return CMD_SUCCESS; |
| 2124 | } |
| 2125 | |
| 2126 | DEFUN (show_ip_route_prefix_longer_vrf_all, |
| 2127 | show_ip_route_prefix_longer_vrf_all_cmd, |
| 2128 | "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR, |
| 2129 | SHOW_STR |
| 2130 | IP_STR |
| 2131 | "IP routing table\n" |
| 2132 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2133 | "Show route matching the specified Network/Mask pair only\n" |
| 2134 | VRF_ALL_CMD_HELP_STR) |
| 2135 | { |
| 2136 | struct route_table *table; |
| 2137 | struct route_node *rn; |
| 2138 | struct rib *rib; |
| 2139 | struct prefix p; |
| 2140 | struct zebra_vrf *zvrf; |
| 2141 | vrf_iter_t iter; |
| 2142 | int ret; |
| 2143 | int first = 1; |
| 2144 | |
| 2145 | ret = str2prefix (argv[0], &p); |
| 2146 | if (! ret) |
| 2147 | { |
| 2148 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 2149 | return CMD_WARNING; |
| 2150 | } |
| 2151 | |
| 2152 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2153 | { |
| 2154 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2155 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2156 | continue; |
| 2157 | |
| 2158 | /* Show matched type IPv4 routes. */ |
| 2159 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2160 | RNODE_FOREACH_RIB (rn, rib) |
| 2161 | if (prefix_match (&p, &rn->p)) |
| 2162 | { |
| 2163 | if (first) |
| 2164 | { |
| 2165 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2166 | first = 0; |
| 2167 | } |
| 2168 | vty_show_ip_route (vty, rn, rib); |
| 2169 | } |
| 2170 | } |
| 2171 | |
| 2172 | return CMD_SUCCESS; |
| 2173 | } |
| 2174 | |
| 2175 | DEFUN (show_ip_route_supernets_vrf_all, |
| 2176 | show_ip_route_supernets_vrf_all_cmd, |
| 2177 | "show ip route supernets-only " VRF_ALL_CMD_STR, |
| 2178 | SHOW_STR |
| 2179 | IP_STR |
| 2180 | "IP routing table\n" |
| 2181 | "Show supernet entries only\n" |
| 2182 | VRF_ALL_CMD_HELP_STR) |
| 2183 | { |
| 2184 | struct route_table *table; |
| 2185 | struct route_node *rn; |
| 2186 | struct rib *rib; |
| 2187 | struct zebra_vrf *zvrf; |
| 2188 | vrf_iter_t iter; |
| 2189 | u_int32_t addr; |
| 2190 | int first = 1; |
| 2191 | |
| 2192 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2193 | { |
| 2194 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2195 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2196 | continue; |
| 2197 | |
| 2198 | /* Show matched type IPv4 routes. */ |
| 2199 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2200 | RNODE_FOREACH_RIB (rn, rib) |
| 2201 | { |
| 2202 | addr = ntohl (rn->p.u.prefix4.s_addr); |
| 2203 | |
| 2204 | if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) |
| 2205 | || (IN_CLASSB (addr) && rn->p.prefixlen < 16) |
| 2206 | || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) |
| 2207 | { |
| 2208 | if (first) |
| 2209 | { |
| 2210 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2211 | first = 0; |
| 2212 | } |
| 2213 | vty_show_ip_route (vty, rn, rib); |
| 2214 | } |
| 2215 | } |
| 2216 | } |
| 2217 | |
| 2218 | return CMD_SUCCESS; |
| 2219 | } |
| 2220 | |
| 2221 | DEFUN (show_ip_route_protocol_vrf_all, |
| 2222 | show_ip_route_protocol_vrf_all_cmd, |
| 2223 | "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 2224 | SHOW_STR |
| 2225 | IP_STR |
| 2226 | "IP routing table\n" |
| 2227 | QUAGGA_IP_REDIST_HELP_STR_ZEBRA |
| 2228 | VRF_ALL_CMD_HELP_STR) |
| 2229 | { |
| 2230 | int type; |
| 2231 | struct route_table *table; |
| 2232 | struct route_node *rn; |
| 2233 | struct rib *rib; |
| 2234 | struct zebra_vrf *zvrf; |
| 2235 | vrf_iter_t iter; |
| 2236 | int first = 1; |
| 2237 | |
| 2238 | type = proto_redistnum (AFI_IP, argv[0]); |
| 2239 | if (type < 0) |
| 2240 | { |
| 2241 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 2242 | return CMD_WARNING; |
| 2243 | } |
| 2244 | |
| 2245 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2246 | { |
| 2247 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2248 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2249 | continue; |
| 2250 | |
| 2251 | /* Show matched type IPv4 routes. */ |
| 2252 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 2253 | RNODE_FOREACH_RIB (rn, rib) |
| 2254 | if (rib->type == type) |
| 2255 | { |
| 2256 | if (first) |
| 2257 | { |
| 2258 | vty_out (vty, SHOW_ROUTE_V4_HEADER); |
| 2259 | first = 0; |
| 2260 | } |
| 2261 | vty_show_ip_route (vty, rn, rib); |
| 2262 | } |
| 2263 | } |
| 2264 | |
| 2265 | return CMD_SUCCESS; |
| 2266 | } |
| 2267 | |
| 2268 | DEFUN (show_ip_route_addr_vrf_all, |
| 2269 | show_ip_route_addr_vrf_all_cmd, |
| 2270 | "show ip route A.B.C.D " VRF_ALL_CMD_STR, |
| 2271 | SHOW_STR |
| 2272 | IP_STR |
| 2273 | "IP routing table\n" |
| 2274 | "Network in the IP routing table to display\n" |
| 2275 | VRF_ALL_CMD_HELP_STR) |
| 2276 | { |
| 2277 | int ret; |
| 2278 | struct prefix_ipv4 p; |
| 2279 | struct route_table *table; |
| 2280 | struct route_node *rn; |
| 2281 | struct zebra_vrf *zvrf; |
| 2282 | vrf_iter_t iter; |
| 2283 | |
| 2284 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2285 | if (ret <= 0) |
| 2286 | { |
| 2287 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2288 | return CMD_WARNING; |
| 2289 | } |
| 2290 | |
| 2291 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2292 | { |
| 2293 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2294 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2295 | continue; |
| 2296 | |
| 2297 | rn = route_node_match (table, (struct prefix *) &p); |
| 2298 | if (! rn) |
| 2299 | continue; |
| 2300 | |
| 2301 | vty_show_ip_route_detail (vty, rn, 0); |
| 2302 | |
| 2303 | route_unlock_node (rn); |
| 2304 | } |
| 2305 | |
| 2306 | return CMD_SUCCESS; |
| 2307 | } |
| 2308 | |
| 2309 | DEFUN (show_ip_route_prefix_vrf_all, |
| 2310 | show_ip_route_prefix_vrf_all_cmd, |
| 2311 | "show ip route A.B.C.D/M " VRF_ALL_CMD_STR, |
| 2312 | SHOW_STR |
| 2313 | IP_STR |
| 2314 | "IP routing table\n" |
| 2315 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" |
| 2316 | VRF_ALL_CMD_HELP_STR) |
| 2317 | { |
| 2318 | int ret; |
| 2319 | struct prefix_ipv4 p; |
| 2320 | struct route_table *table; |
| 2321 | struct route_node *rn; |
| 2322 | struct zebra_vrf *zvrf; |
| 2323 | vrf_iter_t iter; |
| 2324 | |
| 2325 | ret = str2prefix_ipv4 (argv[0], &p); |
| 2326 | if (ret <= 0) |
| 2327 | { |
| 2328 | vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); |
| 2329 | return CMD_WARNING; |
| 2330 | } |
| 2331 | |
| 2332 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2333 | { |
| 2334 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2335 | (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) |
| 2336 | continue; |
| 2337 | |
| 2338 | rn = route_node_match (table, (struct prefix *) &p); |
| 2339 | if (! rn) |
| 2340 | continue; |
| 2341 | if (rn->p.prefixlen != p.prefixlen) |
| 2342 | { |
| 2343 | route_unlock_node (rn); |
| 2344 | continue; |
| 2345 | } |
| 2346 | |
| 2347 | vty_show_ip_route_detail (vty, rn, 0); |
| 2348 | |
| 2349 | route_unlock_node (rn); |
| 2350 | } |
| 2351 | |
| 2352 | return CMD_SUCCESS; |
| 2353 | } |
| 2354 | |
| 2355 | DEFUN (show_ip_route_summary_vrf_all, |
| 2356 | show_ip_route_summary_vrf_all_cmd, |
| 2357 | "show ip route summary " VRF_ALL_CMD_STR, |
| 2358 | SHOW_STR |
| 2359 | IP_STR |
| 2360 | "IP routing table\n" |
| 2361 | "Summary of all routes\n" |
| 2362 | VRF_ALL_CMD_HELP_STR) |
| 2363 | { |
| 2364 | struct zebra_vrf *zvrf; |
| 2365 | vrf_iter_t iter; |
| 2366 | |
| 2367 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2368 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 2369 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 2370 | |
| 2371 | return CMD_SUCCESS; |
| 2372 | } |
| 2373 | |
| 2374 | DEFUN (show_ip_route_summary_prefix_vrf_all, |
| 2375 | show_ip_route_summary_prefix_vrf_all_cmd, |
| 2376 | "show ip route summary prefix " VRF_ALL_CMD_STR, |
| 2377 | SHOW_STR |
| 2378 | IP_STR |
| 2379 | "IP routing table\n" |
| 2380 | "Summary of all routes\n" |
| 2381 | "Prefix routes\n" |
| 2382 | VRF_ALL_CMD_HELP_STR) |
| 2383 | { |
| 2384 | struct zebra_vrf *zvrf; |
| 2385 | vrf_iter_t iter; |
| 2386 | |
| 2387 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2388 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 2389 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]); |
| 2390 | |
| 2391 | return CMD_SUCCESS; |
| 2392 | } |
| 2393 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2394 | /* Write IPv4 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2395 | static int |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 2396 | static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2397 | { |
| 2398 | struct route_node *rn; |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 2399 | struct static_route *si; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2400 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2401 | struct zebra_vrf *zvrf; |
| 2402 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2403 | int write; |
| 2404 | |
| 2405 | write = 0; |
| 2406 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2407 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 2408 | { |
| 2409 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 2410 | (stable = zvrf->stable[AFI_IP][safi]) == NULL) |
| 2411 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2412 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2413 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 2414 | for (si = rn->info; si; si = si->next) |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 2415 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2416 | vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4), |
| 2417 | rn->p.prefixlen); |
| 2418 | |
| 2419 | switch (si->type) |
| 2420 | { |
| 2421 | case STATIC_IPV4_GATEWAY: |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 2422 | vty_out (vty, " %s", inet_ntoa (si->addr.ipv4)); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2423 | break; |
| 2424 | case STATIC_IPV4_IFNAME: |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 2425 | vty_out (vty, " %s", si->ifname); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2426 | break; |
| 2427 | case STATIC_IPV4_BLACKHOLE: |
| 2428 | vty_out (vty, " Null0"); |
| 2429 | break; |
| 2430 | } |
| 2431 | |
| 2432 | /* flags are incompatible with STATIC_IPV4_BLACKHOLE */ |
| 2433 | if (si->type != STATIC_IPV4_BLACKHOLE) |
| 2434 | { |
| 2435 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 2436 | vty_out (vty, " %s", "reject"); |
| 2437 | |
| 2438 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 2439 | vty_out (vty, " %s", "blackhole"); |
| 2440 | } |
| 2441 | |
| 2442 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 2443 | vty_out (vty, " %d", si->distance); |
| 2444 | |
| 2445 | if (si->vrf_id != VRF_DEFAULT) |
| 2446 | vty_out (vty, " vrf %u", si->vrf_id); |
| 2447 | |
| 2448 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2449 | |
| 2450 | write = 1; |
paul | 7021c42 | 2003-07-15 12:52:22 +0000 | [diff] [blame] | 2451 | } |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2452 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2453 | return write; |
| 2454 | } |
Andrew J. Schorr | 0930331 | 2007-05-30 20:10:34 +0000 | [diff] [blame] | 2455 | |
| 2456 | DEFUN (show_ip_protocol, |
| 2457 | show_ip_protocol_cmd, |
| 2458 | "show ip protocol", |
| 2459 | SHOW_STR |
| 2460 | IP_STR |
| 2461 | "IP protocol filtering status\n") |
| 2462 | { |
| 2463 | int i; |
| 2464 | |
| 2465 | vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE); |
| 2466 | vty_out(vty, "------------------------%s", VTY_NEWLINE); |
| 2467 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 2468 | { |
| 2469 | if (proto_rm[AFI_IP][i]) |
| 2470 | vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i), |
| 2471 | proto_rm[AFI_IP][i], |
| 2472 | VTY_NEWLINE); |
| 2473 | else |
| 2474 | vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE); |
| 2475 | } |
| 2476 | if (proto_rm[AFI_IP][i]) |
| 2477 | vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i], |
| 2478 | VTY_NEWLINE); |
| 2479 | else |
| 2480 | vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE); |
| 2481 | |
| 2482 | return CMD_SUCCESS; |
| 2483 | } |
| 2484 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2485 | #ifdef HAVE_IPV6 |
| 2486 | /* General fucntion for IPv6 static route. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 2487 | static int |
hasso | 39db97e | 2004-10-12 20:50:58 +0000 | [diff] [blame] | 2488 | static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, |
| 2489 | const char *gate_str, const char *ifname, |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2490 | const char *flag_str, const char *distance_str, |
| 2491 | const char *vrf_id_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2492 | { |
| 2493 | int ret; |
| 2494 | u_char distance; |
| 2495 | struct prefix p; |
| 2496 | struct in6_addr *gate = NULL; |
| 2497 | struct in6_addr gate_addr; |
| 2498 | u_char type = 0; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2499 | vrf_id_t vrf_id = VRF_DEFAULT; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2500 | u_char flag = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2501 | |
| 2502 | ret = str2prefix (dest_str, &p); |
| 2503 | if (ret <= 0) |
| 2504 | { |
| 2505 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 2506 | return CMD_WARNING; |
| 2507 | } |
| 2508 | |
| 2509 | /* Apply mask for given prefix. */ |
| 2510 | apply_mask (&p); |
| 2511 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2512 | /* Route flags */ |
| 2513 | if (flag_str) { |
| 2514 | switch(flag_str[0]) { |
| 2515 | case 'r': |
| 2516 | case 'R': /* XXX */ |
| 2517 | SET_FLAG (flag, ZEBRA_FLAG_REJECT); |
| 2518 | break; |
| 2519 | case 'b': |
| 2520 | case 'B': /* XXX */ |
| 2521 | SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE); |
| 2522 | break; |
| 2523 | default: |
| 2524 | vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE); |
paul | 595db7f | 2003-05-25 21:35:06 +0000 | [diff] [blame] | 2525 | return CMD_WARNING; |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2526 | } |
| 2527 | } |
| 2528 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2529 | /* Administrative distance. */ |
| 2530 | if (distance_str) |
| 2531 | distance = atoi (distance_str); |
| 2532 | else |
| 2533 | distance = ZEBRA_STATIC_DISTANCE_DEFAULT; |
| 2534 | |
| 2535 | /* When gateway is valid IPv6 addrees, then gate is treated as |
| 2536 | nexthop address other case gate is treated as interface name. */ |
| 2537 | ret = inet_pton (AF_INET6, gate_str, &gate_addr); |
| 2538 | |
| 2539 | if (ifname) |
| 2540 | { |
| 2541 | /* When ifname is specified. It must be come with gateway |
| 2542 | address. */ |
| 2543 | if (ret != 1) |
| 2544 | { |
| 2545 | vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); |
| 2546 | return CMD_WARNING; |
| 2547 | } |
| 2548 | type = STATIC_IPV6_GATEWAY_IFNAME; |
| 2549 | gate = &gate_addr; |
| 2550 | } |
| 2551 | else |
| 2552 | { |
| 2553 | if (ret == 1) |
| 2554 | { |
| 2555 | type = STATIC_IPV6_GATEWAY; |
| 2556 | gate = &gate_addr; |
| 2557 | } |
| 2558 | else |
| 2559 | { |
| 2560 | type = STATIC_IPV6_IFNAME; |
| 2561 | ifname = gate_str; |
| 2562 | } |
| 2563 | } |
| 2564 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2565 | /* VRF id */ |
| 2566 | if (vrf_id_str) |
| 2567 | VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str); |
| 2568 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2569 | if (add_cmd) |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2570 | static_add_ipv6 (&p, type, gate, ifname, flag, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2571 | else |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2572 | static_delete_ipv6 (&p, type, gate, ifname, distance, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2573 | |
| 2574 | return CMD_SUCCESS; |
| 2575 | } |
| 2576 | |
| 2577 | DEFUN (ipv6_route, |
| 2578 | ipv6_route_cmd, |
| 2579 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 2580 | IP_STR |
| 2581 | "Establish static routes\n" |
| 2582 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2583 | "IPv6 gateway address\n" |
| 2584 | "IPv6 gateway interface name\n") |
| 2585 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2586 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, |
| 2587 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2588 | } |
| 2589 | |
| 2590 | DEFUN (ipv6_route_flags, |
| 2591 | ipv6_route_flags_cmd, |
| 2592 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 2593 | IP_STR |
| 2594 | "Establish static routes\n" |
| 2595 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2596 | "IPv6 gateway address\n" |
| 2597 | "IPv6 gateway interface name\n" |
| 2598 | "Emit an ICMP unreachable when matched\n" |
| 2599 | "Silently discard pkts when matched\n") |
| 2600 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2601 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 2602 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2603 | } |
| 2604 | |
| 2605 | DEFUN (ipv6_route_ifname, |
| 2606 | ipv6_route_ifname_cmd, |
| 2607 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 2608 | IP_STR |
| 2609 | "Establish static routes\n" |
| 2610 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2611 | "IPv6 gateway address\n" |
| 2612 | "IPv6 gateway interface name\n") |
| 2613 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2614 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 2615 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2616 | } |
| 2617 | |
| 2618 | DEFUN (ipv6_route_ifname_flags, |
| 2619 | ipv6_route_ifname_flags_cmd, |
| 2620 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 2621 | IP_STR |
| 2622 | "Establish static routes\n" |
| 2623 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2624 | "IPv6 gateway address\n" |
| 2625 | "IPv6 gateway interface name\n" |
| 2626 | "Emit an ICMP unreachable when matched\n" |
| 2627 | "Silently discard pkts when matched\n") |
| 2628 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2629 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 2630 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2631 | } |
| 2632 | |
| 2633 | DEFUN (ipv6_route_pref, |
| 2634 | ipv6_route_pref_cmd, |
| 2635 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 2636 | IP_STR |
| 2637 | "Establish static routes\n" |
| 2638 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2639 | "IPv6 gateway address\n" |
| 2640 | "IPv6 gateway interface name\n" |
| 2641 | "Distance value for this prefix\n") |
| 2642 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2643 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], |
| 2644 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2645 | } |
| 2646 | |
| 2647 | DEFUN (ipv6_route_flags_pref, |
| 2648 | ipv6_route_flags_pref_cmd, |
| 2649 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 2650 | IP_STR |
| 2651 | "Establish static routes\n" |
| 2652 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2653 | "IPv6 gateway address\n" |
| 2654 | "IPv6 gateway interface name\n" |
| 2655 | "Emit an ICMP unreachable when matched\n" |
| 2656 | "Silently discard pkts when matched\n" |
| 2657 | "Distance value for this prefix\n") |
| 2658 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2659 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2660 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2661 | } |
| 2662 | |
| 2663 | DEFUN (ipv6_route_ifname_pref, |
| 2664 | ipv6_route_ifname_pref_cmd, |
| 2665 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 2666 | IP_STR |
| 2667 | "Establish static routes\n" |
| 2668 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2669 | "IPv6 gateway address\n" |
| 2670 | "IPv6 gateway interface name\n" |
| 2671 | "Distance value for this prefix\n") |
| 2672 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2673 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2674 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2675 | } |
| 2676 | |
| 2677 | DEFUN (ipv6_route_ifname_flags_pref, |
| 2678 | ipv6_route_ifname_flags_pref_cmd, |
| 2679 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 2680 | IP_STR |
| 2681 | "Establish static routes\n" |
| 2682 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2683 | "IPv6 gateway address\n" |
| 2684 | "IPv6 gateway interface name\n" |
| 2685 | "Emit an ICMP unreachable when matched\n" |
| 2686 | "Silently discard pkts when matched\n" |
| 2687 | "Distance value for this prefix\n") |
| 2688 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2689 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2690 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2691 | } |
| 2692 | |
| 2693 | DEFUN (no_ipv6_route, |
| 2694 | no_ipv6_route_cmd, |
| 2695 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", |
| 2696 | NO_STR |
| 2697 | IP_STR |
| 2698 | "Establish static routes\n" |
| 2699 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2700 | "IPv6 gateway address\n" |
| 2701 | "IPv6 gateway interface name\n") |
| 2702 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2703 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 2704 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2705 | } |
| 2706 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2707 | ALIAS (no_ipv6_route, |
| 2708 | no_ipv6_route_flags_cmd, |
| 2709 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", |
| 2710 | NO_STR |
| 2711 | IP_STR |
| 2712 | "Establish static routes\n" |
| 2713 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2714 | "IPv6 gateway address\n" |
| 2715 | "IPv6 gateway interface name\n" |
| 2716 | "Emit an ICMP unreachable when matched\n" |
| 2717 | "Silently discard pkts when matched\n") |
| 2718 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2719 | DEFUN (no_ipv6_route_ifname, |
| 2720 | no_ipv6_route_ifname_cmd, |
| 2721 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE", |
| 2722 | NO_STR |
| 2723 | IP_STR |
| 2724 | "Establish static routes\n" |
| 2725 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2726 | "IPv6 gateway address\n" |
| 2727 | "IPv6 gateway interface name\n") |
| 2728 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2729 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 2730 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2731 | } |
| 2732 | |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2733 | ALIAS (no_ipv6_route_ifname, |
| 2734 | no_ipv6_route_ifname_flags_cmd, |
| 2735 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", |
| 2736 | NO_STR |
| 2737 | IP_STR |
| 2738 | "Establish static routes\n" |
| 2739 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2740 | "IPv6 gateway address\n" |
| 2741 | "IPv6 gateway interface name\n" |
| 2742 | "Emit an ICMP unreachable when matched\n" |
| 2743 | "Silently discard pkts when matched\n") |
| 2744 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2745 | DEFUN (no_ipv6_route_pref, |
| 2746 | no_ipv6_route_pref_cmd, |
| 2747 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", |
| 2748 | NO_STR |
| 2749 | IP_STR |
| 2750 | "Establish static routes\n" |
| 2751 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2752 | "IPv6 gateway address\n" |
| 2753 | "IPv6 gateway interface name\n" |
| 2754 | "Distance value for this prefix\n") |
| 2755 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2756 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], |
| 2757 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2758 | } |
| 2759 | |
| 2760 | DEFUN (no_ipv6_route_flags_pref, |
| 2761 | no_ipv6_route_flags_pref_cmd, |
| 2762 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", |
| 2763 | NO_STR |
| 2764 | IP_STR |
| 2765 | "Establish static routes\n" |
| 2766 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2767 | "IPv6 gateway address\n" |
| 2768 | "IPv6 gateway interface name\n" |
| 2769 | "Emit an ICMP unreachable when matched\n" |
| 2770 | "Silently discard pkts when matched\n" |
| 2771 | "Distance value for this prefix\n") |
| 2772 | { |
| 2773 | /* We do not care about argv[2] */ |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2774 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2775 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2776 | } |
| 2777 | |
| 2778 | DEFUN (no_ipv6_route_ifname_pref, |
| 2779 | no_ipv6_route_ifname_pref_cmd, |
| 2780 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", |
| 2781 | NO_STR |
| 2782 | IP_STR |
| 2783 | "Establish static routes\n" |
| 2784 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2785 | "IPv6 gateway address\n" |
| 2786 | "IPv6 gateway interface name\n" |
| 2787 | "Distance value for this prefix\n") |
| 2788 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2789 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2790 | NULL); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 2791 | } |
| 2792 | |
| 2793 | DEFUN (no_ipv6_route_ifname_flags_pref, |
| 2794 | no_ipv6_route_ifname_flags_pref_cmd, |
| 2795 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", |
| 2796 | NO_STR |
| 2797 | IP_STR |
| 2798 | "Establish static routes\n" |
| 2799 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2800 | "IPv6 gateway address\n" |
| 2801 | "IPv6 gateway interface name\n" |
| 2802 | "Emit an ICMP unreachable when matched\n" |
| 2803 | "Silently discard pkts when matched\n" |
| 2804 | "Distance value for this prefix\n") |
| 2805 | { |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 2806 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2807 | NULL); |
| 2808 | } |
| 2809 | |
| 2810 | DEFUN (ipv6_route_vrf, |
| 2811 | ipv6_route_vrf_cmd, |
| 2812 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 2813 | IP_STR |
| 2814 | "Establish static routes\n" |
| 2815 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2816 | "IPv6 gateway address\n" |
| 2817 | "IPv6 gateway interface name\n" |
| 2818 | VRF_CMD_HELP_STR) |
| 2819 | { |
| 2820 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, |
| 2821 | argv[2]); |
| 2822 | } |
| 2823 | |
| 2824 | DEFUN (ipv6_route_flags_vrf, |
| 2825 | ipv6_route_flags_vrf_cmd, |
| 2826 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 2827 | IP_STR |
| 2828 | "Establish static routes\n" |
| 2829 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2830 | "IPv6 gateway address\n" |
| 2831 | "IPv6 gateway interface name\n" |
| 2832 | "Emit an ICMP unreachable when matched\n" |
| 2833 | "Silently discard pkts when matched\n" |
| 2834 | VRF_CMD_HELP_STR) |
| 2835 | { |
| 2836 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, |
| 2837 | argv[3]); |
| 2838 | } |
| 2839 | |
| 2840 | DEFUN (ipv6_route_ifname_vrf, |
| 2841 | ipv6_route_ifname_vrf_cmd, |
| 2842 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 2843 | IP_STR |
| 2844 | "Establish static routes\n" |
| 2845 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2846 | "IPv6 gateway address\n" |
| 2847 | "IPv6 gateway interface name\n" |
| 2848 | VRF_CMD_HELP_STR) |
| 2849 | { |
| 2850 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, |
| 2851 | argv[3]); |
| 2852 | } |
| 2853 | |
| 2854 | DEFUN (ipv6_route_ifname_flags_vrf, |
| 2855 | ipv6_route_ifname_flags_vrf_cmd, |
| 2856 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 2857 | IP_STR |
| 2858 | "Establish static routes\n" |
| 2859 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2860 | "IPv6 gateway address\n" |
| 2861 | "IPv6 gateway interface name\n" |
| 2862 | "Emit an ICMP unreachable when matched\n" |
| 2863 | "Silently discard pkts when matched\n" |
| 2864 | VRF_CMD_HELP_STR) |
| 2865 | { |
| 2866 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, |
| 2867 | argv[4]); |
| 2868 | } |
| 2869 | |
| 2870 | DEFUN (ipv6_route_pref_vrf, |
| 2871 | ipv6_route_pref_vrf_cmd, |
| 2872 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 2873 | IP_STR |
| 2874 | "Establish static routes\n" |
| 2875 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2876 | "IPv6 gateway address\n" |
| 2877 | "IPv6 gateway interface name\n" |
| 2878 | "Distance value for this prefix\n" |
| 2879 | VRF_CMD_HELP_STR) |
| 2880 | { |
| 2881 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], |
| 2882 | argv[3]); |
| 2883 | } |
| 2884 | |
| 2885 | DEFUN (ipv6_route_flags_pref_vrf, |
| 2886 | ipv6_route_flags_pref_vrf_cmd, |
| 2887 | "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 2888 | IP_STR |
| 2889 | "Establish static routes\n" |
| 2890 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2891 | "IPv6 gateway address\n" |
| 2892 | "IPv6 gateway interface name\n" |
| 2893 | "Emit an ICMP unreachable when matched\n" |
| 2894 | "Silently discard pkts when matched\n" |
| 2895 | "Distance value for this prefix\n" |
| 2896 | VRF_CMD_HELP_STR) |
| 2897 | { |
| 2898 | return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], |
| 2899 | argv[4]); |
| 2900 | } |
| 2901 | |
| 2902 | DEFUN (ipv6_route_ifname_pref_vrf, |
| 2903 | ipv6_route_ifname_pref_vrf_cmd, |
| 2904 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 2905 | IP_STR |
| 2906 | "Establish static routes\n" |
| 2907 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2908 | "IPv6 gateway address\n" |
| 2909 | "IPv6 gateway interface name\n" |
| 2910 | "Distance value for this prefix\n" |
| 2911 | VRF_CMD_HELP_STR) |
| 2912 | { |
| 2913 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], |
| 2914 | argv[4]); |
| 2915 | } |
| 2916 | |
| 2917 | DEFUN (ipv6_route_ifname_flags_pref_vrf, |
| 2918 | ipv6_route_ifname_flags_pref_vrf_cmd, |
| 2919 | "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 2920 | IP_STR |
| 2921 | "Establish static routes\n" |
| 2922 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2923 | "IPv6 gateway address\n" |
| 2924 | "IPv6 gateway interface name\n" |
| 2925 | "Emit an ICMP unreachable when matched\n" |
| 2926 | "Silently discard pkts when matched\n" |
| 2927 | "Distance value for this prefix\n" |
| 2928 | VRF_CMD_HELP_STR) |
| 2929 | { |
| 2930 | return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 2931 | argv[5]); |
| 2932 | } |
| 2933 | |
| 2934 | DEFUN (no_ipv6_route_vrf, |
| 2935 | no_ipv6_route_vrf_cmd, |
| 2936 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, |
| 2937 | NO_STR |
| 2938 | IP_STR |
| 2939 | "Establish static routes\n" |
| 2940 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2941 | "IPv6 gateway address\n" |
| 2942 | "IPv6 gateway interface name\n" |
| 2943 | VRF_CMD_HELP_STR) |
| 2944 | { |
| 2945 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, |
| 2946 | (argc > 3) ? argv[3] : argv[2]); |
| 2947 | } |
| 2948 | |
| 2949 | ALIAS (no_ipv6_route_vrf, |
| 2950 | no_ipv6_route_flags_vrf_cmd, |
| 2951 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, |
| 2952 | NO_STR |
| 2953 | IP_STR |
| 2954 | "Establish static routes\n" |
| 2955 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2956 | "IPv6 gateway address\n" |
| 2957 | "IPv6 gateway interface name\n" |
| 2958 | "Emit an ICMP unreachable when matched\n" |
| 2959 | "Silently discard pkts when matched\n" |
| 2960 | VRF_CMD_HELP_STR) |
| 2961 | |
| 2962 | DEFUN (no_ipv6_route_ifname_vrf, |
| 2963 | no_ipv6_route_ifname_vrf_cmd, |
| 2964 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, |
| 2965 | NO_STR |
| 2966 | IP_STR |
| 2967 | "Establish static routes\n" |
| 2968 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2969 | "IPv6 gateway address\n" |
| 2970 | "IPv6 gateway interface name\n" |
| 2971 | VRF_CMD_HELP_STR) |
| 2972 | { |
| 2973 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, |
| 2974 | (argc > 4) ? argv[4] : argv[3]); |
| 2975 | } |
| 2976 | |
| 2977 | ALIAS (no_ipv6_route_ifname_vrf, |
| 2978 | no_ipv6_route_ifname_flags_vrf_cmd, |
| 2979 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, |
| 2980 | NO_STR |
| 2981 | IP_STR |
| 2982 | "Establish static routes\n" |
| 2983 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2984 | "IPv6 gateway address\n" |
| 2985 | "IPv6 gateway interface name\n" |
| 2986 | "Emit an ICMP unreachable when matched\n" |
| 2987 | "Silently discard pkts when matched\n" |
| 2988 | VRF_CMD_HELP_STR) |
| 2989 | |
| 2990 | DEFUN (no_ipv6_route_pref_vrf, |
| 2991 | no_ipv6_route_pref_vrf_cmd, |
| 2992 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, |
| 2993 | NO_STR |
| 2994 | IP_STR |
| 2995 | "Establish static routes\n" |
| 2996 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 2997 | "IPv6 gateway address\n" |
| 2998 | "IPv6 gateway interface name\n" |
| 2999 | "Distance value for this prefix\n" |
| 3000 | VRF_CMD_HELP_STR) |
| 3001 | { |
| 3002 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], |
| 3003 | argv[3]); |
| 3004 | } |
| 3005 | |
| 3006 | DEFUN (no_ipv6_route_flags_pref_vrf, |
| 3007 | no_ipv6_route_flags_pref_vrf_cmd, |
| 3008 | "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 3009 | NO_STR |
| 3010 | IP_STR |
| 3011 | "Establish static routes\n" |
| 3012 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3013 | "IPv6 gateway address\n" |
| 3014 | "IPv6 gateway interface name\n" |
| 3015 | "Emit an ICMP unreachable when matched\n" |
| 3016 | "Silently discard pkts when matched\n" |
| 3017 | "Distance value for this prefix\n" |
| 3018 | VRF_CMD_HELP_STR) |
| 3019 | { |
| 3020 | /* We do not care about argv[2] */ |
| 3021 | return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], |
| 3022 | argv[4]); |
| 3023 | } |
| 3024 | |
| 3025 | DEFUN (no_ipv6_route_ifname_pref_vrf, |
| 3026 | no_ipv6_route_ifname_pref_vrf_cmd, |
| 3027 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, |
| 3028 | NO_STR |
| 3029 | IP_STR |
| 3030 | "Establish static routes\n" |
| 3031 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3032 | "IPv6 gateway address\n" |
| 3033 | "IPv6 gateway interface name\n" |
| 3034 | "Distance value for this prefix\n" |
| 3035 | VRF_CMD_HELP_STR) |
| 3036 | { |
| 3037 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], |
| 3038 | argv[4]); |
| 3039 | } |
| 3040 | |
| 3041 | DEFUN (no_ipv6_route_ifname_flags_pref_vrf, |
| 3042 | no_ipv6_route_ifname_flags_pref_vrf_cmd, |
| 3043 | "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, |
| 3044 | NO_STR |
| 3045 | IP_STR |
| 3046 | "Establish static routes\n" |
| 3047 | "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" |
| 3048 | "IPv6 gateway address\n" |
| 3049 | "IPv6 gateway interface name\n" |
| 3050 | "Emit an ICMP unreachable when matched\n" |
| 3051 | "Silently discard pkts when matched\n" |
| 3052 | "Distance value for this prefix\n" |
| 3053 | VRF_CMD_HELP_STR) |
| 3054 | { |
| 3055 | return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], |
| 3056 | argv[5]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3057 | } |
| 3058 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3059 | DEFUN (show_ipv6_route, |
| 3060 | show_ipv6_route_cmd, |
| 3061 | "show ipv6 route", |
| 3062 | SHOW_STR |
| 3063 | IP_STR |
| 3064 | "IPv6 routing table\n") |
| 3065 | { |
| 3066 | struct route_table *table; |
| 3067 | struct route_node *rn; |
| 3068 | struct rib *rib; |
| 3069 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3070 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3071 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3072 | if (argc > 0) |
| 3073 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3074 | |
| 3075 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3076 | if (! table) |
| 3077 | return CMD_SUCCESS; |
| 3078 | |
| 3079 | /* Show all IPv6 route. */ |
| 3080 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3081 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3082 | { |
| 3083 | if (first) |
| 3084 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3085 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3086 | first = 0; |
| 3087 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3088 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3089 | } |
| 3090 | return CMD_SUCCESS; |
| 3091 | } |
| 3092 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3093 | ALIAS (show_ipv6_route, |
| 3094 | show_ipv6_route_vrf_cmd, |
| 3095 | "show ipv6 route " VRF_CMD_STR, |
| 3096 | SHOW_STR |
| 3097 | IP_STR |
| 3098 | "IPv6 routing table\n" |
| 3099 | VRF_CMD_HELP_STR) |
| 3100 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3101 | DEFUN (show_ipv6_route_prefix_longer, |
| 3102 | show_ipv6_route_prefix_longer_cmd, |
| 3103 | "show ipv6 route X:X::X:X/M longer-prefixes", |
| 3104 | SHOW_STR |
| 3105 | IP_STR |
| 3106 | "IPv6 routing table\n" |
| 3107 | "IPv6 prefix\n" |
| 3108 | "Show route matching the specified Network/Mask pair only\n") |
| 3109 | { |
| 3110 | struct route_table *table; |
| 3111 | struct route_node *rn; |
| 3112 | struct rib *rib; |
| 3113 | struct prefix p; |
| 3114 | int ret; |
| 3115 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3116 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3117 | |
| 3118 | ret = str2prefix (argv[0], &p); |
| 3119 | if (! ret) |
| 3120 | { |
| 3121 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 3122 | return CMD_WARNING; |
| 3123 | } |
| 3124 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3125 | if (argc > 1) |
| 3126 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3127 | |
| 3128 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
| 3129 | if (! table) |
| 3130 | return CMD_SUCCESS; |
| 3131 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3132 | /* Show matched type IPv6 routes. */ |
| 3133 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3134 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3135 | if (prefix_match (&p, &rn->p)) |
| 3136 | { |
| 3137 | if (first) |
| 3138 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3139 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3140 | first = 0; |
| 3141 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3142 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3143 | } |
| 3144 | return CMD_SUCCESS; |
| 3145 | } |
| 3146 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3147 | ALIAS (show_ipv6_route_prefix_longer, |
| 3148 | show_ipv6_route_prefix_longer_vrf_cmd, |
| 3149 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR, |
| 3150 | SHOW_STR |
| 3151 | IP_STR |
| 3152 | "IPv6 routing table\n" |
| 3153 | "IPv6 prefix\n" |
| 3154 | "Show route matching the specified Network/Mask pair only\n" |
| 3155 | VRF_CMD_HELP_STR) |
| 3156 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3157 | DEFUN (show_ipv6_route_protocol, |
| 3158 | show_ipv6_route_protocol_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3159 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3160 | SHOW_STR |
| 3161 | IP_STR |
| 3162 | "IP routing table\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3163 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3164 | { |
| 3165 | int type; |
| 3166 | struct route_table *table; |
| 3167 | struct route_node *rn; |
| 3168 | struct rib *rib; |
| 3169 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3170 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3171 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3172 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 3173 | if (type < 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3174 | { |
| 3175 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 3176 | return CMD_WARNING; |
| 3177 | } |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3178 | |
| 3179 | if (argc > 1) |
| 3180 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3181 | |
| 3182 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3183 | if (! table) |
| 3184 | return CMD_SUCCESS; |
| 3185 | |
| 3186 | /* Show matched type IPv6 routes. */ |
| 3187 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3188 | RNODE_FOREACH_RIB (rn, rib) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3189 | if (rib->type == type) |
| 3190 | { |
| 3191 | if (first) |
| 3192 | { |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 3193 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3194 | first = 0; |
| 3195 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3196 | vty_show_ip_route (vty, rn, rib); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3197 | } |
| 3198 | return CMD_SUCCESS; |
| 3199 | } |
| 3200 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3201 | ALIAS (show_ipv6_route_protocol, |
| 3202 | show_ipv6_route_protocol_vrf_cmd, |
| 3203 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR, |
| 3204 | SHOW_STR |
| 3205 | IP_STR |
| 3206 | "IP routing table\n" |
| 3207 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 3208 | VRF_CMD_HELP_STR) |
| 3209 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3210 | DEFUN (show_ipv6_route_addr, |
| 3211 | show_ipv6_route_addr_cmd, |
| 3212 | "show ipv6 route X:X::X:X", |
| 3213 | SHOW_STR |
| 3214 | IP_STR |
| 3215 | "IPv6 routing table\n" |
| 3216 | "IPv6 Address\n") |
| 3217 | { |
| 3218 | int ret; |
| 3219 | struct prefix_ipv6 p; |
| 3220 | struct route_table *table; |
| 3221 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3222 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3223 | |
| 3224 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3225 | if (ret <= 0) |
| 3226 | { |
| 3227 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 3228 | return CMD_WARNING; |
| 3229 | } |
| 3230 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3231 | if (argc > 1) |
| 3232 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3233 | |
| 3234 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3235 | if (! table) |
| 3236 | return CMD_SUCCESS; |
| 3237 | |
| 3238 | rn = route_node_match (table, (struct prefix *) &p); |
| 3239 | if (! rn) |
| 3240 | { |
| 3241 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
| 3242 | return CMD_WARNING; |
| 3243 | } |
| 3244 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3245 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3246 | |
| 3247 | route_unlock_node (rn); |
| 3248 | |
| 3249 | return CMD_SUCCESS; |
| 3250 | } |
| 3251 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3252 | ALIAS (show_ipv6_route_addr, |
| 3253 | show_ipv6_route_addr_vrf_cmd, |
| 3254 | "show ipv6 route X:X::X:X " VRF_CMD_STR, |
| 3255 | SHOW_STR |
| 3256 | IP_STR |
| 3257 | "IPv6 routing table\n" |
| 3258 | "IPv6 Address\n" |
| 3259 | VRF_CMD_HELP_STR) |
| 3260 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3261 | DEFUN (show_ipv6_route_prefix, |
| 3262 | show_ipv6_route_prefix_cmd, |
| 3263 | "show ipv6 route X:X::X:X/M", |
| 3264 | SHOW_STR |
| 3265 | IP_STR |
| 3266 | "IPv6 routing table\n" |
| 3267 | "IPv6 prefix\n") |
| 3268 | { |
| 3269 | int ret; |
| 3270 | struct prefix_ipv6 p; |
| 3271 | struct route_table *table; |
| 3272 | struct route_node *rn; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3273 | vrf_id_t vrf_id = VRF_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3274 | |
| 3275 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3276 | if (ret <= 0) |
| 3277 | { |
| 3278 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 3279 | return CMD_WARNING; |
| 3280 | } |
| 3281 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3282 | if (argc > 1) |
| 3283 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
| 3284 | |
| 3285 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3286 | if (! table) |
| 3287 | return CMD_SUCCESS; |
| 3288 | |
| 3289 | rn = route_node_match (table, (struct prefix *) &p); |
| 3290 | if (! rn || rn->p.prefixlen != p.prefixlen) |
| 3291 | { |
| 3292 | vty_out (vty, "%% Network not in table%s", VTY_NEWLINE); |
Lu Feng | 969d355 | 2014-10-21 06:24:07 +0000 | [diff] [blame] | 3293 | if (rn) |
| 3294 | route_unlock_node (rn); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3295 | return CMD_WARNING; |
| 3296 | } |
| 3297 | |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3298 | vty_show_ip_route_detail (vty, rn, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3299 | |
| 3300 | route_unlock_node (rn); |
| 3301 | |
| 3302 | return CMD_SUCCESS; |
| 3303 | } |
| 3304 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3305 | ALIAS (show_ipv6_route_prefix, |
| 3306 | show_ipv6_route_prefix_vrf_cmd, |
| 3307 | "show ipv6 route X:X::X:X/M " VRF_CMD_STR, |
| 3308 | SHOW_STR |
| 3309 | IP_STR |
| 3310 | "IPv6 routing table\n" |
| 3311 | "IPv6 prefix\n" |
| 3312 | VRF_CMD_HELP_STR) |
| 3313 | |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3314 | /* Show route summary. */ |
| 3315 | DEFUN (show_ipv6_route_summary, |
| 3316 | show_ipv6_route_summary_cmd, |
| 3317 | "show ipv6 route summary", |
| 3318 | SHOW_STR |
| 3319 | IP_STR |
| 3320 | "IPv6 routing table\n" |
| 3321 | "Summary of all IPv6 routes\n") |
| 3322 | { |
| 3323 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3324 | vrf_id_t vrf_id = VRF_DEFAULT; |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3325 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3326 | if (argc > 0) |
| 3327 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3328 | |
| 3329 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3330 | if (! table) |
| 3331 | return CMD_SUCCESS; |
| 3332 | |
| 3333 | vty_show_ip_route_summary (vty, table); |
| 3334 | |
| 3335 | return CMD_SUCCESS; |
| 3336 | } |
| 3337 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3338 | ALIAS (show_ipv6_route_summary, |
| 3339 | show_ipv6_route_summary_vrf_cmd, |
| 3340 | "show ipv6 route summary " VRF_CMD_STR, |
| 3341 | SHOW_STR |
| 3342 | IP_STR |
| 3343 | "IPv6 routing table\n" |
| 3344 | "Summary of all IPv6 routes\n" |
| 3345 | VRF_CMD_HELP_STR) |
| 3346 | |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3347 | /* Show ipv6 route summary prefix. */ |
| 3348 | DEFUN (show_ipv6_route_summary_prefix, |
| 3349 | show_ipv6_route_summary_prefix_cmd, |
| 3350 | "show ipv6 route summary prefix", |
| 3351 | SHOW_STR |
| 3352 | IP_STR |
| 3353 | "IPv6 routing table\n" |
| 3354 | "Summary of all IPv6 routes\n" |
| 3355 | "Prefix routes\n") |
| 3356 | { |
| 3357 | struct route_table *table; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3358 | vrf_id_t vrf_id = VRF_DEFAULT; |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3359 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3360 | if (argc > 0) |
| 3361 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3362 | |
| 3363 | table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3364 | if (! table) |
| 3365 | return CMD_SUCCESS; |
| 3366 | |
| 3367 | vty_show_ip_route_summary_prefix (vty, table); |
| 3368 | |
| 3369 | return CMD_SUCCESS; |
| 3370 | } |
| 3371 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3372 | ALIAS (show_ipv6_route_summary_prefix, |
| 3373 | show_ipv6_route_summary_prefix_vrf_cmd, |
| 3374 | "show ipv6 route summary prefix " VRF_CMD_STR, |
| 3375 | SHOW_STR |
| 3376 | IP_STR |
| 3377 | "IPv6 routing table\n" |
| 3378 | "Summary of all IPv6 routes\n" |
| 3379 | "Prefix routes\n" |
| 3380 | VRF_CMD_HELP_STR) |
| 3381 | |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3382 | /* |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3383 | * Show IPv6 mroute command.Used to dump |
| 3384 | * the Multicast routing table. |
| 3385 | */ |
| 3386 | |
| 3387 | DEFUN (show_ipv6_mroute, |
| 3388 | show_ipv6_mroute_cmd, |
| 3389 | "show ipv6 mroute", |
| 3390 | SHOW_STR |
| 3391 | IP_STR |
| 3392 | "IPv6 Multicast routing table\n") |
| 3393 | { |
| 3394 | struct route_table *table; |
| 3395 | struct route_node *rn; |
| 3396 | struct rib *rib; |
| 3397 | int first = 1; |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3398 | vrf_id_t vrf_id = VRF_DEFAULT; |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3399 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3400 | if (argc > 0) |
| 3401 | VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
| 3402 | |
| 3403 | table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3404 | if (! table) |
| 3405 | return CMD_SUCCESS; |
| 3406 | |
| 3407 | /* Show all IPv6 route. */ |
| 3408 | for (rn = route_top (table); rn; rn = route_next (rn)) |
Avneesh Sachdev | 9fd92e3 | 2012-11-13 22:48:53 +0000 | [diff] [blame] | 3409 | RNODE_FOREACH_RIB (rn, rib) |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3410 | { |
| 3411 | if (first) |
| 3412 | { |
G.Balaji | cb32fd6 | 2011-11-27 20:09:40 +0530 | [diff] [blame] | 3413 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3414 | first = 0; |
| 3415 | } |
Timo Teräs | 53a5c39 | 2015-05-23 11:08:40 +0300 | [diff] [blame] | 3416 | vty_show_ip_route (vty, rn, rib); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3417 | } |
| 3418 | return CMD_SUCCESS; |
| 3419 | } |
| 3420 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3421 | ALIAS (show_ipv6_mroute, |
| 3422 | show_ipv6_mroute_vrf_cmd, |
| 3423 | "show ipv6 mroute " VRF_CMD_STR, |
| 3424 | SHOW_STR |
| 3425 | IP_STR |
| 3426 | "IPv6 Multicast routing table\n" |
| 3427 | VRF_CMD_HELP_STR) |
| 3428 | |
| 3429 | DEFUN (show_ipv6_route_vrf_all, |
| 3430 | show_ipv6_route_vrf_all_cmd, |
| 3431 | "show ipv6 route " VRF_ALL_CMD_STR, |
| 3432 | SHOW_STR |
| 3433 | IP_STR |
| 3434 | "IPv6 routing table\n" |
| 3435 | VRF_ALL_CMD_HELP_STR) |
| 3436 | { |
| 3437 | struct route_table *table; |
| 3438 | struct route_node *rn; |
| 3439 | struct rib *rib; |
| 3440 | struct zebra_vrf *zvrf; |
| 3441 | vrf_iter_t iter; |
| 3442 | int first = 1; |
| 3443 | |
| 3444 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3445 | { |
| 3446 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3447 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3448 | continue; |
| 3449 | |
| 3450 | /* Show all IPv6 route. */ |
| 3451 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3452 | RNODE_FOREACH_RIB (rn, rib) |
| 3453 | { |
| 3454 | if (first) |
| 3455 | { |
| 3456 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3457 | first = 0; |
| 3458 | } |
| 3459 | vty_show_ip_route (vty, rn, rib); |
| 3460 | } |
| 3461 | } |
| 3462 | |
| 3463 | return CMD_SUCCESS; |
| 3464 | } |
| 3465 | |
| 3466 | DEFUN (show_ipv6_route_prefix_longer_vrf_all, |
| 3467 | show_ipv6_route_prefix_longer_vrf_all_cmd, |
| 3468 | "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR, |
| 3469 | SHOW_STR |
| 3470 | IP_STR |
| 3471 | "IPv6 routing table\n" |
| 3472 | "IPv6 prefix\n" |
| 3473 | "Show route matching the specified Network/Mask pair only\n" |
| 3474 | VRF_ALL_CMD_HELP_STR) |
| 3475 | { |
| 3476 | struct route_table *table; |
| 3477 | struct route_node *rn; |
| 3478 | struct rib *rib; |
| 3479 | struct prefix p; |
| 3480 | struct zebra_vrf *zvrf; |
| 3481 | vrf_iter_t iter; |
| 3482 | int ret; |
| 3483 | int first = 1; |
| 3484 | |
| 3485 | ret = str2prefix (argv[0], &p); |
| 3486 | if (! ret) |
| 3487 | { |
| 3488 | vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); |
| 3489 | return CMD_WARNING; |
| 3490 | } |
| 3491 | |
| 3492 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3493 | { |
| 3494 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3495 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3496 | continue; |
| 3497 | |
| 3498 | /* Show matched type IPv6 routes. */ |
| 3499 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3500 | RNODE_FOREACH_RIB (rn, rib) |
| 3501 | if (prefix_match (&p, &rn->p)) |
| 3502 | { |
| 3503 | if (first) |
| 3504 | { |
| 3505 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3506 | first = 0; |
| 3507 | } |
| 3508 | vty_show_ip_route (vty, rn, rib); |
| 3509 | } |
| 3510 | } |
| 3511 | |
| 3512 | return CMD_SUCCESS; |
| 3513 | } |
| 3514 | |
| 3515 | DEFUN (show_ipv6_route_protocol_vrf_all, |
| 3516 | show_ipv6_route_protocol_vrf_all_cmd, |
| 3517 | "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR, |
| 3518 | SHOW_STR |
| 3519 | IP_STR |
| 3520 | "IP routing table\n" |
| 3521 | QUAGGA_IP6_REDIST_HELP_STR_ZEBRA |
| 3522 | VRF_ALL_CMD_HELP_STR) |
| 3523 | { |
| 3524 | int type; |
| 3525 | struct route_table *table; |
| 3526 | struct route_node *rn; |
| 3527 | struct rib *rib; |
| 3528 | struct zebra_vrf *zvrf; |
| 3529 | vrf_iter_t iter; |
| 3530 | int first = 1; |
| 3531 | |
| 3532 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 3533 | if (type < 0) |
| 3534 | { |
| 3535 | vty_out (vty, "Unknown route type%s", VTY_NEWLINE); |
| 3536 | return CMD_WARNING; |
| 3537 | } |
| 3538 | |
| 3539 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3540 | { |
| 3541 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3542 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3543 | continue; |
| 3544 | |
| 3545 | /* Show matched type IPv6 routes. */ |
| 3546 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3547 | RNODE_FOREACH_RIB (rn, rib) |
| 3548 | if (rib->type == type) |
| 3549 | { |
| 3550 | if (first) |
| 3551 | { |
| 3552 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3553 | first = 0; |
| 3554 | } |
| 3555 | vty_show_ip_route (vty, rn, rib); |
| 3556 | } |
| 3557 | } |
| 3558 | |
| 3559 | return CMD_SUCCESS; |
| 3560 | } |
| 3561 | |
| 3562 | DEFUN (show_ipv6_route_addr_vrf_all, |
| 3563 | show_ipv6_route_addr_vrf_all_cmd, |
| 3564 | "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR, |
| 3565 | SHOW_STR |
| 3566 | IP_STR |
| 3567 | "IPv6 routing table\n" |
| 3568 | "IPv6 Address\n" |
| 3569 | VRF_ALL_CMD_HELP_STR) |
| 3570 | { |
| 3571 | int ret; |
| 3572 | struct prefix_ipv6 p; |
| 3573 | struct route_table *table; |
| 3574 | struct route_node *rn; |
| 3575 | struct zebra_vrf *zvrf; |
| 3576 | vrf_iter_t iter; |
| 3577 | |
| 3578 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3579 | if (ret <= 0) |
| 3580 | { |
| 3581 | vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); |
| 3582 | return CMD_WARNING; |
| 3583 | } |
| 3584 | |
| 3585 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3586 | { |
| 3587 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3588 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3589 | continue; |
| 3590 | |
| 3591 | rn = route_node_match (table, (struct prefix *) &p); |
| 3592 | if (! rn) |
| 3593 | continue; |
| 3594 | |
| 3595 | vty_show_ip_route_detail (vty, rn, 0); |
| 3596 | |
| 3597 | route_unlock_node (rn); |
| 3598 | } |
| 3599 | |
| 3600 | return CMD_SUCCESS; |
| 3601 | } |
| 3602 | |
| 3603 | DEFUN (show_ipv6_route_prefix_vrf_all, |
| 3604 | show_ipv6_route_prefix_vrf_all_cmd, |
| 3605 | "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR, |
| 3606 | SHOW_STR |
| 3607 | IP_STR |
| 3608 | "IPv6 routing table\n" |
| 3609 | "IPv6 prefix\n" |
| 3610 | VRF_ALL_CMD_HELP_STR) |
| 3611 | { |
| 3612 | int ret; |
| 3613 | struct prefix_ipv6 p; |
| 3614 | struct route_table *table; |
| 3615 | struct route_node *rn; |
| 3616 | struct zebra_vrf *zvrf; |
| 3617 | vrf_iter_t iter; |
| 3618 | |
| 3619 | ret = str2prefix_ipv6 (argv[0], &p); |
| 3620 | if (ret <= 0) |
| 3621 | { |
| 3622 | vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); |
| 3623 | return CMD_WARNING; |
| 3624 | } |
| 3625 | |
| 3626 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3627 | { |
| 3628 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3629 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3630 | continue; |
| 3631 | |
| 3632 | rn = route_node_match (table, (struct prefix *) &p); |
| 3633 | if (! rn) |
| 3634 | continue; |
| 3635 | if (rn->p.prefixlen != p.prefixlen) |
| 3636 | { |
| 3637 | route_unlock_node (rn); |
| 3638 | continue; |
| 3639 | } |
| 3640 | |
| 3641 | vty_show_ip_route_detail (vty, rn, 0); |
| 3642 | |
| 3643 | route_unlock_node (rn); |
| 3644 | } |
| 3645 | |
| 3646 | return CMD_SUCCESS; |
| 3647 | } |
| 3648 | |
| 3649 | /* Show route summary. */ |
| 3650 | DEFUN (show_ipv6_route_summary_vrf_all, |
| 3651 | show_ipv6_route_summary_vrf_all_cmd, |
| 3652 | "show ipv6 route summary " VRF_ALL_CMD_STR, |
| 3653 | SHOW_STR |
| 3654 | IP_STR |
| 3655 | "IPv6 routing table\n" |
| 3656 | "Summary of all IPv6 routes\n" |
| 3657 | VRF_ALL_CMD_HELP_STR) |
| 3658 | { |
| 3659 | struct zebra_vrf *zvrf; |
| 3660 | vrf_iter_t iter; |
| 3661 | |
| 3662 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3663 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3664 | vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 3665 | |
| 3666 | return CMD_SUCCESS; |
| 3667 | } |
| 3668 | |
| 3669 | DEFUN (show_ipv6_mroute_vrf_all, |
| 3670 | show_ipv6_mroute_vrf_all_cmd, |
| 3671 | "show ipv6 mroute " VRF_ALL_CMD_STR, |
| 3672 | SHOW_STR |
| 3673 | IP_STR |
| 3674 | "IPv6 Multicast routing table\n" |
| 3675 | VRF_ALL_CMD_HELP_STR) |
| 3676 | { |
| 3677 | struct route_table *table; |
| 3678 | struct route_node *rn; |
| 3679 | struct rib *rib; |
| 3680 | struct zebra_vrf *zvrf; |
| 3681 | vrf_iter_t iter; |
| 3682 | int first = 1; |
| 3683 | |
| 3684 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3685 | { |
| 3686 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3687 | (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3688 | continue; |
| 3689 | |
| 3690 | /* Show all IPv6 route. */ |
| 3691 | for (rn = route_top (table); rn; rn = route_next (rn)) |
| 3692 | RNODE_FOREACH_RIB (rn, rib) |
| 3693 | { |
| 3694 | if (first) |
| 3695 | { |
| 3696 | vty_out (vty, SHOW_ROUTE_V6_HEADER); |
| 3697 | first = 0; |
| 3698 | } |
| 3699 | vty_show_ip_route (vty, rn, rib); |
| 3700 | } |
| 3701 | } |
| 3702 | return CMD_SUCCESS; |
| 3703 | } |
| 3704 | |
| 3705 | DEFUN (show_ipv6_route_summary_prefix_vrf_all, |
| 3706 | show_ipv6_route_summary_prefix_vrf_all_cmd, |
| 3707 | "show ipv6 route summary prefix " VRF_ALL_CMD_STR, |
| 3708 | SHOW_STR |
| 3709 | IP_STR |
| 3710 | "IPv6 routing table\n" |
| 3711 | "Summary of all IPv6 routes\n" |
| 3712 | "Prefix routes\n" |
| 3713 | VRF_ALL_CMD_HELP_STR) |
| 3714 | { |
| 3715 | struct zebra_vrf *zvrf; |
| 3716 | vrf_iter_t iter; |
| 3717 | |
| 3718 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3719 | if ((zvrf = vrf_iter2info (iter)) != NULL) |
| 3720 | vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| 3721 | |
| 3722 | return CMD_SUCCESS; |
| 3723 | } |
| 3724 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3725 | /* Write IPv6 static route configuration. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3726 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3727 | static_config_ipv6 (struct vty *vty) |
| 3728 | { |
| 3729 | struct route_node *rn; |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3730 | struct static_route *si; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3731 | int write; |
| 3732 | char buf[BUFSIZ]; |
| 3733 | struct route_table *stable; |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3734 | struct zebra_vrf *zvrf; |
| 3735 | vrf_iter_t iter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3736 | |
| 3737 | write = 0; |
| 3738 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3739 | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| 3740 | { |
| 3741 | if ((zvrf = vrf_iter2info (iter)) == NULL || |
| 3742 | (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL) |
| 3743 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3744 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3745 | for (rn = route_top (stable); rn; rn = route_next (rn)) |
| 3746 | for (si = rn->info; si; si = si->next) |
| 3747 | { |
| 3748 | vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3749 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3750 | switch (si->type) |
| 3751 | { |
| 3752 | case STATIC_IPV6_GATEWAY: |
| 3753 | vty_out (vty, " %s", |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3754 | inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ)); |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3755 | break; |
| 3756 | case STATIC_IPV6_IFNAME: |
| 3757 | vty_out (vty, " %s", si->ifname); |
| 3758 | break; |
| 3759 | case STATIC_IPV6_GATEWAY_IFNAME: |
| 3760 | vty_out (vty, " %s %s", |
Donald Sharp | d4c27d6 | 2015-11-04 13:26:35 -0500 | [diff] [blame] | 3761 | inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ), |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3762 | si->ifname); |
| 3763 | break; |
| 3764 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3765 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3766 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) |
| 3767 | vty_out (vty, " %s", "reject"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3768 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3769 | if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) |
| 3770 | vty_out (vty, " %s", "blackhole"); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3771 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3772 | if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) |
| 3773 | vty_out (vty, " %d", si->distance); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3774 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3775 | if (si->vrf_id != VRF_DEFAULT) |
| 3776 | vty_out (vty, " vrf %u", si->vrf_id); |
| 3777 | |
| 3778 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3779 | |
| 3780 | write = 1; |
| 3781 | } |
| 3782 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3783 | return write; |
| 3784 | } |
| 3785 | #endif /* HAVE_IPV6 */ |
| 3786 | |
| 3787 | /* Static ip route configuration write function. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3788 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3789 | zebra_ip_config (struct vty *vty) |
| 3790 | { |
| 3791 | int write = 0; |
| 3792 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3793 | write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); |
| 3794 | write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3795 | #ifdef HAVE_IPV6 |
| 3796 | write += static_config_ipv6 (vty); |
| 3797 | #endif /* HAVE_IPV6 */ |
| 3798 | |
| 3799 | return write; |
| 3800 | } |
| 3801 | |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3802 | static int config_write_vty(struct vty *vty) |
| 3803 | { |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3804 | int i; |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3805 | enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get (); |
| 3806 | |
| 3807 | if (ipv4_multicast_mode != MCAST_NO_CONFIG) |
| 3808 | vty_out (vty, "ip multicast rpf-lookup-mode %s%s", |
| 3809 | ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" : |
| 3810 | ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" : |
| 3811 | ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" : |
| 3812 | ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" : |
| 3813 | "longer-prefix", |
| 3814 | VTY_NEWLINE); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3815 | |
| 3816 | for (i=0;i<ZEBRA_ROUTE_MAX;i++) |
| 3817 | { |
| 3818 | if (proto_rm[AFI_IP][i]) |
| 3819 | vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i), |
| 3820 | proto_rm[AFI_IP][i], VTY_NEWLINE); |
| 3821 | } |
| 3822 | if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX]) |
| 3823 | vty_out (vty, "ip protocol %s route-map %s%s", "any", |
| 3824 | proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE); |
| 3825 | |
| 3826 | return 1; |
| 3827 | } |
| 3828 | |
| 3829 | /* table node for protocol filtering */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 3830 | static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 }; |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3831 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3832 | /* IP node for static routes. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 3833 | static struct cmd_node ip_node = { IP_NODE, "", 1 }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3834 | |
| 3835 | /* Route VTY. */ |
| 3836 | void |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 3837 | zebra_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3838 | { |
| 3839 | install_node (&ip_node, zebra_ip_config); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3840 | install_node (&protocol_node, config_write_vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3841 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3842 | install_element (CONFIG_NODE, &ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 3843 | install_element (CONFIG_NODE, &ip_mroute_dist_cmd); |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3844 | install_element (CONFIG_NODE, &no_ip_mroute_cmd); |
David Lamparter | a76681b | 2015-01-22 19:03:53 +0100 | [diff] [blame] | 3845 | install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd); |
David Lamparter | bd07812 | 2015-01-06 19:53:24 +0100 | [diff] [blame] | 3846 | install_element (CONFIG_NODE, &ip_multicast_mode_cmd); |
| 3847 | install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd); |
| 3848 | install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 3849 | install_element (CONFIG_NODE, &ip_protocol_cmd); |
| 3850 | install_element (CONFIG_NODE, &no_ip_protocol_cmd); |
| 3851 | install_element (VIEW_NODE, &show_ip_protocol_cmd); |
| 3852 | install_element (ENABLE_NODE, &show_ip_protocol_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3853 | install_element (CONFIG_NODE, &ip_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3854 | install_element (CONFIG_NODE, &ip_route_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3855 | install_element (CONFIG_NODE, &ip_route_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3856 | install_element (CONFIG_NODE, &ip_route_mask_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3857 | install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3858 | install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3859 | install_element (CONFIG_NODE, &no_ip_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3860 | install_element (CONFIG_NODE, &no_ip_route_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3861 | install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3862 | install_element (CONFIG_NODE, &no_ip_route_mask_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3863 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3864 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3865 | install_element (CONFIG_NODE, &ip_route_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3866 | install_element (CONFIG_NODE, &ip_route_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3867 | install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3868 | install_element (CONFIG_NODE, &ip_route_mask_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3869 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3870 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3871 | install_element (CONFIG_NODE, &no_ip_route_distance_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3872 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3873 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3874 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd); |
hasso | 457ef55 | 2003-05-28 12:02:15 +0000 | [diff] [blame] | 3875 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3876 | |
| 3877 | install_element (VIEW_NODE, &show_ip_route_cmd); |
| 3878 | install_element (VIEW_NODE, &show_ip_route_addr_cmd); |
| 3879 | install_element (VIEW_NODE, &show_ip_route_prefix_cmd); |
| 3880 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd); |
| 3881 | install_element (VIEW_NODE, &show_ip_route_protocol_cmd); |
| 3882 | install_element (VIEW_NODE, &show_ip_route_supernets_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3883 | install_element (VIEW_NODE, &show_ip_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3884 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3885 | install_element (ENABLE_NODE, &show_ip_route_cmd); |
| 3886 | install_element (ENABLE_NODE, &show_ip_route_addr_cmd); |
| 3887 | install_element (ENABLE_NODE, &show_ip_route_prefix_cmd); |
| 3888 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_cmd); |
| 3889 | install_element (ENABLE_NODE, &show_ip_route_protocol_cmd); |
| 3890 | install_element (ENABLE_NODE, &show_ip_route_supernets_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3891 | install_element (ENABLE_NODE, &show_ip_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3892 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3893 | |
Everton Marques | 33d86db | 2014-07-14 11:19:00 -0300 | [diff] [blame] | 3894 | install_element (VIEW_NODE, &show_ip_rpf_cmd); |
| 3895 | install_element (ENABLE_NODE, &show_ip_rpf_cmd); |
David Lamparter | 3b02fe8 | 2015-01-22 19:12:35 +0100 | [diff] [blame] | 3896 | install_element (VIEW_NODE, &show_ip_rpf_addr_cmd); |
| 3897 | install_element (ENABLE_NODE, &show_ip_rpf_addr_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 3898 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3899 | /* Commands for VRF */ |
| 3900 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 3901 | install_element (CONFIG_NODE, &ip_mroute_vrf_cmd); |
| 3902 | install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd); |
| 3903 | install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd); |
| 3904 | install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd); |
| 3905 | |
| 3906 | install_element (CONFIG_NODE, &ip_route_vrf_cmd); |
| 3907 | install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd); |
| 3908 | install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd); |
| 3909 | install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd); |
| 3910 | install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd); |
| 3911 | install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd); |
| 3912 | install_element (CONFIG_NODE, &no_ip_route_vrf_cmd); |
| 3913 | install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd); |
| 3914 | install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd); |
| 3915 | install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd); |
| 3916 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd); |
| 3917 | install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd); |
| 3918 | install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd); |
| 3919 | install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd); |
| 3920 | install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd); |
| 3921 | install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd); |
| 3922 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd); |
| 3923 | install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd); |
| 3924 | install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd); |
| 3925 | install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); |
| 3926 | install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd); |
| 3927 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd); |
| 3928 | install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd); |
| 3929 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3930 | install_element (VIEW_NODE, &show_ip_route_vrf_cmd); |
| 3931 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd); |
| 3932 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd); |
| 3933 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd); |
| 3934 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd); |
| 3935 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd); |
| 3936 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd); |
| 3937 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd); |
| 3938 | install_element (ENABLE_NODE, &show_ip_route_vrf_cmd); |
| 3939 | install_element (ENABLE_NODE, &show_ip_route_addr_vrf_cmd); |
| 3940 | install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_cmd); |
| 3941 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_cmd); |
| 3942 | install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_cmd); |
| 3943 | install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_cmd); |
| 3944 | install_element (ENABLE_NODE, &show_ip_route_summary_vrf_cmd); |
| 3945 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_cmd); |
| 3946 | |
| 3947 | install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd); |
| 3948 | install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd); |
| 3949 | install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd); |
| 3950 | install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd); |
| 3951 | install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd); |
| 3952 | install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd); |
| 3953 | install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd); |
| 3954 | install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd); |
| 3955 | install_element (ENABLE_NODE, &show_ip_route_vrf_all_cmd); |
| 3956 | install_element (ENABLE_NODE, &show_ip_route_addr_vrf_all_cmd); |
| 3957 | install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_all_cmd); |
| 3958 | install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_all_cmd); |
| 3959 | install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_all_cmd); |
| 3960 | install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_all_cmd); |
| 3961 | install_element (ENABLE_NODE, &show_ip_route_summary_vrf_all_cmd); |
| 3962 | install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_all_cmd); |
| 3963 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 3964 | install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd); |
| 3965 | install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd); |
| 3966 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd); |
| 3967 | install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd); |
| 3968 | install_element (ENABLE_NODE, &show_ip_rpf_vrf_cmd); |
| 3969 | install_element (ENABLE_NODE, &show_ip_rpf_vrf_all_cmd); |
| 3970 | install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_cmd); |
| 3971 | install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_all_cmd); |
| 3972 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3973 | #ifdef HAVE_IPV6 |
| 3974 | install_element (CONFIG_NODE, &ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3975 | install_element (CONFIG_NODE, &ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3976 | install_element (CONFIG_NODE, &ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3977 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3978 | install_element (CONFIG_NODE, &no_ipv6_route_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3979 | install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3980 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3981 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3982 | install_element (CONFIG_NODE, &ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3983 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3984 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3985 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3986 | install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3987 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd); |
hasso | 81dfcaa | 2003-05-25 19:21:25 +0000 | [diff] [blame] | 3989 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3990 | install_element (VIEW_NODE, &show_ipv6_route_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 3991 | install_element (VIEW_NODE, &show_ipv6_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 3992 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3993 | install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd); |
| 3994 | install_element (VIEW_NODE, &show_ipv6_route_addr_cmd); |
| 3995 | install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd); |
| 3996 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd); |
| 3997 | install_element (ENABLE_NODE, &show_ipv6_route_cmd); |
| 3998 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_cmd); |
| 3999 | install_element (ENABLE_NODE, &show_ipv6_route_addr_cmd); |
| 4000 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_cmd); |
| 4001 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_cmd); |
Stig Thormodsrud | 61691c9 | 2008-11-04 15:45:07 -0800 | [diff] [blame] | 4002 | install_element (ENABLE_NODE, &show_ipv6_route_summary_cmd); |
Dinesh G Dutt | 56a5f77 | 2014-09-30 12:58:04 -0700 | [diff] [blame] | 4003 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_cmd); |
G.Balaji | cddf391 | 2011-11-26 21:59:32 +0400 | [diff] [blame] | 4004 | |
| 4005 | install_element (VIEW_NODE, &show_ipv6_mroute_cmd); |
| 4006 | install_element (ENABLE_NODE, &show_ipv6_mroute_cmd); |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4007 | |
| 4008 | /* Commands for VRF */ |
| 4009 | |
Feng Lu | 7aaf4ea | 2015-05-22 11:40:06 +0200 | [diff] [blame] | 4010 | install_element (CONFIG_NODE, &ipv6_route_vrf_cmd); |
| 4011 | install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd); |
| 4012 | install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd); |
| 4013 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd); |
| 4014 | install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd); |
| 4015 | install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd); |
| 4016 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd); |
| 4017 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd); |
| 4018 | install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd); |
| 4019 | install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd); |
| 4020 | install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd); |
| 4021 | install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd); |
| 4022 | install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd); |
| 4023 | install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd); |
| 4024 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd); |
| 4025 | install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd); |
| 4026 | |
Feng Lu | 4364ee5 | 2015-05-22 11:40:03 +0200 | [diff] [blame] | 4027 | install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd); |
| 4028 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd); |
| 4029 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd); |
| 4030 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd); |
| 4031 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd); |
| 4032 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd); |
| 4033 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd); |
| 4034 | install_element (ENABLE_NODE, &show_ipv6_route_vrf_cmd); |
| 4035 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_cmd); |
| 4036 | install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_cmd); |
| 4037 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_cmd); |
| 4038 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_cmd); |
| 4039 | install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_cmd); |
| 4040 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_cmd); |
| 4041 | |
| 4042 | install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); |
| 4043 | install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd); |
| 4044 | install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd); |
| 4045 | install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd); |
| 4046 | install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd); |
| 4047 | install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd); |
| 4048 | install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd); |
| 4049 | install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_cmd); |
| 4050 | install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_all_cmd); |
| 4051 | install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_all_cmd); |
| 4052 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_all_cmd); |
| 4053 | install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd); |
| 4054 | install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_all_cmd); |
| 4055 | install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd); |
| 4056 | |
| 4057 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd); |
| 4058 | install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_cmd); |
| 4059 | |
| 4060 | install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); |
| 4061 | install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4062 | #endif /* HAVE_IPV6 */ |
| 4063 | } |