2 * Copyright (C) 2002 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
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
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.
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.
25 #include "zebra_memory.h"
36 #include "zebra/zserv.h"
37 #include "zebra/zebra_vrf.h"
38 #include "zebra/zebra_rnh.h"
39 #include "zebra/redistribute.h"
40 #include "zebra/zebra_routemap.h"
41 #include "zebra/zebra_static.h"
43 extern int allow_delete
;
45 static int do_show_ip_route(struct vty
*vty
, const char *vrf_name
,
46 safi_t safi
, u_char use_json
);
47 static void vty_show_ip_route_detail (struct vty
*vty
, struct route_node
*rn
,
50 #define ONE_DAY_SECOND 60*60*24
51 #define ONE_WEEK_SECOND 60*60*24*7
53 /* General function for static route. */
55 zebra_static_ipv4 (struct vty
*vty
, safi_t safi
, int add_cmd
,
56 const char *dest_str
, const char *mask_str
,
57 const char *gate_str
, const char *flag_str
,
58 const char *tag_str
, const char *distance_str
,
59 const char *vrf_id_str
)
68 struct zebra_vrf
*zvrf
= NULL
;
69 unsigned int ifindex
= 0;
70 const char *ifname
= NULL
;
71 u_char type
= STATIC_IPV4_BLACKHOLE
;
73 ret
= str2prefix (dest_str
, &p
);
76 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
80 /* Cisco like mask notation. */
83 ret
= inet_aton (mask_str
, &mask
);
86 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
89 p
.prefixlen
= ip_masklen (mask
);
92 /* Apply mask for given prefix. */
95 /* Administrative distance. */
97 distance
= atoi (distance_str
);
99 distance
= ZEBRA_STATIC_DISTANCE_DEFAULT
;
106 zvrf
= zebra_vrf_list_lookup_by_name (vrf_id_str
);
110 vty_out (vty
, "%% vrf %s is not defined%s", vrf_id_str
, VTY_NEWLINE
);
114 /* Null0 static route. */
115 if ((gate_str
!= NULL
) && (strncasecmp (gate_str
, "Null0", strlen (gate_str
)) == 0))
119 vty_out (vty
, "%% can not have flag %s with Null0%s", flag_str
, VTY_NEWLINE
);
123 static_add_route (AFI_IP
, safi
, type
, &p
, NULL
, ifindex
, ifname
, ZEBRA_FLAG_BLACKHOLE
, tag
, distance
, zvrf
);
125 static_delete_route (AFI_IP
, safi
, type
, &p
, NULL
, ifindex
, tag
, distance
, zvrf
);
131 switch(flag_str
[0]) {
134 SET_FLAG (flag
, ZEBRA_FLAG_REJECT
);
138 SET_FLAG (flag
, ZEBRA_FLAG_BLACKHOLE
);
141 vty_out (vty
, "%% Malformed flag %s %s", flag_str
, VTY_NEWLINE
);
146 if (gate_str
== NULL
)
149 static_add_route (AFI_IP
, safi
, type
, &p
, NULL
, ifindex
, ifname
, flag
, tag
, distance
, zvrf
);
151 static_delete_route (AFI_IP
, safi
, type
, &p
, NULL
, ifindex
, tag
, distance
, zvrf
);
156 /* When gateway is A.B.C.D format, gate is treated as nexthop
157 address other case gate is treated as interface name. */
158 ret
= inet_aton (gate_str
, &gate
);
161 struct interface
*ifp
= if_lookup_by_name_vrf (gate_str
, zvrf
->vrf_id
);
164 vty_out (vty
, "%% Unknown interface: %s%s", gate_str
, VTY_NEWLINE
);
165 ifindex
= IFINDEX_DELETED
;
168 ifindex
= ifp
->ifindex
;
170 type
= STATIC_IFINDEX
;
173 type
= STATIC_IPV4_GATEWAY
;
176 static_add_route (AFI_IP
, safi
, type
, &p
, ifindex
? NULL
: (union g_addr
*)&gate
, ifindex
, ifname
, flag
, tag
, distance
, zvrf
);
178 static_delete_route (AFI_IP
, safi
, type
, &p
, ifindex
? NULL
: (union g_addr
*)&gate
, ifindex
, tag
, distance
, zvrf
);
183 /* Static unicast routes for multicast RPF lookup. */
184 DEFUN (ip_mroute_dist
,
186 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
188 "Configure static unicast route into MRIB for multicast RPF lookup\n"
189 "IP destination prefix (e.g. 10.0.0.0/8)\n"
191 "Nexthop interface name\n"
194 return zebra_static_ipv4 (vty
, SAFI_MULTICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
, argc
> 2 ? argv
[2] : NULL
, NULL
);
197 ALIAS (ip_mroute_dist
,
199 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
201 "Configure static unicast route into MRIB for multicast RPF lookup\n"
202 "IP destination prefix (e.g. 10.0.0.0/8)\n"
204 "Nexthop interface name\n")
206 DEFUN (no_ip_mroute_dist
,
207 no_ip_mroute_dist_cmd
,
208 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
210 "Configure static unicast route into MRIB for multicast RPF lookup\n"
211 "IP destination prefix (e.g. 10.0.0.0/8)\n"
213 "Nexthop interface name\n"
216 return zebra_static_ipv4 (vty
, SAFI_MULTICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
, argc
> 2 ? argv
[2] : NULL
, NULL
);
219 ALIAS (no_ip_mroute_dist
,
221 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
224 "Configure static unicast route into MRIB for multicast RPF lookup\n"
225 "IP destination prefix (e.g. 10.0.0.0/8)\n"
227 "Nexthop interface name\n")
229 DEFUN (ip_multicast_mode
,
230 ip_multicast_mode_cmd
,
231 "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
233 "Multicast options\n"
234 "RPF lookup behavior\n"
235 "Lookup in unicast RIB only\n"
236 "Lookup in multicast RIB only\n"
237 "Try multicast RIB first, fall back to unicast RIB\n"
238 "Lookup both, use entry with lower distance\n"
239 "Lookup both, use entry with longer prefix\n")
242 if (!strncmp (argv
[0], "u", 1))
243 multicast_mode_ipv4_set (MCAST_URIB_ONLY
);
244 else if (!strncmp (argv
[0], "mrib-o", 6))
245 multicast_mode_ipv4_set (MCAST_MRIB_ONLY
);
246 else if (!strncmp (argv
[0], "mrib-t", 6))
247 multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST
);
248 else if (!strncmp (argv
[0], "low", 3))
249 multicast_mode_ipv4_set (MCAST_MIX_DISTANCE
);
250 else if (!strncmp (argv
[0], "lon", 3))
251 multicast_mode_ipv4_set (MCAST_MIX_PFXLEN
);
254 vty_out (vty
, "Invalid mode specified%s", VTY_NEWLINE
);
261 DEFUN (no_ip_multicast_mode
,
262 no_ip_multicast_mode_cmd
,
263 "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
266 "Multicast options\n"
267 "RPF lookup behavior\n"
268 "Lookup in unicast RIB only\n"
269 "Lookup in multicast RIB only\n"
270 "Try multicast RIB first, fall back to unicast RIB\n"
271 "Lookup both, use entry with lower distance\n"
272 "Lookup both, use entry with longer prefix\n")
274 multicast_mode_ipv4_set (MCAST_NO_CONFIG
);
278 ALIAS (no_ip_multicast_mode
,
279 no_ip_multicast_mode_noarg_cmd
,
280 "no ip multicast rpf-lookup-mode",
283 "Multicast options\n"
284 "RPF lookup behavior\n")
291 "Display RPF information for multicast source\n")
293 return do_show_ip_route(vty
, VRF_DEFAULT_NAME
, SAFI_MULTICAST
, 0);
296 DEFUN (show_ip_rpf_addr
,
297 show_ip_rpf_addr_cmd
,
298 "show ip rpf A.B.C.D",
301 "Display RPF information for multicast source\n"
302 "IP multicast source address (e.g. 10.0.0.0)\n")
305 struct route_node
*rn
;
309 ret
= inet_aton (argv
[0], &addr
);
312 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
316 rib
= rib_match_ipv4_multicast (VRF_DEFAULT
, addr
, &rn
);
319 vty_show_ip_route_detail (vty
, rn
, 1);
321 vty_out (vty
, "%% No match for RPF lookup%s", VTY_NEWLINE
);
326 /* Static route configuration. */
329 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
331 "Establish static routes\n"
332 "IP destination prefix (e.g. 10.0.0.0/8)\n"
333 "IP gateway address\n"
334 "IP gateway interface name\n"
337 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
,
343 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
345 "Establish static routes\n"
346 "IP destination prefix (e.g. 10.0.0.0/8)\n"
347 "IP gateway address\n"
348 "IP gateway interface name\n"
350 "Set tag for this route\n"
353 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, argv
[2],
357 DEFUN (ip_route_flags
,
359 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
361 "Establish static routes\n"
362 "IP destination prefix (e.g. 10.0.0.0/8)\n"
363 "IP gateway address\n"
364 "IP gateway interface name\n"
365 "Emit an ICMP unreachable when matched\n"
366 "Silently discard pkts when matched\n")
368 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], NULL
,
372 DEFUN (ip_route_flags_tag
,
373 ip_route_flags_tag_cmd
,
374 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
376 "Establish static routes\n"
377 "IP destination prefix (e.g. 10.0.0.0/8)\n"
378 "IP gateway address\n"
379 "IP gateway interface name\n"
380 "Emit an ICMP unreachable when matched\n"
381 "Silently discard pkts when matched\n"
382 "Set tag for this route\n"
386 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], argv
[3],
390 DEFUN (ip_route_flags2
,
392 "ip route A.B.C.D/M (reject|blackhole)",
394 "Establish static routes\n"
395 "IP destination prefix (e.g. 10.0.0.0/8)\n"
396 "Emit an ICMP unreachable when matched\n"
397 "Silently discard pkts when matched\n")
399 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], NULL
,
403 DEFUN (ip_route_flags2_tag
,
404 ip_route_flags2_tag_cmd
,
405 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>",
407 "Establish static routes\n"
408 "IP destination prefix (e.g. 10.0.0.0/8)\n"
409 "Emit an ICMP unreachable when matched\n"
410 "Silently discard pkts when matched\n"
411 "Set tag for this route\n"
415 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], argv
[2],
419 /* Mask as A.B.C.D format. */
420 DEFUN (ip_route_mask
,
422 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
424 "Establish static routes\n"
425 "IP destination prefix\n"
426 "IP destination prefix mask\n"
427 "IP gateway address\n"
428 "IP gateway interface name\n"
431 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
,
435 DEFUN (ip_route_mask_tag
,
436 ip_route_mask_tag_cmd
,
437 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
439 "Establish static routes\n"
440 "IP destination prefix\n"
441 "IP destination prefix mask\n"
442 "IP gateway address\n"
443 "IP gateway interface name\n"
445 "Set tag for this route\n"
449 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3],
453 DEFUN (ip_route_mask_flags
,
454 ip_route_mask_flags_cmd
,
455 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
457 "Establish static routes\n"
458 "IP destination prefix\n"
459 "IP destination prefix mask\n"
460 "IP gateway address\n"
461 "IP gateway interface name\n"
462 "Emit an ICMP unreachable when matched\n"
463 "Silently discard pkts when matched\n")
465 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
,
469 DEFUN (ip_route_mask_flags_tag
,
470 ip_route_mask_flags_tag_cmd
,
471 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
473 "Establish static routes\n"
474 "IP destination prefix\n"
475 "IP destination prefix mask\n"
476 "IP gateway address\n"
477 "IP gateway interface name\n"
478 "Emit an ICMP unreachable when matched\n"
479 "Silently discard pkts when matched\n"
480 "Set tag for this route\n"
484 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4],
488 DEFUN (ip_route_mask_flags2
,
489 ip_route_mask_flags2_cmd
,
490 "ip route A.B.C.D A.B.C.D (reject|blackhole)",
492 "Establish static routes\n"
493 "IP destination prefix\n"
494 "IP destination prefix mask\n"
495 "Emit an ICMP unreachable when matched\n"
496 "Silently discard pkts when matched\n")
498 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
,
502 DEFUN (ip_route_mask_flags2_tag
,
503 ip_route_mask_flags2_tag_cmd
,
504 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>",
506 "Establish static routes\n"
507 "IP destination prefix\n"
508 "IP destination prefix mask\n"
509 "Emit an ICMP unreachable when matched\n"
510 "Silently discard pkts when matched\n"
511 "Set tag for this route\n"
514 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3],
518 /* Distance option value. */
519 DEFUN (ip_route_distance
,
520 ip_route_distance_cmd
,
521 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
523 "Establish static routes\n"
524 "IP destination prefix (e.g. 10.0.0.0/8)\n"
525 "IP gateway address\n"
526 "IP gateway interface name\n"
528 "Distance value for this route\n")
530 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
,
534 DEFUN (ip_route_tag_distance
,
535 ip_route_tag_distance_cmd
,
536 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
538 "Establish static routes\n"
539 "IP destination prefix (e.g. 10.0.0.0/8)\n"
540 "IP gateway address\n"
541 "IP gateway interface name\n"
543 "Set tag for this route\n"
545 "Distance value for this route\n")
548 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, argv
[2],
552 DEFUN (ip_route_flags_distance
,
553 ip_route_flags_distance_cmd
,
554 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
556 "Establish static routes\n"
557 "IP destination prefix (e.g. 10.0.0.0/8)\n"
558 "IP gateway address\n"
559 "IP gateway interface name\n"
560 "Emit an ICMP unreachable when matched\n"
561 "Silently discard pkts when matched\n"
562 "Distance value for this route\n")
564 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], NULL
,
568 DEFUN (ip_route_flags_tag_distance
,
569 ip_route_flags_tag_distance_cmd
,
570 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
572 "Establish static routes\n"
573 "IP destination prefix (e.g. 10.0.0.0/8)\n"
574 "IP gateway address\n"
575 "IP gateway interface name\n"
576 "Emit an ICMP unreachable when matched\n"
577 "Silently discard pkts when matched\n"
578 "Set tag for this route\n"
580 "Distance value for this route\n")
582 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], argv
[3],
586 DEFUN (ip_route_flags_distance2
,
587 ip_route_flags_distance2_cmd
,
588 "ip route A.B.C.D/M (reject|blackhole) <1-255>",
590 "Establish static routes\n"
591 "IP destination prefix (e.g. 10.0.0.0/8)\n"
592 "Emit an ICMP unreachable when matched\n"
593 "Silently discard pkts when matched\n"
594 "Distance value for this route\n")
596 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], NULL
,
600 DEFUN (ip_route_flags_tag_distance2
,
601 ip_route_flags_tag_distance2_cmd
,
602 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>",
604 "Establish static routes\n"
605 "IP destination prefix (e.g. 10.0.0.0/8)\n"
606 "Emit an ICMP unreachable when matched\n"
607 "Silently discard pkts when matched\n"
608 "Set tag for this route\n"
610 "Distance value for this route\n")
612 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], argv
[2],
616 DEFUN (ip_route_mask_distance
,
617 ip_route_mask_distance_cmd
,
618 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
620 "Establish static routes\n"
621 "IP destination prefix\n"
622 "IP destination prefix mask\n"
623 "IP gateway address\n"
624 "IP gateway interface name\n"
626 "Distance value for this route\n")
628 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
,
632 DEFUN (ip_route_mask_tag_distance
,
633 ip_route_mask_tag_distance_cmd
,
634 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
636 "Establish static routes\n"
637 "IP destination prefix\n"
638 "IP destination prefix mask\n"
639 "IP gateway address\n"
640 "IP gateway interface name\n"
642 "Set tag for this route\n"
644 "Distance value for this route\n")
646 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3],
650 DEFUN (ip_route_mask_flags_tag_distance
,
651 ip_route_mask_flags_tag_distance_cmd
,
652 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
654 "Establish static routes\n"
655 "IP destination prefix\n"
656 "IP destination prefix mask\n"
657 "IP gateway address\n"
658 "IP gateway interface name\n"
659 "Set tag for this route\n"
661 "Distance value for this route\n"
662 "Emit an ICMP unreachable when matched\n"
663 "Silently discard pkts when matched\n")
665 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4],
670 DEFUN (ip_route_mask_flags_distance
,
671 ip_route_mask_flags_distance_cmd
,
672 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
674 "Establish static routes\n"
675 "IP destination prefix\n"
676 "IP destination prefix mask\n"
677 "IP gateway address\n"
678 "IP gateway interface name\n"
679 "Emit an ICMP unreachable when matched\n"
680 "Silently discard pkts when matched\n"
681 "Distance value for this route\n")
683 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
,
687 DEFUN (ip_route_mask_flags_distance2
,
688 ip_route_mask_flags_distance2_cmd
,
689 "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
691 "Establish static routes\n"
692 "IP destination prefix\n"
693 "IP destination prefix mask\n"
694 "Emit an ICMP unreachable when matched\n"
695 "Silently discard pkts when matched\n"
696 "Distance value for this route\n")
698 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
,
702 DEFUN (ip_route_mask_flags_tag_distance2
,
703 ip_route_mask_flags_tag_distance2_cmd
,
704 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>",
706 "Establish static routes\n"
707 "IP destination prefix\n"
708 "IP destination prefix mask\n"
709 "Set tag for this route\n"
711 "Distance value for this route\n"
712 "Emit an ICMP unreachable when matched\n"
713 "Silently discard pkts when matched\n")
715 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3],
721 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
724 "Establish static routes\n"
725 "IP destination prefix (e.g. 10.0.0.0/8)\n"
726 "IP gateway address\n"
727 "IP gateway interface name\n"
730 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
,
734 DEFUN (no_ip_route_tag
,
736 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
739 "Establish static routes\n"
740 "IP destination prefix (e.g. 10.0.0.0/8)\n"
741 "IP gateway address\n"
742 "IP gateway interface name\n"
744 "Tag of this route\n"
747 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, argv
[2],
752 no_ip_route_flags_cmd
,
753 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
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")
763 ALIAS (no_ip_route_tag
,
764 no_ip_route_flags_tag_cmd
,
765 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
768 "Establish static routes\n"
769 "IP destination prefix (e.g. 10.0.0.0/8)\n"
770 "IP gateway address\n"
771 "IP gateway interface name\n"
772 "Emit an ICMP unreachable when matched\n"
773 "Silently discard pkts when matched\n"
774 "Tag of this route\n"
777 DEFUN (no_ip_route_flags2
,
778 no_ip_route_flags2_cmd
,
779 "no ip route A.B.C.D/M (reject|blackhole)",
782 "Establish static routes\n"
783 "IP destination prefix (e.g. 10.0.0.0/8)\n"
784 "Emit an ICMP unreachable when matched\n"
785 "Silently discard pkts when matched\n")
787 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, NULL
, NULL
,
791 DEFUN (no_ip_route_flags2_tag
,
792 no_ip_route_flags2_tag_cmd
,
793 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>",
796 "Establish static routes\n"
797 "IP destination prefix (e.g. 10.0.0.0/8)\n"
798 "Emit an ICMP unreachable when matched\n"
799 "Silently discard pkts when matched\n"
800 "Tag of this route\n"
803 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, NULL
, argv
[1],
807 DEFUN (no_ip_route_mask
,
808 no_ip_route_mask_cmd
,
809 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
812 "Establish static routes\n"
813 "IP destination prefix\n"
814 "IP destination prefix mask\n"
815 "IP gateway address\n"
816 "IP gateway interface name\n"
819 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
,
823 DEFUN (no_ip_route_mask_tag
,
824 no_ip_route_mask_tag_cmd
,
825 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
828 "Establish static routes\n"
829 "IP destination prefix\n"
830 "IP destination prefix mask\n"
831 "IP gateway address\n"
832 "IP gateway interface name\n"
834 "Tag of this route\n"
837 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3],
841 ALIAS (no_ip_route_mask
,
842 no_ip_route_mask_flags_cmd
,
843 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
846 "Establish static routes\n"
847 "IP destination prefix\n"
848 "IP destination prefix mask\n"
849 "IP gateway address\n"
850 "IP gateway interface name\n"
851 "Emit an ICMP unreachable when matched\n"
852 "Silently discard pkts when matched\n")
854 ALIAS (no_ip_route_mask_tag
,
855 no_ip_route_mask_flags_tag_cmd
,
856 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
859 "Establish static routes\n"
860 "IP destination prefix\n"
861 "IP destination prefix mask\n"
862 "IP gateway address\n"
863 "IP gateway interface name\n"
864 "Emit an ICMP unreachable when matched\n"
865 "Silently discard pkts when matched\n"
866 "Tag of this route\n"
869 DEFUN (no_ip_route_mask_flags2
,
870 no_ip_route_mask_flags2_cmd
,
871 "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
874 "Establish static routes\n"
875 "IP destination prefix\n"
876 "IP destination prefix mask\n"
877 "Emit an ICMP unreachable when matched\n"
878 "Silently discard pkts when matched\n")
880 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
,
884 DEFUN (no_ip_route_mask_flags2_tag
,
885 no_ip_route_mask_flags2_tag_cmd
,
886 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>",
889 "Establish static routes\n"
890 "IP destination prefix\n"
891 "IP destination prefix mask\n"
892 "Emit an ICMP unreachable when matched\n"
893 "Silently discard pkts when matched\n"
894 "Tag of this route\n"
897 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2],
901 DEFUN (no_ip_route_distance
,
902 no_ip_route_distance_cmd
,
903 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
906 "Establish static routes\n"
907 "IP destination prefix (e.g. 10.0.0.0/8)\n"
908 "IP gateway address\n"
909 "IP gateway interface name\n"
911 "Distance value for this route\n")
913 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
,
917 DEFUN (no_ip_route_tag_distance
,
918 no_ip_route_tag_distance_cmd
,
919 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
922 "Establish static routes\n"
923 "IP destination prefix (e.g. 10.0.0.0/8)\n"
924 "IP gateway address\n"
925 "IP gateway interface name\n"
927 "Tag of this route\n"
929 "Distance value for this route\n")
931 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, argv
[2],
935 DEFUN (no_ip_route_flags_distance
,
936 no_ip_route_flags_distance_cmd
,
937 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
940 "Establish static routes\n"
941 "IP destination prefix (e.g. 10.0.0.0/8)\n"
942 "IP gateway address\n"
943 "IP gateway interface name\n"
944 "Emit an ICMP unreachable when matched\n"
945 "Silently discard pkts when matched\n"
946 "Distance value for this route\n")
948 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], NULL
,
952 DEFUN (no_ip_route_flags_tag_distance
,
953 no_ip_route_flags_tag_distance_cmd
,
954 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
957 "Establish static routes\n"
958 "IP destination prefix (e.g. 10.0.0.0/8)\n"
959 "IP gateway address\n"
960 "IP gateway interface name\n"
961 "Emit an ICMP unreachable when matched\n"
962 "Silently discard pkts when matched\n"
963 "Tag of this route\n"
965 "Distance value for this route\n")
967 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], argv
[3],
971 DEFUN (no_ip_route_flags_distance2
,
972 no_ip_route_flags_distance2_cmd
,
973 "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
976 "Establish static routes\n"
977 "IP destination prefix (e.g. 10.0.0.0/8)\n"
978 "Emit an ICMP unreachable when matched\n"
979 "Silently discard pkts when matched\n"
980 "Distance value for this route\n")
982 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], NULL
,
986 DEFUN (no_ip_route_flags_tag_distance2
,
987 no_ip_route_flags_tag_distance2_cmd
,
988 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>",
991 "Establish static routes\n"
992 "IP destination prefix (e.g. 10.0.0.0/8)\n"
993 "Emit an ICMP unreachable when matched\n"
994 "Silently discard pkts when matched\n"
995 "Tag of this route\n"
997 "Distance value for this route\n")
999 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], argv
[2],
1003 DEFUN (no_ip_route_mask_distance
,
1004 no_ip_route_mask_distance_cmd
,
1005 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
1008 "Establish static routes\n"
1009 "IP destination prefix\n"
1010 "IP destination prefix mask\n"
1011 "IP gateway address\n"
1012 "IP gateway interface name\n"
1014 "Distance value for this route\n")
1016 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
,
1020 DEFUN (no_ip_route_mask_tag_distance
,
1021 no_ip_route_mask_tag_distance_cmd
,
1022 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
1025 "Establish static routes\n"
1026 "IP destination prefix\n"
1027 "IP destination prefix mask\n"
1028 "IP gateway address\n"
1029 "IP gateway interface name\n"
1031 "Tag of this route\n"
1033 "Distance value for this route\n")
1035 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3],
1039 DEFUN (no_ip_route_mask_flags_distance
,
1040 no_ip_route_mask_flags_distance_cmd
,
1041 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
1044 "Establish static routes\n"
1045 "IP destination prefix\n"
1046 "IP destination prefix mask\n"
1047 "IP gateway address\n"
1048 "IP gateway interface name\n"
1049 "Emit an ICMP unreachable when matched\n"
1050 "Silently discard pkts when matched\n"
1051 "Distance value for this route\n")
1053 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
,
1057 DEFUN (no_ip_route_mask_flags_tag_distance
,
1058 no_ip_route_mask_flags_tag_distance_cmd
,
1059 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
1062 "Establish static routes\n"
1063 "IP destination prefix\n"
1064 "IP destination prefix mask\n"
1065 "IP gateway address\n"
1066 "IP gateway interface name\n"
1067 "Emit an ICMP unreachable when matched\n"
1068 "Silently discard pkts when matched\n"
1069 "Tag of this route\n"
1071 "Distance value for this route\n")
1073 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4],
1077 DEFUN (no_ip_route_mask_flags_distance2
,
1078 no_ip_route_mask_flags_distance2_cmd
,
1079 "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
1082 "Establish static routes\n"
1083 "IP destination prefix\n"
1084 "IP destination prefix mask\n"
1085 "Emit an ICMP unreachable when matched\n"
1086 "Silently discard pkts when matched\n"
1087 "Distance value for this route\n")
1089 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
,
1093 DEFUN (no_ip_route_mask_flags_tag_distance2
,
1094 no_ip_route_mask_flags_tag_distance2_cmd
,
1095 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>",
1098 "Establish static routes\n"
1099 "IP destination prefix\n"
1100 "IP destination prefix mask\n"
1101 "Emit an ICMP unreachable when matched\n"
1102 "Silently discard pkts when matched\n"
1103 "Tag of this route\n"
1105 "Distance value for this route\n")
1107 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3],
1111 /* Static route configuration. */
1112 DEFUN (ip_route_vrf
,
1114 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR
,
1116 "Establish static routes\n"
1117 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1118 "IP gateway address\n"
1119 "IP gateway interface name\n"
1123 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
, NULL
, argv
[2]);
1126 DEFUN (ip_route_tag_vrf
,
1127 ip_route_tag_vrf_cmd
,
1128 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR
,
1130 "Establish static routes\n"
1131 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1132 "IP gateway address\n"
1133 "IP gateway interface name\n"
1135 "Set tag for this route\n"
1139 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, argv
[2], NULL
, argv
[3]);
1142 DEFUN (ip_route_flags_vrf
,
1143 ip_route_flags_vrf_cmd
,
1144 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR
,
1146 "Establish static routes\n"
1147 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1148 "IP gateway address\n"
1149 "IP gateway interface name\n"
1150 "Emit an ICMP unreachable when matched\n"
1151 "Silently discard pkts when matched\n"
1154 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], NULL
, NULL
, argv
[3]);
1157 DEFUN (ip_route_flags_tag_vrf
,
1158 ip_route_flags_tag_vrf_cmd
,
1159 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1161 "Establish static routes\n"
1162 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1163 "IP gateway address\n"
1164 "IP gateway interface name\n"
1165 "Emit an ICMP unreachable when matched\n"
1166 "Silently discard pkts when matched\n"
1167 "Set tag for this route\n"
1172 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], argv
[3], NULL
, argv
[4]);
1175 DEFUN (ip_route_flags2_vrf
,
1176 ip_route_flags2_vrf_cmd
,
1177 "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR
,
1179 "Establish static routes\n"
1180 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1181 "Emit an ICMP unreachable when matched\n"
1182 "Silently discard pkts when matched\n"
1185 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], NULL
, NULL
, argv
[2]);
1188 DEFUN (ip_route_flags2_tag_vrf
,
1189 ip_route_flags2_tag_vrf_cmd
,
1190 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1192 "Establish static routes\n"
1193 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1194 "Emit an ICMP unreachable when matched\n"
1195 "Silently discard pkts when matched\n"
1196 "Set tag for this route\n"
1201 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], argv
[2], NULL
, argv
[3]);
1204 /* Mask as A.B.C.D format. */
1205 DEFUN (ip_route_mask_vrf
,
1206 ip_route_mask_vrf_cmd
,
1207 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR
,
1209 "Establish static routes\n"
1210 "IP destination prefix\n"
1211 "IP destination prefix mask\n"
1212 "IP gateway address\n"
1213 "IP gateway interface name\n"
1217 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, argv
[3]);
1220 DEFUN (ip_route_mask_tag_vrf
,
1221 ip_route_mask_tag_vrf_cmd
,
1222 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR
,
1224 "Establish static routes\n"
1225 "IP destination prefix\n"
1226 "IP destination prefix mask\n"
1227 "IP gateway address\n"
1228 "IP gateway interface name\n"
1230 "Set tag for this route\n"
1235 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, argv
[4]);
1238 DEFUN (ip_route_mask_flags_vrf
,
1239 ip_route_mask_flags_vrf_cmd
,
1240 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR
,
1242 "Establish static routes\n"
1243 "IP destination prefix\n"
1244 "IP destination prefix mask\n"
1245 "IP gateway address\n"
1246 "IP gateway interface name\n"
1247 "Emit an ICMP unreachable when matched\n"
1248 "Silently discard pkts when matched\n"
1251 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, argv
[4]);
1254 DEFUN (ip_route_mask_flags_tag_vrf
,
1255 ip_route_mask_flags_tag_vrf_cmd
,
1256 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1258 "Establish static routes\n"
1259 "IP destination prefix\n"
1260 "IP destination prefix mask\n"
1261 "IP gateway address\n"
1262 "IP gateway interface name\n"
1263 "Emit an ICMP unreachable when matched\n"
1264 "Silently discard pkts when matched\n"
1265 "Set tag for this route\n"
1270 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, argv
[5]);
1273 DEFUN (ip_route_mask_flags2_vrf
,
1274 ip_route_mask_flags2_vrf_cmd
,
1275 "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR
,
1277 "Establish static routes\n"
1278 "IP destination prefix\n"
1279 "IP destination prefix mask\n"
1280 "Emit an ICMP unreachable when matched\n"
1281 "Silently discard pkts when matched\n"
1284 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, argv
[3]);
1287 DEFUN (ip_route_mask_flags2_tag_vrf
,
1288 ip_route_mask_flags2_tag_vrf_cmd
,
1289 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1291 "Establish static routes\n"
1292 "IP destination prefix\n"
1293 "IP destination prefix mask\n"
1294 "Emit an ICMP unreachable when matched\n"
1295 "Silently discard pkts when matched\n"
1296 "Set tag for this route\n"
1300 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, argv
[4]);
1303 /* Distance option value. */
1304 DEFUN (ip_route_distance_vrf
,
1305 ip_route_distance_vrf_cmd
,
1306 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR
,
1308 "Establish static routes\n"
1309 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1310 "IP gateway address\n"
1311 "IP gateway interface name\n"
1313 "Distance value for this route\n"
1316 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
, argv
[2], argv
[3]);
1319 DEFUN (ip_route_tag_distance_vrf
,
1320 ip_route_tag_distance_vrf_cmd
,
1321 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR
,
1323 "Establish static routes\n"
1324 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1325 "IP gateway address\n"
1326 "IP gateway interface name\n"
1328 "Set tag for this route\n"
1330 "Distance value for this route\n"
1334 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], NULL
, argv
[2], argv
[3], argv
[4]);
1337 DEFUN (ip_route_flags_distance_vrf
,
1338 ip_route_flags_distance_vrf_cmd
,
1339 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
1341 "Establish static routes\n"
1342 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1343 "IP gateway address\n"
1344 "IP gateway interface name\n"
1345 "Emit an ICMP unreachable when matched\n"
1346 "Silently discard pkts when matched\n"
1347 "Distance value for this route\n"
1350 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], NULL
, argv
[3], argv
[4]);
1353 DEFUN (ip_route_flags_tag_distance_vrf
,
1354 ip_route_flags_tag_distance_vrf_cmd
,
1355 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1357 "Establish static routes\n"
1358 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1359 "IP gateway address\n"
1360 "IP gateway interface name\n"
1361 "Emit an ICMP unreachable when matched\n"
1362 "Silently discard pkts when matched\n"
1363 "Set tag for this route\n"
1365 "Distance value for this route\n"
1368 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, argv
[1], argv
[2], argv
[3], argv
[4],argv
[5]);
1371 DEFUN (ip_route_flags_distance2_vrf
,
1372 ip_route_flags_distance2_vrf_cmd
,
1373 "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR
,
1375 "Establish static routes\n"
1376 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1377 "Emit an ICMP unreachable when matched\n"
1378 "Silently discard pkts when matched\n"
1379 "Distance value for this route\n"
1382 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], NULL
, argv
[2], argv
[3]);
1385 DEFUN (ip_route_flags_tag_distance2_vrf
,
1386 ip_route_flags_tag_distance2_vrf_cmd
,
1387 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1389 "Establish static routes\n"
1390 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1391 "Emit an ICMP unreachable when matched\n"
1392 "Silently discard pkts when matched\n"
1393 "Set tag for this route\n"
1395 "Distance value for this route\n"
1398 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], NULL
, NULL
, argv
[1], argv
[2], argv
[3], argv
[4]);
1401 DEFUN (ip_route_mask_distance_vrf
,
1402 ip_route_mask_distance_vrf_cmd
,
1403 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR
,
1405 "Establish static routes\n"
1406 "IP destination prefix\n"
1407 "IP destination prefix mask\n"
1408 "IP gateway address\n"
1409 "IP gateway interface name\n"
1411 "Distance value for this route\n"
1414 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], argv
[4]);
1417 DEFUN (ip_route_mask_tag_distance_vrf
,
1418 ip_route_mask_tag_distance_vrf_cmd
,
1419 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR
,
1421 "Establish static routes\n"
1422 "IP destination prefix\n"
1423 "IP destination prefix mask\n"
1424 "IP gateway address\n"
1425 "IP gateway interface name\n"
1427 "Set tag for this route\n"
1429 "Distance value for this route\n"
1432 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], argv
[5]);
1435 DEFUN (ip_route_mask_flags_tag_distance_vrf
,
1436 ip_route_mask_flags_tag_distance_vrf_cmd
,
1437 "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
,
1439 "Establish static routes\n"
1440 "IP destination prefix\n"
1441 "IP destination prefix mask\n"
1442 "IP gateway address\n"
1443 "IP gateway interface name\n"
1444 "Set tag for this route\n"
1446 "Distance value for this route\n"
1447 "Emit an ICMP unreachable when matched\n"
1448 "Silently discard pkts when matched\n"
1451 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], argv
[6]);
1455 DEFUN (ip_route_mask_flags_distance_vrf
,
1456 ip_route_mask_flags_distance_vrf_cmd
,
1457 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
1459 "Establish static routes\n"
1460 "IP destination prefix\n"
1461 "IP destination prefix mask\n"
1462 "IP gateway address\n"
1463 "IP gateway interface name\n"
1464 "Emit an ICMP unreachable when matched\n"
1465 "Silently discard pkts when matched\n"
1466 "Distance value for this route\n"
1469 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], argv
[5]);
1472 DEFUN (ip_route_mask_flags_distance2_vrf
,
1473 ip_route_mask_flags_distance2_vrf_cmd
,
1474 "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR
,
1476 "Establish static routes\n"
1477 "IP destination prefix\n"
1478 "IP destination prefix mask\n"
1479 "Emit an ICMP unreachable when matched\n"
1480 "Silently discard pkts when matched\n"
1481 "Distance value for this route\n"
1484 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], argv
[4]);
1487 DEFUN (ip_route_mask_flags_tag_distance2_vrf
,
1488 ip_route_mask_flags_tag_distance2_vrf_cmd
,
1489 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1491 "Establish static routes\n"
1492 "IP destination prefix\n"
1493 "IP destination prefix mask\n"
1494 "Set tag for this route\n"
1496 "Distance value for this route\n"
1497 "Emit an ICMP unreachable when matched\n"
1498 "Silently discard pkts when matched\n"
1501 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], argv
[5]);
1504 DEFUN (no_ip_route_vrf
,
1505 no_ip_route_vrf_cmd
,
1506 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR
,
1509 "Establish static routes\n"
1510 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1511 "IP gateway address\n"
1512 "IP gateway interface name\n"
1516 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
, NULL
, argv
[2]);
1519 DEFUN (no_ip_route_flags_vrf
,
1520 no_ip_route_flags_vrf_cmd
,
1521 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR
,
1524 "Establish static routes\n"
1525 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1526 "IP gateway address\n"
1527 "IP gateway interface name\n"
1528 "Emit an ICMP unreachable when matched\n"
1529 "Silently discard pkts when matched\n"
1532 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], NULL
, NULL
, argv
[3]);
1535 DEFUN (no_ip_route_tag_vrf
,
1536 no_ip_route_tag_vrf_cmd
,
1537 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR
,
1540 "Establish static routes\n"
1541 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1542 "IP gateway address\n"
1543 "IP gateway interface name\n"
1545 "Tag of this route\n"
1549 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, argv
[2], NULL
, argv
[3]);
1552 DEFUN (no_ip_route_flags_tag_vrf
,
1553 no_ip_route_flags_tag_vrf_cmd
,
1554 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1557 "Establish static routes\n"
1558 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1559 "IP gateway address\n"
1560 "IP gateway interface name\n"
1561 "Emit an ICMP unreachable when matched\n"
1562 "Silently discard pkts when matched\n"
1563 "Tag of this route\n"
1567 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], argv
[3], NULL
, argv
[4]);
1570 DEFUN (no_ip_route_flags2_vrf
,
1571 no_ip_route_flags2_vrf_cmd
,
1572 "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR
,
1575 "Establish static routes\n"
1576 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1577 "Emit an ICMP unreachable when matched\n"
1578 "Silently discard pkts when matched\n"
1581 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], NULL
, NULL
, argv
[2]);
1584 DEFUN (no_ip_route_flags2_tag_vrf
,
1585 no_ip_route_flags2_tag_vrf_cmd
,
1586 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1589 "Establish static routes\n"
1590 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1591 "Emit an ICMP unreachable when matched\n"
1592 "Silently discard pkts when matched\n"
1593 "Tag of this route\n"
1597 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], argv
[2], NULL
, argv
[3]);
1600 DEFUN (no_ip_route_mask_vrf
,
1601 no_ip_route_mask_vrf_cmd
,
1602 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR
,
1605 "Establish static routes\n"
1606 "IP destination prefix\n"
1607 "IP destination prefix mask\n"
1608 "IP gateway address\n"
1609 "IP gateway interface name\n"
1613 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, argv
[3]);
1616 DEFUN (no_ip_route_mask_flags_vrf
,
1617 no_ip_route_mask_flags_vrf_cmd
,
1618 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR
,
1621 "Establish static routes\n"
1622 "IP destination prefix\n"
1623 "IP destination prefix mask\n"
1624 "IP gateway address\n"
1625 "IP gateway interface name\n"
1626 "Emit an ICMP unreachable when matched\n"
1627 "Silently discard pkts when matched\n"
1630 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, argv
[4]);
1633 DEFUN (no_ip_route_mask_tag_vrf
,
1634 no_ip_route_mask_tag_vrf_cmd
,
1635 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR
,
1638 "Establish static routes\n"
1639 "IP destination prefix\n"
1640 "IP destination prefix mask\n"
1641 "IP gateway address\n"
1642 "IP gateway interface name\n"
1644 "Tag of this route\n"
1648 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, argv
[4]);
1651 DEFUN (no_ip_route_mask_flags_tag_vrf
,
1652 no_ip_route_mask_flags_tag_vrf_cmd
,
1653 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1656 "Establish static routes\n"
1657 "IP destination prefix\n"
1658 "IP destination prefix mask\n"
1659 "IP gateway address\n"
1660 "IP gateway interface name\n"
1661 "Emit an ICMP unreachable when matched\n"
1662 "Silently discard pkts when matched\n"
1663 "Tag of this route\n"
1667 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, argv
[5]);
1670 DEFUN (no_ip_route_mask_flags2_vrf
,
1671 no_ip_route_mask_flags2_vrf_cmd
,
1672 "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR
,
1675 "Establish static routes\n"
1676 "IP destination prefix\n"
1677 "IP destination prefix mask\n"
1678 "Emit an ICMP unreachable when matched\n"
1679 "Silently discard pkts when matched\n"
1682 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, argv
[3]);
1685 DEFUN (no_ip_route_mask_flags2_tag_vrf
,
1686 no_ip_route_mask_flags2_tag_vrf_cmd
,
1687 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
1690 "Establish static routes\n"
1691 "IP destination prefix\n"
1692 "IP destination prefix mask\n"
1693 "Emit an ICMP unreachable when matched\n"
1694 "Silently discard pkts when matched\n"
1695 "Tag of this route\n"
1699 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, argv
[4]);
1703 DEFUN (no_ip_route_distance_vrf
,
1704 no_ip_route_distance_vrf_cmd
,
1705 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR
,
1708 "Establish static routes\n"
1709 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1710 "IP gateway address\n"
1711 "IP gateway interface name\n"
1713 "Distance value for this route\n"
1716 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
, argv
[2], argv
[3]);
1719 DEFUN (no_ip_route_tag_distance_vrf
,
1720 no_ip_route_tag_distance_vrf_cmd
,
1721 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR
,
1724 "Establish static routes\n"
1725 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1726 "IP gateway address\n"
1727 "IP gateway interface name\n"
1729 "Tag of this route\n"
1731 "Distance value for this route\n"
1734 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], NULL
, argv
[2], argv
[3], argv
[4]);
1737 DEFUN (no_ip_route_flags_distance_vrf
,
1738 no_ip_route_flags_distance_vrf_cmd
,
1739 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
1742 "Establish static routes\n"
1743 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1744 "IP gateway address\n"
1745 "IP gateway interface name\n"
1746 "Emit an ICMP unreachable when matched\n"
1747 "Silently discard pkts when matched\n"
1748 "Distance value for this route\n"
1751 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], NULL
, argv
[3], argv
[4]);
1754 DEFUN (no_ip_route_flags_tag_distance_vrf
,
1755 no_ip_route_flags_tag_distance_vrf_cmd
,
1756 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1759 "Establish static routes\n"
1760 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1761 "IP gateway address\n"
1762 "IP gateway interface name\n"
1763 "Emit an ICMP unreachable when matched\n"
1764 "Silently discard pkts when matched\n"
1765 "Tag of this route\n"
1767 "Distance value for this route\n"
1770 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, argv
[1], argv
[2], argv
[3], argv
[4],argv
[5]);
1773 DEFUN (no_ip_route_flags_distance2_vrf
,
1774 no_ip_route_flags_distance2_vrf_cmd
,
1775 "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR
,
1778 "Establish static routes\n"
1779 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1780 "Emit an ICMP unreachable when matched\n"
1781 "Silently discard pkts when matched\n"
1782 "Distance value for this route\n"
1785 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], NULL
, argv
[2], argv
[3]);
1788 DEFUN (no_ip_route_flags_tag_distance2_vrf
,
1789 no_ip_route_flags_tag_distance2_vrf_cmd
,
1790 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1793 "Establish static routes\n"
1794 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1795 "Emit an ICMP unreachable when matched\n"
1796 "Silently discard pkts when matched\n"
1797 "Tag of this route\n"
1799 "Distance value for this route\n"
1802 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], NULL
, NULL
, argv
[1], argv
[2] , argv
[3], argv
[4]);
1805 DEFUN (no_ip_route_mask_distance_vrf
,
1806 no_ip_route_mask_distance_vrf_cmd
,
1807 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR
,
1810 "Establish static routes\n"
1811 "IP destination prefix\n"
1812 "IP destination prefix mask\n"
1813 "IP gateway address\n"
1814 "IP gateway interface name\n"
1816 "Distance value for this route\n"
1819 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], argv
[4]);
1822 DEFUN (no_ip_route_mask_tag_distance_vrf
,
1823 no_ip_route_mask_tag_distance_vrf_cmd
,
1824 "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
,
1827 "Establish static routes\n"
1828 "IP destination prefix\n"
1829 "IP destination prefix mask\n"
1830 "IP gateway address\n"
1831 "IP gateway interface name\n"
1833 "Tag of this route\n"
1835 "Distance value for this route\n"
1838 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], argv
[5]);
1841 DEFUN (no_ip_route_mask_flags_distance_vrf
,
1842 no_ip_route_mask_flags_distance_vrf_cmd
,
1843 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
1846 "Establish static routes\n"
1847 "IP destination prefix\n"
1848 "IP destination prefix mask\n"
1849 "IP gateway address\n"
1850 "IP gateway interface name\n"
1851 "Emit an ICMP unreachable when matched\n"
1852 "Silently discard pkts when matched\n"
1853 "Distance value for this route\n"
1856 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], argv
[5]);
1859 DEFUN (no_ip_route_mask_flags_tag_distance_vrf
,
1860 no_ip_route_mask_flags_tag_distance_vrf_cmd
,
1861 "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
,
1864 "Establish static routes\n"
1865 "IP destination prefix\n"
1866 "IP destination prefix mask\n"
1867 "IP gateway address\n"
1868 "IP gateway interface name\n"
1869 "Emit an ICMP unreachable when matched\n"
1870 "Silently discard pkts when matched\n"
1871 "Tag of this route\n"
1873 "Distance value for this route\n"
1876 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], argv
[6]);
1879 DEFUN (no_ip_route_mask_flags_distance2_vrf
,
1880 no_ip_route_mask_flags_distance2_vrf_cmd
,
1881 "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR
,
1884 "Establish static routes\n"
1885 "IP destination prefix\n"
1886 "IP destination prefix mask\n"
1887 "Emit an ICMP unreachable when matched\n"
1888 "Silently discard pkts when matched\n"
1889 "Distance value for this route\n"
1892 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], argv
[4]);
1895 DEFUN (no_ip_route_mask_flags_tag_distance2_vrf
,
1896 no_ip_route_mask_flags_tag_distance2_vrf_cmd
,
1897 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
1900 "Establish static routes\n"
1901 "IP destination prefix\n"
1902 "IP destination prefix mask\n"
1903 "Emit an ICMP unreachable when matched\n"
1904 "Silently discard pkts when matched\n"
1905 "Tag of this route\n"
1907 "Distance value for this route\n"
1910 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], argv
[5]);
1913 /* New RIB. Detailed information for IPv4 route. */
1915 vty_show_ip_route_detail (struct vty
*vty
, struct route_node
*rn
, int mcast
)
1918 struct nexthop
*nexthop
, *tnexthop
;
1920 char buf
[PREFIX_STRLEN
];
1921 struct zebra_vrf
*zvrf
;
1923 RNODE_FOREACH_RIB (rn
, rib
)
1925 const char *mcast_info
= "";
1928 rib_table_info_t
*info
= rn
->table
->info
;
1929 mcast_info
= (info
->safi
== SAFI_MULTICAST
)
1930 ? " using Multicast RIB"
1931 : " using Unicast RIB";
1934 vty_out (vty
, "Routing entry for %s%s%s",
1935 prefix2str (&rn
->p
, buf
, sizeof(buf
)), mcast_info
,
1937 vty_out (vty
, " Known via \"%s", zebra_route_string (rib
->type
));
1939 vty_out (vty
, "[%d]", rib
->instance
);
1940 vty_out (vty
, "\"");
1941 vty_out (vty
, ", distance %u, metric %u", rib
->distance
, rib
->metric
);
1943 vty_out (vty
, ", tag %d", rib
->tag
);
1945 vty_out (vty
, ", mtu %u", rib
->mtu
);
1946 if (rib
->vrf_id
!= VRF_DEFAULT
)
1948 zvrf
= vrf_info_lookup(rib
->vrf_id
);
1949 vty_out (vty
, ", vrf %s", zvrf
->name
);
1951 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
))
1952 vty_out (vty
, ", best");
1954 vty_out (vty
, ", refcnt %ld", rib
->refcnt
);
1955 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
1956 vty_out (vty
, ", blackhole");
1957 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
1958 vty_out (vty
, ", reject");
1959 vty_out (vty
, "%s", VTY_NEWLINE
);
1961 if (rib
->type
== ZEBRA_ROUTE_RIP
1962 || rib
->type
== ZEBRA_ROUTE_OSPF
1963 || rib
->type
== ZEBRA_ROUTE_ISIS
1964 || rib
->type
== ZEBRA_ROUTE_TABLE
1965 || rib
->type
== ZEBRA_ROUTE_BGP
)
1970 uptime
= time (NULL
);
1971 uptime
-= rib
->uptime
;
1972 tm
= gmtime (&uptime
);
1974 vty_out (vty
, " Last update ");
1976 if (uptime
< ONE_DAY_SECOND
)
1977 vty_out (vty
, "%02d:%02d:%02d",
1978 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
1979 else if (uptime
< ONE_WEEK_SECOND
)
1980 vty_out (vty
, "%dd%02dh%02dm",
1981 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
1983 vty_out (vty
, "%02dw%dd%02dh",
1985 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
1986 vty_out (vty
, " ago%s", VTY_NEWLINE
);
1989 for (ALL_NEXTHOPS_RO(rib
->nexthop
, nexthop
, tnexthop
, recursing
))
1993 vty_out (vty
, " %c%s",
1994 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
) ? '*' : ' ',
1995 recursing
? " " : "");
1997 switch (nexthop
->type
)
1999 case NEXTHOP_TYPE_IPV4
:
2000 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2001 vty_out (vty
, " %s", inet_ntoa (nexthop
->gate
.ipv4
));
2002 if (nexthop
->ifindex
)
2003 vty_out (vty
, ", via %s",
2004 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2006 case NEXTHOP_TYPE_IPV6
:
2007 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2008 vty_out (vty
, " %s",
2009 inet_ntop (AF_INET6
, &nexthop
->gate
.ipv6
, buf
, BUFSIZ
));
2010 if (nexthop
->ifindex
)
2011 vty_out (vty
, ", via %s",
2012 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2014 case NEXTHOP_TYPE_IFINDEX
:
2015 vty_out (vty
, " directly connected, %s",
2016 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2018 case NEXTHOP_TYPE_BLACKHOLE
:
2019 vty_out (vty
, " directly connected, Null0");
2024 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
2025 vty_out (vty
, " inactive");
2027 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
2028 vty_out (vty
, " onlink");
2030 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
2031 vty_out (vty
, " (recursive)");
2033 switch (nexthop
->type
)
2035 case NEXTHOP_TYPE_IPV4
:
2036 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2037 if (nexthop
->src
.ipv4
.s_addr
)
2039 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, addrstr
,
2041 vty_out (vty
, ", src %s", addrstr
);
2044 case NEXTHOP_TYPE_IPV6
:
2045 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2046 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
))
2048 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, addrstr
,
2050 vty_out (vty
, ", src %s", addrstr
);
2056 vty_out (vty
, "%s", VTY_NEWLINE
);
2058 vty_out (vty
, "%s", VTY_NEWLINE
);
2063 vty_show_ip_route (struct vty
*vty
, struct route_node
*rn
, struct rib
*rib
,
2066 struct nexthop
*nexthop
, *tnexthop
;
2070 json_object
*json_nexthops
= NULL
;
2071 json_object
*json_nexthop
= NULL
;
2072 json_object
*json_route
= NULL
;
2076 json_route
= json_object_new_object();
2077 json_nexthops
= json_object_new_array();
2079 json_object_string_add(json_route
, "prefix", prefix2str (&rn
->p
, buf
, sizeof buf
));
2080 json_object_string_add(json_route
, "protocol", zebra_route_string(rib
->type
));
2083 json_object_int_add(json_route
, "instance", rib
->instance
);
2086 json_object_int_add(json_route
, "vrfId", rib
->vrf_id
);
2088 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
))
2089 json_object_boolean_true_add(json_route
, "selected");
2091 if (rib
->type
!= ZEBRA_ROUTE_CONNECT
&& rib
->type
!= ZEBRA_ROUTE_KERNEL
)
2093 json_object_int_add(json_route
, "distance", rib
->distance
);
2094 json_object_int_add(json_route
, "metric", rib
->metric
);
2097 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
2098 json_object_boolean_true_add(json_route
, "blackhole");
2100 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
2101 json_object_boolean_true_add(json_route
, "reject");
2103 if (rib
->type
== ZEBRA_ROUTE_RIP
2104 || rib
->type
== ZEBRA_ROUTE_OSPF
2105 || rib
->type
== ZEBRA_ROUTE_ISIS
2106 || rib
->type
== ZEBRA_ROUTE_TABLE
2107 || rib
->type
== ZEBRA_ROUTE_BGP
)
2112 uptime
= time (NULL
);
2113 uptime
-= rib
->uptime
;
2114 tm
= gmtime (&uptime
);
2116 if (uptime
< ONE_DAY_SECOND
)
2117 sprintf(buf
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
2118 else if (uptime
< ONE_WEEK_SECOND
)
2119 sprintf(buf
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
2121 sprintf(buf
, "%02dw%dd%02dh", tm
->tm_yday
/7, tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
2123 json_object_string_add(json_route
, "uptime", buf
);
2126 for (ALL_NEXTHOPS_RO(rib
->nexthop
, nexthop
, tnexthop
, recursing
))
2128 json_nexthop
= json_object_new_object();
2130 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
))
2131 json_object_boolean_true_add(json_nexthop
, "fib");
2133 switch (nexthop
->type
)
2135 case NEXTHOP_TYPE_IPV4
:
2136 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2137 json_object_string_add(json_nexthop
, "ip", inet_ntoa (nexthop
->gate
.ipv4
));
2138 json_object_string_add(json_nexthop
, "afi", "ipv4");
2140 if (nexthop
->ifindex
)
2142 json_object_int_add(json_nexthop
, "interfaceIndex", nexthop
->ifindex
);
2143 json_object_string_add(json_nexthop
, "interfaceName", ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2146 case NEXTHOP_TYPE_IPV6
:
2147 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2148 json_object_string_add(json_nexthop
, "ip", inet_ntop (AF_INET6
, &nexthop
->gate
.ipv6
, buf
, BUFSIZ
));
2149 json_object_string_add(json_nexthop
, "afi", "ipv6");
2151 if (nexthop
->ifindex
)
2153 json_object_int_add(json_nexthop
, "interfaceIndex", nexthop
->ifindex
);
2154 json_object_string_add(json_nexthop
, "interfaceName", ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2158 case NEXTHOP_TYPE_IFINDEX
:
2159 json_object_boolean_true_add(json_nexthop
, "directlyConnected");
2160 json_object_int_add(json_nexthop
, "interfaceIndex", nexthop
->ifindex
);
2161 json_object_string_add(json_nexthop
, "interfaceName", ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2163 case NEXTHOP_TYPE_BLACKHOLE
:
2164 json_object_boolean_true_add(json_nexthop
, "blackhole");
2170 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
2171 json_object_boolean_true_add(json_nexthop
, "active");
2173 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
2174 json_object_boolean_true_add(json_nexthop
, "onLink");
2176 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
2177 json_object_boolean_true_add(json_nexthop
, "recursive");
2179 switch (nexthop
->type
)
2181 case NEXTHOP_TYPE_IPV4
:
2182 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2183 if (nexthop
->src
.ipv4
.s_addr
)
2185 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, buf
, sizeof buf
))
2186 json_object_string_add(json_nexthop
, "source", buf
);
2189 case NEXTHOP_TYPE_IPV6
:
2190 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2191 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
))
2193 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, buf
, sizeof buf
))
2194 json_object_string_add(json_nexthop
, "source", buf
);
2201 json_object_array_add(json_nexthops
, json_nexthop
);
2204 json_object_object_add(json_route
, "nexthops", json_nexthops
);
2205 json_object_array_add(json
, json_route
);
2209 /* Nexthop information. */
2210 for (ALL_NEXTHOPS_RO(rib
->nexthop
, nexthop
, tnexthop
, recursing
))
2212 if (nexthop
== rib
->nexthop
)
2214 /* Prefix information. */
2215 len
= vty_out (vty
, "%c", zebra_route_char (rib
->type
));
2217 len
+= vty_out (vty
, "[%d]", rib
->instance
);
2218 len
+= vty_out (vty
, "%c%c %s",
2219 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
)
2221 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
2223 prefix2str (&rn
->p
, buf
, sizeof buf
));
2225 /* Distance and metric display. */
2226 if (rib
->type
!= ZEBRA_ROUTE_CONNECT
2227 && rib
->type
!= ZEBRA_ROUTE_KERNEL
)
2228 len
+= vty_out (vty
, " [%d/%d]", rib
->distance
,
2232 vty_out (vty
, " %c%*c",
2233 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
2235 len
- 3 + (2 * recursing
), ' ');
2237 switch (nexthop
->type
)
2239 case NEXTHOP_TYPE_IPV4
:
2240 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2241 vty_out (vty
, " via %s", inet_ntoa (nexthop
->gate
.ipv4
));
2242 if (nexthop
->ifindex
)
2243 vty_out (vty
, ", %s",
2244 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2246 case NEXTHOP_TYPE_IPV6
:
2247 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2248 vty_out (vty
, " via %s",
2249 inet_ntop (AF_INET6
, &nexthop
->gate
.ipv6
, buf
, BUFSIZ
));
2250 if (nexthop
->ifindex
)
2251 vty_out (vty
, ", %s",
2252 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2255 case NEXTHOP_TYPE_IFINDEX
:
2256 vty_out (vty
, " is directly connected, %s",
2257 ifindex2ifname_vrf (nexthop
->ifindex
, rib
->vrf_id
));
2259 case NEXTHOP_TYPE_BLACKHOLE
:
2260 vty_out (vty
, " is directly connected, Null0");
2265 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
2266 vty_out (vty
, " inactive");
2268 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
2269 vty_out (vty
, " onlink");
2271 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
2272 vty_out (vty
, " (recursive)");
2274 switch (nexthop
->type
)
2276 case NEXTHOP_TYPE_IPV4
:
2277 case NEXTHOP_TYPE_IPV4_IFINDEX
:
2278 if (nexthop
->src
.ipv4
.s_addr
)
2280 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, buf
, sizeof buf
))
2281 vty_out (vty
, ", src %s", buf
);
2284 case NEXTHOP_TYPE_IPV6
:
2285 case NEXTHOP_TYPE_IPV6_IFINDEX
:
2286 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
))
2288 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, buf
, sizeof buf
))
2289 vty_out (vty
, ", src %s", buf
);
2296 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
2297 vty_out (vty
, ", bh");
2298 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
2299 vty_out (vty
, ", rej");
2301 if (rib
->type
== ZEBRA_ROUTE_RIP
2302 || rib
->type
== ZEBRA_ROUTE_OSPF
2303 || rib
->type
== ZEBRA_ROUTE_ISIS
2304 || rib
->type
== ZEBRA_ROUTE_TABLE
2305 || rib
->type
== ZEBRA_ROUTE_BGP
)
2310 uptime
= time (NULL
);
2311 uptime
-= rib
->uptime
;
2312 tm
= gmtime (&uptime
);
2314 if (uptime
< ONE_DAY_SECOND
)
2315 vty_out (vty
, ", %02d:%02d:%02d",
2316 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
2317 else if (uptime
< ONE_WEEK_SECOND
)
2318 vty_out (vty
, ", %dd%02dh%02dm",
2319 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
2321 vty_out (vty
, ", %02dw%dd%02dh",
2323 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
2325 vty_out (vty
, "%s", VTY_NEWLINE
);
2329 DEFUN (show_ip_route
,
2331 "show ip route {json}",
2334 "IP routing table\n")
2336 return do_show_ip_route (vty
, VRF_DEFAULT_NAME
, SAFI_UNICAST
, use_json(argc
, argv
));
2340 do_show_ip_route (struct vty
*vty
, const char *vrf_name
, safi_t safi
,
2343 struct route_table
*table
;
2344 struct route_node
*rn
;
2347 struct zebra_vrf
*zvrf
= NULL
;
2349 json_object
*json
= NULL
;
2350 json_object
*json_prefix
= NULL
;
2352 if (!(zvrf
= zebra_vrf_list_lookup_by_name (vrf_name
)))
2355 vty_out (vty
, "{}%s", VTY_NEWLINE
);
2357 vty_out (vty
, "vrf %s not defined%s", vrf_name
, VTY_NEWLINE
);
2361 if (zvrf
->vrf_id
== VRF_UNKNOWN
)
2364 vty_out (vty
, "{}%s", VTY_NEWLINE
);
2366 vty_out (vty
, "vrf %s inactive%s", vrf_name
, VTY_NEWLINE
);
2370 table
= zebra_vrf_table (AFI_IP
, safi
, zvrf
->vrf_id
);
2374 vty_out (vty
, "{}%s", VTY_NEWLINE
);
2380 json
= json_object_new_object();
2382 /* Show all IPv4 routes. */
2383 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2385 RNODE_FOREACH_RIB (rn
, rib
)
2388 json_prefix
= json_object_new_array();
2389 vty_show_ip_route (vty
, rn
, rib
, json_prefix
);
2394 prefix2str (&rn
->p
, buf
, sizeof buf
);
2395 json_object_object_add(json
, buf
, json_prefix
);
2400 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
2401 json_object_free(json
);
2405 /* Show all IPv4 routes. */
2406 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2408 RNODE_FOREACH_RIB (rn
, rib
)
2412 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2415 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2423 DEFUN (show_ip_route_vrf
,
2424 show_ip_route_vrf_cmd
,
2425 "show ip route " VRF_CMD_STR
" {json}",
2428 "IP routing table\n"
2431 u_char uj
= use_json(argc
, argv
);
2433 if (argc
== 1 && uj
)
2434 return do_show_ip_route (vty
, NULL
, SAFI_UNICAST
, uj
);
2436 return do_show_ip_route (vty
, argv
[0], SAFI_UNICAST
, uj
);
2444 "IP nexthop tracking table\n")
2446 vrf_id_t vrf_id
= VRF_DEFAULT
;
2449 VRF_GET_ID (vrf_id
, argv
[0]);
2451 zebra_print_rnh_table(vrf_id
, AF_INET
, vty
, RNH_NEXTHOP_TYPE
);
2456 show_ip_nht_vrf_cmd
,
2457 "show ip nht " VRF_CMD_STR
,
2460 "IP nexthop tracking table\n"
2463 DEFUN (show_ip_nht_vrf_all
,
2464 show_ip_nht_vrf_all_cmd
,
2465 "show ip nht " VRF_ALL_CMD_STR
,
2468 "IP nexthop tracking table\n"
2469 VRF_ALL_CMD_HELP_STR
)
2471 struct zebra_vrf
*zvrf
;
2474 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
2475 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
2477 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
2478 zebra_print_rnh_table(zvrf
->vrf_id
, AF_INET
, vty
, RNH_NEXTHOP_TYPE
);
2484 DEFUN (show_ipv6_nht
,
2489 "IPv6 nexthop tracking table\n")
2491 vrf_id_t vrf_id
= VRF_DEFAULT
;
2494 VRF_GET_ID (vrf_id
, argv
[0]);
2496 zebra_print_rnh_table(vrf_id
, AF_INET6
, vty
, RNH_NEXTHOP_TYPE
);
2500 ALIAS (show_ipv6_nht
,
2501 show_ipv6_nht_vrf_cmd
,
2502 "show ipv6 nht " VRF_CMD_STR
,
2505 "IPv6 nexthop tracking table\n"
2508 DEFUN (show_ipv6_nht_vrf_all
,
2509 show_ipv6_nht_vrf_all_cmd
,
2510 "show ipv6 nht " VRF_ALL_CMD_STR
,
2513 "IPv6 nexthop tracking table\n"
2514 VRF_ALL_CMD_HELP_STR
)
2516 struct zebra_vrf
*zvrf
;
2519 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
2520 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
2522 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
2523 zebra_print_rnh_table(zvrf
->vrf_id
, AF_INET6
, vty
, RNH_NEXTHOP_TYPE
);
2529 DEFUN (ip_nht_default_route
,
2530 ip_nht_default_route_cmd
,
2531 "ip nht resolve-via-default",
2533 "Filter Next Hop tracking route resolution\n"
2534 "Resolve via default route\n")
2536 if (zebra_rnh_ip_default_route
)
2539 zebra_rnh_ip_default_route
= 1;
2540 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
2544 DEFUN (no_ip_nht_default_route
,
2545 no_ip_nht_default_route_cmd
,
2546 "no ip nht resolve-via-default",
2549 "Filter Next Hop tracking route resolution\n"
2550 "Resolve via default route\n")
2552 if (!zebra_rnh_ip_default_route
)
2555 zebra_rnh_ip_default_route
= 0;
2556 zebra_evaluate_rnh(0, AF_INET
, 1, RNH_NEXTHOP_TYPE
, NULL
);
2560 DEFUN (ipv6_nht_default_route
,
2561 ipv6_nht_default_route_cmd
,
2562 "ipv6 nht resolve-via-default",
2564 "Filter Next Hop tracking route resolution\n"
2565 "Resolve via default route\n")
2567 if (zebra_rnh_ipv6_default_route
)
2570 zebra_rnh_ipv6_default_route
= 1;
2571 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
2575 DEFUN (no_ipv6_nht_default_route
,
2576 no_ipv6_nht_default_route_cmd
,
2577 "no ipv6 nht resolve-via-default",
2580 "Filter Next Hop tracking route resolution\n"
2581 "Resolve via default route\n")
2583 if (!zebra_rnh_ipv6_default_route
)
2586 zebra_rnh_ipv6_default_route
= 0;
2587 zebra_evaluate_rnh(0, AF_INET6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
2591 DEFUN (show_ip_route_tag
,
2592 show_ip_route_tag_cmd
,
2593 "show ip route tag <1-65535>",
2596 "IP routing table\n"
2597 "Show only routes with tag\n"
2600 struct route_table
*table
;
2601 struct route_node
*rn
;
2605 vrf_id_t vrf_id
= VRF_DEFAULT
;
2609 tag
= atoi(argv
[1]);
2610 VRF_GET_ID (vrf_id
, argv
[0]);
2613 tag
= atoi(argv
[0]);
2615 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2619 /* Show all IPv4 routes with matching tag value. */
2620 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2621 RNODE_FOREACH_RIB (rn
, rib
)
2623 if (rib
->tag
!= tag
)
2628 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2631 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2636 ALIAS (show_ip_route_tag
,
2637 show_ip_route_vrf_tag_cmd
,
2638 "show ip route " VRF_CMD_STR
" tag <1-65535>",
2641 "IP routing table\n"
2643 "Show only routes with tag\n"
2646 DEFUN (show_ip_route_prefix_longer
,
2647 show_ip_route_prefix_longer_cmd
,
2648 "show ip route A.B.C.D/M longer-prefixes",
2651 "IP routing table\n"
2652 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2653 "Show route matching the specified Network/Mask pair only\n")
2655 struct route_table
*table
;
2656 struct route_node
*rn
;
2661 vrf_id_t vrf_id
= VRF_DEFAULT
;
2665 ret
= str2prefix (argv
[1], &p
);
2666 VRF_GET_ID (vrf_id
, argv
[0]);
2669 ret
= str2prefix (argv
[0], &p
);
2673 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
2677 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2681 /* Show matched type IPv4 routes. */
2682 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2683 RNODE_FOREACH_RIB (rn
, rib
)
2684 if (prefix_match (&p
, &rn
->p
))
2688 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2691 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2696 ALIAS (show_ip_route_prefix_longer
,
2697 show_ip_route_vrf_prefix_longer_cmd
,
2698 "show ip route " VRF_CMD_STR
" A.B.C.D/M longer-prefixes",
2701 "IP routing table\n"
2703 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2704 "Show route matching the specified Network/Mask pair only\n")
2706 DEFUN (show_ip_route_supernets
,
2707 show_ip_route_supernets_cmd
,
2708 "show ip route supernets-only",
2711 "IP routing table\n"
2712 "Show supernet entries only\n")
2714 struct route_table
*table
;
2715 struct route_node
*rn
;
2719 vrf_id_t vrf_id
= VRF_DEFAULT
;
2722 VRF_GET_ID (vrf_id
, argv
[0]);
2724 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2728 /* Show matched type IPv4 routes. */
2729 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2730 RNODE_FOREACH_RIB (rn
, rib
)
2732 addr
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
2734 if ((IN_CLASSC (addr
) && rn
->p
.prefixlen
< 24)
2735 || (IN_CLASSB (addr
) && rn
->p
.prefixlen
< 16)
2736 || (IN_CLASSA (addr
) && rn
->p
.prefixlen
< 8))
2740 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2743 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2749 ALIAS (show_ip_route_supernets
,
2750 show_ip_route_vrf_supernets_cmd
,
2751 "show ip route " VRF_CMD_STR
" supernets-only",
2754 "IP routing table\n"
2756 "Show supernet entries only\n")
2758 DEFUN (show_ip_route_protocol
,
2759 show_ip_route_protocol_cmd
,
2760 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA
,
2763 "IP routing table\n"
2764 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
)
2767 struct route_table
*table
;
2768 struct route_node
*rn
;
2771 vrf_id_t vrf_id
= VRF_DEFAULT
;
2775 type
= proto_redistnum (AFI_IP
, argv
[1]);
2776 VRF_GET_ID (vrf_id
, argv
[0]);
2779 type
= proto_redistnum (AFI_IP
, argv
[0]);
2783 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
2787 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2791 /* Show matched type IPv4 routes. */
2792 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2793 RNODE_FOREACH_RIB (rn
, rib
)
2794 if (rib
->type
== type
)
2798 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2801 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2806 ALIAS (show_ip_route_protocol
,
2807 show_ip_route_vrf_protocol_cmd
,
2808 "show ip route " VRF_CMD_STR
" " QUAGGA_IP_REDIST_STR_ZEBRA
,
2811 "IP routing table\n"
2813 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
)
2815 DEFUN (show_ip_route_ospf_instance
,
2816 show_ip_route_ospf_instance_cmd
,
2817 "show ip route ospf <1-65535>",
2820 "IP routing table\n"
2821 "Open Shortest Path First (OSPFv2)\n"
2824 struct route_table
*table
;
2825 struct route_node
*rn
;
2828 u_short instance
= 0;
2830 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
2832 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, VRF_DEFAULT
);
2836 /* Show matched type IPv4 routes. */
2837 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2838 RNODE_FOREACH_RIB (rn
, rib
)
2839 if (rib
->type
== ZEBRA_ROUTE_OSPF
&& rib
->instance
== instance
)
2843 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
2846 vty_show_ip_route (vty
, rn
, rib
, NULL
);
2851 DEFUN (show_ip_route_addr
,
2852 show_ip_route_addr_cmd
,
2853 "show ip route A.B.C.D",
2856 "IP routing table\n"
2857 "Network in the IP routing table to display\n")
2860 struct prefix_ipv4 p
;
2861 struct route_table
*table
;
2862 struct route_node
*rn
;
2863 vrf_id_t vrf_id
= VRF_DEFAULT
;
2867 VRF_GET_ID (vrf_id
, argv
[0]);
2868 ret
= str2prefix_ipv4 (argv
[1], &p
);
2871 ret
= str2prefix_ipv4 (argv
[0], &p
);
2875 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
2879 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2883 rn
= route_node_match (table
, (struct prefix
*) &p
);
2886 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
2890 vty_show_ip_route_detail (vty
, rn
, 0);
2892 route_unlock_node (rn
);
2897 ALIAS (show_ip_route_addr
,
2898 show_ip_route_vrf_addr_cmd
,
2899 "show ip route " VRF_CMD_STR
" A.B.C.D",
2902 "IP routing table\n"
2904 "Network in the IP routing table to display\n")
2906 DEFUN (show_ip_route_prefix
,
2907 show_ip_route_prefix_cmd
,
2908 "show ip route A.B.C.D/M",
2911 "IP routing table\n"
2912 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2915 struct prefix_ipv4 p
;
2916 struct route_table
*table
;
2917 struct route_node
*rn
;
2918 vrf_id_t vrf_id
= VRF_DEFAULT
;
2922 VRF_GET_ID (vrf_id
, argv
[0]);
2923 ret
= str2prefix_ipv4 (argv
[1], &p
);
2926 ret
= str2prefix_ipv4 (argv
[0], &p
);
2930 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
2934 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
2938 rn
= route_node_match (table
, (struct prefix
*) &p
);
2939 if (! rn
|| rn
->p
.prefixlen
!= p
.prefixlen
)
2941 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
2945 vty_show_ip_route_detail (vty
, rn
, 0);
2947 route_unlock_node (rn
);
2952 ALIAS (show_ip_route_prefix
,
2953 show_ip_route_vrf_prefix_cmd
,
2954 "show ip route " VRF_CMD_STR
" A.B.C.D/M",
2957 "IP routing table\n"
2959 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2962 vty_show_ip_route_summary (struct vty
*vty
, struct route_table
*table
)
2964 struct route_node
*rn
;
2966 #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
2967 #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
2968 u_int32_t rib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
2969 u_int32_t fib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
2973 memset (&rib_cnt
, 0, sizeof(rib_cnt
));
2974 memset (&fib_cnt
, 0, sizeof(fib_cnt
));
2975 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2976 RNODE_FOREACH_RIB (rn
, rib
)
2978 is_ibgp
= (rib
->type
== ZEBRA_ROUTE_BGP
&&
2979 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_IBGP
));
2981 rib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
2983 rib_cnt
[ZEBRA_ROUTE_IBGP
]++;
2985 rib_cnt
[rib
->type
]++;
2987 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
))
2989 fib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
2992 fib_cnt
[ZEBRA_ROUTE_IBGP
]++;
2994 fib_cnt
[rib
->type
]++;
2998 vty_out (vty
, "%-20s %-20s %s (vrf %s)%s",
2999 "Route Source", "Routes", "FIB",
3000 ((rib_table_info_t
*)table
->info
)->zvrf
->name
,
3003 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
3005 if ((rib_cnt
[i
] > 0) ||
3006 (i
== ZEBRA_ROUTE_BGP
&& rib_cnt
[ZEBRA_ROUTE_IBGP
] > 0))
3008 if (i
== ZEBRA_ROUTE_BGP
)
3010 vty_out (vty
, "%-20s %-20d %-20d %s", "ebgp",
3011 rib_cnt
[ZEBRA_ROUTE_BGP
], fib_cnt
[ZEBRA_ROUTE_BGP
],
3013 vty_out (vty
, "%-20s %-20d %-20d %s", "ibgp",
3014 rib_cnt
[ZEBRA_ROUTE_IBGP
], fib_cnt
[ZEBRA_ROUTE_IBGP
],
3018 vty_out (vty
, "%-20s %-20d %-20d %s", zebra_route_string(i
),
3019 rib_cnt
[i
], fib_cnt
[i
], VTY_NEWLINE
);
3023 vty_out (vty
, "------%s", VTY_NEWLINE
);
3024 vty_out (vty
, "%-20s %-20d %-20d %s", "Totals", rib_cnt
[ZEBRA_ROUTE_TOTAL
],
3025 fib_cnt
[ZEBRA_ROUTE_TOTAL
], VTY_NEWLINE
);
3026 vty_out (vty
, "%s", VTY_NEWLINE
);
3030 * Implementation of the ip route summary prefix command.
3032 * This command prints the primary prefixes that have been installed by various
3033 * protocols on the box.
3037 vty_show_ip_route_summary_prefix (struct vty
*vty
, struct route_table
*table
)
3039 struct route_node
*rn
;
3041 struct nexthop
*nexthop
;
3042 #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
3043 #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
3044 u_int32_t rib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
3045 u_int32_t fib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
3049 memset (&rib_cnt
, 0, sizeof(rib_cnt
));
3050 memset (&fib_cnt
, 0, sizeof(fib_cnt
));
3051 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3052 RNODE_FOREACH_RIB (rn
, rib
)
3056 * In case of ECMP, count only once.
3059 for (nexthop
= rib
->nexthop
; (!cnt
&& nexthop
); nexthop
= nexthop
->next
)
3062 rib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
3063 rib_cnt
[rib
->type
]++;
3064 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
))
3066 fib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
3067 fib_cnt
[rib
->type
]++;
3069 if (rib
->type
== ZEBRA_ROUTE_BGP
&&
3070 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_IBGP
))
3072 rib_cnt
[ZEBRA_ROUTE_IBGP
]++;
3073 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
))
3074 fib_cnt
[ZEBRA_ROUTE_IBGP
]++;
3079 vty_out (vty
, "%-20s %-20s %s (vrf %s)%s",
3080 "Route Source", "Prefix Routes", "FIB",
3081 ((rib_table_info_t
*)table
->info
)->zvrf
->name
,
3084 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
3088 if (i
== ZEBRA_ROUTE_BGP
)
3090 vty_out (vty
, "%-20s %-20d %-20d %s", "ebgp",
3091 rib_cnt
[ZEBRA_ROUTE_BGP
] - rib_cnt
[ZEBRA_ROUTE_IBGP
],
3092 fib_cnt
[ZEBRA_ROUTE_BGP
] - fib_cnt
[ZEBRA_ROUTE_IBGP
],
3094 vty_out (vty
, "%-20s %-20d %-20d %s", "ibgp",
3095 rib_cnt
[ZEBRA_ROUTE_IBGP
], fib_cnt
[ZEBRA_ROUTE_IBGP
],
3099 vty_out (vty
, "%-20s %-20d %-20d %s", zebra_route_string(i
),
3100 rib_cnt
[i
], fib_cnt
[i
], VTY_NEWLINE
);
3104 vty_out (vty
, "------%s", VTY_NEWLINE
);
3105 vty_out (vty
, "%-20s %-20d %-20d %s", "Totals", rib_cnt
[ZEBRA_ROUTE_TOTAL
],
3106 fib_cnt
[ZEBRA_ROUTE_TOTAL
], VTY_NEWLINE
);
3107 vty_out (vty
, "%s", VTY_NEWLINE
);
3110 /* Show route summary. */
3111 DEFUN (show_ip_route_summary
,
3112 show_ip_route_summary_cmd
,
3113 "show ip route summary",
3116 "IP routing table\n"
3117 "Summary of all routes\n")
3119 struct route_table
*table
;
3120 vrf_id_t vrf_id
= VRF_DEFAULT
;
3123 VRF_GET_ID (vrf_id
, argv
[0]);
3125 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
3129 vty_show_ip_route_summary (vty
, table
);
3134 ALIAS (show_ip_route_summary
,
3135 show_ip_route_vrf_summary_cmd
,
3136 "show ip route " VRF_CMD_STR
" summary",
3139 "IP routing table\n"
3141 "Summary of all routes\n")
3143 /* Show route summary prefix. */
3144 DEFUN (show_ip_route_summary_prefix
,
3145 show_ip_route_summary_prefix_cmd
,
3146 "show ip route summary prefix",
3149 "IP routing table\n"
3150 "Summary of all routes\n"
3153 struct route_table
*table
;
3154 vrf_id_t vrf_id
= VRF_DEFAULT
;
3157 VRF_GET_ID (vrf_id
, argv
[0]);
3159 table
= zebra_vrf_table (AFI_IP
, SAFI_UNICAST
, vrf_id
);
3163 vty_show_ip_route_summary_prefix (vty
, table
);
3168 ALIAS (show_ip_route_summary_prefix
,
3169 show_ip_route_vrf_summary_prefix_cmd
,
3170 "show ip route " VRF_CMD_STR
" summary prefix",
3173 "IP routing table\n"
3175 "Summary of all routes\n"
3178 DEFUN (show_ip_route_vrf_all
,
3179 show_ip_route_vrf_all_cmd
,
3180 "show ip route " VRF_ALL_CMD_STR
,
3183 "IP routing table\n"
3184 VRF_ALL_CMD_HELP_STR
)
3186 struct route_table
*table
;
3187 struct route_node
*rn
;
3189 struct zebra_vrf
*zvrf
;
3194 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3196 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3197 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3200 /* Show all IPv4 routes. */
3201 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3202 RNODE_FOREACH_RIB (rn
, rib
)
3206 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
3212 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
3215 vty_show_ip_route (vty
, rn
, rib
, NULL
);
3223 DEFUN (show_ip_route_vrf_all_tag
,
3224 show_ip_route_vrf_all_tag_cmd
,
3225 "show ip route " VRF_ALL_CMD_STR
" tag <1-65535>",
3228 "IP routing table\n"
3229 VRF_ALL_CMD_HELP_STR
3230 "Show only routes with tag\n"
3233 struct route_table
*table
;
3234 struct route_node
*rn
;
3236 struct zebra_vrf
*zvrf
;
3243 tag
= atoi(argv
[0]);
3245 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3247 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3248 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3251 /* Show all IPv4 routes with matching tag value. */
3252 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3253 RNODE_FOREACH_RIB (rn
, rib
)
3255 if (rib
->tag
!= tag
)
3260 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
3266 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
3269 vty_show_ip_route (vty
, rn
, rib
, NULL
);
3276 DEFUN (show_ip_route_vrf_all_prefix_longer
,
3277 show_ip_route_vrf_all_prefix_longer_cmd
,
3278 "show ip route " VRF_ALL_CMD_STR
" A.B.C.D/M longer-prefixes",
3281 "IP routing table\n"
3282 VRF_ALL_CMD_HELP_STR
3283 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3284 "Show route matching the specified Network/Mask pair only\n")
3286 struct route_table
*table
;
3287 struct route_node
*rn
;
3290 struct zebra_vrf
*zvrf
;
3296 ret
= str2prefix (argv
[0], &p
);
3299 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
3303 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3305 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3306 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3309 /* Show matched type IPv4 routes. */
3310 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3311 RNODE_FOREACH_RIB (rn
, rib
)
3312 if (prefix_match (&p
, &rn
->p
))
3316 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
3322 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
3325 vty_show_ip_route (vty
, rn
, rib
, NULL
);
3333 DEFUN (show_ip_route_vrf_all_supernets
,
3334 show_ip_route_vrf_all_supernets_cmd
,
3335 "show ip route " VRF_ALL_CMD_STR
" supernets-only",
3338 "IP routing table\n"
3339 VRF_ALL_CMD_HELP_STR
3340 "Show supernet entries only\n")
3342 struct route_table
*table
;
3343 struct route_node
*rn
;
3345 struct zebra_vrf
*zvrf
;
3351 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3353 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3354 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3357 /* Show matched type IPv4 routes. */
3358 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3359 RNODE_FOREACH_RIB (rn
, rib
)
3361 addr
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
3363 if ((IN_CLASSC (addr
) && rn
->p
.prefixlen
< 24)
3364 || (IN_CLASSB (addr
) && rn
->p
.prefixlen
< 16)
3365 || (IN_CLASSA (addr
) && rn
->p
.prefixlen
< 8))
3369 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
3375 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
3378 vty_show_ip_route (vty
, rn
, rib
, NULL
);
3387 DEFUN (show_ip_route_vrf_all_protocol
,
3388 show_ip_route_vrf_all_protocol_cmd
,
3389 "show ip route " VRF_ALL_CMD_STR
" " QUAGGA_IP_REDIST_STR_ZEBRA
,
3392 "IP routing table\n"
3393 VRF_ALL_CMD_HELP_STR
3394 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
"\n")
3397 struct route_table
*table
;
3398 struct route_node
*rn
;
3400 struct zebra_vrf
*zvrf
;
3405 type
= proto_redistnum (AFI_IP
, argv
[0]);
3408 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
3412 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3414 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3415 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3418 /* Show matched type IPv4 routes. */
3419 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
3420 RNODE_FOREACH_RIB (rn
, rib
)
3421 if (rib
->type
== type
)
3425 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
3431 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
3434 vty_show_ip_route (vty
, rn
, rib
, NULL
);
3442 DEFUN (show_ip_route_vrf_all_addr
,
3443 show_ip_route_vrf_all_addr_cmd
,
3444 "show ip route " VRF_ALL_CMD_STR
" A.B.C.D",
3447 "IP routing table\n"
3448 VRF_ALL_CMD_HELP_STR
3449 "Network in the IP routing table to display\n")
3452 struct prefix_ipv4 p
;
3453 struct route_table
*table
;
3454 struct route_node
*rn
;
3455 struct zebra_vrf
*zvrf
;
3458 ret
= str2prefix_ipv4 (argv
[0], &p
);
3461 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
3465 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3467 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3468 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3471 rn
= route_node_match (table
, (struct prefix
*) &p
);
3475 vty_show_ip_route_detail (vty
, rn
, 0);
3477 route_unlock_node (rn
);
3483 DEFUN (show_ip_route_vrf_all_prefix
,
3484 show_ip_route_vrf_all_prefix_cmd
,
3485 "show ip route " VRF_ALL_CMD_STR
" A.B.C.D/M",
3488 "IP routing table\n"
3489 VRF_ALL_CMD_HELP_STR
3490 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3493 struct prefix_ipv4 p
;
3494 struct route_table
*table
;
3495 struct route_node
*rn
;
3496 struct zebra_vrf
*zvrf
;
3499 ret
= str2prefix_ipv4 (argv
[0], &p
);
3502 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
3506 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3508 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
3509 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
3512 rn
= route_node_match (table
, (struct prefix
*) &p
);
3515 if (rn
->p
.prefixlen
!= p
.prefixlen
)
3517 route_unlock_node (rn
);
3521 vty_show_ip_route_detail (vty
, rn
, 0);
3523 route_unlock_node (rn
);
3529 DEFUN (show_ip_route_vrf_all_summary
,
3530 show_ip_route_vrf_all_summary_cmd
,
3531 "show ip route " VRF_ALL_CMD_STR
" summary ",
3534 "IP routing table\n"
3535 VRF_ALL_CMD_HELP_STR
3536 "Summary of all routes\n")
3538 struct zebra_vrf
*zvrf
;
3541 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3542 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
3543 vty_show_ip_route_summary (vty
, zvrf
->table
[AFI_IP
][SAFI_UNICAST
]);
3548 DEFUN (show_ip_route_vrf_all_summary_prefix
,
3549 show_ip_route_vrf_all_summary_prefix_cmd
,
3550 "show ip route " VRF_ALL_CMD_STR
" summary prefix",
3553 "IP routing table\n"
3554 VRF_ALL_CMD_HELP_STR
3555 "Summary of all routes\n"
3558 struct zebra_vrf
*zvrf
;
3561 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
3562 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
3563 vty_show_ip_route_summary_prefix (vty
, zvrf
->table
[AFI_IP
][SAFI_UNICAST
]);
3568 /* Write IPv4 static route configuration. */
3570 static_config_ipv4 (struct vty
*vty
, safi_t safi
, const char *cmd
)
3572 struct route_node
*rn
;
3573 struct static_route
*si
;
3574 struct route_table
*stable
;
3575 struct zebra_vrf
*zvrf
;
3576 char buf
[PREFIX_STRLEN
];
3578 struct listnode
*node
;
3580 for (ALL_LIST_ELEMENTS_RO (zvrf_list
, node
, zvrf
))
3582 if ((stable
= zvrf
->stable
[AFI_IP
][safi
]) == NULL
)
3585 for (rn
= route_top (stable
); rn
; rn
= route_next (rn
))
3586 for (si
= rn
->info
; si
; si
= si
->next
)
3588 vty_out (vty
, "%s %s", cmd
, prefix2str (&rn
->p
, buf
, sizeof buf
));
3592 case STATIC_IPV4_GATEWAY
:
3593 vty_out (vty
, " %s", inet_ntoa (si
->addr
.ipv4
));
3595 case STATIC_IFINDEX
:
3596 vty_out (vty
, " %s", si
->ifname
);
3598 case STATIC_IPV4_BLACKHOLE
:
3599 vty_out (vty
, " Null0");
3603 /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
3604 if (si
->type
!= STATIC_IPV4_BLACKHOLE
)
3606 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_REJECT
))
3607 vty_out (vty
, " %s", "reject");
3609 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_BLACKHOLE
))
3610 vty_out (vty
, " %s", "blackhole");
3614 vty_out (vty
, " tag %d", si
->tag
);
3616 if (si
->distance
!= ZEBRA_STATIC_DISTANCE_DEFAULT
)
3617 vty_out (vty
, " %d", si
->distance
);
3619 if (si
->vrf_id
!= VRF_DEFAULT
)
3620 vty_out (vty
, " vrf %s", zvrf
? zvrf
->name
: "");
3622 vty_out (vty
, "%s", VTY_NEWLINE
);
3631 /* General fucntion for IPv6 static route. */
3633 static_ipv6_func (struct vty
*vty
, int add_cmd
, const char *dest_str
,
3634 const char *gate_str
, const char *ifname
,
3635 const char *flag_str
, const char *tag_str
,
3636 const char *distance_str
, const char *vrf_id_str
)
3641 struct in6_addr
*gate
= NULL
;
3642 struct in6_addr gate_addr
;
3646 unsigned int ifindex
= 0;
3647 struct interface
*ifp
= NULL
;
3648 struct zebra_vrf
*zvrf
;
3650 ret
= str2prefix (dest_str
, &p
);
3653 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
3657 /* Apply mask for given prefix. */
3662 switch(flag_str
[0]) {
3665 SET_FLAG (flag
, ZEBRA_FLAG_REJECT
);
3669 SET_FLAG (flag
, ZEBRA_FLAG_BLACKHOLE
);
3672 vty_out (vty
, "%% Malformed flag %s %s", flag_str
, VTY_NEWLINE
);
3677 /* Administrative distance. */
3679 distance
= atoi (distance_str
);
3681 distance
= ZEBRA_STATIC_DISTANCE_DEFAULT
;
3685 tag
= atoi(tag_str
);
3687 /* When gateway is valid IPv6 addrees, then gate is treated as
3688 nexthop address other case gate is treated as interface name. */
3689 ret
= inet_pton (AF_INET6
, gate_str
, &gate_addr
);
3692 zvrf
= zebra_vrf_list_lookup_by_name (vrf_id_str
);
3696 vty_out (vty
, "%% vrf %s is not defined%s", vrf_id_str
, VTY_NEWLINE
);
3702 /* When ifname is specified. It must be come with gateway
3706 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
3709 type
= STATIC_IPV6_GATEWAY_IFINDEX
;
3711 ifp
= if_lookup_by_name_vrf (ifname
, zvrf
->vrf_id
);
3714 vty_out (vty
, "%% Malformed Interface name %s%s", ifname
, VTY_NEWLINE
);
3717 ifindex
= ifp
->ifindex
;
3723 type
= STATIC_IPV6_GATEWAY
;
3728 type
= STATIC_IFINDEX
;
3729 ifp
= if_lookup_by_name_vrf (gate_str
, zvrf
->vrf_id
);
3732 vty_out (vty
, "%% Malformed Interface name %s%s", gate_str
, VTY_NEWLINE
);
3733 ifindex
= IFINDEX_DELETED
;
3736 ifindex
= ifp
->ifindex
;
3742 static_add_route (AFI_IP6
, SAFI_UNICAST
, type
, &p
, (union g_addr
*)gate
, ifindex
, ifname
, flag
, tag
, distance
, zvrf
);
3744 static_delete_route (AFI_IP6
, SAFI_UNICAST
, type
, &p
, (union g_addr
*)gate
, ifindex
, tag
, distance
, zvrf
);
3751 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3753 "Establish static routes\n"
3754 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3755 "IPv6 gateway address\n"
3756 "IPv6 gateway interface name\n")
3758 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, NULL
, NULL
, NULL
);
3761 DEFUN (ipv6_route_tag
,
3763 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3765 "Establish static routes\n"
3766 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3767 "IPv6 gateway address\n"
3768 "IPv6 gateway interface name\n"
3769 "Set tag for this route\n"
3772 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, argv
[2], NULL
, NULL
);
3775 DEFUN (ipv6_route_flags
,
3776 ipv6_route_flags_cmd
,
3777 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
3779 "Establish static routes\n"
3780 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3781 "IPv6 gateway address\n"
3782 "IPv6 gateway interface name\n"
3783 "Emit an ICMP unreachable when matched\n"
3784 "Silently discard pkts when matched\n")
3786 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, NULL
);
3789 DEFUN (ipv6_route_flags_tag
,
3790 ipv6_route_flags_tag_cmd
,
3791 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
3793 "Establish static routes\n"
3794 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3795 "IPv6 gateway address\n"
3796 "IPv6 gateway interface name\n"
3797 "Emit an ICMP unreachable when matched\n"
3798 "Silently discard pkts when matched\n"
3799 "Set tag for this route\n"
3802 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, NULL
);
3805 DEFUN (ipv6_route_ifname
,
3806 ipv6_route_ifname_cmd
,
3807 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
3809 "Establish static routes\n"
3810 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3811 "IPv6 gateway address\n"
3812 "IPv6 gateway interface name\n")
3814 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, NULL
);
3816 DEFUN (ipv6_route_ifname_tag
,
3817 ipv6_route_ifname_tag_cmd
,
3818 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
3820 "Establish static routes\n"
3821 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3822 "IPv6 gateway address\n"
3823 "IPv6 gateway interface name\n"
3824 "Set tag for this route\n"
3827 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, NULL
);
3830 DEFUN (ipv6_route_ifname_flags
,
3831 ipv6_route_ifname_flags_cmd
,
3832 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
3834 "Establish static routes\n"
3835 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3836 "IPv6 gateway address\n"
3837 "IPv6 gateway interface name\n"
3838 "Emit an ICMP unreachable when matched\n"
3839 "Silently discard pkts when matched\n")
3841 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, NULL
);
3844 DEFUN (ipv6_route_ifname_flags_tag
,
3845 ipv6_route_ifname_flags_tag_cmd
,
3846 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
3848 "Establish static routes\n"
3849 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3850 "IPv6 gateway address\n"
3851 "IPv6 gateway interface name\n"
3852 "Emit an ICMP unreachable when matched\n"
3853 "Silently discard pkts when matched\n"
3854 "Set tag for this route\n"
3857 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, NULL
);
3860 DEFUN (ipv6_route_pref
,
3861 ipv6_route_pref_cmd
,
3862 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
3864 "Establish static routes\n"
3865 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3866 "IPv6 gateway address\n"
3867 "IPv6 gateway interface name\n"
3868 "Distance value for this prefix\n")
3870 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, NULL
, argv
[2], NULL
);
3873 DEFUN (ipv6_route_pref_tag
,
3874 ipv6_route_pref_tag_cmd
,
3875 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
3877 "Establish static routes\n"
3878 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3879 "IPv6 gateway address\n"
3880 "IPv6 gateway interface name\n"
3881 "Set tag for this route\n"
3883 "Distance value for this prefix\n")
3885 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, argv
[2], argv
[3], NULL
);
3888 DEFUN (ipv6_route_flags_pref
,
3889 ipv6_route_flags_pref_cmd
,
3890 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
3892 "Establish static routes\n"
3893 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3894 "IPv6 gateway address\n"
3895 "IPv6 gateway interface name\n"
3896 "Emit an ICMP unreachable when matched\n"
3897 "Silently discard pkts when matched\n"
3898 "Distance value for this prefix\n")
3900 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], NULL
);
3903 DEFUN (ipv6_route_flags_pref_tag
,
3904 ipv6_route_flags_pref_tag_cmd
,
3905 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
3907 "Establish static routes\n"
3908 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3909 "IPv6 gateway address\n"
3910 "IPv6 gateway interface name\n"
3911 "Emit an ICMP unreachable when matched\n"
3912 "Silently discard pkts when matched\n"
3913 "Set tag for this route\n"
3915 "Distance value for this prefix\n")
3917 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], NULL
);
3920 DEFUN (ipv6_route_ifname_pref
,
3921 ipv6_route_ifname_pref_cmd
,
3922 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
3924 "Establish static routes\n"
3925 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3926 "IPv6 gateway address\n"
3927 "IPv6 gateway interface name\n"
3928 "Distance value for this prefix\n")
3930 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], NULL
);
3933 DEFUN (ipv6_route_ifname_pref_tag
,
3934 ipv6_route_ifname_pref_tag_cmd
,
3935 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
3937 "Establish static routes\n"
3938 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3939 "IPv6 gateway address\n"
3940 "IPv6 gateway interface name\n"
3941 "Set tag for this route\n"
3943 "Distance value for this prefix\n")
3945 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], NULL
);
3948 DEFUN (ipv6_route_ifname_flags_pref
,
3949 ipv6_route_ifname_flags_pref_cmd
,
3950 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
3952 "Establish static routes\n"
3953 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3954 "IPv6 gateway address\n"
3955 "IPv6 gateway interface name\n"
3956 "Emit an ICMP unreachable when matched\n"
3957 "Silently discard pkts when matched\n"
3958 "Distance value for this prefix\n")
3960 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], NULL
);
3963 DEFUN (ipv6_route_ifname_flags_pref_tag
,
3964 ipv6_route_ifname_flags_pref_tag_cmd
,
3965 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
3967 "Establish static routes\n"
3968 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3969 "IPv6 gateway address\n"
3970 "IPv6 gateway interface name\n"
3971 "Emit an ICMP unreachable when matched\n"
3972 "Silently discard pkts when matched\n"
3973 "Set tag for this route\n"
3975 "Distance value for this prefix\n")
3977 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], NULL
);
3980 DEFUN (no_ipv6_route
,
3982 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3985 "Establish static routes\n"
3986 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3987 "IPv6 gateway address\n"
3988 "IPv6 gateway interface name\n")
3990 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
, NULL
, NULL
);
3993 DEFUN (no_ipv6_route_tag
,
3994 no_ipv6_route_tag_cmd
,
3995 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3998 "Establish static routes\n"
3999 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4000 "IPv6 gateway address\n"
4001 "IPv6 gateway interface name\n"
4002 "Set tag for this route\n"
4005 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2], NULL
, NULL
);
4008 DEFUN (no_ipv6_route_flags
,
4009 no_ipv6_route_flags_cmd
,
4010 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
4013 "Establish static routes\n"
4014 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4015 "IPv6 gateway address\n"
4016 "IPv6 gateway interface name\n"
4017 "Emit an ICMP unreachable when matched\n"
4018 "Silently discard pkts when matched\n")
4020 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, NULL
);
4023 DEFUN (no_ipv6_route_flags_tag
,
4024 no_ipv6_route_flags_tag_cmd
,
4025 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
4028 "Establish static routes\n"
4029 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4030 "IPv6 gateway address\n"
4031 "IPv6 gateway interface name\n"
4032 "Emit an ICMP unreachable when matched\n"
4033 "Silently discard pkts when matched\n"
4034 "Set tag for this route\n"
4037 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, NULL
);
4040 DEFUN (no_ipv6_route_ifname
,
4041 no_ipv6_route_ifname_cmd
,
4042 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
4045 "Establish static routes\n"
4046 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4047 "IPv6 gateway address\n"
4048 "IPv6 gateway interface name\n")
4050 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, NULL
);
4053 DEFUN (no_ipv6_route_ifname_tag
,
4054 no_ipv6_route_ifname_tag_cmd
,
4055 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
4058 "Establish static routes\n"
4059 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4060 "IPv6 gateway address\n"
4061 "IPv6 gateway interface name\n"
4062 "Set tag for this route\n"
4065 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, NULL
);
4068 DEFUN (no_ipv6_route_ifname_flags
,
4069 no_ipv6_route_ifname_flags_cmd
,
4070 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
4073 "Establish static routes\n"
4074 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4075 "IPv6 gateway address\n"
4076 "IPv6 gateway interface name\n"
4077 "Emit an ICMP unreachable when matched\n"
4078 "Silently discard pkts when matched\n")
4080 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, NULL
);
4083 DEFUN (no_ipv6_route_ifname_flags_tag
,
4084 no_ipv6_route_ifname_flags_tag_cmd
,
4085 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
4088 "Establish static routes\n"
4089 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4090 "IPv6 gateway address\n"
4091 "IPv6 gateway interface name\n"
4092 "Emit an ICMP unreachable when matched\n"
4093 "Silently discard pkts when matched\n"
4094 "Set tag for this route\n"
4097 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, NULL
);
4100 DEFUN (no_ipv6_route_pref
,
4101 no_ipv6_route_pref_cmd
,
4102 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
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 "Distance value for this prefix\n")
4111 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
, argv
[2], NULL
);
4114 DEFUN (no_ipv6_route_pref_tag
,
4115 no_ipv6_route_pref_tag_cmd
,
4116 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
4119 "Establish static routes\n"
4120 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4121 "IPv6 gateway address\n"
4122 "IPv6 gateway interface name\n"
4123 "Set tag for this route\n"
4125 "Distance value for this prefix\n")
4127 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2], argv
[3], NULL
);
4130 DEFUN (no_ipv6_route_flags_pref
,
4131 no_ipv6_route_flags_pref_cmd
,
4132 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
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 "Distance value for this prefix\n")
4143 /* We do not care about argv[2] */
4144 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], NULL
);
4147 DEFUN (no_ipv6_route_flags_pref_tag
,
4148 no_ipv6_route_flags_pref_tag_cmd
,
4149 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
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 "Emit an ICMP unreachable when matched\n"
4157 "Silently discard pkts when matched\n"
4158 "Set tag for this route\n"
4160 "Distance value for this prefix\n")
4162 /* We do not care about argv[2] */
4163 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], NULL
);
4166 DEFUN (no_ipv6_route_ifname_pref
,
4167 no_ipv6_route_ifname_pref_cmd
,
4168 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
4171 "Establish static routes\n"
4172 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4173 "IPv6 gateway address\n"
4174 "IPv6 gateway interface name\n"
4175 "Distance value for this prefix\n")
4177 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], NULL
);
4180 DEFUN (no_ipv6_route_ifname_pref_tag
,
4181 no_ipv6_route_ifname_pref_tag_cmd
,
4182 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
4185 "Establish static routes\n"
4186 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4187 "IPv6 gateway address\n"
4188 "IPv6 gateway interface name\n"
4189 "Set tag for this route\n"
4191 "Distance value for this prefix\n")
4193 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], NULL
);
4196 DEFUN (no_ipv6_route_ifname_flags_pref
,
4197 no_ipv6_route_ifname_flags_pref_cmd
,
4198 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
4201 "Establish static routes\n"
4202 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4203 "IPv6 gateway address\n"
4204 "IPv6 gateway interface name\n"
4205 "Emit an ICMP unreachable when matched\n"
4206 "Silently discard pkts when matched\n"
4207 "Distance value for this prefix\n")
4209 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], NULL
);
4212 DEFUN (no_ipv6_route_ifname_flags_pref_tag
,
4213 no_ipv6_route_ifname_flags_pref_tag_cmd
,
4214 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
4217 "Establish static routes\n"
4218 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4219 "IPv6 gateway address\n"
4220 "IPv6 gateway interface name\n"
4221 "Emit an ICMP unreachable when matched\n"
4222 "Silently discard pkts when matched\n"
4223 "Set tag for this route\n"
4225 "Distance value for this prefix\n")
4227 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], NULL
);
4230 DEFUN (ipv6_route_vrf
,
4232 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR
,
4234 "Establish static routes\n"
4235 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4236 "IPv6 gateway address\n"
4237 "IPv6 gateway interface name\n"
4240 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, NULL
, NULL
, argv
[2]);
4243 DEFUN (ipv6_route_tag_vrf
,
4244 ipv6_route_tag_vrf_cmd
,
4245 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> " VRF_CMD_STR
,
4247 "Establish static routes\n"
4248 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4249 "IPv6 gateway address\n"
4250 "IPv6 gateway interface name\n"
4251 "Set tag for this route\n"
4255 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, argv
[2], NULL
, argv
[3]);
4258 DEFUN (ipv6_route_flags_vrf
,
4259 ipv6_route_flags_vrf_cmd
,
4260 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_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"
4270 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, argv
[3]);
4273 DEFUN (ipv6_route_flags_tag_vrf
,
4274 ipv6_route_flags_tag_vrf_cmd
,
4275 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
4277 "Establish static routes\n"
4278 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4279 "IPv6 gateway address\n"
4280 "IPv6 gateway interface name\n"
4281 "Emit an ICMP unreachable when matched\n"
4282 "Silently discard pkts when matched\n"
4283 "Set tag for this route\n"
4287 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, argv
[4]);
4290 DEFUN (ipv6_route_ifname_vrf
,
4291 ipv6_route_ifname_vrf_cmd
,
4292 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR
,
4294 "Establish static routes\n"
4295 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4296 "IPv6 gateway address\n"
4297 "IPv6 gateway interface name\n"
4300 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, argv
[3]);
4302 DEFUN (ipv6_route_ifname_tag_vrf
,
4303 ipv6_route_ifname_tag_vrf_cmd
,
4304 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> " VRF_CMD_STR
,
4306 "Establish static routes\n"
4307 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4308 "IPv6 gateway address\n"
4309 "IPv6 gateway interface name\n"
4310 "Set tag for this route\n"
4314 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, argv
[4]);
4317 DEFUN (ipv6_route_ifname_flags_vrf
,
4318 ipv6_route_ifname_flags_vrf_cmd
,
4319 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR
,
4321 "Establish static routes\n"
4322 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4323 "IPv6 gateway address\n"
4324 "IPv6 gateway interface name\n"
4325 "Emit an ICMP unreachable when matched\n"
4326 "Silently discard pkts when matched\n"
4329 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, argv
[4]);
4332 DEFUN (ipv6_route_ifname_flags_tag_vrf
,
4333 ipv6_route_ifname_flags_tag_vrf_cmd
,
4334 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
4336 "Establish static routes\n"
4337 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4338 "IPv6 gateway address\n"
4339 "IPv6 gateway interface name\n"
4340 "Emit an ICMP unreachable when matched\n"
4341 "Silently discard pkts when matched\n"
4342 "Set tag for this route\n"
4346 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, argv
[5]);
4349 DEFUN (ipv6_route_pref_vrf
,
4350 ipv6_route_pref_vrf_cmd
,
4351 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR
,
4353 "Establish static routes\n"
4354 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4355 "IPv6 gateway address\n"
4356 "IPv6 gateway interface name\n"
4357 "Distance value for this prefix\n"
4360 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, NULL
, argv
[2], argv
[3]);
4363 DEFUN (ipv6_route_pref_tag_vrf
,
4364 ipv6_route_pref_tag_vrf_cmd
,
4365 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> " VRF_CMD_STR
,
4367 "Establish static routes\n"
4368 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4369 "IPv6 gateway address\n"
4370 "IPv6 gateway interface name\n"
4371 "Set tag for this route\n"
4373 "Distance value for this prefix\n"
4376 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, argv
[2], argv
[3], argv
[4]);
4379 DEFUN (ipv6_route_flags_pref_vrf
,
4380 ipv6_route_flags_pref_vrf_cmd
,
4381 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
4383 "Establish static routes\n"
4384 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4385 "IPv6 gateway address\n"
4386 "IPv6 gateway interface name\n"
4387 "Emit an ICMP unreachable when matched\n"
4388 "Silently discard pkts when matched\n"
4389 "Distance value for this prefix\n"
4392 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], argv
[4]);
4395 DEFUN (ipv6_route_flags_pref_tag_vrf
,
4396 ipv6_route_flags_pref_tag_vrf_cmd
,
4397 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
4399 "Establish static routes\n"
4400 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4401 "IPv6 gateway address\n"
4402 "IPv6 gateway interface name\n"
4403 "Emit an ICMP unreachable when matched\n"
4404 "Silently discard pkts when matched\n"
4405 "Set tag for this route\n"
4407 "Distance value for this prefix\n"
4410 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], argv
[5]);
4413 DEFUN (ipv6_route_ifname_pref_vrf
,
4414 ipv6_route_ifname_pref_vrf_cmd
,
4415 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR
,
4417 "Establish static routes\n"
4418 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4419 "IPv6 gateway address\n"
4420 "IPv6 gateway interface name\n"
4421 "Distance value for this prefix\n"
4424 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], argv
[4]);
4427 DEFUN (ipv6_route_ifname_pref_tag_vrf
,
4428 ipv6_route_ifname_pref_tag_vrf_cmd
,
4429 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> " VRF_CMD_STR
,
4431 "Establish static routes\n"
4432 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4433 "IPv6 gateway address\n"
4434 "IPv6 gateway interface name\n"
4435 "Set tag for this route\n"
4437 "Distance value for this prefix\n"
4440 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], argv
[5]);
4443 DEFUN (ipv6_route_ifname_flags_pref_vrf
,
4444 ipv6_route_ifname_flags_pref_vrf_cmd
,
4445 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR
,
4447 "Establish static routes\n"
4448 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4449 "IPv6 gateway address\n"
4450 "IPv6 gateway interface name\n"
4451 "Emit an ICMP unreachable when matched\n"
4452 "Silently discard pkts when matched\n"
4453 "Distance value for this prefix\n"
4456 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], argv
[5]);
4459 DEFUN (ipv6_route_ifname_flags_pref_tag_vrf
,
4460 ipv6_route_ifname_flags_pref_tag_vrf_cmd
,
4461 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
4463 "Establish static routes\n"
4464 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4465 "IPv6 gateway address\n"
4466 "IPv6 gateway interface name\n"
4467 "Emit an ICMP unreachable when matched\n"
4468 "Silently discard pkts when matched\n"
4469 "Set tag for this route\n"
4471 "Distance value for this prefix\n"
4474 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], argv
[6]);
4477 DEFUN (no_ipv6_route_vrf
,
4478 no_ipv6_route_vrf_cmd
,
4479 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR
,
4482 "Establish static routes\n"
4483 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4484 "IPv6 gateway address\n"
4485 "IPv6 gateway interface name\n"
4488 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
, NULL
, argv
[2]);
4491 DEFUN (no_ipv6_route_tag_vrf
,
4492 no_ipv6_route_tag_vrf_cmd
,
4493 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> " VRF_CMD_STR
,
4496 "Establish static routes\n"
4497 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4498 "IPv6 gateway address\n"
4499 "IPv6 gateway interface name\n"
4500 "Set tag for this route\n"
4504 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2], NULL
, argv
[3]);
4507 DEFUN (no_ipv6_route_flags_vrf
,
4508 no_ipv6_route_flags_vrf_cmd
,
4509 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR
,
4512 "Establish static routes\n"
4513 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4514 "IPv6 gateway address\n"
4515 "IPv6 gateway interface name\n"
4516 "Emit an ICMP unreachable when matched\n"
4517 "Silently discard pkts when matched\n"
4520 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, NULL
, argv
[3]);
4523 DEFUN (no_ipv6_route_flags_tag_vrf
,
4524 no_ipv6_route_flags_tag_vrf_cmd
,
4525 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_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"
4538 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], NULL
, argv
[4]);
4541 DEFUN (no_ipv6_route_ifname_vrf
,
4542 no_ipv6_route_ifname_vrf_cmd
,
4543 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR
,
4546 "Establish static routes\n"
4547 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4548 "IPv6 gateway address\n"
4549 "IPv6 gateway interface name\n"
4552 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, NULL
, argv
[3]);
4555 DEFUN (no_ipv6_route_ifname_tag_vrf
,
4556 no_ipv6_route_ifname_tag_vrf_cmd
,
4557 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> " VRF_CMD_STR
,
4560 "Establish static routes\n"
4561 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4562 "IPv6 gateway address\n"
4563 "IPv6 gateway interface name\n"
4564 "Set tag for this route\n"
4568 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], NULL
, argv
[4]);
4571 DEFUN (no_ipv6_route_ifname_flags_vrf
,
4572 no_ipv6_route_ifname_flags_vrf_cmd
,
4573 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR
,
4576 "Establish static routes\n"
4577 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4578 "IPv6 gateway address\n"
4579 "IPv6 gateway interface name\n"
4580 "Emit an ICMP unreachable when matched\n"
4581 "Silently discard pkts when matched\n"
4584 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, NULL
, argv
[4]);
4587 DEFUN (no_ipv6_route_ifname_flags_tag_vrf
,
4588 no_ipv6_route_ifname_flags_tag_vrf_cmd
,
4589 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> " VRF_CMD_STR
,
4592 "Establish static routes\n"
4593 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4594 "IPv6 gateway address\n"
4595 "IPv6 gateway interface name\n"
4596 "Emit an ICMP unreachable when matched\n"
4597 "Silently discard pkts when matched\n"
4598 "Set tag for this route\n"
4602 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], NULL
, argv
[5]);
4605 DEFUN (no_ipv6_route_pref_vrf
,
4606 no_ipv6_route_pref_vrf_cmd
,
4607 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR
,
4610 "Establish static routes\n"
4611 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4612 "IPv6 gateway address\n"
4613 "IPv6 gateway interface name\n"
4614 "Distance value for this prefix\n"
4617 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
, argv
[2], argv
[3]);
4620 DEFUN (no_ipv6_route_pref_tag_vrf
,
4621 no_ipv6_route_pref_tag_vrf_cmd
,
4622 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> " VRF_CMD_STR
,
4625 "Establish static routes\n"
4626 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4627 "IPv6 gateway address\n"
4628 "IPv6 gateway interface name\n"
4629 "Set tag for this route\n"
4631 "Distance value for this prefix\n"
4634 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2], argv
[3], argv
[4]);
4637 DEFUN (no_ipv6_route_flags_pref_vrf
,
4638 no_ipv6_route_flags_pref_vrf_cmd
,
4639 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR
,
4642 "Establish static routes\n"
4643 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4644 "IPv6 gateway address\n"
4645 "IPv6 gateway interface name\n"
4646 "Emit an ICMP unreachable when matched\n"
4647 "Silently discard pkts when matched\n"
4648 "Distance value for this prefix\n"
4651 /* We do not care about argv[2] */
4652 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], NULL
, argv
[3], argv
[4]);
4655 DEFUN (no_ipv6_route_flags_pref_tag_vrf
,
4656 no_ipv6_route_flags_pref_tag_vrf_cmd
,
4657 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
4660 "Establish static routes\n"
4661 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4662 "IPv6 gateway address\n"
4663 "IPv6 gateway interface name\n"
4664 "Emit an ICMP unreachable when matched\n"
4665 "Silently discard pkts when matched\n"
4666 "Set tag for this route\n"
4668 "Distance value for this prefix\n"
4671 /* We do not care about argv[2] */
4672 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3], argv
[4], argv
[5]);
4675 DEFUN (no_ipv6_route_ifname_pref_vrf
,
4676 no_ipv6_route_ifname_pref_vrf_cmd
,
4677 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR
,
4680 "Establish static routes\n"
4681 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4682 "IPv6 gateway address\n"
4683 "IPv6 gateway interface name\n"
4684 "Distance value for this prefix\n"
4687 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
, argv
[3], argv
[4]);
4690 DEFUN (no_ipv6_route_ifname_pref_tag_vrf
,
4691 no_ipv6_route_ifname_pref_tag_vrf_cmd
,
4692 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> " VRF_CMD_STR
,
4695 "Establish static routes\n"
4696 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4697 "IPv6 gateway address\n"
4698 "IPv6 gateway interface name\n"
4699 "Set tag for this route\n"
4701 "Distance value for this prefix\n"
4704 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3], argv
[4], argv
[5]);
4707 DEFUN (no_ipv6_route_ifname_flags_pref_vrf
,
4708 no_ipv6_route_ifname_flags_pref_vrf_cmd
,
4709 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR
,
4712 "Establish static routes\n"
4713 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4714 "IPv6 gateway address\n"
4715 "IPv6 gateway interface name\n"
4716 "Emit an ICMP unreachable when matched\n"
4717 "Silently discard pkts when matched\n"
4718 "Distance value for this prefix\n"
4721 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], NULL
, argv
[4], argv
[5]);
4724 DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf
,
4725 no_ipv6_route_ifname_flags_pref_tag_vrf_cmd
,
4726 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR
,
4729 "Establish static routes\n"
4730 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4731 "IPv6 gateway address\n"
4732 "IPv6 gateway interface name\n"
4733 "Emit an ICMP unreachable when matched\n"
4734 "Silently discard pkts when matched\n"
4735 "Set tag for this route\n"
4737 "Distance value for this prefix\n"
4740 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4], argv
[5], argv
[6]);
4743 DEFUN (show_ipv6_route
,
4744 show_ipv6_route_cmd
,
4745 "show ipv6 route {json}",
4748 "IPv6 routing table\n")
4750 struct route_table
*table
;
4751 struct route_node
*rn
;
4754 vrf_id_t vrf_id
= VRF_DEFAULT
;
4755 struct zebra_vrf
*zvrf
= NULL
;
4757 json_object
*json
= NULL
;
4758 json_object
*json_prefix
= NULL
;
4759 u_char uj
= use_json(argc
, argv
);
4761 if (argc
> 0 && argv
[0] && strcmp(argv
[0], "json") != 0)
4763 if (!(zvrf
= zebra_vrf_list_lookup_by_name (argv
[0])))
4766 vty_out (vty
, "{}%s", VTY_NEWLINE
);
4768 vty_out (vty
, "vrf %s not defined%s", argv
[0], VTY_NEWLINE
);
4772 if (zvrf
->vrf_id
== VRF_UNKNOWN
)
4775 vty_out (vty
, "{}%s", VTY_NEWLINE
);
4777 vty_out (vty
, "vrf %s inactive%s", argv
[0], VTY_NEWLINE
);
4781 vrf_id
= zvrf
->vrf_id
;
4784 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
4788 vty_out (vty
, "{}%s", VTY_NEWLINE
);
4794 json
= json_object_new_object();
4796 /* Show all IPv6 route. */
4797 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
4799 RNODE_FOREACH_RIB (rn
, rib
)
4802 json_prefix
= json_object_new_array();
4803 vty_show_ip_route (vty
, rn
, rib
, json_prefix
);
4808 prefix2str (&rn
->p
, buf
, sizeof buf
);
4809 json_object_object_add(json
, buf
, json_prefix
);
4814 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4815 json_object_free(json
);
4819 /* Show all IPv6 route. */
4820 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
4822 RNODE_FOREACH_RIB (rn
, rib
)
4826 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
4829 vty_show_ip_route (vty
, rn
, rib
, NULL
);
4837 ALIAS (show_ipv6_route
,
4838 show_ipv6_route_vrf_cmd
,
4839 "show ipv6 route " VRF_CMD_STR
" {json}",
4842 "IPv6 routing table\n"
4845 DEFUN (show_ipv6_route_tag
,
4846 show_ipv6_route_tag_cmd
,
4847 "show ipv6 route tag <1-65535>",
4850 "IPv6 routing table\n"
4851 "Show only routes with tag\n"
4854 struct route_table
*table
;
4855 struct route_node
*rn
;
4859 vrf_id_t vrf_id
= VRF_DEFAULT
;
4863 VRF_GET_ID (vrf_id
, argv
[0]);
4864 tag
= atoi(argv
[1]);
4867 tag
= atoi(argv
[0]);
4869 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
4873 /* Show all IPv6 routes with matching tag value. */
4874 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
4875 RNODE_FOREACH_RIB (rn
, rib
)
4877 if (rib
->tag
!= tag
)
4882 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
4885 vty_show_ip_route (vty
, rn
, rib
, NULL
);
4890 ALIAS (show_ipv6_route_tag
,
4891 show_ipv6_route_vrf_tag_cmd
,
4892 "show ipv6 route " VRF_CMD_STR
" tag <1-65535>",
4895 "IPv6 routing table\n"
4897 "Show only routes with tag\n"
4900 DEFUN (show_ipv6_route_prefix_longer
,
4901 show_ipv6_route_prefix_longer_cmd
,
4902 "show ipv6 route X:X::X:X/M longer-prefixes",
4905 "IPv6 routing table\n"
4907 "Show route matching the specified Network/Mask pair only\n")
4909 struct route_table
*table
;
4910 struct route_node
*rn
;
4915 vrf_id_t vrf_id
= VRF_DEFAULT
;
4919 VRF_GET_ID (vrf_id
, argv
[0]);
4920 ret
= str2prefix (argv
[1], &p
);
4923 ret
= str2prefix (argv
[0], &p
);
4927 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
4931 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
4935 /* Show matched type IPv6 routes. */
4936 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
4937 RNODE_FOREACH_RIB (rn
, rib
)
4938 if (prefix_match (&p
, &rn
->p
))
4942 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
4945 vty_show_ip_route (vty
, rn
, rib
, NULL
);
4950 ALIAS (show_ipv6_route_prefix_longer
,
4951 show_ipv6_route_vrf_prefix_longer_cmd
,
4952 "show ipv6 route " VRF_CMD_STR
" X:X::X:X/M longer-prefixes",
4955 "IPv6 routing table\n"
4958 "Show route matching the specified Network/Mask pair only\n")
4960 DEFUN (show_ipv6_route_protocol
,
4961 show_ipv6_route_protocol_cmd
,
4962 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA
,
4965 "IP routing table\n"
4966 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
)
4969 struct route_table
*table
;
4970 struct route_node
*rn
;
4973 vrf_id_t vrf_id
= VRF_DEFAULT
;
4977 VRF_GET_ID (vrf_id
, argv
[0]);
4978 type
= proto_redistnum (AFI_IP6
, argv
[1]);
4981 type
= proto_redistnum (AFI_IP6
, argv
[0]);
4985 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
4989 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
4993 /* Show matched type IPv6 routes. */
4994 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
4995 RNODE_FOREACH_RIB (rn
, rib
)
4996 if (rib
->type
== type
)
5000 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5003 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5008 ALIAS (show_ipv6_route_protocol
,
5009 show_ipv6_route_vrf_protocol_cmd
,
5010 "show ipv6 route " VRF_CMD_STR
" " QUAGGA_IP6_REDIST_STR_ZEBRA
,
5013 "IP routing table\n"
5015 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
)
5017 DEFUN (show_ipv6_route_addr
,
5018 show_ipv6_route_addr_cmd
,
5019 "show ipv6 route X:X::X:X",
5022 "IPv6 routing table\n"
5026 struct prefix_ipv6 p
;
5027 struct route_table
*table
;
5028 struct route_node
*rn
;
5029 vrf_id_t vrf_id
= VRF_DEFAULT
;
5033 VRF_GET_ID (vrf_id
, argv
[0]);
5034 ret
= str2prefix_ipv6 (argv
[1], &p
);
5037 ret
= str2prefix_ipv6 (argv
[0], &p
);
5041 vty_out (vty
, "Malformed IPv6 address%s", VTY_NEWLINE
);
5045 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
5049 rn
= route_node_match (table
, (struct prefix
*) &p
);
5052 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5056 vty_show_ip_route_detail (vty
, rn
, 0);
5058 route_unlock_node (rn
);
5063 ALIAS (show_ipv6_route_addr
,
5064 show_ipv6_route_vrf_addr_cmd
,
5065 "show ipv6 route " VRF_CMD_STR
" X:X::X:X",
5068 "IPv6 routing table\n"
5072 DEFUN (show_ipv6_route_prefix
,
5073 show_ipv6_route_prefix_cmd
,
5074 "show ipv6 route X:X::X:X/M",
5077 "IPv6 routing table\n"
5081 struct prefix_ipv6 p
;
5082 struct route_table
*table
;
5083 struct route_node
*rn
;
5084 vrf_id_t vrf_id
= VRF_DEFAULT
;
5088 VRF_GET_ID (vrf_id
, argv
[0]);
5089 ret
= str2prefix_ipv6 (argv
[1], &p
);
5092 ret
= str2prefix_ipv6 (argv
[0], &p
);
5096 vty_out (vty
, "Malformed IPv6 prefix%s", VTY_NEWLINE
);
5100 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
5104 rn
= route_node_match (table
, (struct prefix
*) &p
);
5105 if (! rn
|| rn
->p
.prefixlen
!= p
.prefixlen
)
5107 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5111 vty_show_ip_route_detail (vty
, rn
, 0);
5113 route_unlock_node (rn
);
5118 ALIAS (show_ipv6_route_prefix
,
5119 show_ipv6_route_vrf_prefix_cmd
,
5120 "show ipv6 route " VRF_CMD_STR
" X:X::X:X/M ",
5123 "IPv6 routing table\n"
5127 /* Show route summary. */
5128 DEFUN (show_ipv6_route_summary
,
5129 show_ipv6_route_summary_cmd
,
5130 "show ipv6 route summary",
5133 "IPv6 routing table\n"
5134 "Summary of all IPv6 routes\n")
5136 struct route_table
*table
;
5137 vrf_id_t vrf_id
= VRF_DEFAULT
;
5140 VRF_GET_ID (vrf_id
, argv
[0]);
5142 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
5146 vty_show_ip_route_summary (vty
, table
);
5151 ALIAS (show_ipv6_route_summary
,
5152 show_ipv6_route_vrf_summary_cmd
,
5153 "show ipv6 route " VRF_CMD_STR
" summary",
5156 "IPv6 routing table\n"
5158 "Summary of all IPv6 routes\n")
5160 /* Show ipv6 route summary prefix. */
5161 DEFUN (show_ipv6_route_summary_prefix
,
5162 show_ipv6_route_summary_prefix_cmd
,
5163 "show ipv6 route summary prefix",
5166 "IPv6 routing table\n"
5167 "Summary of all IPv6 routes\n"
5170 struct route_table
*table
;
5171 vrf_id_t vrf_id
= VRF_DEFAULT
;
5174 VRF_GET_ID (vrf_id
, argv
[0]);
5176 table
= zebra_vrf_table (AFI_IP6
, SAFI_UNICAST
, vrf_id
);
5180 vty_show_ip_route_summary_prefix (vty
, table
);
5185 ALIAS (show_ipv6_route_summary_prefix
,
5186 show_ipv6_route_vrf_summary_prefix_cmd
,
5187 "show ipv6 route " VRF_CMD_STR
" summary prefix",
5190 "IPv6 routing table\n"
5192 "Summary of all IPv6 routes\n"
5196 * Show IPv6 mroute command.Used to dump
5197 * the Multicast routing table.
5200 DEFUN (show_ipv6_mroute
,
5201 show_ipv6_mroute_cmd
,
5205 "IPv6 Multicast routing table\n")
5207 struct route_table
*table
;
5208 struct route_node
*rn
;
5211 vrf_id_t vrf_id
= VRF_DEFAULT
;
5214 VRF_GET_ID (vrf_id
, argv
[0]);
5216 table
= zebra_vrf_table (AFI_IP6
, SAFI_MULTICAST
, vrf_id
);
5220 /* Show all IPv6 route. */
5221 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5222 RNODE_FOREACH_RIB (rn
, rib
)
5226 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5229 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5234 ALIAS (show_ipv6_mroute
,
5235 show_ipv6_mroute_vrf_cmd
,
5236 "show ipv6 mroute " VRF_CMD_STR
,
5239 "IPv6 Multicast routing table\n"
5242 DEFUN (show_ipv6_route_vrf_all
,
5243 show_ipv6_route_vrf_all_cmd
,
5244 "show ipv6 route " VRF_ALL_CMD_STR
,
5247 "IPv6 routing table\n"
5248 VRF_ALL_CMD_HELP_STR
)
5250 struct route_table
*table
;
5251 struct route_node
*rn
;
5253 struct zebra_vrf
*zvrf
;
5258 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5260 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5261 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5264 /* Show all IPv6 route. */
5265 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5266 RNODE_FOREACH_RIB (rn
, rib
)
5270 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5276 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
5279 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5287 DEFUN (show_ipv6_route_vrf_all_tag
,
5288 show_ipv6_route_vrf_all_tag_cmd
,
5289 "show ipv6 route " VRF_ALL_CMD_STR
" tag <1-65535>",
5292 "IPv6 routing table\n"
5293 VRF_ALL_CMD_HELP_STR
5294 "Show only routes with tag\n"
5297 struct route_table
*table
;
5298 struct route_node
*rn
;
5300 struct zebra_vrf
*zvrf
;
5307 tag
= atoi(argv
[0]);
5309 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5311 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5312 (table
= zvrf
->table
[AFI_IP
][SAFI_UNICAST
]) == NULL
)
5315 /* Show all IPv6 routes with matching tag value. */
5316 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5317 RNODE_FOREACH_RIB (rn
, rib
)
5319 if (rib
->tag
!= tag
)
5324 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5330 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
5333 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5341 DEFUN (show_ipv6_route_vrf_all_prefix_longer
,
5342 show_ipv6_route_vrf_all_prefix_longer_cmd
,
5343 "show ipv6 route " VRF_ALL_CMD_STR
" X:X::X:X/M longer-prefixes",
5346 "IPv6 routing table\n"
5347 VRF_ALL_CMD_HELP_STR
5349 "Show route matching the specified Network/Mask pair only\n")
5351 struct route_table
*table
;
5352 struct route_node
*rn
;
5355 struct zebra_vrf
*zvrf
;
5361 ret
= str2prefix (argv
[0], &p
);
5364 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
5368 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5370 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5371 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5374 /* Show matched type IPv6 routes. */
5375 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5376 RNODE_FOREACH_RIB (rn
, rib
)
5377 if (prefix_match (&p
, &rn
->p
))
5381 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5387 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
5390 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5398 DEFUN (show_ipv6_route_vrf_all_protocol
,
5399 show_ipv6_route_vrf_all_protocol_cmd
,
5400 "show ipv6 route " VRF_ALL_CMD_STR
" " QUAGGA_IP6_REDIST_STR_ZEBRA
,
5403 "IP routing table\n"
5404 VRF_ALL_CMD_HELP_STR
5405 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
)
5408 struct route_table
*table
;
5409 struct route_node
*rn
;
5411 struct zebra_vrf
*zvrf
;
5416 type
= proto_redistnum (AFI_IP6
, argv
[0]);
5419 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
5423 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5425 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5426 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5429 /* Show matched type IPv6 routes. */
5430 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5431 RNODE_FOREACH_RIB (rn
, rib
)
5432 if (rib
->type
== type
)
5436 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5442 vty_out (vty
, "%sVRF %s:%s", VTY_NEWLINE
, zvrf
->name
, VTY_NEWLINE
);
5445 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5453 DEFUN (show_ipv6_route_vrf_all_addr
,
5454 show_ipv6_route_vrf_all_addr_cmd
,
5455 "show ipv6 route " VRF_ALL_CMD_STR
" X:X::X:X",
5458 "IPv6 routing table\n"
5459 VRF_ALL_CMD_HELP_STR
5463 struct prefix_ipv6 p
;
5464 struct route_table
*table
;
5465 struct route_node
*rn
;
5466 struct zebra_vrf
*zvrf
;
5469 ret
= str2prefix_ipv6 (argv
[0], &p
);
5472 vty_out (vty
, "Malformed IPv6 address%s", VTY_NEWLINE
);
5476 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5478 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5479 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5482 rn
= route_node_match (table
, (struct prefix
*) &p
);
5486 vty_show_ip_route_detail (vty
, rn
, 0);
5488 route_unlock_node (rn
);
5494 DEFUN (show_ipv6_route_vrf_all_prefix
,
5495 show_ipv6_route_vrf_all_prefix_cmd
,
5496 "show ipv6 route " VRF_ALL_CMD_STR
" X:X::X:X/M",
5499 "IPv6 routing table\n"
5500 VRF_ALL_CMD_HELP_STR
5504 struct prefix_ipv6 p
;
5505 struct route_table
*table
;
5506 struct route_node
*rn
;
5507 struct zebra_vrf
*zvrf
;
5510 ret
= str2prefix_ipv6 (argv
[0], &p
);
5513 vty_out (vty
, "Malformed IPv6 prefix%s", VTY_NEWLINE
);
5517 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5519 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5520 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5523 rn
= route_node_match (table
, (struct prefix
*) &p
);
5526 if (rn
->p
.prefixlen
!= p
.prefixlen
)
5528 route_unlock_node (rn
);
5532 vty_show_ip_route_detail (vty
, rn
, 0);
5534 route_unlock_node (rn
);
5540 DEFUN (show_ipv6_route_vrf_all_summary
,
5541 show_ipv6_route_vrf_all_summary_cmd
,
5542 "show ipv6 route " VRF_ALL_CMD_STR
" summary",
5545 "IPv6 routing table\n"
5546 VRF_ALL_CMD_HELP_STR
5547 "Summary of all IPv6 routes\n")
5549 struct zebra_vrf
*zvrf
;
5552 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5553 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
5554 vty_show_ip_route_summary (vty
, zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]);
5559 DEFUN (show_ipv6_mroute_vrf_all
,
5560 show_ipv6_mroute_vrf_all_cmd
,
5561 "show ipv6 mroute " VRF_ALL_CMD_STR
,
5564 "IPv6 Multicast routing table\n"
5565 VRF_ALL_CMD_HELP_STR
)
5567 struct route_table
*table
;
5568 struct route_node
*rn
;
5570 struct zebra_vrf
*zvrf
;
5574 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5576 if ((zvrf
= vrf_iter2info (iter
)) == NULL
||
5577 (table
= zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5580 /* Show all IPv6 route. */
5581 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
5582 RNODE_FOREACH_RIB (rn
, rib
)
5586 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
5589 vty_show_ip_route (vty
, rn
, rib
, NULL
);
5595 DEFUN (show_ipv6_route_vrf_all_summary_prefix
,
5596 show_ipv6_route_vrf_all_summary_prefix_cmd
,
5597 "show ipv6 route " VRF_ALL_CMD_STR
" summary prefix",
5600 "IPv6 routing table\n"
5601 VRF_ALL_CMD_HELP_STR
5602 "Summary of all IPv6 routes\n"
5605 struct zebra_vrf
*zvrf
;
5608 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
5609 if ((zvrf
= vrf_iter2info (iter
)) != NULL
)
5610 vty_show_ip_route_summary_prefix (vty
, zvrf
->table
[AFI_IP6
][SAFI_UNICAST
]);
5615 /* Write IPv6 static route configuration. */
5617 static_config_ipv6 (struct vty
*vty
)
5619 struct route_node
*rn
;
5620 struct static_route
*si
;
5622 char buf
[PREFIX_STRLEN
];
5623 struct route_table
*stable
;
5624 struct zebra_vrf
*zvrf
;
5625 struct listnode
*node
;
5627 for (ALL_LIST_ELEMENTS_RO (zvrf_list
, node
, zvrf
))
5629 if ((stable
= zvrf
->stable
[AFI_IP6
][SAFI_UNICAST
]) == NULL
)
5632 for (rn
= route_top (stable
); rn
; rn
= route_next (rn
))
5633 for (si
= rn
->info
; si
; si
= si
->next
)
5635 vty_out (vty
, "ipv6 route %s", prefix2str (&rn
->p
, buf
, sizeof buf
));
5639 case STATIC_IPV6_GATEWAY
:
5640 vty_out (vty
, " %s", inet_ntop (AF_INET6
, &si
->addr
.ipv6
, buf
, BUFSIZ
));
5642 case STATIC_IFINDEX
:
5643 vty_out (vty
, " %s", si
->ifname
);
5645 case STATIC_IPV6_GATEWAY_IFINDEX
:
5646 vty_out (vty
, " %s %s",
5647 inet_ntop (AF_INET6
, &si
->addr
.ipv6
, buf
, BUFSIZ
),
5648 ifindex2ifname_vrf (si
->ifindex
, si
->vrf_id
));
5652 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_REJECT
))
5653 vty_out (vty
, " %s", "reject");
5655 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_BLACKHOLE
))
5656 vty_out (vty
, " %s", "blackhole");
5659 vty_out (vty
, " tag %d", si
->tag
);
5661 if (si
->distance
!= ZEBRA_STATIC_DISTANCE_DEFAULT
)
5662 vty_out (vty
, " %d", si
->distance
);
5664 if (si
->vrf_id
!= VRF_DEFAULT
)
5666 vty_out (vty
, " vrf %s", zvrf
->name
);
5669 vty_out (vty
, "%s", VTY_NEWLINE
);
5676 #endif /* HAVE_IPV6 */
5678 DEFUN (allow_external_route_update
,
5679 allow_external_route_update_cmd
,
5680 "allow-external-route-update",
5681 "Allow Quagga routes to be overwritten by external processes")
5688 DEFUN (no_allow_external_route_update
,
5689 no_allow_external_route_update_cmd
,
5690 "no allow-external-route-update",
5691 "Allow Quagga routes to be overwritten by external processes")
5705 struct zebra_vrf
*zvrf
;
5706 struct listnode
*node
;
5708 for (ALL_LIST_ELEMENTS_RO (zvrf_list
, node
, zvrf
))
5713 vty_out (vty
, "vrf %s ", zvrf
->name
);
5714 if (zvrf
->vrf_id
== VRF_UNKNOWN
)
5715 vty_out (vty
, "inactive");
5717 vty_out (vty
, "id %u table %u", zvrf
->vrf_id
, zvrf
->table_id
);
5718 vty_out (vty
, "%s", VTY_NEWLINE
);
5725 /* Static ip route configuration write function. */
5727 zebra_ip_config (struct vty
*vty
)
5731 write
+= static_config_ipv4 (vty
, SAFI_UNICAST
, "ip route");
5732 write
+= static_config_ipv4 (vty
, SAFI_MULTICAST
, "ip mroute");
5734 write
+= static_config_ipv6 (vty
);
5735 #endif /* HAVE_IPV6 */
5737 write
+= zebra_import_table_config (vty
);
5741 DEFUN (ip_zebra_import_table_distance
,
5742 ip_zebra_import_table_distance_cmd
,
5743 "ip import-table <1-252> distance <1-255>",
5745 "import routes from non-main kernel table\n"
5746 "kernel routing table id\n"
5747 "Distance for imported routes\n"
5748 "Default distance value\n")
5750 u_int32_t table_id
= 0;
5751 int distance
= ZEBRA_TABLE_DISTANCE_DEFAULT
;
5754 VTY_GET_INTEGER("table", table_id
, argv
[0]);
5756 if (!is_zebra_valid_kernel_table(table_id
))
5758 vty_out(vty
, "Invalid routing table ID, %d. Must be in range 1-252%s",
5759 table_id
, VTY_NEWLINE
);
5763 if (is_zebra_main_routing_table(table_id
))
5765 vty_out(vty
, "Invalid routing table ID, %d. Must be non-default table%s",
5766 table_id
, VTY_NEWLINE
);
5771 VTY_GET_INTEGER_RANGE("distance", distance
, argv
[1], 1, 255);
5772 return (zebra_import_table(AFI_IP
, table_id
, distance
, NULL
, 1));
5776 ALIAS (ip_zebra_import_table_distance
,
5777 ip_zebra_import_table_cmd
,
5778 "ip import-table <1-252>",
5780 "import routes from non-main kernel table\n"
5781 "kernel routing table id\n")
5783 DEFUN (ip_zebra_import_table_distance_routemap
,
5784 ip_zebra_import_table_distance_routemap_cmd
,
5785 "ip import-table <1-252> distance <1-255> route-map WORD",
5787 "import routes from non-main kernel table\n"
5788 "kernel routing table id\n"
5789 "Distance for imported routes\n"
5790 "Default distance value\n"
5791 "route-map for filtering\n"
5794 u_int32_t table_id
= 0;
5795 int distance
= ZEBRA_TABLE_DISTANCE_DEFAULT
;
5796 const char *rmap_name
;
5799 VTY_GET_INTEGER("table", table_id
, argv
[0]);
5801 if (!is_zebra_valid_kernel_table(table_id
))
5803 vty_out(vty
, "Invalid routing table ID, %d. Must be in range 1-252%s",
5804 table_id
, VTY_NEWLINE
);
5808 if (is_zebra_main_routing_table(table_id
))
5810 vty_out(vty
, "Invalid routing table ID, %d. Must be non-default table%s",
5811 table_id
, VTY_NEWLINE
);
5817 VTY_GET_INTEGER_RANGE("distance", distance
, argv
[1], 1, 255);
5818 rmap_name
= XSTRDUP (MTYPE_ROUTE_MAP_NAME
, argv
[2]);
5821 rmap_name
= XSTRDUP (MTYPE_ROUTE_MAP_NAME
, argv
[1]);
5823 return (zebra_import_table(AFI_IP
, table_id
, distance
, rmap_name
, 1));
5826 ALIAS (ip_zebra_import_table_distance_routemap
,
5827 ip_zebra_import_table_routemap_cmd
,
5828 "ip import-table <1-252> route-map WORD",
5830 "import routes from non-main kernel table\n"
5831 "kernel routing table id\n"
5832 "route-map for filtering\n"
5835 DEFUN (no_ip_zebra_import_table
,
5836 no_ip_zebra_import_table_cmd
,
5837 "no ip import-table <1-252> {route-map NAME}",
5840 "import routes from non-main kernel table\n"
5841 "kernel routing table id\n")
5843 u_int32_t table_id
= 0;
5846 VTY_GET_INTEGER("table", table_id
, argv
[0]);
5848 if (!is_zebra_valid_kernel_table(table_id
))
5850 vty_out(vty
, "Invalid routing table ID. Must be in range 1-252%s",
5855 if (is_zebra_main_routing_table(table_id
))
5857 vty_out(vty
, "Invalid routing table ID, %d. Must be non-default table%s",
5858 table_id
, VTY_NEWLINE
);
5862 if (!is_zebra_import_table_enabled(AFI_IP
, table_id
))
5865 return (zebra_import_table(AFI_IP
, table_id
, 0, NULL
, 0));
5868 ALIAS (no_ip_zebra_import_table
,
5869 no_ip_zebra_import_table_distance_cmd
,
5870 "no ip import-table <1-252> distance <1-255> {route-map NAME}",
5872 "import routes from non-main kernel table to main table"
5873 "kernel routing table id\n"
5874 "distance to be used\n")
5877 config_write_protocol (struct vty
*vty
)
5880 vty_out(vty
, "allow-external-route-update%s", VTY_NEWLINE
);
5882 if (zebra_rnh_ip_default_route
)
5883 vty_out(vty
, "ip nht resolve-via-default%s", VTY_NEWLINE
);
5885 if (zebra_rnh_ipv6_default_route
)
5886 vty_out(vty
, "ipv6 nht resolve-via-default%s", VTY_NEWLINE
);
5888 enum multicast_mode ipv4_multicast_mode
= multicast_mode_ipv4_get ();
5890 if (ipv4_multicast_mode
!= MCAST_NO_CONFIG
)
5891 vty_out (vty
, "ip multicast rpf-lookup-mode %s%s",
5892 ipv4_multicast_mode
== MCAST_URIB_ONLY
? "urib-only" :
5893 ipv4_multicast_mode
== MCAST_MRIB_ONLY
? "mrib-only" :
5894 ipv4_multicast_mode
== MCAST_MIX_MRIB_FIRST
? "mrib-then-urib" :
5895 ipv4_multicast_mode
== MCAST_MIX_DISTANCE
? "lower-distance" :
5899 zebra_routemap_config_write_protocol(vty
);
5904 /* IP node for static routes. */
5905 static struct cmd_node ip_node
= { IP_NODE
, "", 1 };
5906 static struct cmd_node protocol_node
= { PROTOCOL_NODE
, "", 1 };
5910 zebra_vty_init (void)
5912 install_node (&ip_node
, zebra_ip_config
);
5913 install_node (&protocol_node
, config_write_protocol
);
5915 install_element (CONFIG_NODE
, &allow_external_route_update_cmd
);
5916 install_element (CONFIG_NODE
, &no_allow_external_route_update_cmd
);
5917 install_element (CONFIG_NODE
, &ip_mroute_cmd
);
5918 install_element (CONFIG_NODE
, &ip_mroute_dist_cmd
);
5919 install_element (CONFIG_NODE
, &no_ip_mroute_cmd
);
5920 install_element (CONFIG_NODE
, &no_ip_mroute_dist_cmd
);
5921 install_element (CONFIG_NODE
, &ip_multicast_mode_cmd
);
5922 install_element (CONFIG_NODE
, &no_ip_multicast_mode_cmd
);
5923 install_element (CONFIG_NODE
, &no_ip_multicast_mode_noarg_cmd
);
5924 install_element (CONFIG_NODE
, &ip_route_cmd
);
5925 install_element (CONFIG_NODE
, &ip_route_tag_cmd
);
5926 install_element (CONFIG_NODE
, &ip_route_flags_cmd
);
5927 install_element (CONFIG_NODE
, &ip_route_flags_tag_cmd
);
5928 install_element (CONFIG_NODE
, &ip_route_flags2_cmd
);
5929 install_element (CONFIG_NODE
, &ip_route_flags2_tag_cmd
);
5930 install_element (CONFIG_NODE
, &ip_route_mask_cmd
);
5931 install_element (CONFIG_NODE
, &ip_route_mask_tag_cmd
);
5932 install_element (CONFIG_NODE
, &ip_route_mask_flags_cmd
);
5933 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_cmd
);
5934 install_element (CONFIG_NODE
, &ip_route_mask_flags2_cmd
);
5935 install_element (CONFIG_NODE
, &ip_route_mask_flags2_tag_cmd
);
5936 install_element (CONFIG_NODE
, &no_ip_route_cmd
);
5937 install_element (CONFIG_NODE
, &no_ip_route_tag_cmd
);
5938 install_element (CONFIG_NODE
, &no_ip_route_flags_cmd
);
5939 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_cmd
);
5940 install_element (CONFIG_NODE
, &no_ip_route_flags2_cmd
);
5941 install_element (CONFIG_NODE
, &no_ip_route_flags2_tag_cmd
);
5942 install_element (CONFIG_NODE
, &no_ip_route_mask_cmd
);
5943 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_cmd
);
5944 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_cmd
);
5945 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_cmd
);
5946 install_element (CONFIG_NODE
, &no_ip_route_mask_flags2_cmd
);
5947 install_element (CONFIG_NODE
, &no_ip_route_mask_flags2_tag_cmd
);
5948 install_element (CONFIG_NODE
, &ip_route_distance_cmd
);
5949 install_element (CONFIG_NODE
, &ip_route_tag_distance_cmd
);
5950 install_element (CONFIG_NODE
, &ip_route_flags_distance_cmd
);
5951 install_element (CONFIG_NODE
, &ip_route_flags_tag_distance_cmd
);
5952 install_element (CONFIG_NODE
, &ip_route_flags_distance2_cmd
);
5953 install_element (CONFIG_NODE
, &ip_route_flags_tag_distance2_cmd
);
5954 install_element (CONFIG_NODE
, &ip_route_mask_distance_cmd
);
5955 install_element (CONFIG_NODE
, &ip_route_mask_tag_distance_cmd
);
5956 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance_cmd
);
5957 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_distance_cmd
);
5958 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance2_cmd
);
5959 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_distance2_cmd
);
5960 install_element (CONFIG_NODE
, &no_ip_route_distance_cmd
);
5961 install_element (CONFIG_NODE
, &no_ip_route_tag_distance_cmd
);
5962 install_element (CONFIG_NODE
, &no_ip_route_flags_distance_cmd
);
5963 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_distance_cmd
);
5964 install_element (CONFIG_NODE
, &no_ip_route_flags_distance2_cmd
);
5965 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_distance2_cmd
);
5966 install_element (CONFIG_NODE
, &no_ip_route_mask_distance_cmd
);
5967 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_distance_cmd
);
5968 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance_cmd
);
5969 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_distance_cmd
);
5970 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance2_cmd
);
5971 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_distance2_cmd
);
5972 install_element (CONFIG_NODE
, &ip_zebra_import_table_cmd
);
5973 install_element (CONFIG_NODE
, &ip_zebra_import_table_distance_cmd
);
5974 install_element (CONFIG_NODE
, &ip_zebra_import_table_routemap_cmd
);
5975 install_element (CONFIG_NODE
, &ip_zebra_import_table_distance_routemap_cmd
);
5976 install_element (CONFIG_NODE
, &no_ip_zebra_import_table_cmd
);
5977 install_element (CONFIG_NODE
, &no_ip_zebra_import_table_distance_cmd
);
5979 install_element (VIEW_NODE
, &show_vrf_cmd
);
5980 install_element (VIEW_NODE
, &show_ip_route_cmd
);
5981 install_element (VIEW_NODE
, &show_ip_route_ospf_instance_cmd
);
5982 install_element (VIEW_NODE
, &show_ip_route_tag_cmd
);
5983 install_element (VIEW_NODE
, &show_ip_nht_cmd
);
5984 install_element (VIEW_NODE
, &show_ip_nht_vrf_cmd
);
5985 install_element (VIEW_NODE
, &show_ip_nht_vrf_all_cmd
);
5986 install_element (VIEW_NODE
, &show_ipv6_nht_cmd
);
5987 install_element (VIEW_NODE
, &show_ipv6_nht_vrf_cmd
);
5988 install_element (VIEW_NODE
, &show_ipv6_nht_vrf_all_cmd
);
5989 install_element (VIEW_NODE
, &show_ip_route_addr_cmd
);
5990 install_element (VIEW_NODE
, &show_ip_route_prefix_cmd
);
5991 install_element (VIEW_NODE
, &show_ip_route_prefix_longer_cmd
);
5992 install_element (VIEW_NODE
, &show_ip_route_protocol_cmd
);
5993 install_element (VIEW_NODE
, &show_ip_route_supernets_cmd
);
5994 install_element (VIEW_NODE
, &show_ip_route_summary_cmd
);
5995 install_element (VIEW_NODE
, &show_ip_route_summary_prefix_cmd
);
5996 install_element (ENABLE_NODE
, &show_vrf_cmd
);
5997 install_element (ENABLE_NODE
, &show_ip_route_cmd
);
5998 install_element (ENABLE_NODE
, &show_ip_route_ospf_instance_cmd
);
5999 install_element (ENABLE_NODE
, &show_ip_route_tag_cmd
);
6000 install_element (ENABLE_NODE
, &show_ip_nht_cmd
);
6001 install_element (ENABLE_NODE
, &show_ip_nht_vrf_cmd
);
6002 install_element (ENABLE_NODE
, &show_ip_nht_vrf_all_cmd
);
6003 install_element (ENABLE_NODE
, &show_ipv6_nht_cmd
);
6004 install_element (ENABLE_NODE
, &show_ipv6_nht_vrf_cmd
);
6005 install_element (ENABLE_NODE
, &show_ipv6_nht_vrf_all_cmd
);
6006 install_element (ENABLE_NODE
, &show_ip_route_addr_cmd
);
6007 install_element (ENABLE_NODE
, &show_ip_route_prefix_cmd
);
6008 install_element (ENABLE_NODE
, &show_ip_route_prefix_longer_cmd
);
6009 install_element (ENABLE_NODE
, &show_ip_route_protocol_cmd
);
6010 install_element (ENABLE_NODE
, &show_ip_route_supernets_cmd
);
6011 install_element (ENABLE_NODE
, &show_ip_route_summary_cmd
);
6012 install_element (ENABLE_NODE
, &show_ip_route_summary_prefix_cmd
);
6014 install_element (VIEW_NODE
, &show_ip_rpf_cmd
);
6015 install_element (ENABLE_NODE
, &show_ip_rpf_cmd
);
6016 install_element (VIEW_NODE
, &show_ip_rpf_addr_cmd
);
6017 install_element (ENABLE_NODE
, &show_ip_rpf_addr_cmd
);
6019 /* Commands for VRF */
6021 install_element (CONFIG_NODE
, &ip_route_vrf_cmd
);
6022 install_element (CONFIG_NODE
, &ip_route_tag_vrf_cmd
);
6023 install_element (CONFIG_NODE
, &ip_route_flags_vrf_cmd
);
6024 install_element (CONFIG_NODE
, &ip_route_flags_tag_vrf_cmd
);
6025 install_element (CONFIG_NODE
, &ip_route_flags2_vrf_cmd
);
6026 install_element (CONFIG_NODE
, &ip_route_flags2_tag_vrf_cmd
);
6027 install_element (CONFIG_NODE
, &ip_route_mask_vrf_cmd
);
6028 install_element (CONFIG_NODE
, &ip_route_mask_tag_vrf_cmd
);
6029 install_element (CONFIG_NODE
, &ip_route_mask_flags_vrf_cmd
);
6030 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_vrf_cmd
);
6031 install_element (CONFIG_NODE
, &ip_route_mask_flags2_vrf_cmd
);
6032 install_element (CONFIG_NODE
, &ip_route_mask_flags2_tag_vrf_cmd
);
6033 install_element (CONFIG_NODE
, &no_ip_route_vrf_cmd
);
6034 install_element (CONFIG_NODE
, &no_ip_route_tag_vrf_cmd
);
6035 install_element (CONFIG_NODE
, &no_ip_route_flags_vrf_cmd
);
6036 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_vrf_cmd
);
6037 install_element (CONFIG_NODE
, &no_ip_route_flags2_vrf_cmd
);
6038 install_element (CONFIG_NODE
, &no_ip_route_flags2_tag_vrf_cmd
);
6039 install_element (CONFIG_NODE
, &no_ip_route_mask_vrf_cmd
);
6040 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_vrf_cmd
);
6041 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_vrf_cmd
);
6042 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_vrf_cmd
);
6043 install_element (CONFIG_NODE
, &no_ip_route_mask_flags2_vrf_cmd
);
6044 install_element (CONFIG_NODE
, &no_ip_route_mask_flags2_tag_vrf_cmd
);
6045 install_element (CONFIG_NODE
, &ip_route_distance_vrf_cmd
);
6046 install_element (CONFIG_NODE
, &ip_route_tag_distance_vrf_cmd
);
6047 install_element (CONFIG_NODE
, &ip_route_flags_distance_vrf_cmd
);
6048 install_element (CONFIG_NODE
, &ip_route_flags_tag_distance_vrf_cmd
);
6049 install_element (CONFIG_NODE
, &ip_route_flags_distance2_vrf_cmd
);
6050 install_element (CONFIG_NODE
, &ip_route_flags_tag_distance2_vrf_cmd
);
6051 install_element (CONFIG_NODE
, &ip_route_mask_distance_vrf_cmd
);
6052 install_element (CONFIG_NODE
, &ip_route_mask_tag_distance_vrf_cmd
);
6053 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance_vrf_cmd
);
6054 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_distance_vrf_cmd
);
6055 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance2_vrf_cmd
);
6056 install_element (CONFIG_NODE
, &ip_route_mask_flags_tag_distance2_vrf_cmd
);
6057 install_element (CONFIG_NODE
, &no_ip_route_distance_vrf_cmd
);
6058 install_element (CONFIG_NODE
, &no_ip_route_tag_distance_vrf_cmd
);
6059 install_element (CONFIG_NODE
, &no_ip_route_flags_distance_vrf_cmd
);
6060 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_distance_vrf_cmd
);
6061 install_element (CONFIG_NODE
, &no_ip_route_flags_distance2_vrf_cmd
);
6062 install_element (CONFIG_NODE
, &no_ip_route_flags_tag_distance2_vrf_cmd
);
6063 install_element (CONFIG_NODE
, &no_ip_route_mask_distance_vrf_cmd
);
6064 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_distance_vrf_cmd
);
6065 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance_vrf_cmd
);
6066 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_distance_vrf_cmd
);
6067 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance2_vrf_cmd
);
6068 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_tag_distance2_vrf_cmd
);
6070 install_element (VIEW_NODE
, &show_ip_route_vrf_cmd
);
6071 install_element (VIEW_NODE
, &show_ip_route_vrf_addr_cmd
);
6072 install_element (VIEW_NODE
, &show_ip_route_vrf_tag_cmd
);
6073 install_element (VIEW_NODE
, &show_ip_route_vrf_prefix_cmd
);
6074 install_element (VIEW_NODE
, &show_ip_route_vrf_prefix_longer_cmd
);
6075 install_element (VIEW_NODE
, &show_ip_route_vrf_protocol_cmd
);
6076 install_element (VIEW_NODE
, &show_ip_route_vrf_supernets_cmd
);
6077 install_element (VIEW_NODE
, &show_ip_route_vrf_summary_cmd
);
6078 install_element (VIEW_NODE
, &show_ip_route_vrf_summary_prefix_cmd
);
6079 install_element (ENABLE_NODE
, &show_ip_route_vrf_cmd
);
6080 install_element (ENABLE_NODE
, &show_ip_route_vrf_addr_cmd
);
6081 install_element (ENABLE_NODE
, &show_ip_route_vrf_tag_cmd
);
6082 install_element (ENABLE_NODE
, &show_ip_route_vrf_prefix_cmd
);
6083 install_element (ENABLE_NODE
, &show_ip_route_vrf_prefix_longer_cmd
);
6084 install_element (ENABLE_NODE
, &show_ip_route_vrf_protocol_cmd
);
6085 install_element (ENABLE_NODE
, &show_ip_route_vrf_supernets_cmd
);
6086 install_element (ENABLE_NODE
, &show_ip_route_vrf_summary_cmd
);
6087 install_element (ENABLE_NODE
, &show_ip_route_vrf_summary_prefix_cmd
);
6089 install_element (VIEW_NODE
, &show_ip_route_vrf_all_cmd
);
6090 install_element (VIEW_NODE
, &show_ip_route_vrf_all_tag_cmd
);
6091 install_element (VIEW_NODE
, &show_ip_route_vrf_all_addr_cmd
);
6092 install_element (VIEW_NODE
, &show_ip_route_vrf_all_prefix_cmd
);
6093 install_element (VIEW_NODE
, &show_ip_route_vrf_all_prefix_longer_cmd
);
6094 install_element (VIEW_NODE
, &show_ip_route_vrf_all_protocol_cmd
);
6095 install_element (VIEW_NODE
, &show_ip_route_vrf_all_supernets_cmd
);
6096 install_element (VIEW_NODE
, &show_ip_route_vrf_all_summary_cmd
);
6097 install_element (VIEW_NODE
, &show_ip_route_vrf_all_summary_prefix_cmd
);
6098 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_cmd
);
6099 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_tag_cmd
);
6100 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_addr_cmd
);
6101 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_prefix_cmd
);
6102 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_prefix_longer_cmd
);
6103 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_protocol_cmd
);
6104 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_supernets_cmd
);
6105 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_summary_cmd
);
6106 install_element (ENABLE_NODE
, &show_ip_route_vrf_all_summary_prefix_cmd
);
6109 install_element (CONFIG_NODE
, &ipv6_route_cmd
);
6110 install_element (CONFIG_NODE
, &ipv6_route_flags_cmd
);
6111 install_element (CONFIG_NODE
, &ipv6_route_ifname_cmd
);
6112 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_cmd
);
6113 install_element (CONFIG_NODE
, &no_ipv6_route_cmd
);
6114 install_element (CONFIG_NODE
, &no_ipv6_route_flags_cmd
);
6115 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_cmd
);
6116 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_cmd
);
6117 install_element (CONFIG_NODE
, &ipv6_route_pref_cmd
);
6118 install_element (CONFIG_NODE
, &ipv6_route_flags_pref_cmd
);
6119 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_cmd
);
6120 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_pref_cmd
);
6121 install_element (CONFIG_NODE
, &no_ipv6_route_pref_cmd
);
6122 install_element (CONFIG_NODE
, &no_ipv6_route_flags_pref_cmd
);
6123 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_cmd
);
6124 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_pref_cmd
);
6125 install_element (CONFIG_NODE
, &ipv6_route_tag_cmd
);
6126 install_element (CONFIG_NODE
, &ipv6_route_flags_tag_cmd
);
6127 install_element (CONFIG_NODE
, &ipv6_route_ifname_tag_cmd
);
6128 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_tag_cmd
);
6129 install_element (CONFIG_NODE
, &ipv6_route_pref_tag_cmd
);
6130 install_element (CONFIG_NODE
, &ipv6_route_flags_pref_tag_cmd
);
6131 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_tag_cmd
);
6132 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_pref_tag_cmd
);
6133 install_element (CONFIG_NODE
, &no_ipv6_route_tag_cmd
);
6134 install_element (CONFIG_NODE
, &no_ipv6_route_flags_tag_cmd
);
6135 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_tag_cmd
);
6136 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_tag_cmd
);
6137 install_element (CONFIG_NODE
, &no_ipv6_route_pref_tag_cmd
);
6138 install_element (CONFIG_NODE
, &no_ipv6_route_flags_pref_tag_cmd
);
6139 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_tag_cmd
);
6140 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_pref_tag_cmd
);
6141 install_element (CONFIG_NODE
, &ip_nht_default_route_cmd
);
6142 install_element (CONFIG_NODE
, &no_ip_nht_default_route_cmd
);
6143 install_element (CONFIG_NODE
, &ipv6_nht_default_route_cmd
);
6144 install_element (CONFIG_NODE
, &no_ipv6_nht_default_route_cmd
);
6145 install_element (VIEW_NODE
, &show_ipv6_route_cmd
);
6146 install_element (VIEW_NODE
, &show_ipv6_route_tag_cmd
);
6147 install_element (VIEW_NODE
, &show_ipv6_route_summary_cmd
);
6148 install_element (VIEW_NODE
, &show_ipv6_route_summary_prefix_cmd
);
6149 install_element (VIEW_NODE
, &show_ipv6_route_protocol_cmd
);
6150 install_element (VIEW_NODE
, &show_ipv6_route_addr_cmd
);
6151 install_element (VIEW_NODE
, &show_ipv6_route_prefix_cmd
);
6152 install_element (VIEW_NODE
, &show_ipv6_route_prefix_longer_cmd
);
6153 install_element (ENABLE_NODE
, &show_ipv6_route_cmd
);
6154 install_element (ENABLE_NODE
, &show_ipv6_route_tag_cmd
);
6155 install_element (ENABLE_NODE
, &show_ipv6_route_protocol_cmd
);
6156 install_element (ENABLE_NODE
, &show_ipv6_route_addr_cmd
);
6157 install_element (ENABLE_NODE
, &show_ipv6_route_prefix_cmd
);
6158 install_element (ENABLE_NODE
, &show_ipv6_route_prefix_longer_cmd
);
6159 install_element (ENABLE_NODE
, &show_ipv6_route_summary_cmd
);
6160 install_element (ENABLE_NODE
, &show_ipv6_route_summary_prefix_cmd
);
6162 install_element (VIEW_NODE
, &show_ipv6_mroute_cmd
);
6163 install_element (ENABLE_NODE
, &show_ipv6_mroute_cmd
);
6165 /* Commands for VRF */
6167 install_element (CONFIG_NODE
, &ipv6_route_vrf_cmd
);
6168 install_element (CONFIG_NODE
, &ipv6_route_flags_vrf_cmd
);
6169 install_element (CONFIG_NODE
, &ipv6_route_ifname_vrf_cmd
);
6170 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_vrf_cmd
);
6171 install_element (CONFIG_NODE
, &no_ipv6_route_vrf_cmd
);
6172 install_element (CONFIG_NODE
, &no_ipv6_route_flags_vrf_cmd
);
6173 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_vrf_cmd
);
6174 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_vrf_cmd
);
6175 install_element (CONFIG_NODE
, &ipv6_route_pref_vrf_cmd
);
6176 install_element (CONFIG_NODE
, &ipv6_route_flags_pref_vrf_cmd
);
6177 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_vrf_cmd
);
6178 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_pref_vrf_cmd
);
6179 install_element (CONFIG_NODE
, &no_ipv6_route_pref_vrf_cmd
);
6180 install_element (CONFIG_NODE
, &no_ipv6_route_flags_pref_vrf_cmd
);
6181 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_vrf_cmd
);
6182 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_pref_vrf_cmd
);
6183 install_element (CONFIG_NODE
, &ipv6_route_tag_vrf_cmd
);
6184 install_element (CONFIG_NODE
, &ipv6_route_flags_tag_vrf_cmd
);
6185 install_element (CONFIG_NODE
, &ipv6_route_ifname_tag_vrf_cmd
);
6186 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_tag_vrf_cmd
);
6187 install_element (CONFIG_NODE
, &ipv6_route_pref_tag_vrf_cmd
);
6188 install_element (CONFIG_NODE
, &ipv6_route_flags_pref_tag_vrf_cmd
);
6189 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_tag_vrf_cmd
);
6190 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_pref_tag_vrf_cmd
);
6191 install_element (CONFIG_NODE
, &no_ipv6_route_tag_vrf_cmd
);
6192 install_element (CONFIG_NODE
, &no_ipv6_route_flags_tag_vrf_cmd
);
6193 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_tag_vrf_cmd
);
6194 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_tag_vrf_cmd
);
6195 install_element (CONFIG_NODE
, &no_ipv6_route_pref_tag_vrf_cmd
);
6196 install_element (CONFIG_NODE
, &no_ipv6_route_flags_pref_tag_vrf_cmd
);
6197 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_tag_vrf_cmd
);
6198 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd
);
6201 install_element (VIEW_NODE
, &show_ipv6_route_vrf_cmd
);
6202 install_element (VIEW_NODE
, &show_ipv6_route_vrf_tag_cmd
);
6203 install_element (VIEW_NODE
, &show_ipv6_route_vrf_summary_cmd
);
6204 install_element (VIEW_NODE
, &show_ipv6_route_vrf_summary_prefix_cmd
);
6205 install_element (VIEW_NODE
, &show_ipv6_route_vrf_protocol_cmd
);
6206 install_element (VIEW_NODE
, &show_ipv6_route_vrf_addr_cmd
);
6207 install_element (VIEW_NODE
, &show_ipv6_route_vrf_prefix_cmd
);
6208 install_element (VIEW_NODE
, &show_ipv6_route_vrf_prefix_longer_cmd
);
6209 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_cmd
);
6210 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_tag_cmd
);
6211 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_protocol_cmd
);
6212 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_addr_cmd
);
6213 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_prefix_cmd
);
6214 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_prefix_longer_cmd
);
6215 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_summary_cmd
);
6216 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_summary_prefix_cmd
);
6218 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_cmd
);
6219 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_tag_cmd
);
6220 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_summary_cmd
);
6221 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_summary_prefix_cmd
);
6222 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_protocol_cmd
);
6223 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_addr_cmd
);
6224 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_prefix_cmd
);
6225 install_element (VIEW_NODE
, &show_ipv6_route_vrf_all_prefix_longer_cmd
);
6226 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_cmd
);
6227 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_tag_cmd
);
6228 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_protocol_cmd
);
6229 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_addr_cmd
);
6230 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_prefix_cmd
);
6231 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_prefix_longer_cmd
);
6232 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_summary_cmd
);
6233 install_element (ENABLE_NODE
, &show_ipv6_route_vrf_all_summary_prefix_cmd
);
6235 install_element (VIEW_NODE
, &show_ipv6_mroute_vrf_cmd
);
6236 install_element (ENABLE_NODE
, &show_ipv6_mroute_vrf_cmd
);
6238 install_element (VIEW_NODE
, &show_ipv6_mroute_vrf_all_cmd
);
6239 install_element (ENABLE_NODE
, &show_ipv6_mroute_vrf_all_cmd
);
6240 #endif /* HAVE_IPV6 */