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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "zebra_memory.h"
35 #include "srcdest_table.h"
38 #include "zebra/zebra_router.h"
39 #include "zebra/zserv.h"
40 #include "zebra/zebra_vrf.h"
41 #include "zebra/zebra_mpls.h"
42 #include "zebra/zebra_rnh.h"
43 #include "zebra/redistribute.h"
44 #include "zebra/zebra_routemap.h"
46 #include "zebra/zebra_vxlan.h"
47 #ifndef VTYSH_EXTRACT_PL
48 #include "zebra/zebra_vty_clippy.c"
50 #include "zebra/zserv.h"
51 #include "zebra/router-id.h"
52 #include "zebra/ipforward.h"
53 #include "zebra/zebra_vxlan_private.h"
54 #include "zebra/zebra_pbr.h"
55 #include "zebra/zebra_nhg.h"
57 extern int allow_delete
;
59 static int do_show_ip_route(struct vty
*vty
, const char *vrf_name
, afi_t afi
,
60 safi_t safi
, bool use_fib
, bool use_json
,
62 const struct prefix
*longer_prefix_p
,
63 bool supernets_only
, int type
,
64 unsigned short ospf_instance_id
);
65 static void vty_show_ip_route_detail(struct vty
*vty
, struct route_node
*rn
,
66 int mcast
, bool use_fib
);
67 static void vty_show_ip_route_summary(struct vty
*vty
,
68 struct route_table
*table
);
69 static void vty_show_ip_route_summary_prefix(struct vty
*vty
,
70 struct route_table
*table
);
72 DEFUN (ip_multicast_mode
,
73 ip_multicast_mode_cmd
,
74 "ip multicast rpf-lookup-mode <urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix>",
77 "RPF lookup behavior\n"
78 "Lookup in unicast RIB only\n"
79 "Lookup in multicast RIB only\n"
80 "Try multicast RIB first, fall back to unicast RIB\n"
81 "Lookup both, use entry with lower distance\n"
82 "Lookup both, use entry with longer prefix\n")
84 char *mode
= argv
[3]->text
;
86 if (strmatch(mode
, "urib-only"))
87 multicast_mode_ipv4_set(MCAST_URIB_ONLY
);
88 else if (strmatch(mode
, "mrib-only"))
89 multicast_mode_ipv4_set(MCAST_MRIB_ONLY
);
90 else if (strmatch(mode
, "mrib-then-urib"))
91 multicast_mode_ipv4_set(MCAST_MIX_MRIB_FIRST
);
92 else if (strmatch(mode
, "lower-distance"))
93 multicast_mode_ipv4_set(MCAST_MIX_DISTANCE
);
94 else if (strmatch(mode
, "longer-prefix"))
95 multicast_mode_ipv4_set(MCAST_MIX_PFXLEN
);
97 vty_out(vty
, "Invalid mode specified\n");
98 return CMD_WARNING_CONFIG_FAILED
;
104 DEFUN (no_ip_multicast_mode
,
105 no_ip_multicast_mode_cmd
,
106 "no ip multicast rpf-lookup-mode [<urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix>]",
109 "Multicast options\n"
110 "RPF lookup behavior\n"
111 "Lookup in unicast RIB only\n"
112 "Lookup in multicast RIB only\n"
113 "Try multicast RIB first, fall back to unicast RIB\n"
114 "Lookup both, use entry with lower distance\n"
115 "Lookup both, use entry with longer prefix\n")
117 multicast_mode_ipv4_set(MCAST_NO_CONFIG
);
124 "show ip rpf [json]",
127 "Display RPF information for multicast source\n"
130 bool uj
= use_json(argc
, argv
);
131 return do_show_ip_route(vty
, VRF_DEFAULT_NAME
, AFI_IP
, SAFI_MULTICAST
,
132 false, uj
, 0, NULL
, false, 0, 0);
135 DEFUN (show_ip_rpf_addr
,
136 show_ip_rpf_addr_cmd
,
137 "show ip rpf A.B.C.D",
140 "Display RPF information for multicast source\n"
141 "IP multicast source address (e.g. 10.0.0.0)\n")
145 struct route_node
*rn
;
146 struct route_entry
*re
;
149 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
151 vty_out(vty
, "%% Malformed address\n");
155 re
= rib_match_ipv4_multicast(VRF_DEFAULT
, addr
, &rn
);
158 vty_show_ip_route_detail(vty
, rn
, 1, false);
160 vty_out(vty
, "%% No match for RPF lookup\n");
165 static char re_status_output_char(struct route_entry
*re
, struct nexthop
*nhop
)
167 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_INSTALLED
)) {
168 if (!CHECK_FLAG(nhop
->flags
, NEXTHOP_FLAG_DUPLICATE
) &&
169 !CHECK_FLAG(nhop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
175 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_FAILED
)) {
176 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_QUEUED
))
182 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_QUEUED
))
188 /* New RIB. Detailed information for IPv4 route. */
189 static void vty_show_ip_route_detail(struct vty
*vty
, struct route_node
*rn
,
190 int mcast
, bool use_fib
)
192 struct route_entry
*re
;
193 struct nexthop
*nexthop
;
194 char buf
[SRCDEST2STR_BUFFER
];
195 struct zebra_vrf
*zvrf
;
198 dest
= rib_dest_from_rnode(rn
);
200 RNODE_FOREACH_RE (rn
, re
) {
202 * If re not selected for forwarding, skip re
203 * for "show ip/ipv6 fib <prefix>"
205 if (use_fib
&& re
!= dest
->selected_fib
)
208 const char *mcast_info
= "";
210 rib_table_info_t
*info
= srcdest_rnode_table_info(rn
);
211 mcast_info
= (info
->safi
== SAFI_MULTICAST
)
212 ? " using Multicast RIB"
213 : " using Unicast RIB";
216 vty_out(vty
, "Routing entry for %s%s\n",
217 srcdest_rnode2str(rn
, buf
, sizeof(buf
)), mcast_info
);
218 vty_out(vty
, " Known via \"%s", zebra_route_string(re
->type
));
220 vty_out(vty
, "[%d]", re
->instance
);
222 vty_out(vty
, ", distance %u, metric %u", re
->distance
,
225 vty_out(vty
, ", tag %u", re
->tag
);
226 #if defined(SUPPORT_REALMS)
227 if (re
->tag
> 0 && re
->tag
<= 255)
228 vty_out(vty
, "(realm)");
232 vty_out(vty
, ", mtu %u", re
->mtu
);
233 if (re
->vrf_id
!= VRF_DEFAULT
) {
234 zvrf
= vrf_info_lookup(re
->vrf_id
);
235 vty_out(vty
, ", vrf %s", zvrf_name(zvrf
));
237 if (CHECK_FLAG(re
->flags
, ZEBRA_FLAG_SELECTED
))
238 vty_out(vty
, ", best");
244 uptime
= monotime(NULL
);
245 uptime
-= re
->uptime
;
246 tm
= gmtime(&uptime
);
248 vty_out(vty
, " Last update ");
250 if (uptime
< ONE_DAY_SECOND
)
251 vty_out(vty
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
,
253 else if (uptime
< ONE_WEEK_SECOND
)
254 vty_out(vty
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
,
257 vty_out(vty
, "%02dw%dd%02dh", tm
->tm_yday
/ 7,
258 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
260 vty_out(vty
, " ago\n");
262 for (ALL_NEXTHOPS_PTR(re
->ng
, nexthop
)) {
265 vty_out(vty
, " %c%s",
266 re_status_output_char(re
, nexthop
),
267 nexthop
->rparent
? " " : "");
269 switch (nexthop
->type
) {
270 case NEXTHOP_TYPE_IPV4
:
271 case NEXTHOP_TYPE_IPV4_IFINDEX
:
273 inet_ntoa(nexthop
->gate
.ipv4
));
274 if (nexthop
->ifindex
)
275 vty_out(vty
, ", via %s",
280 case NEXTHOP_TYPE_IPV6
:
281 case NEXTHOP_TYPE_IPV6_IFINDEX
:
283 inet_ntop(AF_INET6
, &nexthop
->gate
.ipv6
,
285 if (nexthop
->ifindex
)
286 vty_out(vty
, ", via %s",
291 case NEXTHOP_TYPE_IFINDEX
:
292 vty_out(vty
, " directly connected, %s",
293 ifindex2ifname(nexthop
->ifindex
,
296 case NEXTHOP_TYPE_BLACKHOLE
:
297 vty_out(vty
, " unreachable");
298 switch (nexthop
->bh_type
) {
299 case BLACKHOLE_REJECT
:
300 vty_out(vty
, " (ICMP unreachable)");
302 case BLACKHOLE_ADMINPROHIB
:
304 " (ICMP admin-prohibited)");
307 vty_out(vty
, " (blackhole)");
309 case BLACKHOLE_UNSPEC
:
317 if ((re
->vrf_id
!= nexthop
->vrf_id
)
318 && (nexthop
->type
!= NEXTHOP_TYPE_BLACKHOLE
)) {
320 vrf_lookup_by_id(nexthop
->vrf_id
);
323 vty_out(vty
, "(vrf %s)", vrf
->name
);
325 vty_out(vty
, "(vrf UNKNOWN)");
328 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_DUPLICATE
))
329 vty_out(vty
, " (duplicate nexthop removed)");
331 if (!CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
332 vty_out(vty
, " inactive");
334 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
335 vty_out(vty
, " onlink");
337 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
338 vty_out(vty
, " (recursive)");
340 switch (nexthop
->type
) {
341 case NEXTHOP_TYPE_IPV4
:
342 case NEXTHOP_TYPE_IPV4_IFINDEX
:
343 if (nexthop
->src
.ipv4
.s_addr
) {
344 if (inet_ntop(AF_INET
,
346 addrstr
, sizeof addrstr
))
347 vty_out(vty
, ", src %s",
351 case NEXTHOP_TYPE_IPV6
:
352 case NEXTHOP_TYPE_IPV6_IFINDEX
:
353 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
,
355 if (inet_ntop(AF_INET6
,
357 addrstr
, sizeof addrstr
))
358 vty_out(vty
, ", src %s",
367 vty_out(vty
, ", mtu %u", re
->nexthop_mtu
);
369 /* Label information */
370 if (nexthop
->nh_label
371 && nexthop
->nh_label
->num_labels
) {
372 vty_out(vty
, ", label %s",
374 nexthop
->nh_label
->num_labels
,
375 nexthop
->nh_label
->label
, buf
,
385 static void vty_show_ip_route(struct vty
*vty
, struct route_node
*rn
,
386 struct route_entry
*re
, json_object
*json
,
389 struct nexthop
*nexthop
;
391 char buf
[SRCDEST2STR_BUFFER
];
392 json_object
*json_nexthops
= NULL
;
393 json_object
*json_nexthop
= NULL
;
394 json_object
*json_route
= NULL
;
395 json_object
*json_labels
= NULL
;
398 struct vrf
*vrf
= NULL
;
399 rib_dest_t
*dest
= rib_dest_from_rnode(rn
);
400 struct nexthop_group
*nhg
;
402 uptime
= monotime(NULL
);
403 uptime
-= re
->uptime
;
404 tm
= gmtime(&uptime
);
406 /* If showing fib information, use the fib view of the
410 nhg
= rib_active_nhg(re
);
415 json_route
= json_object_new_object();
416 json_nexthops
= json_object_new_array();
418 json_object_string_add(json_route
, "prefix",
419 srcdest_rnode2str(rn
, buf
, sizeof buf
));
420 json_object_string_add(json_route
, "protocol",
421 zebra_route_string(re
->type
));
424 json_object_int_add(json_route
, "instance",
428 json_object_int_add(json_route
, "vrfId", re
->vrf_id
);
429 vrf
= vrf_lookup_by_id(re
->vrf_id
);
430 json_object_string_add(json_route
, "vrfName",
434 if (CHECK_FLAG(re
->flags
, ZEBRA_FLAG_SELECTED
))
435 json_object_boolean_true_add(json_route
, "selected");
437 if (dest
->selected_fib
== re
)
438 json_object_boolean_true_add(json_route
,
441 json_object_int_add(json_route
, "distance",
443 json_object_int_add(json_route
, "metric", re
->metric
);
445 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_INSTALLED
))
446 json_object_boolean_true_add(json_route
, "installed");
448 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_FAILED
))
449 json_object_boolean_true_add(json_route
, "failed");
451 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_QUEUED
))
452 json_object_boolean_true_add(json_route
, "queued");
455 json_object_int_add(json_route
, "tag", re
->tag
);
458 json_object_int_add(json_route
, "table", re
->table
);
460 json_object_int_add(json_route
, "internalStatus",
462 json_object_int_add(json_route
, "internalFlags",
464 json_object_int_add(json_route
, "internalNextHopNum",
466 json_object_int_add(json_route
, "internalNextHopActiveNum",
467 re
->nexthop_active_num
);
468 if (uptime
< ONE_DAY_SECOND
)
469 sprintf(buf
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
,
471 else if (uptime
< ONE_WEEK_SECOND
)
472 sprintf(buf
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
,
475 sprintf(buf
, "%02dw%dd%02dh", tm
->tm_yday
/ 7,
476 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
479 json_object_string_add(json_route
, "uptime", buf
);
481 for (ALL_NEXTHOPS_PTR(nhg
, nexthop
)) {
482 json_nexthop
= json_object_new_object();
484 json_object_int_add(json_nexthop
, "flags",
487 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_DUPLICATE
))
488 json_object_boolean_true_add(json_nexthop
,
491 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_FIB
))
492 json_object_boolean_true_add(json_nexthop
,
495 switch (nexthop
->type
) {
496 case NEXTHOP_TYPE_IPV4
:
497 case NEXTHOP_TYPE_IPV4_IFINDEX
:
498 json_object_string_add(
500 inet_ntoa(nexthop
->gate
.ipv4
));
501 json_object_string_add(json_nexthop
, "afi",
504 if (nexthop
->ifindex
) {
505 json_object_int_add(json_nexthop
,
508 json_object_string_add(
509 json_nexthop
, "interfaceName",
515 case NEXTHOP_TYPE_IPV6
:
516 case NEXTHOP_TYPE_IPV6_IFINDEX
:
517 json_object_string_add(
519 inet_ntop(AF_INET6
, &nexthop
->gate
.ipv6
,
521 json_object_string_add(json_nexthop
, "afi",
524 if (nexthop
->ifindex
) {
525 json_object_int_add(json_nexthop
,
528 json_object_string_add(
529 json_nexthop
, "interfaceName",
536 case NEXTHOP_TYPE_IFINDEX
:
537 json_object_boolean_true_add(
538 json_nexthop
, "directlyConnected");
539 json_object_int_add(json_nexthop
,
542 json_object_string_add(
543 json_nexthop
, "interfaceName",
544 ifindex2ifname(nexthop
->ifindex
,
547 case NEXTHOP_TYPE_BLACKHOLE
:
548 json_object_boolean_true_add(json_nexthop
,
550 switch (nexthop
->bh_type
) {
551 case BLACKHOLE_REJECT
:
552 json_object_boolean_true_add(
553 json_nexthop
, "reject");
555 case BLACKHOLE_ADMINPROHIB
:
556 json_object_boolean_true_add(
561 json_object_boolean_true_add(
562 json_nexthop
, "blackhole");
564 case BLACKHOLE_UNSPEC
:
572 if ((nexthop
->vrf_id
!= re
->vrf_id
)
573 && (nexthop
->type
!= NEXTHOP_TYPE_BLACKHOLE
)) {
574 vrf
= vrf_lookup_by_id(nexthop
->vrf_id
);
575 json_object_string_add(json_nexthop
, "vrf",
578 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_DUPLICATE
))
579 json_object_boolean_true_add(json_nexthop
,
582 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
583 json_object_boolean_true_add(json_nexthop
,
586 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
587 json_object_boolean_true_add(json_nexthop
,
590 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
591 json_object_boolean_true_add(json_nexthop
,
594 switch (nexthop
->type
) {
595 case NEXTHOP_TYPE_IPV4
:
596 case NEXTHOP_TYPE_IPV4_IFINDEX
:
597 if (nexthop
->src
.ipv4
.s_addr
) {
598 if (inet_ntop(AF_INET
,
599 &nexthop
->src
.ipv4
, buf
,
601 json_object_string_add(
602 json_nexthop
, "source",
606 case NEXTHOP_TYPE_IPV6
:
607 case NEXTHOP_TYPE_IPV6_IFINDEX
:
608 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
,
610 if (inet_ntop(AF_INET6
,
611 &nexthop
->src
.ipv6
, buf
,
613 json_object_string_add(
614 json_nexthop
, "source",
622 if (nexthop
->nh_label
623 && nexthop
->nh_label
->num_labels
) {
624 json_labels
= json_object_new_array();
626 for (int label_index
= 0;
628 < nexthop
->nh_label
->num_labels
;
630 json_object_array_add(
633 nexthop
->nh_label
->label
636 json_object_object_add(json_nexthop
, "labels",
640 json_object_array_add(json_nexthops
, json_nexthop
);
643 json_object_object_add(json_route
, "nexthops", json_nexthops
);
644 json_object_array_add(json
, json_route
);
648 /* Nexthop information. */
649 for (ALL_NEXTHOPS_PTR(nhg
, nexthop
)) {
650 if (nexthop
== nhg
->nexthop
) {
651 /* Prefix information. */
652 len
= vty_out(vty
, "%c", zebra_route_char(re
->type
));
654 len
+= vty_out(vty
, "[%d]", re
->instance
);
657 CHECK_FLAG(re
->flags
, ZEBRA_FLAG_SELECTED
)
660 re_status_output_char(re
, nexthop
),
661 srcdest_rnode2str(rn
, buf
, sizeof buf
));
663 /* Distance and metric display. */
664 if (((re
->type
== ZEBRA_ROUTE_CONNECT
) &&
665 (re
->distance
|| re
->metric
)) ||
666 (re
->type
!= ZEBRA_ROUTE_CONNECT
))
667 len
+= vty_out(vty
, " [%u/%u]", re
->distance
,
670 vty_out(vty
, " %c%*c",
671 re_status_output_char(re
, nexthop
),
672 len
- 3 + (2 * nexthop_level(nexthop
)), ' ');
675 switch (nexthop
->type
) {
676 case NEXTHOP_TYPE_IPV4
:
677 case NEXTHOP_TYPE_IPV4_IFINDEX
:
678 vty_out(vty
, " via %s", inet_ntoa(nexthop
->gate
.ipv4
));
679 if (nexthop
->ifindex
)
681 ifindex2ifname(nexthop
->ifindex
,
684 case NEXTHOP_TYPE_IPV6
:
685 case NEXTHOP_TYPE_IPV6_IFINDEX
:
686 vty_out(vty
, " via %s",
687 inet_ntop(AF_INET6
, &nexthop
->gate
.ipv6
, buf
,
689 if (nexthop
->ifindex
)
691 ifindex2ifname(nexthop
->ifindex
,
695 case NEXTHOP_TYPE_IFINDEX
:
696 vty_out(vty
, " is directly connected, %s",
697 ifindex2ifname(nexthop
->ifindex
,
700 case NEXTHOP_TYPE_BLACKHOLE
:
701 vty_out(vty
, " unreachable");
702 switch (nexthop
->bh_type
) {
703 case BLACKHOLE_REJECT
:
704 vty_out(vty
, " (ICMP unreachable)");
706 case BLACKHOLE_ADMINPROHIB
:
707 vty_out(vty
, " (ICMP admin-prohibited)");
710 vty_out(vty
, " (blackhole)");
712 case BLACKHOLE_UNSPEC
:
720 if ((nexthop
->vrf_id
!= re
->vrf_id
)
721 && (nexthop
->type
!= NEXTHOP_TYPE_BLACKHOLE
)) {
722 struct vrf
*vrf
= vrf_lookup_by_id(nexthop
->vrf_id
);
725 vty_out(vty
, "(vrf %s)", vrf
->name
);
727 vty_out(vty
, "(vrf UNKNOWN)");
730 if (!CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ACTIVE
))
731 vty_out(vty
, " inactive");
733 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_ONLINK
))
734 vty_out(vty
, " onlink");
736 if (CHECK_FLAG(nexthop
->flags
, NEXTHOP_FLAG_RECURSIVE
))
737 vty_out(vty
, " (recursive)");
739 switch (nexthop
->type
) {
740 case NEXTHOP_TYPE_IPV4
:
741 case NEXTHOP_TYPE_IPV4_IFINDEX
:
742 if (nexthop
->src
.ipv4
.s_addr
) {
743 if (inet_ntop(AF_INET
, &nexthop
->src
.ipv4
, buf
,
745 vty_out(vty
, ", src %s", buf
);
748 case NEXTHOP_TYPE_IPV6
:
749 case NEXTHOP_TYPE_IPV6_IFINDEX
:
750 if (!IPV6_ADDR_SAME(&nexthop
->src
.ipv6
, &in6addr_any
)) {
751 if (inet_ntop(AF_INET6
, &nexthop
->src
.ipv6
, buf
,
753 vty_out(vty
, ", src %s", buf
);
760 /* Label information */
761 if (nexthop
->nh_label
&& nexthop
->nh_label
->num_labels
) {
762 vty_out(vty
, ", label %s",
763 mpls_label2str(nexthop
->nh_label
->num_labels
,
764 nexthop
->nh_label
->label
, buf
,
768 if (uptime
< ONE_DAY_SECOND
)
769 vty_out(vty
, ", %02d:%02d:%02d", tm
->tm_hour
,
770 tm
->tm_min
, tm
->tm_sec
);
771 else if (uptime
< ONE_WEEK_SECOND
)
772 vty_out(vty
, ", %dd%02dh%02dm", tm
->tm_yday
,
773 tm
->tm_hour
, tm
->tm_min
);
775 vty_out(vty
, ", %02dw%dd%02dh", tm
->tm_yday
/ 7,
776 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
782 static void vty_show_ip_route_detail_json(struct vty
*vty
,
783 struct route_node
*rn
, bool use_fib
)
785 json_object
*json
= NULL
;
786 json_object
*json_prefix
= NULL
;
787 struct route_entry
*re
;
791 dest
= rib_dest_from_rnode(rn
);
793 json
= json_object_new_object();
794 json_prefix
= json_object_new_array();
796 RNODE_FOREACH_RE (rn
, re
) {
798 * If re not selected for forwarding, skip re
799 * for "show ip/ipv6 fib <prefix> json"
801 if (use_fib
&& re
!= dest
->selected_fib
)
803 vty_show_ip_route(vty
, rn
, re
, json_prefix
, use_fib
);
806 prefix2str(&rn
->p
, buf
, sizeof(buf
));
807 json_object_object_add(json
, buf
, json_prefix
);
808 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
809 json
, JSON_C_TO_STRING_PRETTY
));
810 json_object_free(json
);
813 static void do_show_route_helper(struct vty
*vty
, struct zebra_vrf
*zvrf
,
814 struct route_table
*table
, afi_t afi
,
815 bool use_fib
, route_tag_t tag
,
816 const struct prefix
*longer_prefix_p
,
817 bool supernets_only
, int type
,
818 unsigned short ospf_instance_id
, bool use_json
,
821 struct route_node
*rn
;
822 struct route_entry
*re
;
825 json_object
*json
= NULL
;
826 json_object
*json_prefix
= NULL
;
831 json
= json_object_new_object();
833 /* Show all routes. */
834 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
)) {
835 dest
= rib_dest_from_rnode(rn
);
837 RNODE_FOREACH_RE (rn
, re
) {
838 if (use_fib
&& re
!= dest
->selected_fib
)
841 if (tag
&& re
->tag
!= tag
)
845 && !prefix_match(longer_prefix_p
, &rn
->p
))
848 /* This can only be true when the afi is IPv4 */
849 if (supernets_only
) {
850 addr
= ntohl(rn
->p
.u
.prefix4
.s_addr
);
852 if (IN_CLASSC(addr
) && rn
->p
.prefixlen
>= 24)
855 if (IN_CLASSB(addr
) && rn
->p
.prefixlen
>= 16)
858 if (IN_CLASSA(addr
) && rn
->p
.prefixlen
>= 8)
862 if (type
&& re
->type
!= type
)
866 && (re
->type
!= ZEBRA_ROUTE_OSPF
867 || re
->instance
!= ospf_instance_id
))
872 json_prefix
= json_object_new_array();
877 SHOW_ROUTE_V4_HEADER
);
880 SHOW_ROUTE_V6_HEADER
);
882 if (tableid
&& tableid
!= RT_TABLE_MAIN
)
883 vty_out(vty
, "\nVRF %s table %u:\n",
884 zvrf_name(zvrf
), tableid
);
885 else if (zvrf_id(zvrf
) != VRF_DEFAULT
)
886 vty_out(vty
, "\nVRF %s:\n",
892 vty_show_ip_route(vty
, rn
, re
, json_prefix
, use_fib
);
896 prefix2str(&rn
->p
, buf
, sizeof(buf
));
897 json_object_object_add(json
, buf
, json_prefix
);
903 vty_out(vty
, "%s\n", json_object_to_json_string_ext(json
,
904 JSON_C_TO_STRING_PRETTY
));
905 json_object_free(json
);
909 static int do_show_ip_route(struct vty
*vty
, const char *vrf_name
, afi_t afi
,
910 safi_t safi
, bool use_fib
, bool use_json
,
912 const struct prefix
*longer_prefix_p
,
913 bool supernets_only
, int type
,
914 unsigned short ospf_instance_id
)
916 struct route_table
*table
;
917 struct zebra_vrf
*zvrf
= NULL
;
919 if (!(zvrf
= zebra_vrf_lookup_by_name(vrf_name
))) {
921 vty_out(vty
, "{}\n");
923 vty_out(vty
, "vrf %s not defined\n", vrf_name
);
927 if (zvrf_id(zvrf
) == VRF_UNKNOWN
) {
929 vty_out(vty
, "{}\n");
931 vty_out(vty
, "vrf %s inactive\n", vrf_name
);
935 table
= zebra_vrf_table(afi
, safi
, zvrf_id(zvrf
));
938 vty_out(vty
, "{}\n");
942 do_show_route_helper(vty
, zvrf
, table
, afi
, use_fib
, tag
,
943 longer_prefix_p
, supernets_only
, type
,
944 ospf_instance_id
, use_json
, 0);
949 DEFPY (show_route_table
,
950 show_route_table_cmd
,
951 "show <ip$ipv4|ipv6$ipv6> route table (1-4294967295)$table [json$json]",
957 "The table number to display, if available\n"
960 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
961 struct zebra_vrf
*zvrf
= zebra_vrf_lookup_by_id(VRF_DEFAULT
);
962 struct route_table
*t
;
964 t
= zebra_router_find_table(zvrf
, table
, afi
, SAFI_UNICAST
);
966 do_show_route_helper(vty
, zvrf
, t
, afi
, false, 0, false, false,
967 0, 0, !!json
, table
);
972 DEFPY (show_route_table_vrf
,
973 show_route_table_vrf_cmd
,
974 "show <ip$ipv4|ipv6$ipv6> route table (1-4294967295)$table vrf NAME$vrf_name [json$json]",
980 "The table number to display, if available\n"
984 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
985 struct zebra_vrf
*zvrf
;
986 struct route_table
*t
;
987 vrf_id_t vrf_id
= VRF_DEFAULT
;
990 VRF_GET_ID(vrf_id
, vrf_name
, !!json
);
991 zvrf
= zebra_vrf_lookup_by_id(vrf_id
);
993 t
= zebra_router_find_table(zvrf
, table
, afi
, SAFI_UNICAST
);
995 do_show_route_helper(vty
, zvrf
, t
, afi
, false, 0, false, false,
996 0, 0, !!json
, table
);
1001 DEFPY (show_route_all_table_vrf
,
1002 show_route_all_table_vrf_cmd
,
1003 "show <ip$ipv4|ipv6$ipv6> route [vrf <NAME$vrf_name|all$vrf_all>] tables [json$json]",
1007 "IP routing table\n"
1008 "Display all tables\n"
1009 VRF_FULL_CMD_HELP_STR
1012 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
1013 struct zebra_vrf
*zvrf
= NULL
;
1014 vrf_id_t vrf_id
= VRF_UNKNOWN
;
1015 struct zebra_router_table
*zrt
;
1018 VRF_GET_ID(vrf_id
, vrf_name
, !!json
);
1019 zvrf
= zebra_vrf_lookup_by_id(vrf_id
);
1022 RB_FOREACH (zrt
, zebra_router_table_head
, &zrouter
.tables
) {
1023 rib_table_info_t
*info
= route_table_get_info(zrt
->table
);
1025 if (zvrf
&& zvrf
!= info
->zvrf
)
1027 if (zrt
->afi
!= afi
|| zrt
->safi
!= SAFI_UNICAST
)
1030 do_show_route_helper(vty
, info
->zvrf
, zrt
->table
, afi
, false, 0,
1031 false, false, 0, 0, !!json
, zrt
->tableid
);
1038 "show <ip$ipv4|ipv6$ipv6> <nht|import-check>$type [<A.B.C.D|X:X::X:X>$addr|vrf NAME$vrf_name [<A.B.C.D|X:X::X:X>$addr]|vrf all$vrf_all]",
1042 "IP nexthop tracking table\n"
1043 "IP import check tracking table\n"
1049 VRF_ALL_CMD_HELP_STR
)
1051 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
1052 vrf_id_t vrf_id
= VRF_DEFAULT
;
1053 struct prefix prefix
, *p
= NULL
;
1056 if (strcmp(type
, "nht") == 0)
1057 rtype
= RNH_NEXTHOP_TYPE
;
1059 rtype
= RNH_IMPORT_CHECK_TYPE
;
1063 struct zebra_vrf
*zvrf
;
1065 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1066 if ((zvrf
= vrf
->info
) != NULL
) {
1067 vty_out(vty
, "\nVRF %s:\n", zvrf_name(zvrf
));
1068 zebra_print_rnh_table(zvrf_id(zvrf
), afi
, vty
,
1074 VRF_GET_ID(vrf_id
, vrf_name
, false);
1076 memset(&prefix
, 0, sizeof(prefix
));
1078 p
= sockunion2hostprefix(addr
, &prefix
);
1080 zebra_print_rnh_table(vrf_id
, afi
, vty
, rtype
, p
);
1084 DEFUN (ip_nht_default_route
,
1085 ip_nht_default_route_cmd
,
1086 "ip nht resolve-via-default",
1088 "Filter Next Hop tracking route resolution\n"
1089 "Resolve via default route\n")
1091 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1096 if (zvrf
->zebra_rnh_ip_default_route
)
1099 zvrf
->zebra_rnh_ip_default_route
= 1;
1101 zebra_evaluate_rnh(zvrf
, AFI_IP
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1105 static void show_nexthop_group_cmd_helper(struct vty
*vty
,
1106 struct zebra_vrf
*zvrf
, afi_t afi
)
1108 struct list
*list
= hash_to_list(zrouter
.nhgs
);
1109 struct nhg_hash_entry
*nhe
;
1110 struct listnode
*node
;
1112 for (ALL_LIST_ELEMENTS_RO(list
, node
, nhe
)) {
1113 struct nexthop
*nhop
;
1114 struct nhg_connected
*rb_node_dep
= NULL
;
1116 if (afi
&& nhe
->afi
!= afi
)
1119 if (nhe
->vrf_id
!= zvrf
->vrf
->vrf_id
)
1122 vty_out(vty
, "Group: %u ID: %u\n", nhe
->dplane_ref
, nhe
->id
);
1123 vty_out(vty
, "\tRefCnt: %d\n", nhe
->refcnt
);
1124 vty_out(vty
, "\tValid: %d, Installed %d\n",
1125 nhe
->flags
& NEXTHOP_GROUP_VALID
,
1126 nhe
->flags
& NEXTHOP_GROUP_INSTALLED
);
1128 vty_out(vty
, "\tInterface Index: %d\n",
1131 if (!zebra_nhg_depends_is_empty(nhe
)) {
1133 vty_out(vty
, "\tDepends:");
1134 RB_FOREACH (rb_node_dep
, nhg_connected_head
,
1135 &nhe
->nhg_depends
) {
1136 vty_out(vty
, " (%u)", rb_node_dep
->nhe
->id
);
1141 vty_out(vty
, "\tDependents:");
1142 RB_FOREACH (rb_node_dep
, nhg_connected_head
,
1143 &nhe
->nhg_dependents
) {
1144 vty_out(vty
, " (%u)", rb_node_dep
->nhe
->id
);
1149 for (ALL_NEXTHOPS_PTR(nhe
->nhg
, nhop
)) {
1151 nexthop_group_write_nexthop(vty
, nhop
);
1158 DEFPY (show_nexthop_group
,
1159 show_nexthop_group_cmd
,
1160 "show nexthop-group [<ipv4$v4|ipv6$v6>] [vrf <NAME$vrf_name|all$vrf_all>]",
1164 "Show Nexthop Groups\n"
1165 VRF_FULL_CMD_HELP_STR
)
1175 struct zebra_vrf
*zvrf
;
1180 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1181 struct zebra_vrf
*zvrf
;
1187 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1188 show_nexthop_group_cmd_helper(vty
, zvrf
, afi
);
1195 zvrf
= zebra_vrf_lookup_by_name(vrf_name
);
1197 zvrf
= zebra_vrf_lookup_by_name(VRF_DEFAULT_NAME
);
1200 vty_out(vty
, "VRF %s specified does not exist", vrf_name
);
1204 show_nexthop_group_cmd_helper(vty
, zvrf
, afi
);
1209 DEFUN (no_ip_nht_default_route
,
1210 no_ip_nht_default_route_cmd
,
1211 "no ip nht resolve-via-default",
1214 "Filter Next Hop tracking route resolution\n"
1215 "Resolve via default route\n")
1217 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1222 if (!zvrf
->zebra_rnh_ip_default_route
)
1225 zvrf
->zebra_rnh_ip_default_route
= 0;
1226 zebra_evaluate_rnh(zvrf
, AFI_IP
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1230 DEFUN (ipv6_nht_default_route
,
1231 ipv6_nht_default_route_cmd
,
1232 "ipv6 nht resolve-via-default",
1234 "Filter Next Hop tracking route resolution\n"
1235 "Resolve via default route\n")
1237 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1242 if (zvrf
->zebra_rnh_ipv6_default_route
)
1245 zvrf
->zebra_rnh_ipv6_default_route
= 1;
1246 zebra_evaluate_rnh(zvrf
, AFI_IP6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1250 DEFUN (no_ipv6_nht_default_route
,
1251 no_ipv6_nht_default_route_cmd
,
1252 "no ipv6 nht resolve-via-default",
1255 "Filter Next Hop tracking route resolution\n"
1256 "Resolve via default route\n")
1259 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1264 if (!zvrf
->zebra_rnh_ipv6_default_route
)
1267 zvrf
->zebra_rnh_ipv6_default_route
= 0;
1268 zebra_evaluate_rnh(zvrf
, AFI_IP6
, 1, RNH_NEXTHOP_TYPE
, NULL
);
1276 ip$ipv4 <fib$fib|route> [vrf <NAME$vrf_name|all$vrf_all>]\
1279 |A.B.C.D/M$prefix longer-prefixes\
1280 |supernets-only$supernets_only\
1283 " FRR_IP_REDIST_STR_ZEBRA
"$type_str\
1284 |ospf$type_str (1-65535)$ospf_instance_id\
1286 |ipv6$ipv6 <fib$fib|route> [vrf <NAME$vrf_name|all$vrf_all>]\
1289 |X:X::X:X/M$prefix longer-prefixes\
1291 [" FRR_IP6_REDIST_STR_ZEBRA
"$type_str]\
1296 "IP forwarding table\n"
1297 "IP routing table\n"
1298 VRF_FULL_CMD_HELP_STR
1299 "Show only routes with tag\n"
1301 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1302 "Show route matching the specified Network/Mask pair only\n"
1303 "Show supernet entries only\n"
1304 FRR_IP_REDIST_HELP_STR_ZEBRA
1305 "Open Shortest Path First (OSPFv2)\n"
1308 "IP forwarding table\n"
1309 "IP routing table\n"
1310 VRF_FULL_CMD_HELP_STR
1311 "Show only routes with tag\n"
1314 "Show route matching the specified Network/Mask pair only\n"
1315 FRR_IP6_REDIST_HELP_STR_ZEBRA
1318 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
1323 type
= proto_redistnum(afi
, type_str
);
1325 vty_out(vty
, "Unknown route type\n");
1331 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1332 struct zebra_vrf
*zvrf
;
1333 struct route_table
*table
;
1335 if ((zvrf
= vrf
->info
) == NULL
1336 || (table
= zvrf
->table
[afi
][SAFI_UNICAST
]) == NULL
)
1340 vty
, zvrf_name(zvrf
), afi
, SAFI_UNICAST
, !!fib
,
1341 !!json
, tag
, prefix_str
? prefix
: NULL
,
1342 !!supernets_only
, type
, ospf_instance_id
);
1345 vrf_id_t vrf_id
= VRF_DEFAULT
;
1348 VRF_GET_ID(vrf_id
, vrf_name
, !!json
);
1349 vrf
= vrf_lookup_by_id(vrf_id
);
1350 do_show_ip_route(vty
, vrf
->name
, afi
, SAFI_UNICAST
, !!fib
,
1351 !!json
, tag
, prefix_str
? prefix
: NULL
,
1352 !!supernets_only
, type
, ospf_instance_id
);
1358 DEFPY (show_route_detail
,
1359 show_route_detail_cmd
,
1362 ip$ipv4 <fib$fib|route> [vrf <NAME$vrf_name|all$vrf_all>]\
1367 |ipv6$ipv6 <fib$fib|route> [vrf <NAME$vrf_name|all$vrf_all>]\
1376 "IPv6 forwarding table\n"
1377 "IP routing table\n"
1378 VRF_FULL_CMD_HELP_STR
1379 "Network in the IP routing table to display\n"
1380 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
1382 "IPv6 forwarding table\n"
1383 "IPv6 routing table\n"
1384 VRF_FULL_CMD_HELP_STR
1389 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
1390 struct route_table
*table
;
1392 struct route_node
*rn
;
1393 bool use_fib
= !!fib
;
1395 bool network_found
= false;
1398 prefix_str
= address_str
;
1399 if (str2prefix(prefix_str
, &p
) < 0) {
1400 vty_out(vty
, "%% Malformed address\n");
1406 struct zebra_vrf
*zvrf
;
1408 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1409 if ((zvrf
= vrf
->info
) == NULL
1410 || (table
= zvrf
->table
[afi
][SAFI_UNICAST
]) == NULL
)
1413 rn
= route_node_match(table
, &p
);
1416 if (!address_str
&& rn
->p
.prefixlen
!= p
.prefixlen
) {
1417 route_unlock_node(rn
);
1421 dest
= rib_dest_from_rnode(rn
);
1422 if (use_fib
&& !dest
->selected_fib
) {
1423 route_unlock_node(rn
);
1427 network_found
= true;
1429 vty_show_ip_route_detail_json(vty
, rn
,
1432 vty_show_ip_route_detail(vty
, rn
, 0, use_fib
);
1434 route_unlock_node(rn
);
1437 if (!network_found
) {
1439 vty_out(vty
, "{}\n");
1443 "%% Network not in FIB\n");
1446 "%% Network not in RIB\n");
1451 vrf_id_t vrf_id
= VRF_DEFAULT
;
1454 VRF_GET_ID(vrf_id
, vrf_name
, false);
1456 table
= zebra_vrf_table(afi
, SAFI_UNICAST
, vrf_id
);
1460 rn
= route_node_match(table
, &p
);
1462 dest
= rib_dest_from_rnode(rn
);
1464 if (!rn
|| (!address_str
&& rn
->p
.prefixlen
!= p
.prefixlen
) ||
1465 (use_fib
&& dest
&& !dest
->selected_fib
)) {
1467 vty_out(vty
, "{}\n");
1471 "%% Network not in FIB\n");
1474 "%% Network not in table\n");
1477 route_unlock_node(rn
);
1482 vty_show_ip_route_detail_json(vty
, rn
, use_fib
);
1484 vty_show_ip_route_detail(vty
, rn
, 0, use_fib
);
1486 route_unlock_node(rn
);
1492 DEFPY (show_route_summary
,
1493 show_route_summary_cmd
,
1494 "show <ip$ipv4|ipv6$ipv6> route [vrf <NAME$vrf_name|all$vrf_all>] \
1495 summary [table (1-4294967295)$table_id] [prefix$prefix]",
1499 "IP routing table\n"
1500 VRF_FULL_CMD_HELP_STR
1501 "Summary of all routes\n"
1502 "Table to display summary for\n"
1503 "The table number\n"
1506 afi_t afi
= ipv4
? AFI_IP
: AFI_IP6
;
1507 struct route_table
*table
;
1510 table_id
= RT_TABLE_MAIN
;
1514 struct zebra_vrf
*zvrf
;
1516 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1517 if ((zvrf
= vrf
->info
) == NULL
)
1520 table
= zebra_vrf_table_with_table_id(afi
,
1528 vty_show_ip_route_summary_prefix(vty
, table
);
1530 vty_show_ip_route_summary(vty
, table
);
1533 vrf_id_t vrf_id
= VRF_DEFAULT
;
1536 VRF_GET_ID(vrf_id
, vrf_name
, false);
1538 table
= zebra_vrf_table_with_table_id(afi
,
1545 vty_show_ip_route_summary_prefix(vty
, table
);
1547 vty_show_ip_route_summary(vty
, table
);
1553 static void vty_show_ip_route_summary(struct vty
*vty
,
1554 struct route_table
*table
)
1556 struct route_node
*rn
;
1557 struct route_entry
*re
;
1558 #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
1559 #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
1560 uint32_t rib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1561 uint32_t fib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1565 memset(&rib_cnt
, 0, sizeof(rib_cnt
));
1566 memset(&fib_cnt
, 0, sizeof(fib_cnt
));
1567 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
))
1568 RNODE_FOREACH_RE (rn
, re
) {
1569 is_ibgp
= (re
->type
== ZEBRA_ROUTE_BGP
1570 && CHECK_FLAG(re
->flags
, ZEBRA_FLAG_IBGP
));
1572 rib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1574 rib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1576 rib_cnt
[re
->type
]++;
1578 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_INSTALLED
)) {
1579 fib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1582 fib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1584 fib_cnt
[re
->type
]++;
1588 vty_out(vty
, "%-20s %-20s %s (vrf %s)\n", "Route Source", "Routes",
1589 "FIB", zvrf_name(((rib_table_info_t
*)route_table_get_info(table
))->zvrf
));
1591 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
1592 if ((rib_cnt
[i
] > 0) || (i
== ZEBRA_ROUTE_BGP
1593 && rib_cnt
[ZEBRA_ROUTE_IBGP
] > 0)) {
1594 if (i
== ZEBRA_ROUTE_BGP
) {
1595 vty_out(vty
, "%-20s %-20d %-20d \n", "ebgp",
1596 rib_cnt
[ZEBRA_ROUTE_BGP
],
1597 fib_cnt
[ZEBRA_ROUTE_BGP
]);
1598 vty_out(vty
, "%-20s %-20d %-20d \n", "ibgp",
1599 rib_cnt
[ZEBRA_ROUTE_IBGP
],
1600 fib_cnt
[ZEBRA_ROUTE_IBGP
]);
1602 vty_out(vty
, "%-20s %-20d %-20d \n",
1603 zebra_route_string(i
), rib_cnt
[i
],
1608 vty_out(vty
, "------\n");
1609 vty_out(vty
, "%-20s %-20d %-20d \n", "Totals",
1610 rib_cnt
[ZEBRA_ROUTE_TOTAL
], fib_cnt
[ZEBRA_ROUTE_TOTAL
]);
1615 * Implementation of the ip route summary prefix command.
1617 * This command prints the primary prefixes that have been installed by various
1618 * protocols on the box.
1621 static void vty_show_ip_route_summary_prefix(struct vty
*vty
,
1622 struct route_table
*table
)
1624 struct route_node
*rn
;
1625 struct route_entry
*re
;
1626 struct nexthop
*nexthop
;
1627 #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
1628 #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
1629 uint32_t rib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1630 uint32_t fib_cnt
[ZEBRA_ROUTE_TOTAL
+ 1];
1634 memset(&rib_cnt
, 0, sizeof(rib_cnt
));
1635 memset(&fib_cnt
, 0, sizeof(fib_cnt
));
1636 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
))
1637 RNODE_FOREACH_RE (rn
, re
) {
1640 * In case of ECMP, count only once.
1643 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_INSTALLED
)) {
1644 fib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1645 fib_cnt
[re
->type
]++;
1647 for (nexthop
= re
->ng
->nexthop
; (!cnt
&& nexthop
);
1648 nexthop
= nexthop
->next
) {
1650 rib_cnt
[ZEBRA_ROUTE_TOTAL
]++;
1651 rib_cnt
[re
->type
]++;
1652 if (re
->type
== ZEBRA_ROUTE_BGP
1653 && CHECK_FLAG(re
->flags
, ZEBRA_FLAG_IBGP
)) {
1654 rib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1655 if (CHECK_FLAG(re
->status
,
1656 ROUTE_ENTRY_INSTALLED
))
1657 fib_cnt
[ZEBRA_ROUTE_IBGP
]++;
1662 vty_out(vty
, "%-20s %-20s %s (vrf %s)\n", "Route Source",
1663 "Prefix Routes", "FIB",
1664 zvrf_name(((rib_table_info_t
*)route_table_get_info(table
))->zvrf
));
1666 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
1667 if (rib_cnt
[i
] > 0) {
1668 if (i
== ZEBRA_ROUTE_BGP
) {
1669 vty_out(vty
, "%-20s %-20d %-20d \n", "ebgp",
1670 rib_cnt
[ZEBRA_ROUTE_BGP
]
1671 - rib_cnt
[ZEBRA_ROUTE_IBGP
],
1672 fib_cnt
[ZEBRA_ROUTE_BGP
]
1673 - fib_cnt
[ZEBRA_ROUTE_IBGP
]);
1674 vty_out(vty
, "%-20s %-20d %-20d \n", "ibgp",
1675 rib_cnt
[ZEBRA_ROUTE_IBGP
],
1676 fib_cnt
[ZEBRA_ROUTE_IBGP
]);
1678 vty_out(vty
, "%-20s %-20d %-20d \n",
1679 zebra_route_string(i
), rib_cnt
[i
],
1684 vty_out(vty
, "------\n");
1685 vty_out(vty
, "%-20s %-20d %-20d \n", "Totals",
1686 rib_cnt
[ZEBRA_ROUTE_TOTAL
], fib_cnt
[ZEBRA_ROUTE_TOTAL
]);
1691 * Show IPv6 mroute command.Used to dump
1692 * the Multicast routing table.
1694 DEFUN (show_ipv6_mroute
,
1695 show_ipv6_mroute_cmd
,
1696 "show ipv6 mroute [vrf NAME]",
1699 "IPv6 Multicast routing table\n"
1702 struct route_table
*table
;
1703 struct route_node
*rn
;
1704 struct route_entry
*re
;
1706 vrf_id_t vrf_id
= VRF_DEFAULT
;
1709 VRF_GET_ID(vrf_id
, argv
[4]->arg
, false);
1711 table
= zebra_vrf_table(AFI_IP6
, SAFI_MULTICAST
, vrf_id
);
1715 /* Show all IPv6 route. */
1716 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
))
1717 RNODE_FOREACH_RE (rn
, re
) {
1719 vty_out(vty
, SHOW_ROUTE_V6_HEADER
);
1722 vty_show_ip_route(vty
, rn
, re
, NULL
, false);
1727 DEFUN (show_ipv6_mroute_vrf_all
,
1728 show_ipv6_mroute_vrf_all_cmd
,
1729 "show ipv6 mroute vrf all",
1732 "IPv6 Multicast routing table\n"
1733 VRF_ALL_CMD_HELP_STR
)
1735 struct route_table
*table
;
1736 struct route_node
*rn
;
1737 struct route_entry
*re
;
1739 struct zebra_vrf
*zvrf
;
1742 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1743 if ((zvrf
= vrf
->info
) == NULL
1744 || (table
= zvrf
->table
[AFI_IP6
][SAFI_MULTICAST
]) == NULL
)
1747 /* Show all IPv6 route. */
1748 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
))
1749 RNODE_FOREACH_RE (rn
, re
) {
1751 vty_out(vty
, SHOW_ROUTE_V6_HEADER
);
1754 vty_show_ip_route(vty
, rn
, re
, NULL
, false);
1760 DEFUN (allow_external_route_update
,
1761 allow_external_route_update_cmd
,
1762 "allow-external-route-update",
1763 "Allow FRR routes to be overwritten by external processes\n")
1770 DEFUN (no_allow_external_route_update
,
1771 no_allow_external_route_update_cmd
,
1772 "no allow-external-route-update",
1774 "Allow FRR routes to be overwritten by external processes\n")
1789 struct zebra_vrf
*zvrf
;
1791 if (vrf_is_backend_netns())
1792 vty_out(vty
, "netns-based vrfs\n");
1794 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1795 if (!(zvrf
= vrf
->info
))
1797 if (zvrf_id(zvrf
) == VRF_DEFAULT
)
1800 vty_out(vty
, "vrf %s ", zvrf_name(zvrf
));
1801 if (zvrf_id(zvrf
) == VRF_UNKNOWN
|| !zvrf_is_active(zvrf
))
1802 vty_out(vty
, "inactive");
1803 else if (zvrf_ns_name(zvrf
))
1804 vty_out(vty
, "id %u netns %s", zvrf_id(zvrf
),
1805 zvrf_ns_name(zvrf
));
1807 vty_out(vty
, "id %u table %u", zvrf_id(zvrf
),
1809 if (vrf_is_user_cfged(vrf
))
1810 vty_out(vty
, " (configured)");
1817 DEFUN (default_vrf_vni_mapping
,
1818 default_vrf_vni_mapping_cmd
,
1819 "vni " CMD_VNI_RANGE
"[prefix-routes-only]",
1820 "VNI corresponding to the DEFAULT VRF\n"
1822 "Prefix routes only \n")
1825 char err
[ERR_STR_SZ
];
1826 struct zebra_vrf
*zvrf
= NULL
;
1827 vni_t vni
= strtoul(argv
[1]->arg
, NULL
, 10);
1830 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
1837 ret
= zebra_vxlan_process_vrf_vni_cmd(zvrf
, vni
, err
, ERR_STR_SZ
,
1840 vty_out(vty
, "%s\n", err
);
1847 DEFUN (no_default_vrf_vni_mapping
,
1848 no_default_vrf_vni_mapping_cmd
,
1849 "no vni " CMD_VNI_RANGE
,
1851 "VNI corresponding to DEFAULT VRF\n"
1855 char err
[ERR_STR_SZ
];
1856 vni_t vni
= strtoul(argv
[2]->arg
, NULL
, 10);
1857 struct zebra_vrf
*zvrf
= NULL
;
1859 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
1863 ret
= zebra_vxlan_process_vrf_vni_cmd(zvrf
, vni
, err
, ERR_STR_SZ
, 0, 0);
1865 vty_out(vty
, "%s\n", err
);
1872 DEFUN (vrf_vni_mapping
,
1873 vrf_vni_mapping_cmd
,
1874 "vni " CMD_VNI_RANGE
"[prefix-routes-only]",
1875 "VNI corresponding to tenant VRF\n"
1877 "prefix-routes-only\n")
1882 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1883 vni_t vni
= strtoul(argv
[1]->arg
, NULL
, 10);
1884 char err
[ERR_STR_SZ
];
1892 /* Mark as having FRR configuration */
1893 vrf_set_user_cfged(vrf
);
1894 ret
= zebra_vxlan_process_vrf_vni_cmd(zvrf
, vni
, err
, ERR_STR_SZ
,
1897 vty_out(vty
, "%s\n", err
);
1904 DEFUN (no_vrf_vni_mapping
,
1905 no_vrf_vni_mapping_cmd
,
1906 "no vni " CMD_VNI_RANGE
"[prefix-routes-only]",
1908 "VNI corresponding to tenant VRF\n"
1910 "prefix-routes-only\n")
1914 char err
[ERR_STR_SZ
];
1915 vni_t vni
= strtoul(argv
[2]->arg
, NULL
, 10);
1917 ZEBRA_DECLVAR_CONTEXT(vrf
, zvrf
);
1925 ret
= zebra_vxlan_process_vrf_vni_cmd(zvrf
, vni
, err
,
1926 ERR_STR_SZ
, filter
, 0);
1928 vty_out(vty
, "%s\n", err
);
1932 /* If no other FRR config for this VRF, mark accordingly. */
1933 if (!zebra_vrf_has_config(zvrf
))
1934 vrf_reset_user_cfged(vrf
);
1940 DEFUN (show_vrf_vni
,
1942 "show vrf vni [json]",
1949 struct zebra_vrf
*zvrf
;
1950 json_object
*json
= NULL
;
1951 json_object
*json_vrfs
= NULL
;
1952 bool uj
= use_json(argc
, argv
);
1955 json
= json_object_new_object();
1956 json_vrfs
= json_object_new_array();
1960 vty_out(vty
, "%-37s %-10s %-20s %-20s %-5s %-18s\n", "VRF",
1961 "VNI", "VxLAN IF", "L3-SVI", "State", "Rmac");
1963 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1968 zebra_vxlan_print_vrf_vni(vty
, zvrf
, json_vrfs
);
1972 json_object_object_add(json
, "vrfs", json_vrfs
);
1973 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
1974 json
, JSON_C_TO_STRING_PRETTY
));
1975 json_object_free(json
);
1981 DEFUN (show_evpn_global
,
1982 show_evpn_global_cmd
,
1988 bool uj
= use_json(argc
, argv
);
1990 zebra_vxlan_print_evpn(vty
, uj
);
1994 DEFUN (show_evpn_vni
,
1996 "show evpn vni [json]",
1999 "VxLAN Network Identifier\n"
2002 struct zebra_vrf
*zvrf
;
2003 bool uj
= use_json(argc
, argv
);
2005 zvrf
= zebra_vrf_get_evpn();
2006 zebra_vxlan_print_vnis(vty
, zvrf
, uj
);
2010 DEFUN (show_evpn_vni_detail
, show_evpn_vni_detail_cmd
,
2011 "show evpn vni detail [json]",
2014 "VxLAN Network Identifier\n"
2015 "Detailed Information On Each VNI\n"
2018 struct zebra_vrf
*zvrf
;
2019 bool uj
= use_json(argc
, argv
);
2021 zvrf
= zebra_vrf_get_evpn();
2022 zebra_vxlan_print_vnis_detail(vty
, zvrf
, uj
);
2026 DEFUN (show_evpn_vni_vni
,
2027 show_evpn_vni_vni_cmd
,
2028 "show evpn vni " CMD_VNI_RANGE
"[json]",
2031 "VxLAN Network Identifier\n"
2035 struct zebra_vrf
*zvrf
;
2037 bool uj
= use_json(argc
, argv
);
2039 vni
= strtoul(argv
[3]->arg
, NULL
, 10);
2040 zvrf
= zebra_vrf_get_evpn();
2041 zebra_vxlan_print_vni(vty
, zvrf
, vni
, uj
);
2045 DEFUN (show_evpn_rmac_vni_mac
,
2046 show_evpn_rmac_vni_mac_cmd
,
2047 "show evpn rmac vni " CMD_VNI_RANGE
" mac WORD [json]",
2054 "mac-address (e.g. 0a:0a:0a:0a:0a:0a)\n"
2059 bool uj
= use_json(argc
, argv
);
2061 l3vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2062 if (!prefix_str2mac(argv
[6]->arg
, &mac
)) {
2063 vty_out(vty
, "%% Malformed MAC address\n");
2066 zebra_vxlan_print_specific_rmac_l3vni(vty
, l3vni
, &mac
, uj
);
2070 DEFUN (show_evpn_rmac_vni
,
2071 show_evpn_rmac_vni_cmd
,
2072 "show evpn rmac vni " CMD_VNI_RANGE
"[json]",
2081 bool uj
= use_json(argc
, argv
);
2083 l3vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2084 zebra_vxlan_print_rmacs_l3vni(vty
, l3vni
, uj
);
2089 DEFUN (show_evpn_rmac_vni_all
,
2090 show_evpn_rmac_vni_all_cmd
,
2091 "show evpn rmac vni all [json]",
2099 bool uj
= use_json(argc
, argv
);
2101 zebra_vxlan_print_rmacs_all_l3vni(vty
, uj
);
2106 DEFUN (show_evpn_nh_vni_ip
,
2107 show_evpn_nh_vni_ip_cmd
,
2108 "show evpn next-hops vni " CMD_VNI_RANGE
" ip WORD [json]",
2115 "Host address (ipv4 or ipv6)\n"
2120 bool uj
= use_json(argc
, argv
);
2122 l3vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2123 if (str2ipaddr(argv
[6]->arg
, &ip
) != 0) {
2125 vty_out(vty
, "%% Malformed Neighbor address\n");
2128 zebra_vxlan_print_specific_nh_l3vni(vty
, l3vni
, &ip
, uj
);
2133 DEFUN (show_evpn_nh_vni
,
2134 show_evpn_nh_vni_cmd
,
2135 "show evpn next-hops vni " CMD_VNI_RANGE
"[json]",
2144 bool uj
= use_json(argc
, argv
);
2146 l3vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2147 zebra_vxlan_print_nh_l3vni(vty
, l3vni
, uj
);
2152 DEFUN (show_evpn_nh_vni_all
,
2153 show_evpn_nh_vni_all_cmd
,
2154 "show evpn next-hops vni all [json]",
2162 bool uj
= use_json(argc
, argv
);
2164 zebra_vxlan_print_nh_all_l3vni(vty
, uj
);
2169 DEFUN (show_evpn_mac_vni
,
2170 show_evpn_mac_vni_cmd
,
2171 "show evpn mac vni " CMD_VNI_RANGE
"[json]",
2175 "VxLAN Network Identifier\n"
2179 struct zebra_vrf
*zvrf
;
2181 bool uj
= use_json(argc
, argv
);
2183 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2184 zvrf
= zebra_vrf_get_evpn();
2185 zebra_vxlan_print_macs_vni(vty
, zvrf
, vni
, uj
);
2189 DEFUN (show_evpn_mac_vni_all
,
2190 show_evpn_mac_vni_all_cmd
,
2191 "show evpn mac vni all [json]",
2195 "VxLAN Network Identifier\n"
2199 struct zebra_vrf
*zvrf
;
2200 bool uj
= use_json(argc
, argv
);
2202 zvrf
= zebra_vrf_get_evpn();
2203 zebra_vxlan_print_macs_all_vni(vty
, zvrf
, false, uj
);
2207 DEFUN (show_evpn_mac_vni_all_detail
, show_evpn_mac_vni_all_detail_cmd
,
2208 "show evpn mac vni all detail [json]",
2212 "VxLAN Network Identifier\n"
2214 "Detailed Information On Each VNI MAC\n"
2217 struct zebra_vrf
*zvrf
;
2218 bool uj
= use_json(argc
, argv
);
2220 zvrf
= zebra_vrf_get_evpn();
2221 zebra_vxlan_print_macs_all_vni_detail(vty
, zvrf
, false, uj
);
2225 DEFUN (show_evpn_mac_vni_all_vtep
,
2226 show_evpn_mac_vni_all_vtep_cmd
,
2227 "show evpn mac vni all vtep A.B.C.D [json]",
2231 "VxLAN Network Identifier\n"
2234 "Remote VTEP IP address\n"
2237 struct zebra_vrf
*zvrf
;
2238 struct in_addr vtep_ip
;
2239 bool uj
= use_json(argc
, argv
);
2241 if (!inet_aton(argv
[6]->arg
, &vtep_ip
)) {
2243 vty_out(vty
, "%% Malformed VTEP IP address\n");
2246 zvrf
= zebra_vrf_get_evpn();
2247 zebra_vxlan_print_macs_all_vni_vtep(vty
, zvrf
, vtep_ip
, uj
);
2253 DEFUN (show_evpn_mac_vni_mac
,
2254 show_evpn_mac_vni_mac_cmd
,
2255 "show evpn mac vni " CMD_VNI_RANGE
" mac WORD [json]",
2259 "VxLAN Network Identifier\n"
2262 "MAC address (e.g., 00:e0:ec:20:12:62)\n"
2266 struct zebra_vrf
*zvrf
;
2269 bool uj
= use_json(argc
, argv
);
2271 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2272 if (!prefix_str2mac(argv
[6]->arg
, &mac
)) {
2273 vty_out(vty
, "%% Malformed MAC address");
2276 zvrf
= zebra_vrf_get_evpn();
2277 zebra_vxlan_print_specific_mac_vni(vty
, zvrf
, vni
, &mac
, uj
);
2281 DEFUN (show_evpn_mac_vni_vtep
,
2282 show_evpn_mac_vni_vtep_cmd
,
2283 "show evpn mac vni " CMD_VNI_RANGE
" vtep A.B.C.D" "[json]",
2287 "VxLAN Network Identifier\n"
2290 "Remote VTEP IP address\n"
2293 struct zebra_vrf
*zvrf
;
2295 struct in_addr vtep_ip
;
2296 bool uj
= use_json(argc
, argv
);
2298 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2299 if (!inet_aton(argv
[6]->arg
, &vtep_ip
)) {
2301 vty_out(vty
, "%% Malformed VTEP IP address\n");
2305 zvrf
= zebra_vrf_get_evpn();
2306 zebra_vxlan_print_macs_vni_vtep(vty
, zvrf
, vni
, vtep_ip
, uj
);
2310 DEFPY (show_evpn_mac_vni_all_dad
,
2311 show_evpn_mac_vni_all_dad_cmd
,
2312 "show evpn mac vni all duplicate [json]",
2316 "VxLAN Network Identifier\n"
2318 "Duplicate address list\n"
2321 struct zebra_vrf
*zvrf
;
2322 bool uj
= use_json(argc
, argv
);
2324 zvrf
= zebra_vrf_get_evpn();
2325 zebra_vxlan_print_macs_all_vni(vty
, zvrf
, true, uj
);
2330 DEFPY (show_evpn_mac_vni_dad
,
2331 show_evpn_mac_vni_dad_cmd
,
2332 "show evpn mac vni " CMD_VNI_RANGE
" duplicate [json]",
2336 "VxLAN Network Identifier\n"
2338 "Duplicate address list\n"
2341 struct zebra_vrf
*zvrf
;
2342 bool uj
= use_json(argc
, argv
);
2344 zvrf
= zebra_vrf_get_evpn();
2346 zebra_vxlan_print_macs_vni_dad(vty
, zvrf
, vni
, uj
);
2351 DEFPY (show_evpn_neigh_vni_dad
,
2352 show_evpn_neigh_vni_dad_cmd
,
2353 "show evpn arp-cache vni " CMD_VNI_RANGE
"duplicate [json]",
2356 "ARP and ND cache\n"
2357 "VxLAN Network Identifier\n"
2359 "Duplicate address list\n"
2362 struct zebra_vrf
*zvrf
;
2363 bool uj
= use_json(argc
, argv
);
2365 zvrf
= zebra_vrf_get_evpn();
2366 zebra_vxlan_print_neigh_vni_dad(vty
, zvrf
, vni
, uj
);
2370 DEFPY (show_evpn_neigh_vni_all_dad
,
2371 show_evpn_neigh_vni_all_dad_cmd
,
2372 "show evpn arp-cache vni all duplicate [json]",
2375 "ARP and ND cache\n"
2376 "VxLAN Network Identifier\n"
2378 "Duplicate address list\n"
2381 struct zebra_vrf
*zvrf
;
2382 bool uj
= use_json(argc
, argv
);
2384 zvrf
= zebra_vrf_get_evpn();
2385 zebra_vxlan_print_neigh_all_vni(vty
, zvrf
, true, uj
);
2390 DEFUN (show_evpn_neigh_vni
,
2391 show_evpn_neigh_vni_cmd
,
2392 "show evpn arp-cache vni " CMD_VNI_RANGE
"[json]",
2395 "ARP and ND cache\n"
2396 "VxLAN Network Identifier\n"
2400 struct zebra_vrf
*zvrf
;
2402 bool uj
= use_json(argc
, argv
);
2404 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2405 zvrf
= zebra_vrf_get_evpn();
2406 zebra_vxlan_print_neigh_vni(vty
, zvrf
, vni
, uj
);
2410 DEFUN (show_evpn_neigh_vni_all
,
2411 show_evpn_neigh_vni_all_cmd
,
2412 "show evpn arp-cache vni all [json]",
2415 "ARP and ND cache\n"
2416 "VxLAN Network Identifier\n"
2420 struct zebra_vrf
*zvrf
;
2421 bool uj
= use_json(argc
, argv
);
2423 zvrf
= zebra_vrf_get_evpn();
2424 zebra_vxlan_print_neigh_all_vni(vty
, zvrf
, false, uj
);
2428 DEFUN (show_evpn_neigh_vni_all_detail
, show_evpn_neigh_vni_all_detail_cmd
,
2429 "show evpn arp-cache vni all detail [json]",
2432 "ARP and ND cache\n"
2433 "VxLAN Network Identifier\n"
2435 "Neighbor details for all vnis in detail\n" JSON_STR
)
2437 struct zebra_vrf
*zvrf
;
2438 bool uj
= use_json(argc
, argv
);
2440 zvrf
= zebra_vrf_get_evpn();
2441 zebra_vxlan_print_neigh_all_vni_detail(vty
, zvrf
, false, uj
);
2445 DEFUN (show_evpn_neigh_vni_neigh
,
2446 show_evpn_neigh_vni_neigh_cmd
,
2447 "show evpn arp-cache vni " CMD_VNI_RANGE
" ip WORD [json]",
2450 "ARP and ND cache\n"
2451 "VxLAN Network Identifier\n"
2454 "Neighbor address (IPv4 or IPv6 address)\n"
2457 struct zebra_vrf
*zvrf
;
2460 bool uj
= use_json(argc
, argv
);
2462 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2463 if (str2ipaddr(argv
[6]->arg
, &ip
) != 0) {
2465 vty_out(vty
, "%% Malformed Neighbor address\n");
2468 zvrf
= zebra_vrf_get_evpn();
2469 zebra_vxlan_print_specific_neigh_vni(vty
, zvrf
, vni
, &ip
, uj
);
2473 DEFUN (show_evpn_neigh_vni_vtep
,
2474 show_evpn_neigh_vni_vtep_cmd
,
2475 "show evpn arp-cache vni " CMD_VNI_RANGE
" vtep A.B.C.D [json]",
2478 "ARP and ND cache\n"
2479 "VxLAN Network Identifier\n"
2482 "Remote VTEP IP address\n"
2485 struct zebra_vrf
*zvrf
;
2487 struct in_addr vtep_ip
;
2488 bool uj
= use_json(argc
, argv
);
2490 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
2491 if (!inet_aton(argv
[6]->arg
, &vtep_ip
)) {
2493 vty_out(vty
, "%% Malformed VTEP IP address\n");
2497 zvrf
= zebra_vrf_get_evpn();
2498 zebra_vxlan_print_neigh_vni_vtep(vty
, zvrf
, vni
, vtep_ip
, uj
);
2502 /* policy routing contexts */
2503 DEFUN (show_pbr_ipset
,
2505 "show pbr ipset [WORD]",
2507 "Policy-Based Routing\n"
2508 "IPset Context information\n"
2509 "IPset Name information\n")
2513 found
= argv_find(argv
, argc
, "WORD", &idx
);
2515 zebra_pbr_show_ipset_list(vty
, NULL
);
2517 zebra_pbr_show_ipset_list(vty
, argv
[idx
]->arg
);
2521 /* policy routing contexts */
2522 DEFUN (show_pbr_iptable
,
2523 show_pbr_iptable_cmd
,
2524 "show pbr iptable [WORD]",
2526 "Policy-Based Routing\n"
2527 "IPtable Context information\n"
2528 "IPtable Name information\n")
2533 found
= argv_find(argv
, argc
, "WORD", &idx
);
2535 zebra_pbr_show_iptable(vty
, NULL
);
2537 zebra_pbr_show_iptable(vty
, argv
[idx
]->arg
);
2541 DEFPY (clear_evpn_dup_addr
,
2542 clear_evpn_dup_addr_cmd
,
2543 "clear evpn dup-addr vni <all$vni_all |" CMD_VNI_RANGE
"$vni [mac X:X:X:X:X:X | ip <A.B.C.D|X:X::X:X>]>",
2546 "Duplicate address \n"
2547 "VxLAN Network Identifier\n"
2551 "MAC address (e.g., 00:e0:ec:20:12:62)\n"
2556 struct zebra_vrf
*zvrf
;
2557 struct ipaddr host_ip
= {.ipa_type
= IPADDR_NONE
};
2558 int ret
= CMD_SUCCESS
;
2560 zvrf
= zebra_vrf_get_evpn();
2562 if (!is_zero_mac(&mac
->eth_addr
)) {
2563 ret
= zebra_vxlan_clear_dup_detect_vni_mac(vty
, zvrf
,
2567 if (sockunion_family(ip
) == AF_INET
) {
2568 host_ip
.ipa_type
= IPADDR_V4
;
2569 host_ip
.ipaddr_v4
.s_addr
= sockunion2ip(ip
);
2571 host_ip
.ipa_type
= IPADDR_V6
;
2572 memcpy(&host_ip
.ipaddr_v6
, &ip
->sin6
.sin6_addr
,
2573 sizeof(struct in6_addr
));
2575 ret
= zebra_vxlan_clear_dup_detect_vni_ip(vty
, zvrf
,
2579 ret
= zebra_vxlan_clear_dup_detect_vni(vty
, zvrf
, vni
);
2582 ret
= zebra_vxlan_clear_dup_detect_vni_all(vty
, zvrf
);
2588 /* Static ip route configuration write function. */
2589 static int zebra_ip_config(struct vty
*vty
)
2593 write
+= zebra_import_table_config(vty
, VRF_DEFAULT
);
2598 DEFUN (ip_zebra_import_table_distance
,
2599 ip_zebra_import_table_distance_cmd
,
2600 "ip import-table (1-252) [distance (1-255)] [route-map WORD]",
2602 "import routes from non-main kernel table\n"
2603 "kernel routing table id\n"
2604 "Distance for imported routes\n"
2605 "Default distance value\n"
2606 "route-map for filtering\n"
2609 uint32_t table_id
= 0;
2611 table_id
= strtoul(argv
[2]->arg
, NULL
, 10);
2612 int distance
= ZEBRA_TABLE_DISTANCE_DEFAULT
;
2614 strmatch(argv
[argc
- 2]->text
, "route-map")
2615 ? XSTRDUP(MTYPE_ROUTE_MAP_NAME
, argv
[argc
- 1]->arg
)
2619 if (argc
== 7 || (argc
== 5 && !rmap
))
2620 distance
= strtoul(argv
[4]->arg
, NULL
, 10);
2622 if (!is_zebra_valid_kernel_table(table_id
)) {
2624 "Invalid routing table ID, %d. Must be in range 1-252\n",
2627 XFREE(MTYPE_ROUTE_MAP_NAME
, rmap
);
2631 if (is_zebra_main_routing_table(table_id
)) {
2633 "Invalid routing table ID, %d. Must be non-default table\n",
2636 XFREE(MTYPE_ROUTE_MAP_NAME
, rmap
);
2640 ret
= zebra_import_table(AFI_IP
, VRF_DEFAULT
, table_id
,
2643 XFREE(MTYPE_ROUTE_MAP_NAME
, rmap
);
2648 DEFUN_HIDDEN (zebra_packet_process
,
2649 zebra_packet_process_cmd
,
2650 "zebra zapi-packets (1-10000)",
2653 "Number of packets to process before relinquishing thread\n")
2655 uint32_t packets
= strtoul(argv
[2]->arg
, NULL
, 10);
2657 atomic_store_explicit(&zrouter
.packets_to_process
, packets
,
2658 memory_order_relaxed
);
2663 DEFUN_HIDDEN (no_zebra_packet_process
,
2664 no_zebra_packet_process_cmd
,
2665 "no zebra zapi-packets [(1-10000)]",
2669 "Number of packets to process before relinquishing thread\n")
2671 atomic_store_explicit(&zrouter
.packets_to_process
,
2672 ZEBRA_ZAPI_PACKETS_TO_PROCESS
,
2673 memory_order_relaxed
);
2678 DEFUN_HIDDEN (zebra_workqueue_timer
,
2679 zebra_workqueue_timer_cmd
,
2680 "zebra work-queue (0-10000)",
2683 "Time in milliseconds\n")
2685 uint32_t timer
= strtoul(argv
[2]->arg
, NULL
, 10);
2686 zrouter
.ribq
->spec
.hold
= timer
;
2691 DEFUN_HIDDEN (no_zebra_workqueue_timer
,
2692 no_zebra_workqueue_timer_cmd
,
2693 "no zebra work-queue [(0-10000)]",
2697 "Time in milliseconds\n")
2699 zrouter
.ribq
->spec
.hold
= ZEBRA_RIB_PROCESS_HOLD_TIME
;
2704 DEFUN (no_ip_zebra_import_table
,
2705 no_ip_zebra_import_table_cmd
,
2706 "no ip import-table (1-252) [distance (1-255)] [route-map NAME]",
2709 "import routes from non-main kernel table\n"
2710 "kernel routing table id\n"
2711 "Distance for imported routes\n"
2712 "Default distance value\n"
2713 "route-map for filtering\n"
2716 uint32_t table_id
= 0;
2717 table_id
= strtoul(argv
[3]->arg
, NULL
, 10);
2719 if (!is_zebra_valid_kernel_table(table_id
)) {
2721 "Invalid routing table ID. Must be in range 1-252\n");
2725 if (is_zebra_main_routing_table(table_id
)) {
2727 "Invalid routing table ID, %d. Must be non-default table\n",
2732 if (!is_zebra_import_table_enabled(AFI_IP
, VRF_DEFAULT
, table_id
))
2735 return (zebra_import_table(AFI_IP
, VRF_DEFAULT
, table_id
, 0, NULL
, 0));
2738 static int config_write_protocol(struct vty
*vty
)
2741 vty_out(vty
, "allow-external-route-update\n");
2743 if (zrouter
.ribq
->spec
.hold
!= ZEBRA_RIB_PROCESS_HOLD_TIME
)
2744 vty_out(vty
, "zebra work-queue %u\n", zrouter
.ribq
->spec
.hold
);
2746 if (zrouter
.packets_to_process
!= ZEBRA_ZAPI_PACKETS_TO_PROCESS
)
2747 vty_out(vty
, "zebra zapi-packets %u\n",
2748 zrouter
.packets_to_process
);
2750 enum multicast_mode ipv4_multicast_mode
= multicast_mode_ipv4_get();
2752 if (ipv4_multicast_mode
!= MCAST_NO_CONFIG
)
2753 vty_out(vty
, "ip multicast rpf-lookup-mode %s\n",
2754 ipv4_multicast_mode
== MCAST_URIB_ONLY
2756 : ipv4_multicast_mode
== MCAST_MRIB_ONLY
2758 : ipv4_multicast_mode
2759 == MCAST_MIX_MRIB_FIRST
2761 : ipv4_multicast_mode
2762 == MCAST_MIX_DISTANCE
2766 /* Include dataplane info */
2767 dplane_config_write_helper(vty
);
2781 " Route Route Neighbor LSP LSP\n");
2783 "VRF Installs Removals Updates Installs Removals\n");
2785 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2786 struct zebra_vrf
*zvrf
= vrf
->info
;
2788 vty_out(vty
, "%-25s %10" PRIu64
" %10" PRIu64
" %10" PRIu64
2789 " %10" PRIu64
" %10" PRIu64
"\n",
2790 vrf
->name
, zvrf
->installs
, zvrf
->removals
,
2791 zvrf
->neigh_updates
, zvrf
->lsp_installs
,
2792 zvrf
->lsp_removals
);
2798 DEFUN (ip_forwarding
,
2802 "Turn on IP forwarding\n")
2808 ret
= ipforward_on();
2811 vty_out(vty
, "Can't turn on IP forwarding\n");
2812 return CMD_WARNING_CONFIG_FAILED
;
2818 DEFUN (no_ip_forwarding
,
2819 no_ip_forwarding_cmd
,
2823 "Turn off IP forwarding\n")
2829 ret
= ipforward_off();
2832 vty_out(vty
, "Can't turn off IP forwarding\n");
2833 return CMD_WARNING_CONFIG_FAILED
;
2839 /* Only display ip forwarding is enabled or not. */
2840 DEFUN (show_ip_forwarding
,
2841 show_ip_forwarding_cmd
,
2842 "show ip forwarding",
2845 "IP forwarding status\n")
2852 vty_out(vty
, "IP forwarding is off\n");
2854 vty_out(vty
, "IP forwarding is on\n");
2858 /* Only display ipv6 forwarding is enabled or not. */
2859 DEFUN (show_ipv6_forwarding
,
2860 show_ipv6_forwarding_cmd
,
2861 "show ipv6 forwarding",
2863 "IPv6 information\n"
2864 "Forwarding status\n")
2868 ret
= ipforward_ipv6();
2872 vty_out(vty
, "ipv6 forwarding is unknown\n");
2875 vty_out(vty
, "ipv6 forwarding is %s\n", "off");
2878 vty_out(vty
, "ipv6 forwarding is %s\n", "on");
2881 vty_out(vty
, "ipv6 forwarding is %s\n", "off");
2887 DEFUN (ipv6_forwarding
,
2888 ipv6_forwarding_cmd
,
2891 "Turn on IPv6 forwarding\n")
2895 ret
= ipforward_ipv6();
2897 ret
= ipforward_ipv6_on();
2900 vty_out(vty
, "Can't turn on IPv6 forwarding\n");
2901 return CMD_WARNING_CONFIG_FAILED
;
2907 DEFUN (no_ipv6_forwarding
,
2908 no_ipv6_forwarding_cmd
,
2909 "no ipv6 forwarding",
2912 "Turn off IPv6 forwarding\n")
2916 ret
= ipforward_ipv6();
2918 ret
= ipforward_ipv6_off();
2921 vty_out(vty
, "Can't turn off IPv6 forwarding\n");
2922 return CMD_WARNING_CONFIG_FAILED
;
2928 /* Display dataplane info */
2929 DEFUN (show_dataplane
,
2931 "show zebra dplane [detailed]",
2934 "Zebra dataplane information\n"
2935 "Detailed output\n")
2938 bool detailed
= false;
2940 if (argv_find(argv
, argc
, "detailed", &idx
))
2943 return dplane_show_helper(vty
, detailed
);
2946 /* Display dataplane providers info */
2947 DEFUN (show_dataplane_providers
,
2948 show_dataplane_providers_cmd
,
2949 "show zebra dplane providers [detailed]",
2952 "Zebra dataplane information\n"
2953 "Zebra dataplane provider information\n"
2954 "Detailed output\n")
2957 bool detailed
= false;
2959 if (argv_find(argv
, argc
, "detailed", &idx
))
2962 return dplane_show_provs_helper(vty
, detailed
);
2965 /* Configure dataplane incoming queue limit */
2966 DEFUN (zebra_dplane_queue_limit
,
2967 zebra_dplane_queue_limit_cmd
,
2968 "zebra dplane limit (0-10000)",
2971 "Limit incoming queued updates\n"
2972 "Number of queued updates\n")
2976 limit
= strtoul(argv
[3]->arg
, NULL
, 10);
2978 dplane_set_in_queue_limit(limit
, true);
2983 /* Reset dataplane queue limit to default value */
2984 DEFUN (no_zebra_dplane_queue_limit
,
2985 no_zebra_dplane_queue_limit_cmd
,
2986 "no zebra dplane limit [(0-10000)]",
2990 "Limit incoming queued updates\n"
2991 "Number of queued updates\n")
2993 dplane_set_in_queue_limit(0, false);
2998 DEFUN (zebra_show_routing_tables_summary
,
2999 zebra_show_routing_tables_summary_cmd
,
3000 "show zebra router table summary",
3003 "The Zebra Router Information\n"
3004 "Table Information about this Zebra Router\n"
3005 "Summary Information\n")
3007 zebra_router_show_table_summary(vty
);
3012 /* Table configuration write function. */
3013 static int config_write_table(struct vty
*vty
)
3018 /* IPForwarding configuration write function. */
3019 static int config_write_forwarding(struct vty
*vty
)
3021 /* FIXME: Find better place for that. */
3022 router_id_write(vty
);
3025 vty_out(vty
, "no ip forwarding\n");
3026 if (!ipforward_ipv6())
3027 vty_out(vty
, "no ipv6 forwarding\n");
3028 vty_out(vty
, "!\n");
3032 DEFUN_HIDDEN (show_frr
,
3038 vty_out(vty
, "........ .. . .. . ..... ...77:................................................\n");
3039 vty_out(vty
, ".............................7777:..............................................\n");
3040 vty_out(vty
, ".............................777777,............................................\n");
3041 vty_out(vty
, "... .........................77777777,..........................................\n");
3042 vty_out(vty
, "............................=7777777777:........................................\n");
3043 vty_out(vty
, "........................:7777777777777777,......................................\n");
3044 vty_out(vty
, ".................... ~7777777777777?~,..........................................\n");
3045 vty_out(vty
, "...................I7777777777+.................................................\n");
3046 vty_out(vty
, "................,777777777?............ .......................................\n");
3047 vty_out(vty
, "..............:77777777?..........~?77777.......................................\n");
3048 vty_out(vty
, ".............77777777~........=7777777777.......................................\n");
3049 vty_out(vty
, ".......... +7777777,.......?7777777777777.......................................\n");
3050 vty_out(vty
, "..........7777777~......:7777777777777777......77?,.............................\n");
3051 vty_out(vty
, "........:777777?......+777777777777777777......777777I,.........................\n");
3052 vty_out(vty
, ".......?777777,.....+77777777777777777777......777777777?.......................\n");
3053 vty_out(vty
, "......?777777......7777777777777777777777......,?777777777?.....................\n");
3054 vty_out(vty
, ".....?77777?.....=7777777777777777777I~............,I7777777~...................\n");
3055 vty_out(vty
, "....+77777+.....I77777777777777777:...................+777777I..................\n");
3056 vty_out(vty
, "...~77777+.....7777777777777777=........................?777777...... .......\n");
3057 vty_out(vty
, "...77777I.....I77777777777777~.........:?................,777777.....I777.......\n");
3058 vty_out(vty
, "..777777.....I7777777777777I .......?7777..................777777.....777?......\n");
3059 vty_out(vty
, ".~77777,....=7777777777777:......,7777777..................,77777+....+777......\n");
3060 vty_out(vty
, ".77777I.....7777777777777,......777777777.......ONNNN.......=77777.....777~.....\n");
3061 vty_out(vty
, ",77777.....I777777777777,.....:7777777777......DNNNNNN.......77777+ ...7777.....\n");
3062 vty_out(vty
, "I7777I.....777777777777=.....~77777777777......NNNNNNN~......=7777I....=777.....\n");
3063 vty_out(vty
, "77777:....=777777777777.....,777777777777......$NNNNND ......:77777....:777.....\n");
3064 vty_out(vty
, "77777. ...777777777777~.....7777777777777........7DZ,........:77777.....777.....\n");
3065 vty_out(vty
, "????? . ..777777777777.....,7777777777777....................:77777I....777.....\n");
3066 vty_out(vty
, "....... ..777777777777.....+7777777777777....................=7777777+...?7.....\n");
3067 vty_out(vty
, "..........77777777777I.....I7777777777777....................7777777777:........\n");
3068 vty_out(vty
, "..........77777777777I.....?7777777777777...................~777777777777.......\n");
3069 vty_out(vty
, "..........777777777777.....~7777777777777..................,77777777777777+.....\n");
3070 vty_out(vty
, "..........777777777777......7777777777777..................77777777777777777,...\n");
3071 vty_out(vty
, "..... ....?77777777777I.....~777777777777................,777777.....,:+77777I..\n");
3072 vty_out(vty
, "........ .:777777777777,.....?77777777777...............?777777..............,:=\n");
3073 vty_out(vty
, ".......... 7777777777777..... ?7777777777.............=7777777.....~777I........\n");
3074 vty_out(vty
, "...........:777777777777I......~777777777...........I7777777~.....+777I.........\n");
3075 vty_out(vty
, "..... ......7777777777777I.......I7777777.......+777777777I......7777I..........\n");
3076 vty_out(vty
, ".............77777777777777........?77777......777777777?......=7777=...........\n");
3077 vty_out(vty
, ".............,77777777777777+.........~77......777777I,......:77777.............\n");
3078 vty_out(vty
, "..............~777777777777777~................777777......:77777=..............\n");
3079 vty_out(vty
, "...............:7777777777777777?..............:777777,.....=77=................\n");
3080 vty_out(vty
, "................,777777777777777777?,...........,777777:.....,..................\n");
3081 vty_out(vty
, "........... ......I777777777777777777777I.........777777~.......................\n");
3082 vty_out(vty
, "...................,777777777777777777777..........777777+......................\n");
3083 vty_out(vty
, ".....................+7777777777777777777...........777777?.....................\n");
3084 vty_out(vty
, ".......................=77777777777777777............777777I....................\n");
3085 vty_out(vty
, ".........................:777777777777777.............I77777I...................\n");
3086 vty_out(vty
, "............................~777777777777..............+777777..................\n");
3087 vty_out(vty
, "................................~77777777...............=777777.................\n");
3088 vty_out(vty
, ".....................................:=?I................~777777................\n");
3089 vty_out(vty
, "..........................................................:777777,..............\n");
3090 vty_out(vty
, ".... ... ... . . .... ....... ....... ....................:777777..............\n");
3095 /* IP node for static routes. */
3096 static struct cmd_node ip_node
= {IP_NODE
, "", 1};
3097 static struct cmd_node protocol_node
= {PROTOCOL_NODE
, "", 1};
3098 /* table node for routing tables. */
3099 static struct cmd_node table_node
= {TABLE_NODE
,
3100 "", /* This node has no interface. */
3102 static struct cmd_node forwarding_node
= {FORWARDING_NODE
,
3103 "", /* This node has no interface. */
3107 void zebra_vty_init(void)
3109 /* Install configuration write function. */
3110 install_node(&table_node
, config_write_table
);
3111 install_node(&forwarding_node
, config_write_forwarding
);
3113 install_element(VIEW_NODE
, &show_ip_forwarding_cmd
);
3114 install_element(CONFIG_NODE
, &ip_forwarding_cmd
);
3115 install_element(CONFIG_NODE
, &no_ip_forwarding_cmd
);
3116 install_element(ENABLE_NODE
, &show_zebra_cmd
);
3118 install_element(VIEW_NODE
, &show_ipv6_forwarding_cmd
);
3119 install_element(CONFIG_NODE
, &ipv6_forwarding_cmd
);
3120 install_element(CONFIG_NODE
, &no_ipv6_forwarding_cmd
);
3123 zebra_route_map_init();
3125 install_node(&ip_node
, zebra_ip_config
);
3126 install_node(&protocol_node
, config_write_protocol
);
3128 install_element(CONFIG_NODE
, &allow_external_route_update_cmd
);
3129 install_element(CONFIG_NODE
, &no_allow_external_route_update_cmd
);
3131 install_element(CONFIG_NODE
, &ip_multicast_mode_cmd
);
3132 install_element(CONFIG_NODE
, &no_ip_multicast_mode_cmd
);
3134 install_element(CONFIG_NODE
, &ip_zebra_import_table_distance_cmd
);
3135 install_element(CONFIG_NODE
, &no_ip_zebra_import_table_cmd
);
3136 install_element(CONFIG_NODE
, &zebra_workqueue_timer_cmd
);
3137 install_element(CONFIG_NODE
, &no_zebra_workqueue_timer_cmd
);
3138 install_element(CONFIG_NODE
, &zebra_packet_process_cmd
);
3139 install_element(CONFIG_NODE
, &no_zebra_packet_process_cmd
);
3141 install_element(VIEW_NODE
, &show_nexthop_group_cmd
);
3143 install_element(VIEW_NODE
, &show_vrf_cmd
);
3144 install_element(VIEW_NODE
, &show_vrf_vni_cmd
);
3145 install_element(VIEW_NODE
, &show_route_cmd
);
3146 install_element(VIEW_NODE
, &show_route_table_cmd
);
3147 if (vrf_is_backend_netns())
3148 install_element(VIEW_NODE
, &show_route_table_vrf_cmd
);
3149 install_element(VIEW_NODE
, &show_route_all_table_vrf_cmd
);
3150 install_element(VIEW_NODE
, &show_route_detail_cmd
);
3151 install_element(VIEW_NODE
, &show_route_summary_cmd
);
3152 install_element(VIEW_NODE
, &show_ip_nht_cmd
);
3154 install_element(VIEW_NODE
, &show_ip_rpf_cmd
);
3155 install_element(VIEW_NODE
, &show_ip_rpf_addr_cmd
);
3157 install_element(CONFIG_NODE
, &ip_nht_default_route_cmd
);
3158 install_element(CONFIG_NODE
, &no_ip_nht_default_route_cmd
);
3159 install_element(CONFIG_NODE
, &ipv6_nht_default_route_cmd
);
3160 install_element(CONFIG_NODE
, &no_ipv6_nht_default_route_cmd
);
3161 install_element(VRF_NODE
, &ip_nht_default_route_cmd
);
3162 install_element(VRF_NODE
, &no_ip_nht_default_route_cmd
);
3163 install_element(VRF_NODE
, &ipv6_nht_default_route_cmd
);
3164 install_element(VRF_NODE
, &no_ipv6_nht_default_route_cmd
);
3165 install_element(VIEW_NODE
, &show_ipv6_mroute_cmd
);
3167 /* Commands for VRF */
3168 install_element(VIEW_NODE
, &show_ipv6_mroute_vrf_all_cmd
);
3170 install_element(VIEW_NODE
, &show_frr_cmd
);
3171 install_element(VIEW_NODE
, &show_evpn_global_cmd
);
3172 install_element(VIEW_NODE
, &show_evpn_vni_cmd
);
3173 install_element(VIEW_NODE
, &show_evpn_vni_detail_cmd
);
3174 install_element(VIEW_NODE
, &show_evpn_vni_vni_cmd
);
3175 install_element(VIEW_NODE
, &show_evpn_rmac_vni_mac_cmd
);
3176 install_element(VIEW_NODE
, &show_evpn_rmac_vni_cmd
);
3177 install_element(VIEW_NODE
, &show_evpn_rmac_vni_all_cmd
);
3178 install_element(VIEW_NODE
, &show_evpn_nh_vni_ip_cmd
);
3179 install_element(VIEW_NODE
, &show_evpn_nh_vni_cmd
);
3180 install_element(VIEW_NODE
, &show_evpn_nh_vni_all_cmd
);
3181 install_element(VIEW_NODE
, &show_evpn_mac_vni_cmd
);
3182 install_element(VIEW_NODE
, &show_evpn_mac_vni_all_cmd
);
3183 install_element(VIEW_NODE
, &show_evpn_mac_vni_all_detail_cmd
);
3184 install_element(VIEW_NODE
, &show_evpn_mac_vni_all_vtep_cmd
);
3185 install_element(VIEW_NODE
, &show_evpn_mac_vni_mac_cmd
);
3186 install_element(VIEW_NODE
, &show_evpn_mac_vni_vtep_cmd
);
3187 install_element(VIEW_NODE
, &show_evpn_mac_vni_dad_cmd
);
3188 install_element(VIEW_NODE
, &show_evpn_mac_vni_all_dad_cmd
);
3189 install_element(VIEW_NODE
, &show_evpn_neigh_vni_cmd
);
3190 install_element(VIEW_NODE
, &show_evpn_neigh_vni_all_cmd
);
3191 install_element(VIEW_NODE
, &show_evpn_neigh_vni_all_detail_cmd
);
3192 install_element(VIEW_NODE
, &show_evpn_neigh_vni_neigh_cmd
);
3193 install_element(VIEW_NODE
, &show_evpn_neigh_vni_vtep_cmd
);
3194 install_element(VIEW_NODE
, &show_evpn_neigh_vni_dad_cmd
);
3195 install_element(VIEW_NODE
, &show_evpn_neigh_vni_all_dad_cmd
);
3196 install_element(ENABLE_NODE
, &clear_evpn_dup_addr_cmd
);
3198 install_element(VIEW_NODE
, &show_pbr_ipset_cmd
);
3199 install_element(VIEW_NODE
, &show_pbr_iptable_cmd
);
3201 install_element(CONFIG_NODE
, &default_vrf_vni_mapping_cmd
);
3202 install_element(CONFIG_NODE
, &no_default_vrf_vni_mapping_cmd
);
3203 install_element(VRF_NODE
, &vrf_vni_mapping_cmd
);
3204 install_element(VRF_NODE
, &no_vrf_vni_mapping_cmd
);
3206 install_element(VIEW_NODE
, &show_dataplane_cmd
);
3207 install_element(VIEW_NODE
, &show_dataplane_providers_cmd
);
3208 install_element(CONFIG_NODE
, &zebra_dplane_queue_limit_cmd
);
3209 install_element(CONFIG_NODE
, &no_zebra_dplane_queue_limit_cmd
);
3211 install_element(VIEW_NODE
, &zebra_show_routing_tables_summary_cmd
);