3 Copyright (C) 2008 Everton da Silva Marques
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 $QuaggaId: $Format:%an, %ai, %h$ $
31 #include "pim_mroute.h"
33 #include "pim_iface.h"
35 #include "pim_mroute.h"
38 #include "pim_igmpv3.h"
43 #include "pim_neighbor.h"
45 #include "pim_ifchannel.h"
46 #include "pim_hello.h"
48 #include "pim_upstream.h"
50 #include "pim_macro.h"
51 #include "pim_ssmpingd.h"
52 #include "pim_zebra.h"
53 #include "pim_static.h"
56 static struct cmd_node pim_global_node
= {
62 static struct cmd_node interface_node
= {
68 static void pim_if_membership_clear(struct interface
*ifp
)
70 struct pim_interface
*pim_ifp
;
75 if (PIM_IF_TEST_PIM(pim_ifp
->options
) &&
76 PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
80 pim_ifchannel_membership_clear(ifp
);
84 When PIM is disabled on interface, IGMPv3 local membership
85 information is not injected into PIM interface state.
87 The function pim_if_membership_refresh() fetches all IGMPv3 local
88 membership information into PIM. It is intented to be called
89 whenever PIM is enabled on the interface in order to collect missed
90 local membership information.
92 static void pim_if_membership_refresh(struct interface
*ifp
)
94 struct pim_interface
*pim_ifp
;
95 struct listnode
*sock_node
;
96 struct igmp_sock
*igmp
;
101 if (!PIM_IF_TEST_PIM(pim_ifp
->options
))
103 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
107 First clear off membership from all PIM (S,G) entries on the
111 pim_ifchannel_membership_clear(ifp
);
114 Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on
118 /* scan igmp sockets */
119 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
120 struct listnode
*grpnode
;
121 struct igmp_group
*grp
;
123 /* scan igmp groups */
124 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
125 struct listnode
*srcnode
;
126 struct igmp_source
*src
;
128 /* scan group sources */
129 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
131 if (IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
)) {
132 pim_ifchannel_local_membership_add(ifp
,
137 } /* scan group sources */
138 } /* scan igmp groups */
139 } /* scan igmp sockets */
142 Finally delete every PIM (S,G) entry lacking all state info
145 pim_ifchannel_delete_on_noinfo(ifp
);
149 static void pim_show_assert(struct vty
*vty
)
151 struct listnode
*ifnode
;
152 struct interface
*ifp
;
155 now
= pim_time_monotonic_sec();
158 "Interface Address Source Group State Winner Uptime Timer%s",
161 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
162 struct pim_interface
*pim_ifp
;
163 struct in_addr ifaddr
;
164 struct listnode
*ch_node
;
165 struct pim_ifchannel
*ch
;
172 ifaddr
= pim_ifp
->primary_address
;
174 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
175 char ch_src_str
[100];
176 char ch_grp_str
[100];
177 char winner_str
[100];
181 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
182 ch_src_str
, sizeof(ch_src_str
));
183 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
184 ch_grp_str
, sizeof(ch_grp_str
));
185 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
,
186 winner_str
, sizeof(winner_str
));
188 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
189 pim_time_timer_to_mmss(timer
, sizeof(timer
),
190 ch
->t_ifassert_timer
);
192 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
197 pim_ifchannel_ifassert_name(ch
->ifassert_state
),
202 } /* scan interface channels */
203 } /* scan interfaces */
206 static void pim_show_assert_internal(struct vty
*vty
)
208 struct listnode
*ifnode
;
209 struct interface
*ifp
;
213 "ECA: Evaluate CouldAssert%s"
214 "ATD: AssertTrackingDesired%s"
215 "eATD: Evaluate AssertTrackingDesired%s%s",
216 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
219 "Interface Address Source Group CA eCA ATD eATD%s",
222 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
223 struct pim_interface
*pim_ifp
;
224 struct in_addr ifaddr
;
225 struct listnode
*ch_node
;
226 struct pim_ifchannel
*ch
;
233 ifaddr
= pim_ifp
->primary_address
;
235 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
236 char ch_src_str
[100];
237 char ch_grp_str
[100];
239 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
240 ch_src_str
, sizeof(ch_src_str
));
241 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
242 ch_grp_str
, sizeof(ch_grp_str
));
243 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
248 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
249 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
250 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes" : "no",
251 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no",
253 } /* scan interface channels */
254 } /* scan interfaces */
257 static void pim_show_assert_metric(struct vty
*vty
)
259 struct listnode
*ifnode
;
260 struct interface
*ifp
;
263 "Interface Address Source Group RPT Pref Metric Address %s",
266 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
267 struct pim_interface
*pim_ifp
;
268 struct in_addr ifaddr
;
269 struct listnode
*ch_node
;
270 struct pim_ifchannel
*ch
;
277 ifaddr
= pim_ifp
->primary_address
;
279 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
280 char ch_src_str
[100];
281 char ch_grp_str
[100];
283 struct pim_assert_metric am
;
285 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
, pim_ifp
->primary_address
);
287 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
288 ch_src_str
, sizeof(ch_src_str
));
289 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
290 ch_grp_str
, sizeof(ch_grp_str
));
291 pim_inet4_dump("<addr?>", am
.ip_address
,
292 addr_str
, sizeof(addr_str
));
294 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s%s",
299 am
.rpt_bit_flag
? "yes" : "no",
300 am
.metric_preference
,
304 } /* scan interface channels */
305 } /* scan interfaces */
308 static void pim_show_assert_winner_metric(struct vty
*vty
)
310 struct listnode
*ifnode
;
311 struct interface
*ifp
;
314 "Interface Address Source Group RPT Pref Metric Address %s",
317 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
318 struct pim_interface
*pim_ifp
;
319 struct in_addr ifaddr
;
320 struct listnode
*ch_node
;
321 struct pim_ifchannel
*ch
;
328 ifaddr
= pim_ifp
->primary_address
;
330 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
331 char ch_src_str
[100];
332 char ch_grp_str
[100];
334 struct pim_assert_metric
*am
;
338 am
= &ch
->ifassert_winner_metric
;
340 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
341 ch_src_str
, sizeof(ch_src_str
));
342 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
343 ch_grp_str
, sizeof(ch_grp_str
));
344 pim_inet4_dump("<addr?>", am
->ip_address
,
345 addr_str
, sizeof(addr_str
));
347 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
348 snprintf(pref_str
, sizeof(pref_str
), "INFI");
350 snprintf(pref_str
, sizeof(pref_str
), "%4u", am
->metric_preference
);
352 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
353 snprintf(metr_str
, sizeof(metr_str
), "INFI");
355 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
357 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
362 am
->rpt_bit_flag
? "yes" : "no",
367 } /* scan interface channels */
368 } /* scan interfaces */
371 static void pim_show_membership(struct vty
*vty
)
373 struct listnode
*ifnode
;
374 struct interface
*ifp
;
377 "Interface Address Source Group Membership%s",
380 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
381 struct pim_interface
*pim_ifp
;
382 struct in_addr ifaddr
;
383 struct listnode
*ch_node
;
384 struct pim_ifchannel
*ch
;
391 ifaddr
= pim_ifp
->primary_address
;
393 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
394 char ch_src_str
[100];
395 char ch_grp_str
[100];
397 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
398 ch_src_str
, sizeof(ch_src_str
));
399 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
400 ch_grp_str
, sizeof(ch_grp_str
));
402 vty_out(vty
, "%-9s %-15s %-15s %-15s %-10s%s",
407 ch
->local_ifmembership
== PIM_IFMEMBERSHIP_NOINFO
?
408 "NOINFO" : "INCLUDE",
410 } /* scan interface channels */
411 } /* scan interfaces */
415 static void igmp_show_interfaces(struct vty
*vty
)
417 struct listnode
*node
;
418 struct interface
*ifp
;
421 now
= pim_time_monotonic_sec();
424 "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s",
427 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
428 struct pim_interface
*pim_ifp
;
429 struct listnode
*sock_node
;
430 struct igmp_sock
*igmp
;
437 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
441 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
443 mloop
= pim_socket_mcastloop_get(igmp
->fd
);
445 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
447 inet_ntoa(igmp
->ifaddr
),
451 if_is_multicast(ifp
) ? "yes" : "no",
452 if_is_broadcast(ifp
) ? "yes" : "no",
453 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
454 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
455 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
456 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
462 static void igmp_show_interface_join(struct vty
*vty
)
464 struct listnode
*node
;
465 struct interface
*ifp
;
468 now
= pim_time_monotonic_sec();
471 "Interface Address Source Group Socket Uptime %s",
474 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
475 struct pim_interface
*pim_ifp
;
476 struct listnode
*join_node
;
477 struct igmp_join
*ij
;
478 struct in_addr pri_addr
;
479 char pri_addr_str
[100];
486 if (!pim_ifp
->igmp_join_list
)
489 pri_addr
= pim_find_primary_addr(ifp
);
490 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
492 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, join_node
, ij
)) {
494 char source_str
[100];
497 pim_time_uptime(uptime
, sizeof(uptime
), now
- ij
->sock_creation
);
498 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
499 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
501 vty_out(vty
, "%-9s %-15s %-15s %-15s %6d %8s%s",
509 } /* for (pim_ifp->igmp_join_list) */
515 static void show_interface_address(struct vty
*vty
)
517 struct listnode
*ifpnode
;
518 struct interface
*ifp
;
521 "Interface Primary Secondary %s",
524 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifpnode
, ifp
)) {
525 struct listnode
*ifcnode
;
526 struct connected
*ifc
;
527 struct in_addr pri_addr
;
528 char pri_addr_str
[100];
530 pri_addr
= pim_find_primary_addr(ifp
);
532 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
534 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, ifcnode
, ifc
)) {
535 char sec_addr_str
[100];
536 struct prefix
*p
= ifc
->address
;
538 if (p
->family
!= AF_INET
)
541 if (p
->u
.prefix4
.s_addr
== pri_addr
.s_addr
) {
542 sec_addr_str
[0] = '\0';
545 pim_inet4_dump("<sec?>", p
->u
.prefix4
, sec_addr_str
, sizeof(sec_addr_str
));
548 vty_out(vty
, "%-9s %-15s %-15s%s",
557 static void pim_show_dr(struct vty
*vty
)
559 struct listnode
*node
;
560 struct interface
*ifp
;
563 now
= pim_time_monotonic_sec();
566 "NonPri: Number of neighbors missing DR Priority hello option%s"
567 "DrPri: Designated Router Priority sent%s%s",
568 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
570 vty_out(vty
, "Interface Address DR Uptime Elections Changes NonPri DrPri%s", VTY_NEWLINE
);
572 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
573 struct pim_interface
*pim_ifp
;
574 struct in_addr ifaddr
;
583 if (pim_ifp
->pim_sock_fd
< 0)
586 ifaddr
= pim_ifp
->primary_address
;
588 pim_time_uptime_begin(dr_uptime
, sizeof(dr_uptime
),
589 now
, pim_ifp
->pim_dr_election_last
);
591 pim_inet4_dump("<dr?>", pim_ifp
->pim_dr_addr
,
592 dr_str
, sizeof(dr_str
));
594 vty_out(vty
, "%-9s %-15s %-15s %8s %9d %7d %6d %10d%s",
599 pim_ifp
->pim_dr_election_count
,
600 pim_ifp
->pim_dr_election_changes
,
601 pim_ifp
->pim_dr_num_nondrpri_neighbors
,
602 pim_ifp
->pim_dr_priority
,
607 static void pim_show_hello(struct vty
*vty
)
609 struct listnode
*node
;
610 struct interface
*ifp
;
613 now
= pim_time_monotonic_sec();
615 vty_out(vty
, "Interface Address Period Timer StatStart Recv Rfail Send Sfail%s", VTY_NEWLINE
);
617 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
618 struct pim_interface
*pim_ifp
;
619 struct in_addr ifaddr
;
620 char hello_period
[10];
621 char hello_timer
[10];
622 char stat_uptime
[10];
629 if (pim_ifp
->pim_sock_fd
< 0)
632 ifaddr
= pim_ifp
->primary_address
;
634 pim_time_timer_to_mmss(hello_timer
, sizeof(hello_timer
), pim_ifp
->t_pim_hello_timer
);
635 pim_time_mmss(hello_period
, sizeof(hello_period
), pim_ifp
->pim_hello_period
);
636 pim_time_uptime(stat_uptime
, sizeof(stat_uptime
), now
- pim_ifp
->pim_ifstat_start
);
638 vty_out(vty
, "%-9s %-15s %6s %5s %9s %4u %5u %4u %5u%s",
644 pim_ifp
->pim_ifstat_hello_recv
,
645 pim_ifp
->pim_ifstat_hello_recvfail
,
646 pim_ifp
->pim_ifstat_hello_sent
,
647 pim_ifp
->pim_ifstat_hello_sendfail
,
652 static void pim_show_interfaces(struct vty
*vty
)
654 struct listnode
*node
;
655 struct interface
*ifp
;
658 now
= pim_time_monotonic_sec();
660 vty_out(vty
, "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s", VTY_NEWLINE
);
662 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
663 struct pim_interface
*pim_ifp
;
664 struct in_addr ifaddr
;
673 if (pim_ifp
->pim_sock_fd
< 0)
676 ifaddr
= pim_ifp
->primary_address
;
678 pim_time_uptime(uptime
, sizeof(uptime
), now
- pim_ifp
->pim_sock_creation
);
680 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
682 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
686 pim_ifp
->pim_sock_fd
,
688 if_is_multicast(ifp
) ? "yes" : "no",
689 if_is_broadcast(ifp
) ? "yes" : "no",
690 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
691 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
692 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
693 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
698 static void pim_show_join(struct vty
*vty
)
700 struct listnode
*ifnode
;
701 struct interface
*ifp
;
704 now
= pim_time_monotonic_sec();
707 "Interface Address Source Group State Uptime Expire Prune%s",
710 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
711 struct pim_interface
*pim_ifp
;
712 struct in_addr ifaddr
;
713 struct listnode
*ch_node
;
714 struct pim_ifchannel
*ch
;
721 ifaddr
= pim_ifp
->primary_address
;
723 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
724 char ch_src_str
[100];
725 char ch_grp_str
[100];
730 pim_inet4_dump("<ch_src?>", ch
->source_addr
,
731 ch_src_str
, sizeof(ch_src_str
));
732 pim_inet4_dump("<ch_grp?>", ch
->group_addr
,
733 ch_grp_str
, sizeof(ch_grp_str
));
735 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
736 pim_time_timer_to_mmss(expire
, sizeof(expire
),
737 ch
->t_ifjoin_expiry_timer
);
738 pim_time_timer_to_mmss(prune
, sizeof(prune
),
739 ch
->t_ifjoin_prune_pending_timer
);
741 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
746 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
),
751 } /* scan interface channels */
752 } /* scan interfaces */
756 static void pim_show_neighbors(struct vty
*vty
)
758 struct listnode
*node
;
759 struct interface
*ifp
;
762 now
= pim_time_monotonic_sec();
765 "Recv flags: H=holdtime L=lan_prune_delay P=dr_priority G=generation_id A=address_list%s"
766 " T=can_disable_join_suppression%s%s",
767 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
769 vty_out(vty
, "Interface Address Neighbor Uptime Timer Holdt DrPri GenId Recv %s", VTY_NEWLINE
);
771 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
772 struct pim_interface
*pim_ifp
;
773 struct in_addr ifaddr
;
774 struct listnode
*neighnode
;
775 struct pim_neighbor
*neigh
;
782 if (pim_ifp
->pim_sock_fd
< 0)
785 ifaddr
= pim_ifp
->primary_address
;
787 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
791 char neigh_src_str
[100];
794 pim_inet4_dump("<src?>", neigh
->source_addr
,
795 neigh_src_str
, sizeof(neigh_src_str
));
796 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
797 pim_time_mmss(holdtime
, sizeof(holdtime
), neigh
->holdtime
);
798 pim_time_timer_to_mmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
800 recv
[0] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
) ? 'H' : ' ';
801 recv
[1] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? 'L' : ' ';
802 recv
[2] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
) ? 'P' : ' ';
803 recv
[3] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
) ? 'G' : ' ';
804 recv
[4] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
) ? 'A' : ' ';
805 recv
[5] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
) ? 'T' : ' ';
808 vty_out(vty
, "%-9s %-15s %-15s %8s %5s %5s %5u %08x %6s%s",
816 neigh
->generation_id
,
825 static void pim_show_lan_prune_delay(struct vty
*vty
)
827 struct listnode
*node
;
828 struct interface
*ifp
;
831 "PrDly=propagation_delay (msec) OvInt=override_interval (msec)%s"
832 "HiDly=highest_propagation_delay (msec) HiInt=highest_override_interval (msec)%s"
833 "NoDly=number_of_non_lan_delay_neighbors%s"
834 "T=t_bit LPD=lan_prune_delay_hello_option%s%s",
835 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
837 vty_out(vty
, "Interface Address PrDly OvInt NoDly HiDly HiInt T | Neighbor LPD PrDly OvInt T%s", VTY_NEWLINE
);
839 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
840 struct pim_interface
*pim_ifp
;
841 struct in_addr ifaddr
;
842 struct listnode
*neighnode
;
843 struct pim_neighbor
*neigh
;
850 if (pim_ifp
->pim_sock_fd
< 0)
853 ifaddr
= pim_ifp
->primary_address
;
855 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
856 char neigh_src_str
[100];
858 pim_inet4_dump("<src?>", neigh
->source_addr
,
859 neigh_src_str
, sizeof(neigh_src_str
));
861 vty_out(vty
, "%-9s %-15s %5u %5u %5u %5u %5u %1u | %-15s %-3s %5u %5u %1u%s",
864 pim_ifp
->pim_propagation_delay_msec
,
865 pim_ifp
->pim_override_interval_msec
,
866 pim_ifp
->pim_number_of_nonlandelay_neighbors
,
867 pim_ifp
->pim_neighbors_highest_propagation_delay_msec
,
868 pim_ifp
->pim_neighbors_highest_override_interval_msec
,
869 PIM_FORCE_BOOLEAN(PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp
->options
)),
871 PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? "yes" : "no",
872 neigh
->propagation_delay_msec
,
873 neigh
->override_interval_msec
,
874 PIM_FORCE_BOOLEAN(PIM_OPTION_IS_SET(neigh
->hello_options
,
875 PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
)),
882 static void pim_show_jp_override_interval(struct vty
*vty
)
884 struct listnode
*node
;
885 struct interface
*ifp
;
888 "EffPDelay=effective_propagation_delay (msec)%s"
889 "EffOvrInt=override_interval (msec)%s"
890 "JPOvrInt=jp_override_interval (msec)%s%s",
891 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
893 vty_out(vty
, "Interface Address LAN_Delay EffPDelay EffOvrInt JPOvrInt%s", VTY_NEWLINE
);
895 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
896 struct pim_interface
*pim_ifp
;
897 struct in_addr ifaddr
;
904 if (pim_ifp
->pim_sock_fd
< 0)
907 ifaddr
= pim_ifp
->primary_address
;
909 vty_out(vty
, "%-9s %-15s %-9s %9u %9u %8u%s",
912 pim_if_lan_delay_enabled(ifp
) ? "enabled" : "disabled",
913 pim_if_effective_propagation_delay_msec(ifp
),
914 pim_if_effective_override_interval_msec(ifp
),
915 pim_if_jp_override_interval_msec(ifp
),
920 static void pim_show_neighbors_secondary(struct vty
*vty
)
922 struct listnode
*node
;
923 struct interface
*ifp
;
925 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
927 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
928 struct pim_interface
*pim_ifp
;
929 struct in_addr ifaddr
;
930 struct listnode
*neighnode
;
931 struct pim_neighbor
*neigh
;
938 if (pim_ifp
->pim_sock_fd
< 0)
941 ifaddr
= pim_ifp
->primary_address
;
943 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
944 char neigh_src_str
[100];
945 struct listnode
*prefix_node
;
948 if (!neigh
->prefix_list
)
951 pim_inet4_dump("<src?>", neigh
->source_addr
,
952 neigh_src_str
, sizeof(neigh_src_str
));
954 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
955 char neigh_sec_str
[100];
957 if (p
->family
!= AF_INET
)
960 pim_inet4_dump("<src?>", p
->u
.prefix4
,
961 neigh_sec_str
, sizeof(neigh_sec_str
));
963 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
974 static void pim_show_upstream(struct vty
*vty
)
976 struct listnode
*upnode
;
977 struct pim_upstream
*up
;
980 now
= pim_time_monotonic_sec();
982 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RefCnt%s", VTY_NEWLINE
);
984 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
990 pim_inet4_dump("<src?>", up
->source_addr
, src_str
, sizeof(src_str
));
991 pim_inet4_dump("<grp?>", up
->group_addr
, grp_str
, sizeof(grp_str
));
992 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
993 pim_time_timer_to_hhmmss(join_timer
, sizeof(join_timer
), up
->t_join_timer
);
995 vty_out(vty
, "%-10s%-15s %-15s %-5s %-8s %-9s %6d%s",
996 up
->rpf
.source_nexthop
.interface
->name
,
999 up
->join_state
== PIM_UPSTREAM_JOINED
? "Jnd" : "NtJnd",
1007 static void pim_show_join_desired(struct vty
*vty
)
1009 struct listnode
*ifnode
;
1010 struct listnode
*chnode
;
1011 struct interface
*ifp
;
1012 struct pim_interface
*pim_ifp
;
1013 struct pim_ifchannel
*ch
;
1018 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1021 /* scan all interfaces */
1022 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1023 pim_ifp
= ifp
->info
;
1027 /* scan per-interface (S,G) state */
1028 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, chnode
, ch
)) {
1029 struct pim_upstream
*up
= ch
->upstream
;
1031 pim_inet4_dump("<src?>", up
->source_addr
, src_str
, sizeof(src_str
));
1032 pim_inet4_dump("<grp?>", up
->group_addr
, grp_str
, sizeof(grp_str
));
1034 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
1038 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
1039 pim_macro_chisin_joins(ch
) ? "yes" : "no",
1040 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
1041 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
1042 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
1048 static void pim_show_upstream_rpf(struct vty
*vty
)
1050 struct listnode
*upnode
;
1051 struct pim_upstream
*up
;
1054 "Source Group RpfIface RibNextHop RpfAddress %s",
1057 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
1060 char rpf_nexthop_str
[100];
1061 char rpf_addr_str
[100];
1062 struct pim_rpf
*rpf
;
1063 const char *rpf_ifname
;
1067 pim_inet4_dump("<src?>", up
->source_addr
, src_str
, sizeof(src_str
));
1068 pim_inet4_dump("<grp?>", up
->group_addr
, grp_str
, sizeof(grp_str
));
1069 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
1070 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1072 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1074 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
1084 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
)
1086 char refresh_uptime
[10];
1088 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
1091 "RPF Cache Refresh Delay: %ld msecs%s"
1092 "RPF Cache Refresh Timer: %ld msecs%s"
1093 "RPF Cache Refresh Requests: %lld%s"
1094 "RPF Cache Refresh Events: %lld%s"
1095 "RPF Cache Refresh Last: %s%s",
1096 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1097 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1098 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1099 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1100 refresh_uptime
, VTY_NEWLINE
);
1103 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1105 char uptime_scan_oil
[10];
1106 char uptime_mroute_add
[10];
1107 char uptime_mroute_del
[10];
1109 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1110 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1111 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1114 "Scan OIL - Last: %s Events: %lld%s"
1115 "MFC Add - Last: %s Events: %lld%s"
1116 "MFC Del - Last: %s Events: %lld%s",
1117 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1118 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1119 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
1122 static void pim_show_rpf(struct vty
*vty
)
1124 struct listnode
*up_node
;
1125 struct pim_upstream
*up
;
1126 time_t now
= pim_time_monotonic_sec();
1128 show_rpf_refresh_stats(vty
, now
);
1130 vty_out(vty
, "%s", VTY_NEWLINE
);
1133 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
1136 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, up_node
, up
)) {
1139 char rpf_addr_str
[100];
1140 char rib_nexthop_str
[100];
1141 const char *rpf_ifname
;
1142 struct pim_rpf
*rpf
= &up
->rpf
;
1144 pim_inet4_dump("<src?>", up
->source_addr
, src_str
, sizeof(src_str
));
1145 pim_inet4_dump("<grp?>", up
->group_addr
, grp_str
, sizeof(grp_str
));
1146 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1147 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
1149 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1151 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
1157 rpf
->source_nexthop
.mrib_route_metric
,
1158 rpf
->source_nexthop
.mrib_metric_preference
,
1163 static void igmp_show_querier(struct vty
*vty
)
1165 struct listnode
*node
;
1166 struct interface
*ifp
;
1168 vty_out(vty
, "Interface Address Querier StartCount Query-Timer Other-Timer%s", VTY_NEWLINE
);
1170 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1171 struct pim_interface
*pim_ifp
= ifp
->info
;
1172 struct listnode
*sock_node
;
1173 struct igmp_sock
*igmp
;
1178 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1179 char query_hhmmss
[10];
1180 char other_hhmmss
[10];
1182 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
1183 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
1185 vty_out(vty
, "%-9s %-15s %-7s %10d %11s %11s%s",
1187 inet_ntoa(igmp
->ifaddr
),
1188 igmp
->t_igmp_query_timer
? "THIS" : "OTHER",
1189 igmp
->startup_query_count
,
1197 static void igmp_show_groups(struct vty
*vty
)
1199 struct listnode
*ifnode
;
1200 struct interface
*ifp
;
1203 now
= pim_time_monotonic_sec();
1205 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
1207 /* scan interfaces */
1208 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1209 struct pim_interface
*pim_ifp
= ifp
->info
;
1210 struct listnode
*sock_node
;
1211 struct igmp_sock
*igmp
;
1216 /* scan igmp sockets */
1217 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1218 char ifaddr_str
[100];
1219 struct listnode
*grpnode
;
1220 struct igmp_group
*grp
;
1222 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1224 /* scan igmp groups */
1225 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1226 char group_str
[100];
1230 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1231 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
1232 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
1234 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
1238 grp
->group_filtermode_isexcl
? "EXCL" : "INCL",
1240 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
1241 igmp_group_compat_mode(igmp
, grp
),
1245 } /* scan igmp groups */
1246 } /* scan igmp sockets */
1247 } /* scan interfaces */
1250 static void igmp_show_group_retransmission(struct vty
*vty
)
1252 struct listnode
*ifnode
;
1253 struct interface
*ifp
;
1255 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
1257 /* scan interfaces */
1258 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1259 struct pim_interface
*pim_ifp
= ifp
->info
;
1260 struct listnode
*sock_node
;
1261 struct igmp_sock
*igmp
;
1266 /* scan igmp sockets */
1267 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1268 char ifaddr_str
[100];
1269 struct listnode
*grpnode
;
1270 struct igmp_group
*grp
;
1272 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1274 /* scan igmp groups */
1275 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1276 char group_str
[100];
1277 char grp_retr_mmss
[10];
1278 struct listnode
*src_node
;
1279 struct igmp_source
*src
;
1280 int grp_retr_sources
= 0;
1282 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1283 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
1286 /* count group sources with retransmission state */
1287 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
1288 if (src
->source_query_retransmit_count
> 0) {
1293 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
1298 grp
->group_specific_query_retransmit_count
,
1302 } /* scan igmp groups */
1303 } /* scan igmp sockets */
1304 } /* scan interfaces */
1307 static void igmp_show_parameters(struct vty
*vty
)
1309 struct listnode
*ifnode
;
1310 struct interface
*ifp
;
1313 "QRV: Robustness Variable SQI: Startup Query Interval%s"
1314 "QQI: Query Interval OQPI: Other Querier Present Interval%s"
1315 "QRI: Query Response Interval LMQT: Last Member Query Time%s"
1316 "GMI: Group Membership Interval OHPI: Older Host Present Interval%s%s",
1317 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
1320 "Interface Address QRV QQI QRI GMI SQI OQPI LMQT OHPI %s",
1323 /* scan interfaces */
1324 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1325 struct pim_interface
*pim_ifp
= ifp
->info
;
1326 struct listnode
*sock_node
;
1327 struct igmp_sock
*igmp
;
1332 /* scan igmp sockets */
1333 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1334 char ifaddr_str
[100];
1335 long gmi_dsec
; /* Group Membership Interval */
1336 long oqpi_dsec
; /* Other Querier Present Interval */
1342 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1344 gmi_dsec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
1345 igmp
->querier_query_interval
,
1346 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1348 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
1350 oqpi_dsec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
1351 igmp
->querier_query_interval
,
1352 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1354 lmqt_dsec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
1355 igmp
->querier_robustness_variable
) / 100;
1357 ohpi_dsec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
1358 igmp
->querier_query_interval
,
1359 pim_ifp
->igmp_query_max_response_time_dsec
);
1361 qri_dsec
= pim_ifp
->igmp_query_max_response_time_dsec
;
1364 "%-9s %-15s %3d %3d %3ld.%ld %3ld.%ld %3d %3ld.%ld %3ld.%ld %3ld.%ld%s",
1367 igmp
->querier_robustness_variable
,
1368 igmp
->querier_query_interval
,
1369 qri_dsec
/ 10, qri_dsec
% 10,
1370 gmi_dsec
/ 10, gmi_dsec
% 10,
1372 oqpi_dsec
/ 10, oqpi_dsec
% 10,
1373 lmqt_dsec
/ 10, lmqt_dsec
% 10,
1374 ohpi_dsec
/ 10, ohpi_dsec
% 10,
1377 } /* scan igmp sockets */
1378 } /* scan interfaces */
1381 static void igmp_show_sources(struct vty
*vty
)
1383 struct listnode
*ifnode
;
1384 struct interface
*ifp
;
1387 now
= pim_time_monotonic_sec();
1389 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
1391 /* scan interfaces */
1392 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1393 struct pim_interface
*pim_ifp
= ifp
->info
;
1394 struct listnode
*sock_node
;
1395 struct igmp_sock
*igmp
;
1400 /* scan igmp sockets */
1401 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1402 char ifaddr_str
[100];
1403 struct listnode
*grpnode
;
1404 struct igmp_group
*grp
;
1406 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1408 /* scan igmp groups */
1409 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1410 char group_str
[100];
1411 struct listnode
*srcnode
;
1412 struct igmp_source
*src
;
1414 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1416 /* scan group sources */
1417 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1418 char source_str
[100];
1422 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1424 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
1426 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
1428 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
1434 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
1438 } /* scan group sources */
1439 } /* scan igmp groups */
1440 } /* scan igmp sockets */
1441 } /* scan interfaces */
1444 static void igmp_show_source_retransmission(struct vty
*vty
)
1446 struct listnode
*ifnode
;
1447 struct interface
*ifp
;
1449 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
1451 /* scan interfaces */
1452 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1453 struct pim_interface
*pim_ifp
= ifp
->info
;
1454 struct listnode
*sock_node
;
1455 struct igmp_sock
*igmp
;
1460 /* scan igmp sockets */
1461 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1462 char ifaddr_str
[100];
1463 struct listnode
*grpnode
;
1464 struct igmp_group
*grp
;
1466 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1468 /* scan igmp groups */
1469 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1470 char group_str
[100];
1471 struct listnode
*srcnode
;
1472 struct igmp_source
*src
;
1474 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1476 /* scan group sources */
1477 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1478 char source_str
[100];
1480 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1482 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
1487 src
->source_query_retransmit_count
,
1490 } /* scan group sources */
1491 } /* scan igmp groups */
1492 } /* scan igmp sockets */
1493 } /* scan interfaces */
1496 static void clear_igmp_interfaces()
1498 struct listnode
*ifnode
;
1499 struct listnode
*ifnextnode
;
1500 struct interface
*ifp
;
1502 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1503 pim_if_addr_del_all_igmp(ifp
);
1506 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1507 pim_if_addr_add_all(ifp
);
1511 static void clear_pim_interfaces()
1513 struct listnode
*ifnode
;
1514 struct listnode
*ifnextnode
;
1515 struct interface
*ifp
;
1517 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1519 pim_neighbor_delete_all(ifp
, "interface cleared");
1524 static void clear_interfaces()
1526 clear_igmp_interfaces();
1527 clear_pim_interfaces();
1530 DEFUN (pim_interface
,
1533 "Select an interface to configure\n"
1534 "Interface's name\n")
1537 struct interface
*ifp
;
1538 const char *ifname
= argv
[idx_ifname
]->arg
;
1541 sl
= strlen(ifname
);
1542 if (sl
> INTERFACE_NAMSIZ
) {
1543 vty_out(vty
, "%% Interface name %s is invalid: length exceeds "
1545 ifname
, INTERFACE_NAMSIZ
, VTY_NEWLINE
);
1549 ifp
= if_lookup_by_name_len(ifname
, sl
);
1551 vty_out(vty
, "%% Interface %s does not exist%s", ifname
, VTY_NEWLINE
);
1553 /* Returning here would prevent pimd from booting when there are
1554 interface commands in pimd.conf, since all interfaces are
1555 unknown at pimd boot time (the zebra daemon has not been
1556 contacted for interface discovery). */
1558 ifp
= if_get_by_name_len(ifname
, sl
);
1560 vty_out(vty
, "%% Could not create interface %s%s", ifname
, VTY_NEWLINE
);
1566 vty
->node
= INTERFACE_NODE
;
1571 DEFUN (clear_ip_interfaces
,
1572 clear_ip_interfaces_cmd
,
1573 "clear ip interfaces",
1576 "Reset interfaces\n")
1583 DEFUN (clear_ip_igmp_interfaces
,
1584 clear_ip_igmp_interfaces_cmd
,
1585 "clear ip igmp interfaces",
1589 "Reset IGMP interfaces\n")
1591 clear_igmp_interfaces();
1596 static void mroute_add_all()
1598 struct listnode
*node
;
1599 struct channel_oil
*c_oil
;
1601 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1602 if (pim_mroute_add(c_oil
)) {
1603 /* just log warning */
1604 char source_str
[100];
1605 char group_str
[100];
1606 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1607 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1608 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1609 __FILE__
, __PRETTY_FUNCTION__
,
1610 source_str
, group_str
);
1615 static void mroute_del_all()
1617 struct listnode
*node
;
1618 struct channel_oil
*c_oil
;
1620 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1621 if (pim_mroute_del(c_oil
)) {
1622 /* just log warning */
1623 char source_str
[100];
1624 char group_str
[100];
1625 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1626 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1627 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1628 __FILE__
, __PRETTY_FUNCTION__
,
1629 source_str
, group_str
);
1634 static void static_mroute_add_all()
1636 struct listnode
*node
;
1637 struct static_route
*s_route
;
1639 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1640 if (pim_mroute_add(&s_route
->c_oil
)) {
1641 /* just log warning */
1642 char source_str
[100];
1643 char group_str
[100];
1644 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1645 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1646 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1647 __FILE__
, __PRETTY_FUNCTION__
,
1648 source_str
, group_str
);
1653 static void static_mroute_del_all()
1655 struct listnode
*node
;
1656 struct static_route
*s_route
;
1658 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1659 if (pim_mroute_del(&s_route
->c_oil
)) {
1660 /* just log warning */
1661 char source_str
[100];
1662 char group_str
[100];
1663 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1664 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1665 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1666 __FILE__
, __PRETTY_FUNCTION__
,
1667 source_str
, group_str
);
1672 DEFUN (clear_ip_mroute
,
1673 clear_ip_mroute_cmd
,
1677 "Reset multicast routes\n")
1685 DEFUN (clear_ip_pim_interfaces
,
1686 clear_ip_pim_interfaces_cmd
,
1687 "clear ip pim interfaces",
1691 "Reset PIM interfaces\n")
1693 clear_pim_interfaces();
1698 DEFUN (clear_ip_pim_oil
,
1699 clear_ip_pim_oil_cmd
,
1704 "Rescan PIM OIL (output interface list)\n")
1711 DEFUN (show_ip_igmp_interface
,
1712 show_ip_igmp_interface_cmd
,
1713 "show ip igmp interface",
1717 "IGMP interface information\n")
1719 igmp_show_interfaces(vty
);
1724 DEFUN (show_ip_igmp_join
,
1725 show_ip_igmp_join_cmd
,
1726 "show ip igmp join",
1730 "IGMP static join information\n")
1732 igmp_show_interface_join(vty
);
1737 DEFUN (show_ip_igmp_groups
,
1738 show_ip_igmp_groups_cmd
,
1739 "show ip igmp groups",
1745 igmp_show_groups(vty
);
1750 DEFUN (show_ip_igmp_groups_retransmissions
,
1751 show_ip_igmp_groups_retransmissions_cmd
,
1752 "show ip igmp groups retransmissions",
1757 "IGMP group retransmissions\n")
1759 igmp_show_group_retransmission(vty
);
1764 DEFUN (show_ip_igmp_parameters
,
1765 show_ip_igmp_parameters_cmd
,
1766 "show ip igmp parameters",
1770 "IGMP parameters information\n")
1772 igmp_show_parameters(vty
);
1777 DEFUN (show_ip_igmp_sources
,
1778 show_ip_igmp_sources_cmd
,
1779 "show ip igmp sources",
1785 igmp_show_sources(vty
);
1790 DEFUN (show_ip_igmp_sources_retransmissions
,
1791 show_ip_igmp_sources_retransmissions_cmd
,
1792 "show ip igmp sources retransmissions",
1797 "IGMP source retransmissions\n")
1799 igmp_show_source_retransmission(vty
);
1804 DEFUN (show_ip_igmp_querier
,
1805 show_ip_igmp_querier_cmd
,
1806 "show ip igmp querier",
1810 "IGMP querier information\n")
1812 igmp_show_querier(vty
);
1817 DEFUN (show_ip_pim_address
,
1818 show_ip_pim_address_cmd
,
1819 "show ip pim address",
1823 "PIM interface address\n")
1825 show_interface_address(vty
);
1830 DEFUN (show_ip_pim_assert
,
1831 show_ip_pim_assert_cmd
,
1832 "show ip pim assert",
1836 "PIM interface assert\n")
1838 pim_show_assert(vty
);
1843 DEFUN (show_ip_pim_assert_internal
,
1844 show_ip_pim_assert_internal_cmd
,
1845 "show ip pim assert-internal",
1849 "PIM interface internal assert state\n")
1851 pim_show_assert_internal(vty
);
1856 DEFUN (show_ip_pim_assert_metric
,
1857 show_ip_pim_assert_metric_cmd
,
1858 "show ip pim assert-metric",
1862 "PIM interface assert metric\n")
1864 pim_show_assert_metric(vty
);
1869 DEFUN (show_ip_pim_assert_winner_metric
,
1870 show_ip_pim_assert_winner_metric_cmd
,
1871 "show ip pim assert-winner-metric",
1875 "PIM interface assert winner metric\n")
1877 pim_show_assert_winner_metric(vty
);
1882 DEFUN (show_ip_pim_dr
,
1884 "show ip pim designated-router",
1888 "PIM interface designated router\n")
1895 DEFUN (show_ip_pim_hello
,
1896 show_ip_pim_hello_cmd
,
1897 "show ip pim hello",
1901 "PIM interface hello information\n")
1903 pim_show_hello(vty
);
1908 DEFUN (show_ip_pim_interface
,
1909 show_ip_pim_interface_cmd
,
1910 "show ip pim interface",
1914 "PIM interface information\n")
1916 pim_show_interfaces(vty
);
1921 DEFUN (show_ip_pim_join
,
1922 show_ip_pim_join_cmd
,
1927 "PIM interface join information\n")
1934 DEFUN (show_ip_pim_lan_prune_delay
,
1935 show_ip_pim_lan_prune_delay_cmd
,
1936 "show ip pim lan-prune-delay",
1940 "PIM neighbors LAN prune delay parameters\n")
1942 pim_show_lan_prune_delay(vty
);
1947 DEFUN (show_ip_pim_local_membership
,
1948 show_ip_pim_local_membership_cmd
,
1949 "show ip pim local-membership",
1953 "PIM interface local-membership\n")
1955 pim_show_membership(vty
);
1960 DEFUN (show_ip_pim_jp_override_interval
,
1961 show_ip_pim_jp_override_interval_cmd
,
1962 "show ip pim jp-override-interval",
1966 "PIM interface J/P override interval\n")
1968 pim_show_jp_override_interval(vty
);
1973 DEFUN (show_ip_pim_neighbor
,
1974 show_ip_pim_neighbor_cmd
,
1975 "show ip pim neighbor",
1979 "PIM neighbor information\n")
1981 pim_show_neighbors(vty
);
1986 DEFUN (show_ip_pim_secondary
,
1987 show_ip_pim_secondary_cmd
,
1988 "show ip pim secondary",
1992 "PIM neighbor addresses\n")
1994 pim_show_neighbors_secondary(vty
);
1999 DEFUN (show_ip_pim_upstream
,
2000 show_ip_pim_upstream_cmd
,
2001 "show ip pim upstream",
2005 "PIM upstream information\n")
2007 pim_show_upstream(vty
);
2012 DEFUN (show_ip_pim_upstream_join_desired
,
2013 show_ip_pim_upstream_join_desired_cmd
,
2014 "show ip pim upstream-join-desired",
2018 "PIM upstream join-desired\n")
2020 pim_show_join_desired(vty
);
2025 DEFUN (show_ip_pim_upstream_rpf
,
2026 show_ip_pim_upstream_rpf_cmd
,
2027 "show ip pim upstream-rpf",
2031 "PIM upstream source rpf\n")
2033 pim_show_upstream_rpf(vty
);
2038 DEFUN (show_ip_pim_rpf
,
2039 show_ip_pim_rpf_cmd
,
2044 "PIM cached source rpf information\n")
2051 static void show_multicast_interfaces(struct vty
*vty
)
2053 struct listnode
*node
;
2054 struct interface
*ifp
;
2056 vty_out(vty
, "%s", VTY_NEWLINE
);
2058 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2061 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2062 struct pim_interface
*pim_ifp
;
2063 struct in_addr ifaddr
;
2064 struct sioc_vif_req vreq
;
2066 pim_ifp
= ifp
->info
;
2071 memset(&vreq
, 0, sizeof(vreq
));
2072 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2074 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2075 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2076 (unsigned long)SIOCGETVIFCNT
,
2078 pim_ifp
->mroute_vif_index
,
2080 safe_strerror(errno
),
2084 ifaddr
= pim_ifp
->primary_address
;
2086 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2090 pim_ifp
->mroute_vif_index
,
2091 (unsigned long) vreq
.icount
,
2092 (unsigned long) vreq
.ocount
,
2093 (unsigned long) vreq
.ibytes
,
2094 (unsigned long) vreq
.obytes
,
2099 DEFUN (show_ip_multicast
,
2100 show_ip_multicast_cmd
,
2101 "show ip multicast",
2104 "Multicast global information\n")
2106 time_t now
= pim_time_monotonic_sec();
2108 if (PIM_MROUTE_IS_ENABLED
) {
2111 vty_out(vty
, "Mroute socket descriptor: %d%s",
2112 qpim_mroute_socket_fd
,
2115 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
2116 vty_out(vty
, "Mroute socket uptime: %s%s",
2121 vty_out(vty
, "Multicast disabled%s",
2125 vty_out(vty
, "%s", VTY_NEWLINE
);
2126 vty_out(vty
, "Zclient update socket: ");
2127 if (qpim_zclient_update
) {
2128 vty_out(vty
, "%d failures=%d%s", qpim_zclient_update
->sock
,
2129 qpim_zclient_update
->fail
, VTY_NEWLINE
);
2132 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2134 vty_out(vty
, "Zclient lookup socket: ");
2135 if (qpim_zclient_lookup
) {
2136 vty_out(vty
, "%d failures=%d%s", qpim_zclient_lookup
->sock
,
2137 qpim_zclient_lookup
->fail
, VTY_NEWLINE
);
2140 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2143 vty_out(vty
, "%s", VTY_NEWLINE
);
2144 vty_out(vty
, "Current highest VifIndex: %d%s",
2145 qpim_mroute_oif_highest_vif_index
,
2147 vty_out(vty
, "Maximum highest VifIndex: %d%s",
2148 PIM_MAX_USABLE_VIFS
,
2151 vty_out(vty
, "%s", VTY_NEWLINE
);
2152 vty_out(vty
, "Upstream Join Timer: %d secs%s",
2155 vty_out(vty
, "Join/Prune Holdtime: %d secs%s",
2159 vty_out(vty
, "%s", VTY_NEWLINE
);
2161 show_rpf_refresh_stats(vty
, now
);
2163 vty_out(vty
, "%s", VTY_NEWLINE
);
2165 show_scan_oil_stats(vty
, now
);
2167 show_multicast_interfaces(vty
);
2172 static void show_mroute(struct vty
*vty
)
2174 struct listnode
*node
;
2175 struct channel_oil
*c_oil
;
2176 struct static_route
*s_route
;
2179 vty_out(vty
, "Proto: I=IGMP P=PIM S=STATIC O=SOURCE%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
2181 vty_out(vty
, "Source Group Proto Input iVifI Output oVifI TTL Uptime %s",
2184 now
= pim_time_monotonic_sec();
2186 /* print list of PIM and IGMP routes */
2187 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2188 char group_str
[100];
2189 char source_str
[100];
2192 if (!c_oil
->installed
)
2195 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2196 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2198 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2199 struct interface
*ifp_in
;
2200 struct interface
*ifp_out
;
2201 char oif_uptime
[10];
2205 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
2209 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
2210 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2212 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
2215 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
2218 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
2221 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
2225 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2229 ifp_in
? ifp_in
->name
: "<iif?>",
2230 c_oil
->oil
.mfcc_parent
,
2231 ifp_out
? ifp_out
->name
: "<oif?>",
2239 /* Print list of static routes */
2240 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2241 char group_str
[100];
2242 char source_str
[100];
2245 if (!s_route
->c_oil
.installed
)
2248 pim_inet4_dump("<group?>", s_route
->group
, group_str
, sizeof(group_str
));
2249 pim_inet4_dump("<source?>", s_route
->source
, source_str
, sizeof(source_str
));
2251 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2252 struct interface
*ifp_in
;
2253 struct interface
*ifp_out
;
2254 char oif_uptime
[10];
2258 ttl
= s_route
->oif_ttls
[oif_vif_index
];
2262 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
2263 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2265 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
2270 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2274 ifp_in
? ifp_in
->name
: "<iif?>",
2276 ifp_out
? ifp_out
->name
: "<oif?>",
2285 DEFUN (show_ip_mroute
,
2296 static void show_mroute_count(struct vty
*vty
)
2298 struct listnode
*node
;
2299 struct channel_oil
*c_oil
;
2300 struct static_route
*s_route
;
2302 vty_out(vty
, "%s", VTY_NEWLINE
);
2304 vty_out(vty
, "Source Group Packets Bytes WrongIf %s",
2307 /* Print PIM and IGMP route counts */
2308 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2309 char group_str
[100];
2310 char source_str
[100];
2312 if (!c_oil
->installed
)
2315 pim_mroute_update_counters (c_oil
);
2317 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2318 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2320 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2329 /* Print static route counts */
2330 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2331 char group_str
[100];
2332 char source_str
[100];
2334 if (!s_route
->c_oil
.installed
)
2337 pim_mroute_update_counters (&s_route
->c_oil
);
2339 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2340 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2342 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2345 s_route
->c_oil
.cc
.pktcnt
,
2346 s_route
->c_oil
.cc
.bytecnt
,
2347 s_route
->c_oil
.cc
.wrong_if
,
2352 DEFUN (show_ip_mroute_count
,
2353 show_ip_mroute_count_cmd
,
2354 "show ip mroute count",
2358 "Route and packet count data\n")
2360 show_mroute_count(vty
);
2366 "show ip rib A.B.C.D",
2370 "Unicast address\n")
2373 struct in_addr addr
;
2374 const char *addr_str
;
2375 struct pim_nexthop nexthop
;
2376 char nexthop_addr_str
[100];
2379 addr_str
= argv
[idx_ipv4
]->arg
;
2380 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2382 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
2383 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2387 if (pim_nexthop_lookup(&nexthop
, addr
, NULL
)) {
2388 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
2389 addr_str
, VTY_NEWLINE
);
2393 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
2396 pim_inet4_dump("<nexthop?>", nexthop
.mrib_nexthop_addr
,
2397 nexthop_addr_str
, sizeof(nexthop_addr_str
));
2399 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
2402 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2403 nexthop
.mrib_route_metric
,
2404 nexthop
.mrib_metric_preference
,
2410 static void show_ssmpingd(struct vty
*vty
)
2412 struct listnode
*node
;
2413 struct ssmpingd_sock
*ss
;
2416 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
2419 if (!qpim_ssmpingd_list
)
2422 now
= pim_time_monotonic_sec();
2424 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
2425 char source_str
[100];
2427 struct sockaddr_in bind_addr
;
2428 socklen_t len
= sizeof(bind_addr
);
2429 char bind_addr_str
[100];
2431 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
2433 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
2434 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
2435 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
2438 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
2439 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
2441 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
2445 ntohs(bind_addr
.sin_port
),
2447 (long long)ss
->requests
,
2452 DEFUN (show_ip_ssmpingd
,
2453 show_ip_ssmpingd_cmd
,
2465 "ip pim rp A.B.C.D",
2467 "pim multicast routing\n"
2469 "ip address of RP\n")
2474 result
= inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &qpim_rp
.rpf_addr
.s_addr
);
2476 vty_out(vty
, "%% Bad RP address specified: %s", argv
[idx_ipv4
]->arg
);
2480 if (pim_nexthop_lookup(&qpim_rp
.source_nexthop
, qpim_rp
.rpf_addr
, NULL
) != 0) {
2481 vty_out(vty
, "%% No Path to RP address specified: %s", argv
[idx_ipv4
]->arg
);
2488 DEFUN (no_ip_pim_rp
,
2490 "no ip pim rp [A.B.C.D]",
2493 "pim multicast routing\n"
2495 "ip address of RP\n")
2497 qpim_rp
.rpf_addr
.s_addr
= INADDR_NONE
;
2502 DEFUN (ip_multicast_routing
,
2503 ip_multicast_routing_cmd
,
2504 "ip multicast-routing",
2506 "Enable IP multicast forwarding\n")
2508 pim_mroute_socket_enable();
2509 pim_if_add_vif_all();
2511 static_mroute_add_all();
2515 DEFUN (no_ip_multicast_routing
,
2516 no_ip_multicast_routing_cmd
,
2517 "no ip multicast-routing",
2520 "Global IP configuration subcommands\n"
2521 "Enable IP multicast forwarding\n")
2524 static_mroute_del_all();
2525 pim_if_del_vif_all();
2526 pim_mroute_socket_disable();
2532 "ip ssmpingd [A.B.C.D]",
2539 struct in_addr source_addr
;
2540 const char *source_str
= (argc
> 0) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2542 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2544 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2545 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2549 result
= pim_ssmpingd_start(source_addr
);
2551 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
2552 source_str
, result
, VTY_NEWLINE
);
2559 DEFUN (no_ip_ssmpingd
,
2561 "no ip ssmpingd [A.B.C.D]",
2569 struct in_addr source_addr
;
2570 const char *source_str
= (argc
> 0) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2572 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2574 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2575 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2579 result
= pim_ssmpingd_stop(source_addr
);
2581 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
2582 source_str
, result
, VTY_NEWLINE
);
2589 DEFUN (interface_ip_igmp
,
2590 interface_ip_igmp_cmd
,
2595 struct interface
*ifp
;
2596 struct pim_interface
*pim_ifp
;
2599 pim_ifp
= ifp
->info
;
2602 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
2604 vty_out(vty
, "Could not enable IGMP on interface %s%s",
2605 ifp
->name
, VTY_NEWLINE
);
2610 PIM_IF_DO_IGMP(pim_ifp
->options
);
2613 pim_if_addr_add_all(ifp
);
2614 pim_if_membership_refresh(ifp
);
2619 DEFUN (interface_no_ip_igmp
,
2620 interface_no_ip_igmp_cmd
,
2626 struct interface
*ifp
;
2627 struct pim_interface
*pim_ifp
;
2630 pim_ifp
= ifp
->info
;
2634 PIM_IF_DONT_IGMP(pim_ifp
->options
);
2636 pim_if_membership_clear(ifp
);
2638 pim_if_addr_del_all_igmp(ifp
);
2640 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
2647 DEFUN (interface_ip_igmp_join
,
2648 interface_ip_igmp_join_cmd
,
2649 "ip igmp join A.B.C.D A.B.C.D",
2652 "IGMP join multicast group\n"
2653 "Multicast group address\n"
2658 struct interface
*ifp
;
2659 const char *group_str
;
2660 const char *source_str
;
2661 struct in_addr group_addr
;
2662 struct in_addr source_addr
;
2668 group_str
= argv
[idx_ipv4
]->arg
;
2669 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2671 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2672 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2676 /* Source address */
2677 source_str
= argv
[idx_ipv4_2
]->arg
;
2678 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2680 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2681 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2685 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
2687 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
2688 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2695 DEFUN (interface_no_ip_igmp_join
,
2696 interface_no_ip_igmp_join_cmd
,
2697 "no ip igmp join A.B.C.D A.B.C.D",
2701 "IGMP join multicast group\n"
2702 "Multicast group address\n"
2707 struct interface
*ifp
;
2708 const char *group_str
;
2709 const char *source_str
;
2710 struct in_addr group_addr
;
2711 struct in_addr source_addr
;
2717 group_str
= argv
[idx_ipv4
]->arg
;
2718 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2720 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2721 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2725 /* Source address */
2726 source_str
= argv
[idx_ipv4_2
]->arg
;
2727 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2729 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2730 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2734 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
2736 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
2737 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2745 CLI reconfiguration affects the interface level (struct pim_interface).
2746 This function propagates the reconfiguration to every active socket
2749 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
2751 struct interface
*ifp
;
2752 struct pim_interface
*pim_ifp
;
2756 /* other querier present? */
2758 if (igmp
->t_other_querier_timer
)
2761 /* this is the querier */
2763 zassert(igmp
->interface
);
2764 zassert(igmp
->interface
->info
);
2766 ifp
= igmp
->interface
;
2767 pim_ifp
= ifp
->info
;
2769 if (PIM_DEBUG_IGMP_TRACE
) {
2770 char ifaddr_str
[100];
2771 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2772 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
2773 __PRETTY_FUNCTION__
,
2776 pim_ifp
->igmp_default_query_interval
);
2780 igmp_startup_mode_on() will reset QQI:
2782 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
2784 igmp_startup_mode_on(igmp
);
2787 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
2789 if (igmp
->t_igmp_query_timer
) {
2790 /* other querier present */
2791 zassert(igmp
->t_igmp_query_timer
);
2792 zassert(!igmp
->t_other_querier_timer
);
2794 pim_igmp_general_query_off(igmp
);
2795 pim_igmp_general_query_on(igmp
);
2797 zassert(igmp
->t_igmp_query_timer
);
2798 zassert(!igmp
->t_other_querier_timer
);
2801 /* this is the querier */
2803 zassert(!igmp
->t_igmp_query_timer
);
2804 zassert(igmp
->t_other_querier_timer
);
2806 pim_igmp_other_querier_timer_off(igmp
);
2807 pim_igmp_other_querier_timer_on(igmp
);
2809 zassert(!igmp
->t_igmp_query_timer
);
2810 zassert(igmp
->t_other_querier_timer
);
2814 static void change_query_interval(struct pim_interface
*pim_ifp
,
2817 struct listnode
*sock_node
;
2818 struct igmp_sock
*igmp
;
2820 pim_ifp
->igmp_default_query_interval
= query_interval
;
2822 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2823 igmp_sock_query_interval_reconfig(igmp
);
2824 igmp_sock_query_reschedule(igmp
);
2828 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
2829 int query_max_response_time_dsec
)
2831 struct listnode
*sock_node
;
2832 struct igmp_sock
*igmp
;
2834 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
2837 Below we modify socket/group/source timers in order to quickly
2838 reflect the change. Otherwise, those timers would eventually catch
2842 /* scan all sockets */
2843 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2844 struct listnode
*grp_node
;
2845 struct igmp_group
*grp
;
2847 /* reschedule socket general query */
2848 igmp_sock_query_reschedule(igmp
);
2850 /* scan socket groups */
2851 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
2852 struct listnode
*src_node
;
2853 struct igmp_source
*src
;
2855 /* reset group timers for groups in EXCLUDE mode */
2856 if (grp
->group_filtermode_isexcl
) {
2857 igmp_group_reset_gmi(grp
);
2860 /* scan group sources */
2861 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2863 /* reset source timers for sources with running timers */
2864 if (src
->t_source_timer
) {
2865 igmp_source_reset_gmi(igmp
, grp
, src
);
2872 #define IGMP_QUERY_INTERVAL_MIN (1)
2873 #define IGMP_QUERY_INTERVAL_MAX (1800)
2875 DEFUN (interface_ip_igmp_query_interval
,
2876 interface_ip_igmp_query_interval_cmd
,
2877 "ip igmp query-interval (1-1800)",
2880 IFACE_IGMP_QUERY_INTERVAL_STR
2881 "Query interval in seconds\n")
2883 struct interface
*ifp
;
2884 struct pim_interface
*pim_ifp
;
2886 int query_interval_dsec
;
2889 pim_ifp
= ifp
->info
;
2893 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2899 query_interval
= atoi(argv
[4]->arg
);
2900 query_interval_dsec
= 10 * query_interval
;
2903 It seems we don't need to check bounds since command.c does it
2904 already, but we verify them anyway for extra safety.
2906 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
2907 vty_out(vty
, "General query interval %d lower than minimum %d%s",
2909 IGMP_QUERY_INTERVAL_MIN
,
2913 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
2914 vty_out(vty
, "General query interval %d higher than maximum %d%s",
2916 IGMP_QUERY_INTERVAL_MAX
,
2921 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2923 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
2924 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2929 change_query_interval(pim_ifp
, query_interval
);
2934 DEFUN (interface_no_ip_igmp_query_interval
,
2935 interface_no_ip_igmp_query_interval_cmd
,
2936 "no ip igmp query-interval",
2940 IFACE_IGMP_QUERY_INTERVAL_STR
)
2942 struct interface
*ifp
;
2943 struct pim_interface
*pim_ifp
;
2944 int default_query_interval_dsec
;
2947 pim_ifp
= ifp
->info
;
2952 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
2954 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2956 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
2957 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2962 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
2967 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN (1)
2968 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX (25)
2970 DEFUN (interface_ip_igmp_query_max_response_time
,
2971 interface_ip_igmp_query_max_response_time_cmd
,
2972 "ip igmp query-max-response-time (1-25)",
2975 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
2976 "Query response value in seconds\n")
2978 struct interface
*ifp
;
2979 struct pim_interface
*pim_ifp
;
2980 int query_max_response_time
;
2983 pim_ifp
= ifp
->info
;
2987 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2993 query_max_response_time
= atoi(argv
[4]->arg
);
2996 It seems we don't need to check bounds since command.c does it
2997 already, but we verify them anyway for extra safety.
2999 if (query_max_response_time
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN
) {
3000 vty_out(vty
, "Query max response time %d sec lower than minimum %d sec%s",
3001 query_max_response_time
,
3002 IGMP_QUERY_MAX_RESPONSE_TIME_MIN
,
3006 if (query_max_response_time
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX
) {
3007 vty_out(vty
, "Query max response time %d sec higher than maximum %d sec%s",
3008 query_max_response_time
,
3009 IGMP_QUERY_MAX_RESPONSE_TIME_MAX
,
3014 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
) {
3016 "Can't set query max response time %d sec >= general query interval %d sec%s",
3017 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
3022 change_query_max_response_time(pim_ifp
, 10 * query_max_response_time
);
3027 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3028 interface_no_ip_igmp_query_max_response_time_cmd
,
3029 "no ip igmp query-max-response-time",
3033 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
)
3035 struct interface
*ifp
;
3036 struct pim_interface
*pim_ifp
;
3037 int default_query_interval_dsec
;
3040 pim_ifp
= ifp
->info
;
3045 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3047 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3049 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3050 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3055 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3060 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
3061 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
3063 DEFUN (interface_ip_igmp_query_max_response_time_dsec
,
3064 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3065 "ip igmp query-max-response-time-dsec (10-250)",
3068 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3069 "Query response value in deciseconds\n")
3071 struct interface
*ifp
;
3072 struct pim_interface
*pim_ifp
;
3073 int query_max_response_time_dsec
;
3074 int default_query_interval_dsec
;
3077 pim_ifp
= ifp
->info
;
3081 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3087 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
3090 It seems we don't need to check bounds since command.c does it
3091 already, but we verify them anyway for extra safety.
3093 if (query_max_response_time_dsec
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
) {
3094 vty_out(vty
, "Query max response time %d dsec lower than minimum %d dsec%s",
3095 query_max_response_time_dsec
,
3096 IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
,
3100 if (query_max_response_time_dsec
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
) {
3101 vty_out(vty
, "Query max response time %d dsec higher than maximum %d dsec%s",
3102 query_max_response_time_dsec
,
3103 IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
,
3108 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3110 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
3112 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
3113 query_max_response_time_dsec
, default_query_interval_dsec
,
3118 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
3123 DEFUN (interface_no_ip_igmp_query_max_response_time_dsec
,
3124 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3125 "no ip igmp query-max-response-time-dsec",
3129 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
3131 struct interface
*ifp
;
3132 struct pim_interface
*pim_ifp
;
3133 int default_query_interval_dsec
;
3136 pim_ifp
= ifp
->info
;
3141 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3143 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3145 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3146 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3151 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3156 DEFUN (interface_ip_pim_drprio
,
3157 interface_ip_pim_drprio_cmd
,
3158 "ip pim drpriority (1-4294967295)",
3161 "Set the Designated Router Election Priority\n"
3162 "Value of the new DR Priority\n")
3165 struct interface
*ifp
;
3166 struct pim_interface
*pim_ifp
;
3167 uint32_t old_dr_prio
;
3170 pim_ifp
= ifp
->info
;
3173 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
3177 old_dr_prio
= pim_ifp
->pim_dr_priority
;
3179 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
3181 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
3182 if (pim_if_dr_election(ifp
))
3183 pim_hello_restart_now(ifp
);
3189 DEFUN (interface_no_ip_pim_drprio
,
3190 interface_no_ip_pim_drprio_cmd
,
3191 "no ip pim drpriority [(1-4294967295)]",
3194 "Revert the Designated Router Priority to default\n"
3195 "Old Value of the Priority\n")
3197 struct interface
*ifp
;
3198 struct pim_interface
*pim_ifp
;
3201 pim_ifp
= ifp
->info
;
3204 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3208 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
3209 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
3210 if (pim_if_dr_election(ifp
))
3211 pim_hello_restart_now(ifp
);
3218 pim_cmd_interface_add (struct interface
*ifp
, enum pim_interface_type itype
)
3220 struct pim_interface
*pim_ifp
= ifp
->info
;
3221 struct in_addr null
= { .s_addr
= 0 };
3224 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
3230 PIM_IF_DO_PIM(pim_ifp
->options
);
3233 pim_ifp
->itype
= itype
;
3234 pim_if_addr_add_all(ifp
);
3235 pim_if_membership_refresh(ifp
);
3237 pim_rp_check_rp (null
, pim_ifp
->primary_address
);
3242 DEFUN (interface_ip_pim_ssm
,
3243 interface_ip_pim_ssm_cmd
,
3249 struct interface
*ifp
;
3253 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SSM
)) {
3254 vty_out(vty
, "Could not enable PIM SSM on interface%s", VTY_NEWLINE
);
3261 DEFUN (interface_ip_pim_sm
,
3262 interface_ip_pim_sm_cmd
,
3268 struct interface
*ifp
;
3271 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SM
)) {
3272 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
3276 pim_if_create_pimreg();
3282 pim_cmd_interface_delete (struct interface
*ifp
)
3284 struct pim_interface
*pim_ifp
= ifp
->info
;
3289 PIM_IF_DONT_PIM(pim_ifp
->options
);
3291 pim_if_membership_clear(ifp
);
3294 pim_if_addr_del_all() removes all sockets from
3295 pim_ifp->igmp_socket_list.
3297 pim_if_addr_del_all(ifp
);
3300 pim_sock_delete() removes all neighbors from
3301 pim_ifp->pim_neighbor_list.
3303 pim_sock_delete(ifp
, "pim unconfigured on interface");
3305 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
3312 DEFUN (interface_no_ip_pim_ssm
,
3313 interface_no_ip_pim_ssm_cmd
,
3320 struct interface
*ifp
;
3323 if (!pim_cmd_interface_delete(ifp
)) {
3324 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3331 DEFUN (interface_no_ip_pim_sm
,
3332 interface_no_ip_pim_sm_cmd
,
3339 struct interface
*ifp
;
3342 if (!pim_cmd_interface_delete(ifp
)) {
3343 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3350 DEFUN (interface_ip_mroute
,
3351 interface_ip_mroute_cmd
,
3352 "ip mroute INTERFACE A.B.C.D",
3354 "Add multicast route\n"
3355 "Outgoing interface name\n"
3358 int idx_interface
= 2;
3360 struct interface
*iif
;
3361 struct interface
*oif
;
3362 const char *oifname
;
3363 const char *grp_str
;
3364 struct in_addr grp_addr
;
3365 struct in_addr src_addr
;
3370 oifname
= argv
[idx_interface
]->arg
;
3371 oif
= if_lookup_by_name(oifname
);
3373 vty_out(vty
, "No such interface name %s%s",
3374 oifname
, VTY_NEWLINE
);
3378 grp_str
= argv
[idx_ipv4
]->arg
;
3379 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3381 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3382 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3386 src_addr
.s_addr
= INADDR_ANY
;
3388 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3389 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3396 DEFUN (interface_ip_mroute_source
,
3397 interface_ip_mroute_source_cmd
,
3398 "ip mroute INTERFACE A.B.C.D A.B.C.D",
3400 "Add multicast route\n"
3401 "Outgoing interface name\n"
3405 int idx_interface
= 2;
3408 struct interface
*iif
;
3409 struct interface
*oif
;
3410 const char *oifname
;
3411 const char *grp_str
;
3412 struct in_addr grp_addr
;
3413 const char *src_str
;
3414 struct in_addr src_addr
;
3419 oifname
= argv
[idx_interface
]->arg
;
3420 oif
= if_lookup_by_name(oifname
);
3422 vty_out(vty
, "No such interface name %s%s",
3423 oifname
, VTY_NEWLINE
);
3427 grp_str
= argv
[idx_ipv4
]->arg
;
3428 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3430 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3431 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3435 src_str
= argv
[idx_ipv4_2
]->arg
;
3436 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3438 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3439 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3443 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3444 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3451 DEFUN (interface_no_ip_mroute
,
3452 interface_no_ip_mroute_cmd
,
3453 "no ip mroute INTERFACE A.B.C.D",
3456 "Add multicast route\n"
3457 "Outgoing interface name\n"
3460 int idx_interface
= 3;
3462 struct interface
*iif
;
3463 struct interface
*oif
;
3464 const char *oifname
;
3465 const char *grp_str
;
3466 struct in_addr grp_addr
;
3467 struct in_addr src_addr
;
3472 oifname
= argv
[idx_interface
]->arg
;
3473 oif
= if_lookup_by_name(oifname
);
3475 vty_out(vty
, "No such interface name %s%s",
3476 oifname
, VTY_NEWLINE
);
3480 grp_str
= argv
[idx_ipv4
]->arg
;
3481 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3483 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3484 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3488 src_addr
.s_addr
= INADDR_ANY
;
3490 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3491 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3498 DEFUN (interface_no_ip_mroute_source
,
3499 interface_no_ip_mroute_source_cmd
,
3500 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
3503 "Add multicast route\n"
3504 "Outgoing interface name\n"
3508 int idx_interface
= 3;
3511 struct interface
*iif
;
3512 struct interface
*oif
;
3513 const char *oifname
;
3514 const char *grp_str
;
3515 struct in_addr grp_addr
;
3516 const char *src_str
;
3517 struct in_addr src_addr
;
3522 oifname
= argv
[idx_interface
]->arg
;
3523 oif
= if_lookup_by_name(oifname
);
3525 vty_out(vty
, "No such interface name %s%s",
3526 oifname
, VTY_NEWLINE
);
3530 grp_str
= argv
[idx_ipv4
]->arg
;
3531 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3533 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3534 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3538 src_str
= argv
[idx_ipv4_2
]->arg
;
3539 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3541 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3542 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3546 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3547 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3555 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3556 * "ip pim hello <1-180> <1-180>",
3559 * IFACE_PIM_HELLO_STR
3560 * IFACE_PIM_HELLO_TIME_STR
3561 * IFACE_PIM_HELLO_HOLD_STR
3564 DEFUN (interface_ip_pim_hello
,
3565 interface_ip_pim_hello_cmd
,
3566 "ip pim hello (1-180)",
3570 IFACE_PIM_HELLO_TIME_STR
)
3573 struct interface
*ifp
;
3574 struct pim_interface
*pim_ifp
;
3577 pim_ifp
= ifp
->info
;
3580 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3584 pim_ifp
->pim_hello_period
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
3587 pim_ifp
->pim_default_holdtime
= strtol(argv
[4]->arg
, NULL
, 10);
3594 DEFUN (interface_no_ip_pim_hello
,
3595 interface_no_ip_pim_hello_cmd
,
3596 "no ip pim hello [(1-180) (1-180)]",
3601 IFACE_PIM_HELLO_TIME_STR
3602 IFACE_PIM_HELLO_HOLD_STR
)
3604 struct interface
*ifp
;
3605 struct pim_interface
*pim_ifp
;
3608 pim_ifp
= ifp
->info
;
3611 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3615 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
3616 pim_ifp
->pim_default_holdtime
= -1;
3627 PIM_DO_DEBUG_IGMP_EVENTS
;
3628 PIM_DO_DEBUG_IGMP_PACKETS
;
3629 PIM_DO_DEBUG_IGMP_TRACE
;
3634 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3640 DEFUN (no_debug_igmp
,
3647 PIM_DONT_DEBUG_IGMP_EVENTS
;
3648 PIM_DONT_DEBUG_IGMP_PACKETS
;
3649 PIM_DONT_DEBUG_IGMP_TRACE
;
3654 DEFUN (debug_igmp_events
,
3655 debug_igmp_events_cmd
,
3656 "debug igmp events",
3659 DEBUG_IGMP_EVENTS_STR
)
3661 PIM_DO_DEBUG_IGMP_EVENTS
;
3666 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3667 * "undebug igmp events",
3670 * DEBUG_IGMP_EVENTS_STR
3673 DEFUN (no_debug_igmp_events
,
3674 no_debug_igmp_events_cmd
,
3675 "no debug igmp events",
3679 DEBUG_IGMP_EVENTS_STR
)
3681 PIM_DONT_DEBUG_IGMP_EVENTS
;
3686 DEFUN (debug_igmp_packets
,
3687 debug_igmp_packets_cmd
,
3688 "debug igmp packets",
3691 DEBUG_IGMP_PACKETS_STR
)
3693 PIM_DO_DEBUG_IGMP_PACKETS
;
3698 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3699 * "undebug igmp packets",
3702 * DEBUG_IGMP_PACKETS_STR
3705 DEFUN (no_debug_igmp_packets
,
3706 no_debug_igmp_packets_cmd
,
3707 "no debug igmp packets",
3711 DEBUG_IGMP_PACKETS_STR
)
3713 PIM_DONT_DEBUG_IGMP_PACKETS
;
3718 DEFUN (debug_igmp_trace
,
3719 debug_igmp_trace_cmd
,
3723 DEBUG_IGMP_TRACE_STR
)
3725 PIM_DO_DEBUG_IGMP_TRACE
;
3730 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3731 * "undebug igmp trace",
3734 * DEBUG_IGMP_TRACE_STR
3737 DEFUN (no_debug_igmp_trace
,
3738 no_debug_igmp_trace_cmd
,
3739 "no debug igmp trace",
3743 DEBUG_IGMP_TRACE_STR
)
3745 PIM_DONT_DEBUG_IGMP_TRACE
;
3750 DEFUN (debug_mroute
,
3756 PIM_DO_DEBUG_MROUTE
;
3761 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3767 DEFUN (no_debug_mroute
,
3768 no_debug_mroute_cmd
,
3774 PIM_DONT_DEBUG_MROUTE
;
3779 DEFUN (debug_static
,
3785 PIM_DO_DEBUG_STATIC
;
3790 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3796 DEFUN (no_debug_static
,
3797 no_debug_static_cmd
,
3803 PIM_DONT_DEBUG_STATIC
;
3814 PIM_DO_DEBUG_PIM_EVENTS
;
3815 PIM_DO_DEBUG_PIM_PACKETS
;
3816 PIM_DO_DEBUG_PIM_TRACE
;
3821 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3827 DEFUN (no_debug_pim
,
3834 PIM_DONT_DEBUG_PIM_EVENTS
;
3835 PIM_DONT_DEBUG_PIM_PACKETS
;
3836 PIM_DONT_DEBUG_PIM_TRACE
;
3838 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3839 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3845 DEFUN (debug_pim_events
,
3846 debug_pim_events_cmd
,
3850 DEBUG_PIM_EVENTS_STR
)
3852 PIM_DO_DEBUG_PIM_EVENTS
;
3857 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3858 * "undebug pim events",
3861 * DEBUG_PIM_EVENTS_STR
3864 DEFUN (no_debug_pim_events
,
3865 no_debug_pim_events_cmd
,
3866 "no debug pim events",
3870 DEBUG_PIM_EVENTS_STR
)
3872 PIM_DONT_DEBUG_PIM_EVENTS
;
3877 DEFUN (debug_pim_packets
,
3878 debug_pim_packets_cmd
,
3879 "debug pim packets",
3882 DEBUG_PIM_PACKETS_STR
)
3884 PIM_DO_DEBUG_PIM_PACKETS
;
3885 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
3889 DEFUN (debug_pim_packets_filter
,
3890 debug_pim_packets_filter_cmd
,
3891 "debug pim packets <hello|joins>",
3894 DEBUG_PIM_PACKETS_STR
3895 DEBUG_PIM_HELLO_PACKETS_STR
3896 DEBUG_PIM_J_P_PACKETS_STR
)
3898 int idx_hello_join
= 3;
3899 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3901 PIM_DO_DEBUG_PIM_HELLO
;
3902 vty_out (vty
, "PIM Hello debugging is on %s", VTY_NEWLINE
);
3904 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3906 PIM_DO_DEBUG_PIM_J_P
;
3907 vty_out (vty
, "PIM Join/Prune debugging is on %s", VTY_NEWLINE
);
3913 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3914 * "undebug pim packets",
3917 * DEBUG_PIM_PACKETS_STR
3920 DEFUN (no_debug_pim_packets
,
3921 no_debug_pim_packets_cmd
,
3922 "no debug pim packets",
3926 DEBUG_PIM_PACKETS_STR
3927 DEBUG_PIM_HELLO_PACKETS_STR
3928 DEBUG_PIM_J_P_PACKETS_STR
)
3930 PIM_DONT_DEBUG_PIM_PACKETS
;
3931 vty_out (vty
, "PIM Packet debugging is off %s", VTY_NEWLINE
);
3935 DEFUN (no_debug_pim_packets_filter
,
3936 no_debug_pim_packets_filter_cmd
,
3937 "no debug pim packets <hello|joins>",
3941 DEBUG_PIM_PACKETS_STR
3942 DEBUG_PIM_HELLO_PACKETS_STR
3943 DEBUG_PIM_J_P_PACKETS_STR
)
3945 int idx_hello_join
= 4;
3946 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3948 PIM_DONT_DEBUG_PIM_HELLO
;
3949 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
3951 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3953 PIM_DONT_DEBUG_PIM_J_P
;
3954 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
3960 DEFUN (debug_pim_packetdump_send
,
3961 debug_pim_packetdump_send_cmd
,
3962 "debug pim packet-dump send",
3965 DEBUG_PIM_PACKETDUMP_STR
3966 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3968 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
3973 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3974 * "undebug pim packet-dump send",
3977 * DEBUG_PIM_PACKETDUMP_STR
3978 * DEBUG_PIM_PACKETDUMP_SEND_STR
3981 DEFUN (no_debug_pim_packetdump_send
,
3982 no_debug_pim_packetdump_send_cmd
,
3983 "no debug pim packet-dump send",
3987 DEBUG_PIM_PACKETDUMP_STR
3988 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3990 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3995 DEFUN (debug_pim_packetdump_recv
,
3996 debug_pim_packetdump_recv_cmd
,
3997 "debug pim packet-dump receive",
4000 DEBUG_PIM_PACKETDUMP_STR
4001 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4003 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4008 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4009 * "undebug pim packet-dump receive",
4012 * DEBUG_PIM_PACKETDUMP_STR
4013 * DEBUG_PIM_PACKETDUMP_RECV_STR
4016 DEFUN (no_debug_pim_packetdump_recv
,
4017 no_debug_pim_packetdump_recv_cmd
,
4018 "no debug pim packet-dump receive",
4022 DEBUG_PIM_PACKETDUMP_STR
4023 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4025 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4030 DEFUN (debug_pim_trace
,
4031 debug_pim_trace_cmd
,
4035 DEBUG_PIM_TRACE_STR
)
4037 PIM_DO_DEBUG_PIM_TRACE
;
4042 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4043 * "undebug pim trace",
4046 * DEBUG_PIM_TRACE_STR
4049 DEFUN (no_debug_pim_trace
,
4050 no_debug_pim_trace_cmd
,
4051 "no debug pim trace",
4055 DEBUG_PIM_TRACE_STR
)
4057 PIM_DONT_DEBUG_PIM_TRACE
;
4062 DEFUN (debug_ssmpingd
,
4069 PIM_DO_DEBUG_SSMPINGD
;
4074 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4075 * "undebug ssmpingd",
4078 * DEBUG_SSMPINGD_STR
4081 DEFUN (no_debug_ssmpingd
,
4082 no_debug_ssmpingd_cmd
,
4083 "no debug ssmpingd",
4089 PIM_DONT_DEBUG_SSMPINGD
;
4094 DEFUN (debug_pim_zebra
,
4095 debug_pim_zebra_cmd
,
4099 DEBUG_PIM_ZEBRA_STR
)
4106 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4107 * "undebug pim zebra",
4110 * DEBUG_PIM_ZEBRA_STR
4113 DEFUN (no_debug_pim_zebra
,
4114 no_debug_pim_zebra_cmd
,
4115 "no debug pim zebra",
4119 DEBUG_PIM_ZEBRA_STR
)
4121 PIM_DONT_DEBUG_ZEBRA
;
4126 DEFUN (show_debugging_pim
,
4127 show_debugging_pim_cmd
,
4128 "show debugging pim",
4133 pim_debug_config_write(vty
);
4137 static struct igmp_sock
*find_igmp_sock_by_fd(int fd
)
4139 struct listnode
*ifnode
;
4140 struct interface
*ifp
;
4142 /* scan all interfaces */
4143 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
4144 struct pim_interface
*pim_ifp
;
4145 struct igmp_sock
*igmp
;
4150 pim_ifp
= ifp
->info
;
4152 /* lookup igmp socket under current interface */
4153 igmp
= igmp_sock_lookup_by_fd(pim_ifp
->igmp_socket_list
, fd
);
4161 DEFUN (test_igmp_receive_report
,
4162 test_igmp_receive_report_cmd
,
4163 "test igmp receive report (0-65535) A.B.C.D (1-6) .LINE",
4165 "Test IGMP protocol\n"
4166 "Test IGMP message\n"
4167 "Test IGMP report\n"
4169 "IGMP group address\n"
4175 int idx_number_2
= 6;
4179 size_t ip_hlen
; /* ip header length in bytes */
4184 const char *grp_str
;
4185 struct in_addr grp_addr
;
4186 const char *record_type_str
;
4188 const char *src_str
;
4190 struct igmp_sock
*igmp
;
4193 struct in_addr
*sources
;
4194 struct in_addr
*src_addr
;
4197 socket
= argv
[idx_number
]->arg
;
4198 socket_fd
= atoi(socket
);
4199 igmp
= find_igmp_sock_by_fd(socket_fd
);
4201 vty_out(vty
, "Could not find IGMP socket %s: fd=%d%s",
4202 socket
, socket_fd
, VTY_NEWLINE
);
4206 grp_str
= argv
[idx_ipv4
]->arg
;
4207 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4209 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4210 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4214 record_type_str
= argv
[idx_number_2
]->arg
;
4215 record_type
= atoi(record_type_str
);
4220 ip_hdr
= (struct ip
*) buf
;
4221 ip_hdr
->ip_p
= PIM_IP_PROTO_IGMP
;
4222 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4223 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4224 ip_hdr
->ip_src
= igmp
->ifaddr
;
4225 ip_hdr
->ip_dst
= igmp
->ifaddr
;
4228 Build IGMP v3 report message
4230 igmp_msg
= buf
+ ip_hlen
;
4231 group_record
= igmp_msg
+ IGMP_V3_REPORT_GROUPPRECORD_OFFSET
;
4232 *igmp_msg
= PIM_IGMP_V3_MEMBERSHIP_REPORT
; /* type */
4233 *(uint16_t *) (igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = 0; /* for computing checksum */
4234 *(uint16_t *) (igmp_msg
+ IGMP_V3_REPORT_NUMGROUPS_OFFSET
) = htons(1); /* one group record */
4235 *(uint8_t *) (group_record
+ IGMP_V3_GROUP_RECORD_TYPE_OFFSET
) = record_type
;
4236 memcpy(group_record
+ IGMP_V3_GROUP_RECORD_GROUP_OFFSET
, &grp_addr
, sizeof(struct in_addr
));
4238 /* Scan LINE sources */
4239 sources
= (struct in_addr
*) (group_record
+ IGMP_V3_GROUP_RECORD_SOURCE_OFFSET
);
4241 for (argi
= 3; argi
< argc
; ++argi
,++src_addr
) {
4242 src_str
= argv
[argi
]->arg
;
4243 result
= inet_pton(AF_INET
, src_str
, src_addr
);
4245 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4246 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4250 num_sources
= src_addr
- sources
;
4252 *(uint16_t *)(group_record
+ IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET
) = htons(num_sources
);
4254 igmp_msg_len
= IGMP_V3_MSG_MIN_SIZE
+ (num_sources
<< 4); /* v3 report for one single group record */
4256 /* compute checksum */
4257 *(uint16_t *)(igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = in_cksum(igmp_msg
, igmp_msg_len
);
4259 /* "receive" message */
4261 ip_msg_len
= ip_hlen
+ igmp_msg_len
;
4262 result
= pim_igmp_packet(igmp
, buf
, ip_msg_len
);
4264 vty_out(vty
, "pim_igmp_packet(len=%d) returned: %d%s",
4265 ip_msg_len
, result
, VTY_NEWLINE
);
4272 static int hexval(uint8_t ch
)
4274 return isdigit(ch
) ? (ch
- '0') : (10 + tolower(ch
) - 'a');
4277 DEFUN (test_pim_receive_dump
,
4278 test_pim_receive_dump_cmd
,
4279 "test pim receive dump INTERFACE A.B.C.D .LINE",
4281 "Test PIM protocol\n"
4282 "Test PIM message reception\n"
4283 "Test PIM packet dump reception from neighbor\n"
4285 "Neighbor address\n"
4288 int idx_interface
= 4;
4293 size_t ip_hlen
; /* ip header length in bytes */
4296 const char *neigh_str
;
4297 struct in_addr neigh_addr
;
4299 struct interface
*ifp
;
4303 /* Find interface */
4304 ifname
= argv
[idx_interface
]->arg
;
4305 ifp
= if_lookup_by_name(ifname
);
4307 vty_out(vty
, "No such interface name %s%s",
4308 ifname
, VTY_NEWLINE
);
4312 /* Neighbor address */
4313 neigh_str
= argv
[idx_ipv4
]->arg
;
4314 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4316 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4317 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4324 ip_hdr
= (struct ip
*) buf
;
4325 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4326 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4327 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4328 ip_hdr
->ip_src
= neigh_addr
;
4329 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4332 Build PIM hello message
4334 pim_msg
= buf
+ ip_hlen
;
4337 /* Scan LINE dump into buffer */
4338 for (argi
= 2; argi
< argc
; ++argi
) {
4339 const char *str
= argv
[argi
]->arg
;
4340 int str_len
= strlen(str
);
4341 int str_last
= str_len
- 1;
4345 vty_out(vty
, "%% Uneven hex array arg %d=%s%s",
4346 argi
, str
, VTY_NEWLINE
);
4350 for (i
= 0; i
< str_last
; i
+= 2) {
4353 uint8_t h1
= str
[i
];
4354 uint8_t h2
= str
[i
+ 1];
4356 if (!isxdigit(h1
) || !isxdigit(h2
)) {
4357 vty_out(vty
, "%% Non-hex octet %c%c at hex array arg %d=%s%s",
4358 h1
, h2
, argi
, str
, VTY_NEWLINE
);
4361 octet
= (hexval(h1
) << 4) + hexval(h2
);
4363 left
= sizeof(buf
) - ip_hlen
- pim_msg_size
;
4365 vty_out(vty
, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s",
4366 sizeof(buf
), left
, argi
, str
, octet
, VTY_NEWLINE
);
4370 pim_msg
[pim_msg_size
++] = octet
;
4374 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4376 vty_out(vty
, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s",
4377 sizeof(buf
), ip_msg_len
, pim_msg_size
, VTY_NEWLINE
);
4379 /* "receive" message */
4381 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4383 vty_out(vty
, "%% pim_pim_packet(len=%d) returned failure: %d%s",
4384 ip_msg_len
, result
, VTY_NEWLINE
);
4391 DEFUN (test_pim_receive_hello
,
4392 test_pim_receive_hello_cmd
,
4393 "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]",
4395 "Test PIM protocol\n"
4396 "Test PIM message reception\n"
4397 "Test PIM hello reception from neighbor\n"
4399 "Neighbor address\n"
4400 "Neighbor holdtime\n"
4401 "Neighbor DR priority\n"
4402 "Neighbor generation ID\n"
4403 "Neighbor propagation delay (msec)\n"
4404 "Neighbor override interval (msec)\n"
4405 "Neighbor LAN prune delay T-bit\n"
4406 "Neighbor secondary addresses\n")
4408 int idx_interface
= 4;
4411 int idx_number_2
= 7;
4412 int idx_number_3
= 8;
4413 int idx_number_4
= 9;
4414 int idx_number_5
= 10;
4415 int idx_number_6
= 11;
4419 size_t ip_hlen
; /* ip header length in bytes */
4423 const char *neigh_str
;
4424 struct in_addr neigh_addr
;
4426 struct interface
*ifp
;
4427 uint16_t neigh_holdtime
;
4428 uint16_t neigh_propagation_delay
;
4429 uint16_t neigh_override_interval
;
4430 int neigh_can_disable_join_suppression
;
4431 uint32_t neigh_dr_priority
;
4432 uint32_t neigh_generation_id
;
4436 /* Find interface */
4437 ifname
= argv
[idx_interface
]->arg
;
4438 ifp
= if_lookup_by_name(ifname
);
4440 vty_out(vty
, "No such interface name %s%s",
4441 ifname
, VTY_NEWLINE
);
4445 /* Neighbor address */
4446 neigh_str
= argv
[idx_ipv4
]->arg
;
4447 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4449 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4450 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4454 neigh_holdtime
= atoi(argv
[idx_number
]->arg
);
4455 neigh_dr_priority
= atoi(argv
[idx_number_2
]->arg
);
4456 neigh_generation_id
= atoi(argv
[idx_number_3
]->arg
);
4457 neigh_propagation_delay
= atoi(argv
[idx_number_4
]->arg
);
4458 neigh_override_interval
= atoi(argv
[idx_number_5
]->arg
);
4459 neigh_can_disable_join_suppression
= atoi(argv
[idx_number_6
]->arg
);
4464 ip_hdr
= (struct ip
*) buf
;
4465 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4466 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4467 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4468 ip_hdr
->ip_src
= neigh_addr
;
4469 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4472 Build PIM hello message
4474 pim_msg
= buf
+ ip_hlen
;
4476 /* Scan LINE addresses */
4477 for (argi
= 8; argi
< argc
; ++argi
) {
4478 const char *sec_str
= argv
[argi
]->arg
;
4479 struct in_addr sec_addr
;
4480 result
= inet_pton(AF_INET
, sec_str
, &sec_addr
);
4482 vty_out(vty
, "Bad neighbor secondary address %s: errno=%d: %s%s",
4483 sec_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4488 "FIXME WRITEME consider neighbor secondary address %s%s",
4489 sec_str
, VTY_NEWLINE
);
4492 pim_tlv_size
= pim_hello_build_tlv(ifp
->name
,
4493 pim_msg
+ PIM_PIM_MIN_LEN
,
4494 sizeof(buf
) - ip_hlen
- PIM_PIM_MIN_LEN
,
4497 neigh_generation_id
,
4498 neigh_propagation_delay
,
4499 neigh_override_interval
,
4500 neigh_can_disable_join_suppression
,
4501 0 /* FIXME secondary address list */);
4502 if (pim_tlv_size
< 0) {
4503 vty_out(vty
, "pim_hello_build_tlv() returned failure: %d%s",
4504 pim_tlv_size
, VTY_NEWLINE
);
4508 pim_msg_size
= pim_tlv_size
+ PIM_PIM_MIN_LEN
;
4510 pim_msg_build_header(pim_msg
, pim_msg_size
,
4511 PIM_MSG_TYPE_HELLO
);
4513 /* "receive" message */
4515 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4516 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4518 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4519 ip_msg_len
, result
, VTY_NEWLINE
);
4526 DEFUN (test_pim_receive_assert
,
4527 test_pim_receive_assert_cmd
,
4528 "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)",
4530 "Test PIM protocol\n"
4531 "Test PIM message reception\n"
4532 "Test reception of PIM assert\n"
4534 "Neighbor address\n"
4535 "Assert multicast group address\n"
4536 "Assert unicast source address\n"
4537 "Assert metric preference\n"
4538 "Assert route metric\n"
4539 "Assert RPT bit flag\n")
4541 int idx_interface
= 4;
4546 int idx_number_2
= 9;
4547 int idx_number_3
= 10;
4549 uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4552 size_t ip_hlen
; /* ip header length in bytes */
4555 const char *neigh_str
;
4556 struct in_addr neigh_addr
;
4557 const char *group_str
;
4558 struct in_addr group_addr
;
4559 const char *source_str
;
4560 struct in_addr source_addr
;
4562 struct interface
*ifp
;
4563 uint32_t assert_metric_preference
;
4564 uint32_t assert_route_metric
;
4565 uint32_t assert_rpt_bit_flag
;
4569 /* Find interface */
4570 ifname
= argv
[idx_interface
]->arg
;
4571 ifp
= if_lookup_by_name(ifname
);
4573 vty_out(vty
, "No such interface name %s%s",
4574 ifname
, VTY_NEWLINE
);
4578 /* Neighbor address */
4579 neigh_str
= argv
[idx_ipv4
]->arg
;
4580 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4582 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4583 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4588 group_str
= argv
[idx_ipv4_2
]->arg
;
4589 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4591 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4592 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4596 /* Source address */
4597 source_str
= argv
[idx_ipv4_3
]->arg
;
4598 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4600 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4601 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4605 assert_metric_preference
= atoi(argv
[idx_number
]->arg
);
4606 assert_route_metric
= atoi(argv
[idx_number_2
]->arg
);
4607 assert_rpt_bit_flag
= atoi(argv
[idx_number_3
]->arg
);
4609 remain
= buf_pastend
- buf
;
4610 if (remain
< (int) sizeof(struct ip
)) {
4611 vty_out(vty
, "No room for ip header: buf_size=%d < ip_header_size=%zu%s",
4612 remain
, sizeof(struct ip
), VTY_NEWLINE
);
4619 ip_hdr
= (struct ip
*) buf
;
4620 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4621 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4622 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4623 ip_hdr
->ip_src
= neigh_addr
;
4624 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4627 Build PIM assert message
4629 pim_msg
= buf
+ ip_hlen
; /* skip ip header */
4631 pim_msg_size
= pim_assert_build_msg(pim_msg
, buf_pastend
- pim_msg
, ifp
,
4632 group_addr
, source_addr
,
4633 assert_metric_preference
,
4634 assert_route_metric
,
4635 assert_rpt_bit_flag
);
4636 if (pim_msg_size
< 0) {
4637 vty_out(vty
, "Failure building PIM assert message: size=%d%s",
4638 pim_msg_size
, VTY_NEWLINE
);
4642 /* "receive" message */
4644 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4645 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4647 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4648 ip_msg_len
, result
, VTY_NEWLINE
);
4655 static int recv_joinprune(struct vty
*vty
,
4656 struct cmd_token
**argv
,
4660 const uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4662 uint8_t *pim_msg_curr
;
4665 size_t ip_hlen
; /* ip header length in bytes */
4667 uint16_t neigh_holdtime
;
4668 const char *neigh_dst_str
;
4669 struct in_addr neigh_dst_addr
;
4670 const char *neigh_src_str
;
4671 struct in_addr neigh_src_addr
;
4672 const char *group_str
;
4673 struct in_addr group_addr
;
4674 const char *source_str
;
4675 struct in_addr source_addr
;
4677 struct interface
*ifp
;
4680 uint16_t num_joined
;
4681 uint16_t num_pruned
;
4683 /* Find interface */
4684 ifname
= argv
[0]->arg
;
4685 ifp
= if_lookup_by_name(ifname
);
4687 vty_out(vty
, "No such interface name %s%s",
4688 ifname
, VTY_NEWLINE
);
4692 neigh_holdtime
= atoi(argv
[1]->arg
);
4694 /* Neighbor destination address */
4695 neigh_dst_str
= argv
[2]->arg
;
4696 result
= inet_pton(AF_INET
, neigh_dst_str
, &neigh_dst_addr
);
4698 vty_out(vty
, "Bad neighbor destination address %s: errno=%d: %s%s",
4699 neigh_dst_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4703 /* Neighbor source address */
4704 neigh_src_str
= argv
[3]->arg
;
4705 result
= inet_pton(AF_INET
, neigh_src_str
, &neigh_src_addr
);
4707 vty_out(vty
, "Bad neighbor source address %s: errno=%d: %s%s",
4708 neigh_src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4712 /* Multicast group address */
4713 group_str
= argv
[4]->arg
;
4714 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4716 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4717 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4721 /* Multicast source address */
4722 source_str
= argv
[5]->arg
;
4723 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4725 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4726 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4733 ip_hdr
= (struct ip
*) buf
;
4734 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4735 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4736 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4737 ip_hdr
->ip_src
= neigh_src_addr
;
4738 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4743 pim_msg
= buf
+ ip_hlen
;
4745 /* skip room for pim header */
4746 pim_msg_curr
= pim_msg
+ PIM_MSG_HEADER_LEN
;
4748 remain
= buf_pastend
- pim_msg_curr
;
4749 pim_msg_curr
= pim_msg_addr_encode_ipv4_ucast(pim_msg_curr
,
4752 if (!pim_msg_curr
) {
4753 vty_out(vty
, "Failure encoding destination address %s: space left=%d%s",
4754 neigh_dst_str
, remain
, VTY_NEWLINE
);
4758 remain
= buf_pastend
- pim_msg_curr
;
4760 vty_out(vty
, "Group will not fit: space left=%d%s",
4761 remain
, VTY_NEWLINE
);
4765 *pim_msg_curr
= 0; /* reserved */
4767 *pim_msg_curr
= 1; /* number of groups */
4769 *((uint16_t *) pim_msg_curr
) = htons(neigh_holdtime
);
4773 remain
= buf_pastend
- pim_msg_curr
;
4774 pim_msg_curr
= pim_msg_addr_encode_ipv4_group(pim_msg_curr
,
4777 if (!pim_msg_curr
) {
4778 vty_out(vty
, "Failure encoding group address %s: space left=%d%s",
4779 group_str
, remain
, VTY_NEWLINE
);
4783 remain
= buf_pastend
- pim_msg_curr
;
4785 vty_out(vty
, "Sources will not fit: space left=%d%s",
4786 remain
, VTY_NEWLINE
);
4799 /* number of joined sources */
4800 *((uint16_t *) pim_msg_curr
) = htons(num_joined
);
4804 /* number of pruned sources */
4805 *((uint16_t *) pim_msg_curr
) = htons(num_pruned
);
4809 remain
= buf_pastend
- pim_msg_curr
;
4810 pim_msg_curr
= pim_msg_addr_encode_ipv4_source(pim_msg_curr
,
4813 if (!pim_msg_curr
) {
4814 vty_out(vty
, "Failure encoding source address %s: space left=%d%s",
4815 source_str
, remain
, VTY_NEWLINE
);
4819 /* Add PIM header */
4821 pim_msg_size
= pim_msg_curr
- pim_msg
;
4823 pim_msg_build_header(pim_msg
, pim_msg_size
,
4824 PIM_MSG_TYPE_JOIN_PRUNE
);
4830 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4831 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4833 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4834 ip_msg_len
, result
, VTY_NEWLINE
);
4841 DEFUN (test_pim_receive_join
,
4842 test_pim_receive_join_cmd
,
4843 "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4845 "Test PIM protocol\n"
4846 "Test PIM message reception\n"
4847 "Test PIM join reception from neighbor\n"
4849 "Neighbor holdtime\n"
4850 "Upstream neighbor unicast destination address\n"
4851 "Downstream neighbor unicast source address\n"
4852 "Multicast group address\n"
4853 "Unicast source address\n")
4855 return recv_joinprune(vty
, argv
, 1 /* src_is_join=true */);
4858 DEFUN (test_pim_receive_prune
,
4859 test_pim_receive_prune_cmd
,
4860 "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4862 "Test PIM protocol\n"
4863 "Test PIM message reception\n"
4864 "Test PIM prune reception from neighbor\n"
4866 "Neighbor holdtime\n"
4867 "Upstream neighbor unicast destination address\n"
4868 "Downstream neighbor unicast source address\n"
4869 "Multicast group address\n"
4870 "Unicast source address\n")
4872 return recv_joinprune(vty
, argv
, 0 /* src_is_join=false */);
4875 DEFUN (test_pim_receive_upcall
,
4876 test_pim_receive_upcall_cmd
,
4877 "test pim receive upcall <nocache|wrongvif|wholepkt> (0-65535) A.B.C.D A.B.C.D",
4879 "Test PIM protocol\n"
4880 "Test PIM message reception\n"
4881 "Test reception of kernel upcall\n"
4882 "NOCACHE kernel upcall\n"
4883 "WRONGVIF kernel upcall\n"
4884 "WHOLEPKT kernel upcall\n"
4885 "Input interface vif index\n"
4886 "Multicast group address\n"
4887 "Multicast source address\n")
4894 const char *upcall_type
;
4895 const char *group_str
;
4896 const char *source_str
;
4899 upcall_type
= argv
[idx_type
]->arg
;
4901 if (upcall_type
[0] == 'n')
4902 msg
.im_msgtype
= IGMPMSG_NOCACHE
;
4903 else if (upcall_type
[1] == 'r')
4904 msg
.im_msgtype
= IGMPMSG_WRONGVIF
;
4905 else if (upcall_type
[1] == 'h')
4906 msg
.im_msgtype
= IGMPMSG_WHOLEPKT
;
4908 vty_out(vty
, "Unknown kernel upcall type: %s%s",
4909 upcall_type
, VTY_NEWLINE
);
4913 msg
.im_vif
= atoi(argv
[idx_number
]->arg
);
4916 group_str
= argv
[idx_ipv4
]->arg
;
4917 result
= inet_pton(AF_INET
, group_str
, &msg
.im_dst
);
4919 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4920 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4924 /* Source address */
4925 source_str
= argv
[idx_ipv4_2
]->arg
;
4926 result
= inet_pton(AF_INET
, source_str
, &msg
.im_src
);
4928 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4929 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4933 msg
.im_mbz
= 0; /* Must be zero */
4935 result
= pim_mroute_msg(-1, (char *) &msg
, sizeof(msg
));
4937 vty_out(vty
, "pim_mroute_msg(len=%zu) returned failure: %d%s",
4938 sizeof(msg
), result
, VTY_NEWLINE
);
4947 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
4948 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
4950 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
4951 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
4952 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
4953 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
4954 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
4955 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
4957 install_element (CONFIG_NODE
, &interface_cmd
); /* from if.h */
4959 install_element (CONFIG_NODE
, &pim_interface_cmd
);
4961 install_element (CONFIG_NODE
, &no_interface_cmd
); /* from if.h */
4963 install_default (INTERFACE_NODE
);
4964 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
4965 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
4966 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
4967 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
4968 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
4969 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
4970 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
4971 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
4972 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
4973 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
4974 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
4975 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
4976 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
4977 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
4978 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
4979 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
4980 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
4981 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
4983 // Static mroutes NEB
4984 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
4985 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
4986 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
4987 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
4989 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
4990 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
4991 install_element (VIEW_NODE
, &show_ip_igmp_parameters_cmd
);
4992 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
4993 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
4994 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
4995 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
4996 install_element (VIEW_NODE
, &show_ip_igmp_querier_cmd
);
4997 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
4998 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
4999 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
5000 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
5001 install_element (VIEW_NODE
, &show_ip_pim_dr_cmd
);
5002 install_element (VIEW_NODE
, &show_ip_pim_hello_cmd
);
5003 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
5004 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
5005 install_element (VIEW_NODE
, &show_ip_pim_jp_override_interval_cmd
);
5006 install_element (VIEW_NODE
, &show_ip_pim_lan_prune_delay_cmd
);
5007 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
5008 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
5009 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
5010 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
5011 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
5012 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
5013 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
5014 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
5015 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
5016 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
5017 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
5018 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
5019 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
5021 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
5022 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
5023 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
5024 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
5025 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
5027 install_element (ENABLE_NODE
, &show_ip_igmp_interface_cmd
);
5028 install_element (ENABLE_NODE
, &show_ip_igmp_join_cmd
);
5029 install_element (ENABLE_NODE
, &show_ip_igmp_parameters_cmd
);
5030 install_element (ENABLE_NODE
, &show_ip_igmp_groups_cmd
);
5031 install_element (ENABLE_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
5032 install_element (ENABLE_NODE
, &show_ip_igmp_sources_cmd
);
5033 install_element (ENABLE_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
5034 install_element (ENABLE_NODE
, &show_ip_igmp_querier_cmd
);
5035 install_element (ENABLE_NODE
, &show_ip_pim_address_cmd
);
5036 install_element (ENABLE_NODE
, &show_ip_pim_assert_cmd
);
5037 install_element (ENABLE_NODE
, &show_ip_pim_assert_internal_cmd
);
5038 install_element (ENABLE_NODE
, &show_ip_pim_assert_metric_cmd
);
5039 install_element (ENABLE_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
5040 install_element (ENABLE_NODE
, &show_ip_pim_dr_cmd
);
5041 install_element (ENABLE_NODE
, &show_ip_pim_hello_cmd
);
5042 install_element (ENABLE_NODE
, &show_ip_pim_interface_cmd
);
5043 install_element (ENABLE_NODE
, &show_ip_pim_join_cmd
);
5044 install_element (ENABLE_NODE
, &show_ip_pim_jp_override_interval_cmd
);
5045 install_element (ENABLE_NODE
, &show_ip_pim_lan_prune_delay_cmd
);
5046 install_element (ENABLE_NODE
, &show_ip_pim_local_membership_cmd
);
5047 install_element (ENABLE_NODE
, &show_ip_pim_neighbor_cmd
);
5048 install_element (ENABLE_NODE
, &show_ip_pim_rpf_cmd
);
5049 install_element (ENABLE_NODE
, &show_ip_pim_secondary_cmd
);
5050 install_element (ENABLE_NODE
, &show_ip_pim_upstream_cmd
);
5051 install_element (ENABLE_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
5052 install_element (ENABLE_NODE
, &show_ip_pim_upstream_rpf_cmd
);
5053 install_element (ENABLE_NODE
, &show_ip_multicast_cmd
);
5054 install_element (ENABLE_NODE
, &show_ip_mroute_cmd
);
5055 install_element (ENABLE_NODE
, &show_ip_mroute_count_cmd
);
5056 install_element (ENABLE_NODE
, &show_ip_rib_cmd
);
5057 install_element (ENABLE_NODE
, &show_ip_ssmpingd_cmd
);
5058 install_element (ENABLE_NODE
, &show_debugging_pim_cmd
);
5060 install_element (ENABLE_NODE
, &test_igmp_receive_report_cmd
);
5061 install_element (ENABLE_NODE
, &test_pim_receive_assert_cmd
);
5062 install_element (ENABLE_NODE
, &test_pim_receive_dump_cmd
);
5063 install_element (ENABLE_NODE
, &test_pim_receive_hello_cmd
);
5064 install_element (ENABLE_NODE
, &test_pim_receive_join_cmd
);
5065 install_element (ENABLE_NODE
, &test_pim_receive_prune_cmd
);
5066 install_element (ENABLE_NODE
, &test_pim_receive_upcall_cmd
);
5068 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
5069 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
5070 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
5071 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
5072 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
5073 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
5074 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
5075 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
5076 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
5077 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
5078 install_element (ENABLE_NODE
, &debug_static_cmd
);
5079 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
5080 install_element (ENABLE_NODE
, &debug_pim_cmd
);
5081 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
5082 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
5083 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
5084 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
5085 install_element (ENABLE_NODE
, &debug_pim_packets_filter_cmd
);
5086 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
5087 install_element (ENABLE_NODE
, &no_debug_pim_packets_filter_cmd
);
5088 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
5089 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
5090 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
5091 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
5092 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
5093 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
5094 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
5095 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
5096 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
5097 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
5099 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
5100 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
5101 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
5102 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
5103 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
5104 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
5105 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
5106 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
5107 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
5108 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
5109 install_element (CONFIG_NODE
, &debug_static_cmd
);
5110 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
5111 install_element (CONFIG_NODE
, &debug_pim_cmd
);
5112 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
5113 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
5114 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
5115 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
5116 install_element (CONFIG_NODE
, &debug_pim_packets_filter_cmd
);
5117 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
5118 install_element (CONFIG_NODE
, &no_debug_pim_packets_filter_cmd
);
5119 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
5120 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
5121 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
5122 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
5123 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
5124 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);