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