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.
31 #include "zebra/zserv.h"
33 /* General fucntion for static route. */
35 zebra_static_ipv4 (struct vty
*vty
, int add_cmd
, const char *dest_str
,
36 const char *mask_str
, const char *gate_str
,
37 const char *flag_str
, const char *distance_str
)
47 ret
= str2prefix (dest_str
, &p
);
50 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
54 /* Cisco like mask notation. */
57 ret
= inet_aton (mask_str
, &mask
);
60 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
63 p
.prefixlen
= ip_masklen (mask
);
66 /* Apply mask for given prefix. */
69 /* Administrative distance. */
71 distance
= atoi (distance_str
);
73 distance
= ZEBRA_STATIC_DISTANCE_DEFAULT
;
75 /* Null0 static route. */
76 if ((gate_str
!= NULL
) && (strncasecmp (gate_str
, "Null0", strlen (gate_str
)) == 0))
80 vty_out (vty
, "%% can not have flag %s with Null0%s", flag_str
, VTY_NEWLINE
);
84 static_add_ipv4 (&p
, NULL
, NULL
, ZEBRA_FLAG_BLACKHOLE
, distance
, 0);
86 static_delete_ipv4 (&p
, NULL
, NULL
, distance
, 0);
95 SET_FLAG (flag
, ZEBRA_FLAG_REJECT
);
99 SET_FLAG (flag
, ZEBRA_FLAG_BLACKHOLE
);
102 vty_out (vty
, "%% Malformed flag %s %s", flag_str
, VTY_NEWLINE
);
107 if (gate_str
== NULL
)
110 static_add_ipv4 (&p
, NULL
, NULL
, flag
, distance
, 0);
112 static_delete_ipv4 (&p
, NULL
, NULL
, distance
, 0);
117 /* When gateway is A.B.C.D format, gate is treated as nexthop
118 address other case gate is treated as interface name. */
119 ret
= inet_aton (gate_str
, &gate
);
126 static_add_ipv4 (&p
, ifname
? NULL
: &gate
, ifname
, flag
, distance
, 0);
128 static_delete_ipv4 (&p
, ifname
? NULL
: &gate
, ifname
, distance
, 0);
133 /* Static route configuration. */
136 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
138 "Establish static routes\n"
139 "IP destination prefix (e.g. 10.0.0.0/8)\n"
140 "IP gateway address\n"
141 "IP gateway interface name\n"
144 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, argv
[1], NULL
, NULL
);
147 DEFUN (ip_route_flags
,
149 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
151 "Establish static routes\n"
152 "IP destination prefix (e.g. 10.0.0.0/8)\n"
153 "IP gateway address\n"
154 "IP gateway interface name\n"
155 "Emit an ICMP unreachable when matched\n"
156 "Silently discard pkts when matched\n")
158 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, argv
[1], argv
[2], NULL
);
161 DEFUN (ip_route_flags2
,
163 "ip route A.B.C.D/M (reject|blackhole)",
165 "Establish static routes\n"
166 "IP destination prefix (e.g. 10.0.0.0/8)\n"
167 "Emit an ICMP unreachable when matched\n"
168 "Silently discard pkts when matched\n")
170 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, NULL
, argv
[1], NULL
);
173 /* Mask as A.B.C.D format. */
174 DEFUN (ip_route_mask
,
176 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
178 "Establish static routes\n"
179 "IP destination prefix\n"
180 "IP destination prefix mask\n"
181 "IP gateway address\n"
182 "IP gateway interface name\n"
185 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
);
188 DEFUN (ip_route_mask_flags
,
189 ip_route_mask_flags_cmd
,
190 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
192 "Establish static routes\n"
193 "IP destination prefix\n"
194 "IP destination prefix mask\n"
195 "IP gateway address\n"
196 "IP gateway interface name\n"
197 "Emit an ICMP unreachable when matched\n"
198 "Silently discard pkts when matched\n")
200 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
);
203 DEFUN (ip_route_mask_flags2
,
204 ip_route_mask_flags2_cmd
,
205 "ip route A.B.C.D A.B.C.D (reject|blackhole)",
207 "Establish static routes\n"
208 "IP destination prefix\n"
209 "IP destination prefix mask\n"
210 "Emit an ICMP unreachable when matched\n"
211 "Silently discard pkts when matched\n")
213 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
);
216 /* Distance option value. */
217 DEFUN (ip_route_distance
,
218 ip_route_distance_cmd
,
219 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
221 "Establish static routes\n"
222 "IP destination prefix (e.g. 10.0.0.0/8)\n"
223 "IP gateway address\n"
224 "IP gateway interface name\n"
226 "Distance value for this route\n")
228 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, argv
[1], NULL
, argv
[2]);
231 DEFUN (ip_route_flags_distance
,
232 ip_route_flags_distance_cmd
,
233 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
235 "Establish static routes\n"
236 "IP destination prefix (e.g. 10.0.0.0/8)\n"
237 "IP gateway address\n"
238 "IP gateway interface name\n"
239 "Emit an ICMP unreachable when matched\n"
240 "Silently discard pkts when matched\n"
241 "Distance value for this route\n")
243 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, argv
[1], argv
[2], argv
[3]);
246 DEFUN (ip_route_flags_distance2
,
247 ip_route_flags_distance2_cmd
,
248 "ip route A.B.C.D/M (reject|blackhole) <1-255>",
250 "Establish static routes\n"
251 "IP destination prefix (e.g. 10.0.0.0/8)\n"
252 "Emit an ICMP unreachable when matched\n"
253 "Silently discard pkts when matched\n"
254 "Distance value for this route\n")
256 return zebra_static_ipv4 (vty
, 1, argv
[0], NULL
, NULL
, argv
[1], argv
[2]);
259 DEFUN (ip_route_mask_distance
,
260 ip_route_mask_distance_cmd
,
261 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
263 "Establish static routes\n"
264 "IP destination prefix\n"
265 "IP destination prefix mask\n"
266 "IP gateway address\n"
267 "IP gateway interface name\n"
269 "Distance value for this route\n")
271 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3]);
274 DEFUN (ip_route_mask_flags_distance
,
275 ip_route_mask_flags_distance_cmd
,
276 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
278 "Establish static routes\n"
279 "IP destination prefix\n"
280 "IP destination prefix mask\n"
281 "IP gateway address\n"
282 "IP gateway interface name\n"
283 "Distance value for this route\n"
284 "Emit an ICMP unreachable when matched\n"
285 "Silently discard pkts when matched\n")
287 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4]);
290 DEFUN (ip_route_mask_flags_distance2
,
291 ip_route_mask_flags_distance2_cmd
,
292 "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
294 "Establish static routes\n"
295 "IP destination prefix\n"
296 "IP destination prefix mask\n"
297 "Distance value for this route\n"
298 "Emit an ICMP unreachable when matched\n"
299 "Silently discard pkts when matched\n")
301 return zebra_static_ipv4 (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3]);
306 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
309 "Establish static routes\n"
310 "IP destination prefix (e.g. 10.0.0.0/8)\n"
311 "IP gateway address\n"
312 "IP gateway interface name\n"
315 return zebra_static_ipv4 (vty
, 0, argv
[0], NULL
, argv
[1], NULL
, NULL
);
319 no_ip_route_flags_cmd
,
320 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
323 "Establish static routes\n"
324 "IP destination prefix (e.g. 10.0.0.0/8)\n"
325 "IP gateway address\n"
326 "IP gateway interface name\n"
327 "Emit an ICMP unreachable when matched\n"
328 "Silently discard pkts when matched\n")
330 DEFUN (no_ip_route_flags2
,
331 no_ip_route_flags2_cmd
,
332 "no ip route A.B.C.D/M (reject|blackhole)",
335 "Establish static routes\n"
336 "IP destination prefix (e.g. 10.0.0.0/8)\n"
337 "Emit an ICMP unreachable when matched\n"
338 "Silently discard pkts when matched\n")
340 return zebra_static_ipv4 (vty
, 0, argv
[0], NULL
, NULL
, NULL
, NULL
);
343 DEFUN (no_ip_route_mask
,
344 no_ip_route_mask_cmd
,
345 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
348 "Establish static routes\n"
349 "IP destination prefix\n"
350 "IP destination prefix mask\n"
351 "IP gateway address\n"
352 "IP gateway interface name\n"
355 return zebra_static_ipv4 (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
);
358 ALIAS (no_ip_route_mask
,
359 no_ip_route_mask_flags_cmd
,
360 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
363 "Establish static routes\n"
364 "IP destination prefix\n"
365 "IP destination prefix mask\n"
366 "IP gateway address\n"
367 "IP gateway interface name\n"
368 "Emit an ICMP unreachable when matched\n"
369 "Silently discard pkts when matched\n")
371 DEFUN (no_ip_route_mask_flags2
,
372 no_ip_route_mask_flags2_cmd
,
373 "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
376 "Establish static routes\n"
377 "IP destination prefix\n"
378 "IP destination prefix mask\n"
379 "Emit an ICMP unreachable when matched\n"
380 "Silently discard pkts when matched\n")
382 return zebra_static_ipv4 (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
);
385 DEFUN (no_ip_route_distance
,
386 no_ip_route_distance_cmd
,
387 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
390 "Establish static routes\n"
391 "IP destination prefix (e.g. 10.0.0.0/8)\n"
392 "IP gateway address\n"
393 "IP gateway interface name\n"
395 "Distance value for this route\n")
397 return zebra_static_ipv4 (vty
, 0, argv
[0], NULL
, argv
[1], NULL
, argv
[2]);
400 DEFUN (no_ip_route_flags_distance
,
401 no_ip_route_flags_distance_cmd
,
402 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
405 "Establish static routes\n"
406 "IP destination prefix (e.g. 10.0.0.0/8)\n"
407 "IP gateway address\n"
408 "IP gateway interface name\n"
409 "Emit an ICMP unreachable when matched\n"
410 "Silently discard pkts when matched\n"
411 "Distance value for this route\n")
413 return zebra_static_ipv4 (vty
, 0, argv
[0], NULL
, argv
[1], argv
[2], argv
[3]);
416 DEFUN (no_ip_route_flags_distance2
,
417 no_ip_route_flags_distance2_cmd
,
418 "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
421 "Establish static routes\n"
422 "IP destination prefix (e.g. 10.0.0.0/8)\n"
423 "Emit an ICMP unreachable when matched\n"
424 "Silently discard pkts when matched\n"
425 "Distance value for this route\n")
427 return zebra_static_ipv4 (vty
, 0, argv
[0], NULL
, NULL
, argv
[1], argv
[2]);
430 DEFUN (no_ip_route_mask_distance
,
431 no_ip_route_mask_distance_cmd
,
432 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
435 "Establish static routes\n"
436 "IP destination prefix\n"
437 "IP destination prefix mask\n"
438 "IP gateway address\n"
439 "IP gateway interface name\n"
441 "Distance value for this route\n")
443 return zebra_static_ipv4 (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3]);
446 DEFUN (no_ip_route_mask_flags_distance
,
447 no_ip_route_mask_flags_distance_cmd
,
448 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
451 "Establish static routes\n"
452 "IP destination prefix\n"
453 "IP destination prefix mask\n"
454 "IP gateway address\n"
455 "IP gateway interface name\n"
456 "Emit an ICMP unreachable when matched\n"
457 "Silently discard pkts when matched\n"
458 "Distance value for this route\n")
460 return zebra_static_ipv4 (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4]);
463 DEFUN (no_ip_route_mask_flags_distance2
,
464 no_ip_route_mask_flags_distance2_cmd
,
465 "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
468 "Establish static routes\n"
469 "IP destination prefix\n"
470 "IP destination prefix mask\n"
471 "Emit an ICMP unreachable when matched\n"
472 "Silently discard pkts when matched\n"
473 "Distance value for this route\n")
475 return zebra_static_ipv4 (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3]);
478 char *proto_rm
[AFI_MAX
][ZEBRA_ROUTE_MAX
+1]; /* "any" == ZEBRA_ROUTE_MAX */
482 "ip protocol PROTO route-map ROUTE-MAP",
484 "Apply route map to PROTO\n"
490 if (strcasecmp(argv
[0], "any") == 0)
493 i
= proto_name2num(argv
[0]);
496 vty_out (vty
, "invalid protocol name \"%s\"%s", argv
[0] ? argv
[0] : "",
500 if (proto_rm
[AFI_IP
][i
])
501 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
502 proto_rm
[AFI_IP
][i
] = XSTRDUP (MTYPE_ROUTE_MAP_NAME
, argv
[1]);
506 DEFUN (no_ip_protocol
,
508 "no ip protocol PROTO",
510 "Remove route map from PROTO\n"
515 if (strcasecmp(argv
[0], "any") == 0)
518 i
= proto_name2num(argv
[0]);
521 vty_out (vty
, "invalid protocol name \"%s\"%s", argv
[0] ? argv
[0] : "",
525 if (proto_rm
[AFI_IP
][i
])
526 XFREE (MTYPE_ROUTE_MAP_NAME
, proto_rm
[AFI_IP
][i
]);
527 proto_rm
[AFI_IP
][i
] = NULL
;
531 /* New RIB. Detailed information for IPv4 route. */
533 vty_show_ip_route_detail (struct vty
*vty
, struct route_node
*rn
)
536 struct nexthop
*nexthop
;
538 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
540 vty_out (vty
, "Routing entry for %s/%d%s",
541 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
543 vty_out (vty
, " Known via \"%s\"", zebra_route_string (rib
->type
));
544 vty_out (vty
, ", distance %d, metric %d", rib
->distance
, rib
->metric
);
545 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
))
546 vty_out (vty
, ", best");
548 vty_out (vty
, ", refcnt %ld", rib
->refcnt
);
549 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
550 vty_out (vty
, ", blackhole");
551 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
552 vty_out (vty
, ", reject");
553 vty_out (vty
, "%s", VTY_NEWLINE
);
555 #define ONE_DAY_SECOND 60*60*24
556 #define ONE_WEEK_SECOND 60*60*24*7
557 if (rib
->type
== ZEBRA_ROUTE_RIP
558 || rib
->type
== ZEBRA_ROUTE_OSPF
559 || rib
->type
== ZEBRA_ROUTE_ISIS
560 || rib
->type
== ZEBRA_ROUTE_BGP
)
565 uptime
= time (NULL
);
566 uptime
-= rib
->uptime
;
567 tm
= gmtime (&uptime
);
569 vty_out (vty
, " Last update ");
571 if (uptime
< ONE_DAY_SECOND
)
572 vty_out (vty
, "%02d:%02d:%02d",
573 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
574 else if (uptime
< ONE_WEEK_SECOND
)
575 vty_out (vty
, "%dd%02dh%02dm",
576 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
578 vty_out (vty
, "%02dw%dd%02dh",
580 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
581 vty_out (vty
, " ago%s", VTY_NEWLINE
);
584 for (nexthop
= rib
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
589 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
) ? '*' : ' ');
591 switch (nexthop
->type
)
593 case NEXTHOP_TYPE_IPV4
:
594 case NEXTHOP_TYPE_IPV4_IFINDEX
:
595 vty_out (vty
, " %s", inet_ntoa (nexthop
->gate
.ipv4
));
596 if (nexthop
->ifindex
)
597 vty_out (vty
, ", via %s", ifindex2ifname (nexthop
->ifindex
));
599 case NEXTHOP_TYPE_IFINDEX
:
600 vty_out (vty
, " directly connected, %s",
601 ifindex2ifname (nexthop
->ifindex
));
603 case NEXTHOP_TYPE_IFNAME
:
604 vty_out (vty
, " directly connected, %s", nexthop
->ifname
);
606 case NEXTHOP_TYPE_BLACKHOLE
:
607 vty_out (vty
, " directly connected, Null0");
612 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
613 vty_out (vty
, " inactive");
615 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
617 vty_out (vty
, " (recursive");
619 switch (nexthop
->rtype
)
621 case NEXTHOP_TYPE_IPV4
:
622 case NEXTHOP_TYPE_IPV4_IFINDEX
:
623 vty_out (vty
, " via %s)", inet_ntoa (nexthop
->rgate
.ipv4
));
625 case NEXTHOP_TYPE_IFINDEX
:
626 case NEXTHOP_TYPE_IFNAME
:
627 vty_out (vty
, " is directly connected, %s)",
628 ifindex2ifname (nexthop
->rifindex
));
634 switch (nexthop
->type
)
636 case NEXTHOP_TYPE_IPV4
:
637 case NEXTHOP_TYPE_IPV4_IFINDEX
:
638 case NEXTHOP_TYPE_IPV4_IFNAME
:
639 if (nexthop
->src
.ipv4
.s_addr
)
641 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, addrstr
,
643 vty_out (vty
, ", src %s", addrstr
);
647 case NEXTHOP_TYPE_IPV6
:
648 case NEXTHOP_TYPE_IPV6_IFINDEX
:
649 case NEXTHOP_TYPE_IPV6_IFNAME
:
650 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
))
652 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, addrstr
,
654 vty_out (vty
, ", src %s", addrstr
);
657 #endif /* HAVE_IPV6 */
661 vty_out (vty
, "%s", VTY_NEWLINE
);
663 vty_out (vty
, "%s", VTY_NEWLINE
);
668 vty_show_ip_route (struct vty
*vty
, struct route_node
*rn
, struct rib
*rib
)
670 struct nexthop
*nexthop
;
674 /* Nexthop information. */
675 for (nexthop
= rib
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
677 if (nexthop
== rib
->nexthop
)
679 /* Prefix information. */
680 len
= vty_out (vty
, "%c%c%c %s/%d",
681 zebra_route_char (rib
->type
),
682 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
)
684 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
686 inet_ntop (AF_INET
, &rn
->p
.u
.prefix
, buf
, BUFSIZ
),
689 /* Distance and metric display. */
690 if (rib
->type
!= ZEBRA_ROUTE_CONNECT
691 && rib
->type
!= ZEBRA_ROUTE_KERNEL
)
692 len
+= vty_out (vty
, " [%d/%d]", rib
->distance
,
696 vty_out (vty
, " %c%*c",
697 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
701 switch (nexthop
->type
)
703 case NEXTHOP_TYPE_IPV4
:
704 case NEXTHOP_TYPE_IPV4_IFINDEX
:
705 vty_out (vty
, " via %s", inet_ntoa (nexthop
->gate
.ipv4
));
706 if (nexthop
->ifindex
)
707 vty_out (vty
, ", %s", ifindex2ifname (nexthop
->ifindex
));
709 case NEXTHOP_TYPE_IFINDEX
:
710 vty_out (vty
, " is directly connected, %s",
711 ifindex2ifname (nexthop
->ifindex
));
713 case NEXTHOP_TYPE_IFNAME
:
714 vty_out (vty
, " is directly connected, %s", nexthop
->ifname
);
716 case NEXTHOP_TYPE_BLACKHOLE
:
717 vty_out (vty
, " is directly connected, Null0");
722 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
723 vty_out (vty
, " inactive");
725 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
727 vty_out (vty
, " (recursive");
729 switch (nexthop
->rtype
)
731 case NEXTHOP_TYPE_IPV4
:
732 case NEXTHOP_TYPE_IPV4_IFINDEX
:
733 vty_out (vty
, " via %s)", inet_ntoa (nexthop
->rgate
.ipv4
));
735 case NEXTHOP_TYPE_IFINDEX
:
736 case NEXTHOP_TYPE_IFNAME
:
737 vty_out (vty
, " is directly connected, %s)",
738 ifindex2ifname (nexthop
->rifindex
));
744 switch (nexthop
->type
)
746 case NEXTHOP_TYPE_IPV4
:
747 case NEXTHOP_TYPE_IPV4_IFINDEX
:
748 case NEXTHOP_TYPE_IPV4_IFNAME
:
749 if (nexthop
->src
.ipv4
.s_addr
)
751 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, buf
, sizeof buf
))
752 vty_out (vty
, ", src %s", buf
);
756 case NEXTHOP_TYPE_IPV6
:
757 case NEXTHOP_TYPE_IPV6_IFINDEX
:
758 case NEXTHOP_TYPE_IPV6_IFNAME
:
759 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
))
761 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, buf
, sizeof buf
))
762 vty_out (vty
, ", src %s", buf
);
765 #endif /* HAVE_IPV6 */
770 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
771 vty_out (vty
, ", bh");
772 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
773 vty_out (vty
, ", rej");
775 if (rib
->type
== ZEBRA_ROUTE_RIP
776 || rib
->type
== ZEBRA_ROUTE_OSPF
777 || rib
->type
== ZEBRA_ROUTE_ISIS
778 || rib
->type
== ZEBRA_ROUTE_BGP
)
783 uptime
= time (NULL
);
784 uptime
-= rib
->uptime
;
785 tm
= gmtime (&uptime
);
787 #define ONE_DAY_SECOND 60*60*24
788 #define ONE_WEEK_SECOND 60*60*24*7
790 if (uptime
< ONE_DAY_SECOND
)
791 vty_out (vty
, ", %02d:%02d:%02d",
792 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
793 else if (uptime
< ONE_WEEK_SECOND
)
794 vty_out (vty
, ", %dd%02dh%02dm",
795 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
797 vty_out (vty
, ", %02dw%dd%02dh",
799 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
801 vty_out (vty
, "%s", VTY_NEWLINE
);
805 DEFUN (show_ip_route
,
810 "IP routing table\n")
812 struct route_table
*table
;
813 struct route_node
*rn
;
817 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
821 /* Show all IPv4 routes. */
822 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
823 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
827 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
830 vty_show_ip_route (vty
, rn
, rib
);
835 DEFUN (show_ip_route_prefix_longer
,
836 show_ip_route_prefix_longer_cmd
,
837 "show ip route A.B.C.D/M longer-prefixes",
841 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
842 "Show route matching the specified Network/Mask pair only\n")
844 struct route_table
*table
;
845 struct route_node
*rn
;
851 ret
= str2prefix (argv
[0], &p
);
854 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
858 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
862 /* Show matched type IPv4 routes. */
863 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
864 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
865 if (prefix_match (&p
, &rn
->p
))
869 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
872 vty_show_ip_route (vty
, rn
, rib
);
877 DEFUN (show_ip_route_supernets
,
878 show_ip_route_supernets_cmd
,
879 "show ip route supernets-only",
883 "Show supernet entries only\n")
885 struct route_table
*table
;
886 struct route_node
*rn
;
891 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
895 /* Show matched type IPv4 routes. */
896 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
897 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
899 addr
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
901 if ((IN_CLASSC (addr
) && rn
->p
.prefixlen
< 24)
902 || (IN_CLASSB (addr
) && rn
->p
.prefixlen
< 16)
903 || (IN_CLASSA (addr
) && rn
->p
.prefixlen
< 8))
907 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
910 vty_show_ip_route (vty
, rn
, rib
);
916 DEFUN (show_ip_route_protocol
,
917 show_ip_route_protocol_cmd
,
918 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA
,
922 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
)
925 struct route_table
*table
;
926 struct route_node
*rn
;
930 type
= proto_redistnum (AFI_IP
, argv
[0]);
933 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
937 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
941 /* Show matched type IPv4 routes. */
942 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
943 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
944 if (rib
->type
== type
)
948 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
951 vty_show_ip_route (vty
, rn
, rib
);
956 DEFUN (show_ip_route_addr
,
957 show_ip_route_addr_cmd
,
958 "show ip route A.B.C.D",
962 "Network in the IP routing table to display\n")
965 struct prefix_ipv4 p
;
966 struct route_table
*table
;
967 struct route_node
*rn
;
969 ret
= str2prefix_ipv4 (argv
[0], &p
);
972 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
976 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
980 rn
= route_node_match (table
, (struct prefix
*) &p
);
983 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
987 vty_show_ip_route_detail (vty
, rn
);
989 route_unlock_node (rn
);
994 DEFUN (show_ip_route_prefix
,
995 show_ip_route_prefix_cmd
,
996 "show ip route A.B.C.D/M",
1000 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
1003 struct prefix_ipv4 p
;
1004 struct route_table
*table
;
1005 struct route_node
*rn
;
1007 ret
= str2prefix_ipv4 (argv
[0], &p
);
1010 vty_out (vty
, "%% Malformed IPv4 address%s", VTY_NEWLINE
);
1014 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
1018 rn
= route_node_match (table
, (struct prefix
*) &p
);
1019 if (! rn
|| rn
->p
.prefixlen
!= p
.prefixlen
)
1021 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
1025 vty_show_ip_route_detail (vty
, rn
);
1027 route_unlock_node (rn
);
1033 vty_show_ip_route_summary (struct vty
*vty
, struct route_table
*table
)
1035 struct route_node
*rn
;
1037 struct nexthop
*nexthop
;
1038 #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
1039 #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
1040 u_int32_t rib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1041 u_int32_t fib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1044 memset (&rib_cnt
, 0, sizeof(rib_cnt
));
1045 memset (&fib_cnt
, 0, sizeof(fib_cnt
));
1046 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
1047 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1048 for (nexthop
= rib
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
1050 rib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1051 rib_cnt
[rib
->type
]++;
1052 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
))
1054 fib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1055 fib_cnt
[rib
->type
]++;
1057 if (rib
->type
== ZEBRA_ROUTE_BGP
&&
1058 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_IBGP
))
1060 rib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1061 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
))
1062 fib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1066 vty_out (vty
, "%-20s %-20s %-20s %s",
1067 "Route Source", "Routes", "FIB", VTY_NEWLINE
);
1069 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
1073 if (i
== ZEBRA_ROUTE_BGP
)
1075 vty_out (vty
, "%-20s %-20d %-20d %s", "ebgp",
1076 rib_cnt
[ZEBRA_ROUTE_BGP
] - rib_cnt
[ZEBRA_ROUTE_IBGP
],
1077 fib_cnt
[ZEBRA_ROUTE_BGP
] - fib_cnt
[ZEBRA_ROUTE_IBGP
],
1079 vty_out (vty
, "%-20s %-20d %-20d %s", "ibgp",
1080 rib_cnt
[ZEBRA_ROUTE_IBGP
], fib_cnt
[ZEBRA_ROUTE_IBGP
],
1084 vty_out (vty
, "%-20s %-20d %-20d %s", zebra_route_string(i
),
1085 rib_cnt
[i
], fib_cnt
[i
], VTY_NEWLINE
);
1089 vty_out (vty
, "------%s", VTY_NEWLINE
);
1090 vty_out (vty
, "%-20s %-20d %-20d %s", "Totals", rib_cnt
[ZEBRA_ROUTE_TOTAL
],
1091 fib_cnt
[ZEBRA_ROUTE_TOTAL
], VTY_NEWLINE
);
1094 /* Show route summary. */
1095 DEFUN (show_ip_route_summary
,
1096 show_ip_route_summary_cmd
,
1097 "show ip route summary",
1100 "IP routing table\n"
1101 "Summary of all routes\n")
1103 struct route_table
*table
;
1105 table
= vrf_table (AFI_IP
, SAFI_UNICAST
, 0);
1109 vty_show_ip_route_summary (vty
, table
);
1114 /* Write IPv4 static route configuration. */
1116 static_config_ipv4 (struct vty
*vty
)
1118 struct route_node
*rn
;
1119 struct static_ipv4
*si
;
1120 struct route_table
*stable
;
1126 stable
= vrf_static_table (AFI_IP
, SAFI_UNICAST
, 0);
1130 for (rn
= route_top (stable
); rn
; rn
= route_next (rn
))
1131 for (si
= rn
->info
; si
; si
= si
->next
)
1133 vty_out (vty
, "ip route %s/%d", inet_ntoa (rn
->p
.u
.prefix4
),
1138 case STATIC_IPV4_GATEWAY
:
1139 vty_out (vty
, " %s", inet_ntoa (si
->gate
.ipv4
));
1141 case STATIC_IPV4_IFNAME
:
1142 vty_out (vty
, " %s", si
->gate
.ifname
);
1144 case STATIC_IPV4_BLACKHOLE
:
1145 vty_out (vty
, " Null0");
1149 /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
1150 if (si
->type
!= STATIC_IPV4_BLACKHOLE
)
1152 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_REJECT
))
1153 vty_out (vty
, " %s", "reject");
1155 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_BLACKHOLE
))
1156 vty_out (vty
, " %s", "blackhole");
1159 if (si
->distance
!= ZEBRA_STATIC_DISTANCE_DEFAULT
)
1160 vty_out (vty
, " %d", si
->distance
);
1162 vty_out (vty
, "%s", VTY_NEWLINE
);
1169 DEFUN (show_ip_protocol
,
1170 show_ip_protocol_cmd
,
1174 "IP protocol filtering status\n")
1178 vty_out(vty
, "Protocol : route-map %s", VTY_NEWLINE
);
1179 vty_out(vty
, "------------------------%s", VTY_NEWLINE
);
1180 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
1182 if (proto_rm
[AFI_IP
][i
])
1183 vty_out (vty
, "%-10s : %-10s%s", zebra_route_string(i
),
1184 proto_rm
[AFI_IP
][i
],
1187 vty_out (vty
, "%-10s : none%s", zebra_route_string(i
), VTY_NEWLINE
);
1189 if (proto_rm
[AFI_IP
][i
])
1190 vty_out (vty
, "%-10s : %-10s%s", "any", proto_rm
[AFI_IP
][i
],
1193 vty_out (vty
, "%-10s : none%s", "any", VTY_NEWLINE
);
1200 /* General fucntion for IPv6 static route. */
1202 static_ipv6_func (struct vty
*vty
, int add_cmd
, const char *dest_str
,
1203 const char *gate_str
, const char *ifname
,
1204 const char *flag_str
, const char *distance_str
)
1209 struct in6_addr
*gate
= NULL
;
1210 struct in6_addr gate_addr
;
1215 ret
= str2prefix (dest_str
, &p
);
1218 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
1222 /* Apply mask for given prefix. */
1227 switch(flag_str
[0]) {
1230 SET_FLAG (flag
, ZEBRA_FLAG_REJECT
);
1234 SET_FLAG (flag
, ZEBRA_FLAG_BLACKHOLE
);
1237 vty_out (vty
, "%% Malformed flag %s %s", flag_str
, VTY_NEWLINE
);
1242 /* Administrative distance. */
1244 distance
= atoi (distance_str
);
1246 distance
= ZEBRA_STATIC_DISTANCE_DEFAULT
;
1248 /* When gateway is valid IPv6 addrees, then gate is treated as
1249 nexthop address other case gate is treated as interface name. */
1250 ret
= inet_pton (AF_INET6
, gate_str
, &gate_addr
);
1254 /* When ifname is specified. It must be come with gateway
1258 vty_out (vty
, "%% Malformed address%s", VTY_NEWLINE
);
1261 type
= STATIC_IPV6_GATEWAY_IFNAME
;
1268 type
= STATIC_IPV6_GATEWAY
;
1273 type
= STATIC_IPV6_IFNAME
;
1279 static_add_ipv6 (&p
, type
, gate
, ifname
, flag
, distance
, table
);
1281 static_delete_ipv6 (&p
, type
, gate
, ifname
, distance
, table
);
1288 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
1290 "Establish static routes\n"
1291 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1292 "IPv6 gateway address\n"
1293 "IPv6 gateway interface name\n")
1295 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, NULL
);
1298 DEFUN (ipv6_route_flags
,
1299 ipv6_route_flags_cmd
,
1300 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
1302 "Establish static routes\n"
1303 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1304 "IPv6 gateway address\n"
1305 "IPv6 gateway interface name\n"
1306 "Emit an ICMP unreachable when matched\n"
1307 "Silently discard pkts when matched\n")
1309 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], NULL
);
1312 DEFUN (ipv6_route_ifname
,
1313 ipv6_route_ifname_cmd
,
1314 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
1316 "Establish static routes\n"
1317 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1318 "IPv6 gateway address\n"
1319 "IPv6 gateway interface name\n")
1321 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, NULL
);
1324 DEFUN (ipv6_route_ifname_flags
,
1325 ipv6_route_ifname_flags_cmd
,
1326 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
1328 "Establish static routes\n"
1329 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1330 "IPv6 gateway address\n"
1331 "IPv6 gateway interface name\n"
1332 "Emit an ICMP unreachable when matched\n"
1333 "Silently discard pkts when matched\n")
1335 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], NULL
);
1338 DEFUN (ipv6_route_pref
,
1339 ipv6_route_pref_cmd
,
1340 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
1342 "Establish static routes\n"
1343 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1344 "IPv6 gateway address\n"
1345 "IPv6 gateway interface name\n"
1346 "Distance value for this prefix\n")
1348 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, NULL
, argv
[2]);
1351 DEFUN (ipv6_route_flags_pref
,
1352 ipv6_route_flags_pref_cmd
,
1353 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
1355 "Establish static routes\n"
1356 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1357 "IPv6 gateway address\n"
1358 "IPv6 gateway interface name\n"
1359 "Emit an ICMP unreachable when matched\n"
1360 "Silently discard pkts when matched\n"
1361 "Distance value for this prefix\n")
1363 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], NULL
, argv
[2], argv
[3]);
1366 DEFUN (ipv6_route_ifname_pref
,
1367 ipv6_route_ifname_pref_cmd
,
1368 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
1370 "Establish static routes\n"
1371 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1372 "IPv6 gateway address\n"
1373 "IPv6 gateway interface name\n"
1374 "Distance value for this prefix\n")
1376 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], NULL
, argv
[3]);
1379 DEFUN (ipv6_route_ifname_flags_pref
,
1380 ipv6_route_ifname_flags_pref_cmd
,
1381 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
1383 "Establish static routes\n"
1384 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1385 "IPv6 gateway address\n"
1386 "IPv6 gateway interface name\n"
1387 "Emit an ICMP unreachable when matched\n"
1388 "Silently discard pkts when matched\n"
1389 "Distance value for this prefix\n")
1391 return static_ipv6_func (vty
, 1, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4]);
1394 DEFUN (no_ipv6_route
,
1396 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
1399 "Establish static routes\n"
1400 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1401 "IPv6 gateway address\n"
1402 "IPv6 gateway interface name\n")
1404 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, NULL
);
1407 ALIAS (no_ipv6_route
,
1408 no_ipv6_route_flags_cmd
,
1409 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
1412 "Establish static routes\n"
1413 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1414 "IPv6 gateway address\n"
1415 "IPv6 gateway interface name\n"
1416 "Emit an ICMP unreachable when matched\n"
1417 "Silently discard pkts when matched\n")
1419 DEFUN (no_ipv6_route_ifname
,
1420 no_ipv6_route_ifname_cmd
,
1421 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
1424 "Establish static routes\n"
1425 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1426 "IPv6 gateway address\n"
1427 "IPv6 gateway interface name\n")
1429 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, NULL
);
1432 ALIAS (no_ipv6_route_ifname
,
1433 no_ipv6_route_ifname_flags_cmd
,
1434 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
1437 "Establish static routes\n"
1438 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1439 "IPv6 gateway address\n"
1440 "IPv6 gateway interface name\n"
1441 "Emit an ICMP unreachable when matched\n"
1442 "Silently discard pkts when matched\n")
1444 DEFUN (no_ipv6_route_pref
,
1445 no_ipv6_route_pref_cmd
,
1446 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
1449 "Establish static routes\n"
1450 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1451 "IPv6 gateway address\n"
1452 "IPv6 gateway interface name\n"
1453 "Distance value for this prefix\n")
1455 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, NULL
, argv
[2]);
1458 DEFUN (no_ipv6_route_flags_pref
,
1459 no_ipv6_route_flags_pref_cmd
,
1460 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
1463 "Establish static routes\n"
1464 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1465 "IPv6 gateway address\n"
1466 "IPv6 gateway interface name\n"
1467 "Emit an ICMP unreachable when matched\n"
1468 "Silently discard pkts when matched\n"
1469 "Distance value for this prefix\n")
1471 /* We do not care about argv[2] */
1472 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], NULL
, argv
[2], argv
[3]);
1475 DEFUN (no_ipv6_route_ifname_pref
,
1476 no_ipv6_route_ifname_pref_cmd
,
1477 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
1480 "Establish static routes\n"
1481 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1482 "IPv6 gateway address\n"
1483 "IPv6 gateway interface name\n"
1484 "Distance value for this prefix\n")
1486 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], NULL
, argv
[3]);
1489 DEFUN (no_ipv6_route_ifname_flags_pref
,
1490 no_ipv6_route_ifname_flags_pref_cmd
,
1491 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
1494 "Establish static routes\n"
1495 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
1496 "IPv6 gateway address\n"
1497 "IPv6 gateway interface name\n"
1498 "Emit an ICMP unreachable when matched\n"
1499 "Silently discard pkts when matched\n"
1500 "Distance value for this prefix\n")
1502 return static_ipv6_func (vty
, 0, argv
[0], argv
[1], argv
[2], argv
[3], argv
[4]);
1505 /* New RIB. Detailed information for IPv6 route. */
1507 vty_show_ipv6_route_detail (struct vty
*vty
, struct route_node
*rn
)
1510 struct nexthop
*nexthop
;
1513 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1515 vty_out (vty
, "Routing entry for %s/%d%s",
1516 inet_ntop (AF_INET6
, &rn
->p
.u
.prefix6
, buf
, BUFSIZ
),
1519 vty_out (vty
, " Known via \"%s\"", zebra_route_string (rib
->type
));
1520 vty_out (vty
, ", distance %d, metric %d", rib
->distance
, rib
->metric
);
1521 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
))
1522 vty_out (vty
, ", best");
1524 vty_out (vty
, ", refcnt %ld", rib
->refcnt
);
1525 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
1526 vty_out (vty
, ", blackhole");
1527 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
1528 vty_out (vty
, ", reject");
1529 vty_out (vty
, "%s", VTY_NEWLINE
);
1531 #define ONE_DAY_SECOND 60*60*24
1532 #define ONE_WEEK_SECOND 60*60*24*7
1533 if (rib
->type
== ZEBRA_ROUTE_RIPNG
1534 || rib
->type
== ZEBRA_ROUTE_OSPF6
1535 || rib
->type
== ZEBRA_ROUTE_ISIS
1536 || rib
->type
== ZEBRA_ROUTE_BGP
)
1541 uptime
= time (NULL
);
1542 uptime
-= rib
->uptime
;
1543 tm
= gmtime (&uptime
);
1545 vty_out (vty
, " Last update ");
1547 if (uptime
< ONE_DAY_SECOND
)
1548 vty_out (vty
, "%02d:%02d:%02d",
1549 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
1550 else if (uptime
< ONE_WEEK_SECOND
)
1551 vty_out (vty
, "%dd%02dh%02dm",
1552 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
1554 vty_out (vty
, "%02dw%dd%02dh",
1556 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
1557 vty_out (vty
, " ago%s", VTY_NEWLINE
);
1560 for (nexthop
= rib
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
1562 vty_out (vty
, " %c",
1563 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
) ? '*' : ' ');
1565 switch (nexthop
->type
)
1567 case NEXTHOP_TYPE_IPV6
:
1568 case NEXTHOP_TYPE_IPV6_IFINDEX
:
1569 case NEXTHOP_TYPE_IPV6_IFNAME
:
1570 vty_out (vty
, " %s",
1571 inet_ntop (AF_INET6
, &nexthop
->gate
.ipv6
, buf
, BUFSIZ
));
1572 if (nexthop
->type
== NEXTHOP_TYPE_IPV6_IFNAME
)
1573 vty_out (vty
, ", %s", nexthop
->ifname
);
1574 else if (nexthop
->ifindex
)
1575 vty_out (vty
, ", via %s", ifindex2ifname (nexthop
->ifindex
));
1577 case NEXTHOP_TYPE_IFINDEX
:
1578 vty_out (vty
, " directly connected, %s",
1579 ifindex2ifname (nexthop
->ifindex
));
1581 case NEXTHOP_TYPE_IFNAME
:
1582 vty_out (vty
, " directly connected, %s",
1588 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
1589 vty_out (vty
, " inactive");
1591 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
1593 vty_out (vty
, " (recursive");
1595 switch (nexthop
->rtype
)
1597 case NEXTHOP_TYPE_IPV6
:
1598 case NEXTHOP_TYPE_IPV6_IFINDEX
:
1599 case NEXTHOP_TYPE_IPV6_IFNAME
:
1600 vty_out (vty
, " via %s)",
1601 inet_ntop (AF_INET6
, &nexthop
->rgate
.ipv6
,
1603 if (nexthop
->rifindex
)
1604 vty_out (vty
, ", %s", ifindex2ifname (nexthop
->rifindex
));
1606 case NEXTHOP_TYPE_IFINDEX
:
1607 case NEXTHOP_TYPE_IFNAME
:
1608 vty_out (vty
, " is directly connected, %s)",
1609 ifindex2ifname (nexthop
->rifindex
));
1615 vty_out (vty
, "%s", VTY_NEWLINE
);
1617 vty_out (vty
, "%s", VTY_NEWLINE
);
1622 vty_show_ipv6_route (struct vty
*vty
, struct route_node
*rn
,
1625 struct nexthop
*nexthop
;
1629 /* Nexthop information. */
1630 for (nexthop
= rib
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
1632 if (nexthop
== rib
->nexthop
)
1634 /* Prefix information. */
1635 len
= vty_out (vty
, "%c%c%c %s/%d",
1636 zebra_route_char (rib
->type
),
1637 CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_SELECTED
)
1639 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
1641 inet_ntop (AF_INET6
, &rn
->p
.u
.prefix6
, buf
, BUFSIZ
),
1644 /* Distance and metric display. */
1645 if (rib
->type
!= ZEBRA_ROUTE_CONNECT
1646 && rib
->type
!= ZEBRA_ROUTE_KERNEL
)
1647 len
+= vty_out (vty
, " [%d/%d]", rib
->distance
,
1651 vty_out (vty
, " %c%*c",
1652 CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_FIB
)
1656 switch (nexthop
->type
)
1658 case NEXTHOP_TYPE_IPV6
:
1659 case NEXTHOP_TYPE_IPV6_IFINDEX
:
1660 case NEXTHOP_TYPE_IPV6_IFNAME
:
1661 vty_out (vty
, " via %s",
1662 inet_ntop (AF_INET6
, &nexthop
->gate
.ipv6
, buf
, BUFSIZ
));
1663 if (nexthop
->type
== NEXTHOP_TYPE_IPV6_IFNAME
)
1664 vty_out (vty
, ", %s", nexthop
->ifname
);
1665 else if (nexthop
->ifindex
)
1666 vty_out (vty
, ", %s", ifindex2ifname (nexthop
->ifindex
));
1668 case NEXTHOP_TYPE_IFINDEX
:
1669 vty_out (vty
, " is directly connected, %s",
1670 ifindex2ifname (nexthop
->ifindex
));
1672 case NEXTHOP_TYPE_IFNAME
:
1673 vty_out (vty
, " is directly connected, %s",
1679 if (! CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
1680 vty_out (vty
, " inactive");
1682 if (CHECK_FLAG (nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
1684 vty_out (vty
, " (recursive");
1686 switch (nexthop
->rtype
)
1688 case NEXTHOP_TYPE_IPV6
:
1689 case NEXTHOP_TYPE_IPV6_IFINDEX
:
1690 case NEXTHOP_TYPE_IPV6_IFNAME
:
1691 vty_out (vty
, " via %s)",
1692 inet_ntop (AF_INET6
, &nexthop
->rgate
.ipv6
,
1694 if (nexthop
->rifindex
)
1695 vty_out (vty
, ", %s", ifindex2ifname (nexthop
->rifindex
));
1697 case NEXTHOP_TYPE_IFINDEX
:
1698 case NEXTHOP_TYPE_IFNAME
:
1699 vty_out (vty
, " is directly connected, %s)",
1700 ifindex2ifname (nexthop
->rifindex
));
1707 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_BLACKHOLE
))
1708 vty_out (vty
, ", bh");
1709 if (CHECK_FLAG (rib
->flags
, ZEBRA_FLAG_REJECT
))
1710 vty_out (vty
, ", rej");
1712 if (rib
->type
== ZEBRA_ROUTE_RIPNG
1713 || rib
->type
== ZEBRA_ROUTE_OSPF6
1714 || rib
->type
== ZEBRA_ROUTE_ISIS
1715 || rib
->type
== ZEBRA_ROUTE_BGP
)
1720 uptime
= time (NULL
);
1721 uptime
-= rib
->uptime
;
1722 tm
= gmtime (&uptime
);
1724 #define ONE_DAY_SECOND 60*60*24
1725 #define ONE_WEEK_SECOND 60*60*24*7
1727 if (uptime
< ONE_DAY_SECOND
)
1728 vty_out (vty
, ", %02d:%02d:%02d",
1729 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
1730 else if (uptime
< ONE_WEEK_SECOND
)
1731 vty_out (vty
, ", %dd%02dh%02dm",
1732 tm
->tm_yday
, tm
->tm_hour
, tm
->tm_min
);
1734 vty_out (vty
, ", %02dw%dd%02dh",
1736 tm
->tm_yday
- ((tm
->tm_yday
/7) * 7), tm
->tm_hour
);
1738 vty_out (vty
, "%s", VTY_NEWLINE
);
1742 DEFUN (show_ipv6_route
,
1743 show_ipv6_route_cmd
,
1747 "IPv6 routing table\n")
1749 struct route_table
*table
;
1750 struct route_node
*rn
;
1754 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1758 /* Show all IPv6 route. */
1759 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
1760 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1764 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
1767 vty_show_ipv6_route (vty
, rn
, rib
);
1772 DEFUN (show_ipv6_route_prefix_longer
,
1773 show_ipv6_route_prefix_longer_cmd
,
1774 "show ipv6 route X:X::X:X/M longer-prefixes",
1777 "IPv6 routing table\n"
1779 "Show route matching the specified Network/Mask pair only\n")
1781 struct route_table
*table
;
1782 struct route_node
*rn
;
1788 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1792 ret
= str2prefix (argv
[0], &p
);
1795 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
1799 /* Show matched type IPv6 routes. */
1800 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
1801 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1802 if (prefix_match (&p
, &rn
->p
))
1806 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
1809 vty_show_ipv6_route (vty
, rn
, rib
);
1814 DEFUN (show_ipv6_route_protocol
,
1815 show_ipv6_route_protocol_cmd
,
1816 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA
,
1819 "IP routing table\n"
1820 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
)
1823 struct route_table
*table
;
1824 struct route_node
*rn
;
1828 type
= proto_redistnum (AFI_IP6
, argv
[0]);
1831 vty_out (vty
, "Unknown route type%s", VTY_NEWLINE
);
1835 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1839 /* Show matched type IPv6 routes. */
1840 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
1841 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1842 if (rib
->type
== type
)
1846 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
1849 vty_show_ipv6_route (vty
, rn
, rib
);
1854 DEFUN (show_ipv6_route_addr
,
1855 show_ipv6_route_addr_cmd
,
1856 "show ipv6 route X:X::X:X",
1859 "IPv6 routing table\n"
1863 struct prefix_ipv6 p
;
1864 struct route_table
*table
;
1865 struct route_node
*rn
;
1867 ret
= str2prefix_ipv6 (argv
[0], &p
);
1870 vty_out (vty
, "Malformed IPv6 address%s", VTY_NEWLINE
);
1874 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1878 rn
= route_node_match (table
, (struct prefix
*) &p
);
1881 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
1885 vty_show_ipv6_route_detail (vty
, rn
);
1887 route_unlock_node (rn
);
1892 DEFUN (show_ipv6_route_prefix
,
1893 show_ipv6_route_prefix_cmd
,
1894 "show ipv6 route X:X::X:X/M",
1897 "IPv6 routing table\n"
1901 struct prefix_ipv6 p
;
1902 struct route_table
*table
;
1903 struct route_node
*rn
;
1905 ret
= str2prefix_ipv6 (argv
[0], &p
);
1908 vty_out (vty
, "Malformed IPv6 prefix%s", VTY_NEWLINE
);
1912 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1916 rn
= route_node_match (table
, (struct prefix
*) &p
);
1917 if (! rn
|| rn
->p
.prefixlen
!= p
.prefixlen
)
1919 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
1923 vty_show_ipv6_route_detail (vty
, rn
);
1925 route_unlock_node (rn
);
1930 /* Show route summary. */
1931 DEFUN (show_ipv6_route_summary
,
1932 show_ipv6_route_summary_cmd
,
1933 "show ipv6 route summary",
1936 "IPv6 routing table\n"
1937 "Summary of all IPv6 routes\n")
1939 struct route_table
*table
;
1941 table
= vrf_table (AFI_IP6
, SAFI_UNICAST
, 0);
1945 vty_show_ip_route_summary (vty
, table
);
1951 * Show IP mroute command to dump the BGP Multicast
1954 DEFUN (show_ip_mroute
,
1959 "IP Multicast routing table\n")
1961 struct route_table
*table
;
1962 struct route_node
*rn
;
1966 table
= vrf_table (AFI_IP
, SAFI_MULTICAST
, 0);
1970 /* Show all IPv4 routes. */
1971 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
1972 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
1976 vty_out (vty
, SHOW_ROUTE_V4_HEADER
);
1979 vty_show_ip_route (vty
, rn
, rib
);
1985 * Show IPv6 mroute command.Used to dump
1986 * the Multicast routing table.
1989 DEFUN (show_ipv6_mroute
,
1990 show_ipv6_mroute_cmd
,
1994 "IPv6 Multicast routing table\n")
1996 struct route_table
*table
;
1997 struct route_node
*rn
;
2001 table
= vrf_table (AFI_IP6
, SAFI_MULTICAST
, 0);
2005 /* Show all IPv6 route. */
2006 for (rn
= route_top (table
); rn
; rn
= route_next (rn
))
2007 for (rib
= rn
->info
; rib
; rib
= rib
->next
)
2011 vty_out (vty
, SHOW_ROUTE_V6_HEADER
);
2014 vty_show_ipv6_route (vty
, rn
, rib
);
2024 /* Write IPv6 static route configuration. */
2026 static_config_ipv6 (struct vty
*vty
)
2028 struct route_node
*rn
;
2029 struct static_ipv6
*si
;
2032 struct route_table
*stable
;
2037 stable
= vrf_static_table (AFI_IP6
, SAFI_UNICAST
, 0);
2041 for (rn
= route_top (stable
); rn
; rn
= route_next (rn
))
2042 for (si
= rn
->info
; si
; si
= si
->next
)
2044 vty_out (vty
, "ipv6 route %s/%d",
2045 inet_ntop (AF_INET6
, &rn
->p
.u
.prefix6
, buf
, BUFSIZ
),
2050 case STATIC_IPV6_GATEWAY
:
2051 vty_out (vty
, " %s", inet_ntop (AF_INET6
, &si
->ipv6
, buf
, BUFSIZ
));
2053 case STATIC_IPV6_IFNAME
:
2054 vty_out (vty
, " %s", si
->ifname
);
2056 case STATIC_IPV6_GATEWAY_IFNAME
:
2057 vty_out (vty
, " %s %s",
2058 inet_ntop (AF_INET6
, &si
->ipv6
, buf
, BUFSIZ
), si
->ifname
);
2062 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_REJECT
))
2063 vty_out (vty
, " %s", "reject");
2065 if (CHECK_FLAG(si
->flags
, ZEBRA_FLAG_BLACKHOLE
))
2066 vty_out (vty
, " %s", "blackhole");
2068 if (si
->distance
!= ZEBRA_STATIC_DISTANCE_DEFAULT
)
2069 vty_out (vty
, " %d", si
->distance
);
2070 vty_out (vty
, "%s", VTY_NEWLINE
);
2076 #endif /* HAVE_IPV6 */
2078 /* Static ip route configuration write function. */
2080 zebra_ip_config (struct vty
*vty
)
2084 write
+= static_config_ipv4 (vty
);
2086 write
+= static_config_ipv6 (vty
);
2087 #endif /* HAVE_IPV6 */
2092 /* ip protocol configuration write function */
2093 static int config_write_protocol(struct vty
*vty
)
2097 for (i
=0;i
<ZEBRA_ROUTE_MAX
;i
++)
2099 if (proto_rm
[AFI_IP
][i
])
2100 vty_out (vty
, "ip protocol %s route-map %s%s", zebra_route_string(i
),
2101 proto_rm
[AFI_IP
][i
], VTY_NEWLINE
);
2103 if (proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
])
2104 vty_out (vty
, "ip protocol %s route-map %s%s", "any",
2105 proto_rm
[AFI_IP
][ZEBRA_ROUTE_MAX
], VTY_NEWLINE
);
2110 /* table node for protocol filtering */
2111 static struct cmd_node protocol_node
= { PROTOCOL_NODE
, "", 1 };
2113 /* IP node for static routes. */
2114 static struct cmd_node ip_node
= { IP_NODE
, "", 1 };
2118 zebra_vty_init (void)
2120 install_node (&ip_node
, zebra_ip_config
);
2121 install_node (&protocol_node
, config_write_protocol
);
2123 install_element (CONFIG_NODE
, &ip_protocol_cmd
);
2124 install_element (CONFIG_NODE
, &no_ip_protocol_cmd
);
2125 install_element (VIEW_NODE
, &show_ip_protocol_cmd
);
2126 install_element (ENABLE_NODE
, &show_ip_protocol_cmd
);
2127 install_element (CONFIG_NODE
, &ip_route_cmd
);
2128 install_element (CONFIG_NODE
, &ip_route_flags_cmd
);
2129 install_element (CONFIG_NODE
, &ip_route_flags2_cmd
);
2130 install_element (CONFIG_NODE
, &ip_route_mask_cmd
);
2131 install_element (CONFIG_NODE
, &ip_route_mask_flags_cmd
);
2132 install_element (CONFIG_NODE
, &ip_route_mask_flags2_cmd
);
2133 install_element (CONFIG_NODE
, &no_ip_route_cmd
);
2134 install_element (CONFIG_NODE
, &no_ip_route_flags_cmd
);
2135 install_element (CONFIG_NODE
, &no_ip_route_flags2_cmd
);
2136 install_element (CONFIG_NODE
, &no_ip_route_mask_cmd
);
2137 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_cmd
);
2138 install_element (CONFIG_NODE
, &no_ip_route_mask_flags2_cmd
);
2139 install_element (CONFIG_NODE
, &ip_route_distance_cmd
);
2140 install_element (CONFIG_NODE
, &ip_route_flags_distance_cmd
);
2141 install_element (CONFIG_NODE
, &ip_route_flags_distance2_cmd
);
2142 install_element (CONFIG_NODE
, &ip_route_mask_distance_cmd
);
2143 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance_cmd
);
2144 install_element (CONFIG_NODE
, &ip_route_mask_flags_distance2_cmd
);
2145 install_element (CONFIG_NODE
, &no_ip_route_distance_cmd
);
2146 install_element (CONFIG_NODE
, &no_ip_route_flags_distance_cmd
);
2147 install_element (CONFIG_NODE
, &no_ip_route_flags_distance2_cmd
);
2148 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance_cmd
);
2149 install_element (CONFIG_NODE
, &no_ip_route_mask_flags_distance2_cmd
);
2151 install_element (VIEW_NODE
, &show_ip_route_cmd
);
2152 install_element (VIEW_NODE
, &show_ip_route_addr_cmd
);
2153 install_element (VIEW_NODE
, &show_ip_route_prefix_cmd
);
2154 install_element (VIEW_NODE
, &show_ip_route_prefix_longer_cmd
);
2155 install_element (VIEW_NODE
, &show_ip_route_protocol_cmd
);
2156 install_element (VIEW_NODE
, &show_ip_route_supernets_cmd
);
2157 install_element (VIEW_NODE
, &show_ip_route_summary_cmd
);
2158 install_element (ENABLE_NODE
, &show_ip_route_cmd
);
2159 install_element (ENABLE_NODE
, &show_ip_route_addr_cmd
);
2160 install_element (ENABLE_NODE
, &show_ip_route_prefix_cmd
);
2161 install_element (ENABLE_NODE
, &show_ip_route_prefix_longer_cmd
);
2162 install_element (ENABLE_NODE
, &show_ip_route_protocol_cmd
);
2163 install_element (ENABLE_NODE
, &show_ip_route_supernets_cmd
);
2164 install_element (ENABLE_NODE
, &show_ip_route_summary_cmd
);
2166 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
2167 install_element (ENABLE_NODE
, &show_ip_mroute_cmd
);
2171 install_element (CONFIG_NODE
, &ipv6_route_cmd
);
2172 install_element (CONFIG_NODE
, &ipv6_route_flags_cmd
);
2173 install_element (CONFIG_NODE
, &ipv6_route_ifname_cmd
);
2174 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_cmd
);
2175 install_element (CONFIG_NODE
, &no_ipv6_route_cmd
);
2176 install_element (CONFIG_NODE
, &no_ipv6_route_flags_cmd
);
2177 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_cmd
);
2178 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_cmd
);
2179 install_element (CONFIG_NODE
, &ipv6_route_pref_cmd
);
2180 install_element (CONFIG_NODE
, &ipv6_route_flags_pref_cmd
);
2181 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_cmd
);
2182 install_element (CONFIG_NODE
, &ipv6_route_ifname_flags_pref_cmd
);
2183 install_element (CONFIG_NODE
, &no_ipv6_route_pref_cmd
);
2184 install_element (CONFIG_NODE
, &no_ipv6_route_flags_pref_cmd
);
2185 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_cmd
);
2186 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_flags_pref_cmd
);
2187 install_element (VIEW_NODE
, &show_ipv6_route_cmd
);
2188 install_element (VIEW_NODE
, &show_ipv6_route_summary_cmd
);
2189 install_element (VIEW_NODE
, &show_ipv6_route_protocol_cmd
);
2190 install_element (VIEW_NODE
, &show_ipv6_route_addr_cmd
);
2191 install_element (VIEW_NODE
, &show_ipv6_route_prefix_cmd
);
2192 install_element (VIEW_NODE
, &show_ipv6_route_prefix_longer_cmd
);
2193 install_element (ENABLE_NODE
, &show_ipv6_route_cmd
);
2194 install_element (ENABLE_NODE
, &show_ipv6_route_protocol_cmd
);
2195 install_element (ENABLE_NODE
, &show_ipv6_route_addr_cmd
);
2196 install_element (ENABLE_NODE
, &show_ipv6_route_prefix_cmd
);
2197 install_element (ENABLE_NODE
, &show_ipv6_route_prefix_longer_cmd
);
2198 install_element (ENABLE_NODE
, &show_ipv6_route_summary_cmd
);
2200 install_element (VIEW_NODE
, &show_ipv6_mroute_cmd
);
2201 install_element (ENABLE_NODE
, &show_ipv6_mroute_cmd
);
2202 #endif /* HAVE_IPV6 */