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