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,
30 #include "pim_mroute.h"
32 #include "pim_iface.h"
34 #include "pim_mroute.h"
37 #include "pim_igmpv3.h"
42 #include "pim_neighbor.h"
44 #include "pim_ifchannel.h"
45 #include "pim_hello.h"
47 #include "pim_upstream.h"
49 #include "pim_macro.h"
50 #include "pim_ssmpingd.h"
51 #include "pim_zebra.h"
52 #include "pim_static.h"
54 #include "pim_zlookup.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
)) {
134 memset (&sg
, 0, sizeof (struct prefix_sg
));
135 sg
.src
= src
->source_addr
;
136 sg
.grp
= grp
->group_addr
;
137 pim_ifchannel_local_membership_add(ifp
, &sg
);
140 } /* scan group sources */
141 } /* scan igmp groups */
142 } /* scan igmp sockets */
145 Finally delete every PIM (S,G) entry lacking all state info
148 pim_ifchannel_delete_on_noinfo(ifp
);
152 static void pim_show_assert(struct vty
*vty
)
154 struct listnode
*ifnode
;
155 struct interface
*ifp
;
158 now
= pim_time_monotonic_sec();
161 "Interface Address Source Group State Winner Uptime Timer%s",
164 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
165 struct pim_interface
*pim_ifp
;
166 struct in_addr ifaddr
;
167 struct listnode
*ch_node
;
168 struct pim_ifchannel
*ch
;
175 ifaddr
= pim_ifp
->primary_address
;
177 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
178 char ch_src_str
[100];
179 char ch_grp_str
[100];
180 char winner_str
[100];
184 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
185 ch_src_str
, sizeof(ch_src_str
));
186 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
187 ch_grp_str
, sizeof(ch_grp_str
));
188 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
,
189 winner_str
, sizeof(winner_str
));
191 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
192 pim_time_timer_to_mmss(timer
, sizeof(timer
),
193 ch
->t_ifassert_timer
);
195 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
200 pim_ifchannel_ifassert_name(ch
->ifassert_state
),
205 } /* scan interface channels */
206 } /* scan interfaces */
209 static void pim_show_assert_internal(struct vty
*vty
)
211 struct listnode
*ifnode
;
212 struct interface
*ifp
;
216 "ECA: Evaluate CouldAssert%s"
217 "ATD: AssertTrackingDesired%s"
218 "eATD: Evaluate AssertTrackingDesired%s%s",
219 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
222 "Interface Address Source Group CA eCA ATD eATD%s",
225 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
226 struct pim_interface
*pim_ifp
;
227 struct in_addr ifaddr
;
228 struct listnode
*ch_node
;
229 struct pim_ifchannel
*ch
;
236 ifaddr
= pim_ifp
->primary_address
;
238 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
239 char ch_src_str
[100];
240 char ch_grp_str
[100];
242 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
243 ch_src_str
, sizeof(ch_src_str
));
244 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
245 ch_grp_str
, sizeof(ch_grp_str
));
246 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
251 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
252 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
253 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes" : "no",
254 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no",
256 } /* scan interface channels */
257 } /* scan interfaces */
260 static void pim_show_assert_metric(struct vty
*vty
)
262 struct listnode
*ifnode
;
263 struct interface
*ifp
;
266 "Interface Address Source Group RPT Pref Metric Address %s",
269 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
270 struct pim_interface
*pim_ifp
;
271 struct in_addr ifaddr
;
272 struct listnode
*ch_node
;
273 struct pim_ifchannel
*ch
;
280 ifaddr
= pim_ifp
->primary_address
;
282 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
283 char ch_src_str
[100];
284 char ch_grp_str
[100];
286 struct pim_assert_metric am
;
288 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
, pim_ifp
->primary_address
);
290 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
291 ch_src_str
, sizeof(ch_src_str
));
292 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
293 ch_grp_str
, sizeof(ch_grp_str
));
294 pim_inet4_dump("<addr?>", am
.ip_address
,
295 addr_str
, sizeof(addr_str
));
297 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s%s",
302 am
.rpt_bit_flag
? "yes" : "no",
303 am
.metric_preference
,
307 } /* scan interface channels */
308 } /* scan interfaces */
311 static void pim_show_assert_winner_metric(struct vty
*vty
)
313 struct listnode
*ifnode
;
314 struct interface
*ifp
;
317 "Interface Address Source Group RPT Pref Metric Address %s",
320 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
321 struct pim_interface
*pim_ifp
;
322 struct in_addr ifaddr
;
323 struct listnode
*ch_node
;
324 struct pim_ifchannel
*ch
;
331 ifaddr
= pim_ifp
->primary_address
;
333 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
334 char ch_src_str
[100];
335 char ch_grp_str
[100];
337 struct pim_assert_metric
*am
;
341 am
= &ch
->ifassert_winner_metric
;
343 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
344 ch_src_str
, sizeof(ch_src_str
));
345 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
346 ch_grp_str
, sizeof(ch_grp_str
));
347 pim_inet4_dump("<addr?>", am
->ip_address
,
348 addr_str
, sizeof(addr_str
));
350 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
351 snprintf(pref_str
, sizeof(pref_str
), "INFI");
353 snprintf(pref_str
, sizeof(pref_str
), "%4u", am
->metric_preference
);
355 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
356 snprintf(metr_str
, sizeof(metr_str
), "INFI");
358 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
360 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
365 am
->rpt_bit_flag
? "yes" : "no",
370 } /* scan interface channels */
371 } /* scan interfaces */
374 static void pim_show_membership(struct vty
*vty
)
376 struct listnode
*ifnode
;
377 struct interface
*ifp
;
380 "Interface Address Source Group Membership%s",
383 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
384 struct pim_interface
*pim_ifp
;
385 struct in_addr ifaddr
;
386 struct listnode
*ch_node
;
387 struct pim_ifchannel
*ch
;
394 ifaddr
= pim_ifp
->primary_address
;
396 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
397 char ch_src_str
[100];
398 char ch_grp_str
[100];
400 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
401 ch_src_str
, sizeof(ch_src_str
));
402 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
403 ch_grp_str
, sizeof(ch_grp_str
));
405 vty_out(vty
, "%-9s %-15s %-15s %-15s %-10s%s",
410 ch
->local_ifmembership
== PIM_IFMEMBERSHIP_NOINFO
?
411 "NOINFO" : "INCLUDE",
413 } /* scan interface channels */
414 } /* scan interfaces */
418 static void igmp_show_interfaces(struct vty
*vty
)
420 struct listnode
*node
;
421 struct interface
*ifp
;
424 now
= pim_time_monotonic_sec();
427 "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s",
430 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
431 struct pim_interface
*pim_ifp
;
432 struct listnode
*sock_node
;
433 struct igmp_sock
*igmp
;
440 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
444 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
446 mloop
= pim_socket_mcastloop_get(igmp
->fd
);
448 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
450 inet_ntoa(igmp
->ifaddr
),
454 if_is_multicast(ifp
) ? "yes" : "no",
455 if_is_broadcast(ifp
) ? "yes" : "no",
456 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
457 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
458 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
459 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
465 static void igmp_show_interface_join(struct vty
*vty
)
467 struct listnode
*node
;
468 struct interface
*ifp
;
471 now
= pim_time_monotonic_sec();
474 "Interface Address Source Group Socket Uptime %s",
477 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
478 struct pim_interface
*pim_ifp
;
479 struct listnode
*join_node
;
480 struct igmp_join
*ij
;
481 struct in_addr pri_addr
;
482 char pri_addr_str
[100];
489 if (!pim_ifp
->igmp_join_list
)
492 pri_addr
= pim_find_primary_addr(ifp
);
493 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
495 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, join_node
, ij
)) {
497 char source_str
[100];
500 pim_time_uptime(uptime
, sizeof(uptime
), now
- ij
->sock_creation
);
501 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
502 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
504 vty_out(vty
, "%-9s %-15s %-15s %-15s %6d %8s%s",
512 } /* for (pim_ifp->igmp_join_list) */
518 static void show_interface_address(struct vty
*vty
)
520 struct listnode
*ifpnode
;
521 struct interface
*ifp
;
524 "Interface Primary Secondary %s",
527 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifpnode
, ifp
)) {
528 struct listnode
*ifcnode
;
529 struct connected
*ifc
;
530 struct in_addr pri_addr
;
531 char pri_addr_str
[100];
533 pri_addr
= pim_find_primary_addr(ifp
);
535 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
537 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, ifcnode
, ifc
)) {
538 char sec_addr_str
[100];
539 struct prefix
*p
= ifc
->address
;
541 if (p
->family
!= AF_INET
)
544 if (p
->u
.prefix4
.s_addr
== pri_addr
.s_addr
) {
545 sec_addr_str
[0] = '\0';
548 pim_inet4_dump("<sec?>", p
->u
.prefix4
, sec_addr_str
, sizeof(sec_addr_str
));
551 vty_out(vty
, "%-9s %-15s %-15s%s",
560 static void pim_show_dr(struct vty
*vty
)
562 struct listnode
*node
;
563 struct interface
*ifp
;
566 now
= pim_time_monotonic_sec();
569 "NonPri: Number of neighbors missing DR Priority hello option%s"
570 "DrPri: Designated Router Priority sent%s%s",
571 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
573 vty_out(vty
, "Interface Address DR Uptime Elections Changes NonPri DrPri%s", VTY_NEWLINE
);
575 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
576 struct pim_interface
*pim_ifp
;
577 struct in_addr ifaddr
;
586 if (pim_ifp
->pim_sock_fd
< 0)
589 ifaddr
= pim_ifp
->primary_address
;
591 pim_time_uptime_begin(dr_uptime
, sizeof(dr_uptime
),
592 now
, pim_ifp
->pim_dr_election_last
);
594 pim_inet4_dump("<dr?>", pim_ifp
->pim_dr_addr
,
595 dr_str
, sizeof(dr_str
));
597 vty_out(vty
, "%-9s %-15s %-15s %8s %9d %7d %6d %10d%s",
602 pim_ifp
->pim_dr_election_count
,
603 pim_ifp
->pim_dr_election_changes
,
604 pim_ifp
->pim_dr_num_nondrpri_neighbors
,
605 pim_ifp
->pim_dr_priority
,
610 static void pim_show_hello(struct vty
*vty
)
612 struct listnode
*node
;
613 struct interface
*ifp
;
616 now
= pim_time_monotonic_sec();
618 vty_out(vty
, "Interface Address Period Timer StatStart Recv Rfail Send Sfail LGenid%s", VTY_NEWLINE
);
620 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
621 struct pim_interface
*pim_ifp
;
622 struct in_addr ifaddr
;
623 char hello_period
[10];
624 char hello_timer
[10];
625 char stat_uptime
[10];
632 if (pim_ifp
->pim_sock_fd
< 0)
635 ifaddr
= pim_ifp
->primary_address
;
637 pim_time_timer_to_mmss(hello_timer
, sizeof(hello_timer
), pim_ifp
->t_pim_hello_timer
);
638 pim_time_mmss(hello_period
, sizeof(hello_period
), pim_ifp
->pim_hello_period
);
639 pim_time_uptime(stat_uptime
, sizeof(stat_uptime
), now
- pim_ifp
->pim_ifstat_start
);
641 vty_out(vty
, "%-9s %-15s %6s %5s %9s %4u %5u %4u %5u %08x%s",
647 pim_ifp
->pim_ifstat_hello_recv
,
648 pim_ifp
->pim_ifstat_hello_recvfail
,
649 pim_ifp
->pim_ifstat_hello_sent
,
650 pim_ifp
->pim_ifstat_hello_sendfail
,
651 pim_ifp
->pim_generation_id
,
656 static void pim_show_interfaces(struct vty
*vty
)
658 struct listnode
*node
;
659 struct interface
*ifp
;
662 now
= pim_time_monotonic_sec();
664 vty_out(vty
, "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s", VTY_NEWLINE
);
666 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
667 struct pim_interface
*pim_ifp
;
668 struct in_addr ifaddr
;
677 if (pim_ifp
->pim_sock_fd
< 0)
680 ifaddr
= pim_ifp
->primary_address
;
682 pim_time_uptime(uptime
, sizeof(uptime
), now
- pim_ifp
->pim_sock_creation
);
684 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
686 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
690 pim_ifp
->pim_sock_fd
,
692 if_is_multicast(ifp
) ? "yes" : "no",
693 if_is_broadcast(ifp
) ? "yes" : "no",
694 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
695 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
696 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
697 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
702 static void pim_show_join(struct vty
*vty
)
704 struct listnode
*ifnode
;
705 struct interface
*ifp
;
708 now
= pim_time_monotonic_sec();
711 "Interface Address Source Group State Uptime Expire Prune%s",
714 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
715 struct pim_interface
*pim_ifp
;
716 struct in_addr ifaddr
;
717 struct listnode
*ch_node
;
718 struct pim_ifchannel
*ch
;
725 ifaddr
= pim_ifp
->primary_address
;
727 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
728 char ch_src_str
[100];
729 char ch_grp_str
[100];
734 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
735 ch_src_str
, sizeof(ch_src_str
));
736 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
737 ch_grp_str
, sizeof(ch_grp_str
));
739 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
740 pim_time_timer_to_mmss(expire
, sizeof(expire
),
741 ch
->t_ifjoin_expiry_timer
);
742 pim_time_timer_to_mmss(prune
, sizeof(prune
),
743 ch
->t_ifjoin_prune_pending_timer
);
745 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
750 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
),
755 } /* scan interface channels */
756 } /* scan interfaces */
760 static void pim_show_neighbors(struct vty
*vty
)
762 struct listnode
*node
;
763 struct interface
*ifp
;
766 now
= pim_time_monotonic_sec();
769 "Recv flags: H=holdtime L=lan_prune_delay P=dr_priority G=generation_id A=address_list%s"
770 " T=can_disable_join_suppression%s%s",
771 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
773 vty_out(vty
, "Interface Address Neighbor Uptime Timer Holdt DrPri GenId Recv %s", VTY_NEWLINE
);
775 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
776 struct pim_interface
*pim_ifp
;
777 struct in_addr ifaddr
;
778 struct listnode
*neighnode
;
779 struct pim_neighbor
*neigh
;
786 if (pim_ifp
->pim_sock_fd
< 0)
789 ifaddr
= pim_ifp
->primary_address
;
791 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
795 char neigh_src_str
[100];
798 pim_inet4_dump("<src?>", neigh
->source_addr
,
799 neigh_src_str
, sizeof(neigh_src_str
));
800 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
801 pim_time_mmss(holdtime
, sizeof(holdtime
), neigh
->holdtime
);
802 pim_time_timer_to_mmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
804 recv
[0] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
) ? 'H' : ' ';
805 recv
[1] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? 'L' : ' ';
806 recv
[2] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
) ? 'P' : ' ';
807 recv
[3] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
) ? 'G' : ' ';
808 recv
[4] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
) ? 'A' : ' ';
809 recv
[5] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
) ? 'T' : ' ';
812 vty_out(vty
, "%-9s %-15s %-15s %8s %5s %5s %5u %08x %6s%s",
820 neigh
->generation_id
,
829 static void pim_show_lan_prune_delay(struct vty
*vty
)
831 struct listnode
*node
;
832 struct interface
*ifp
;
835 "PrDly=propagation_delay (msec) OvInt=override_interval (msec)%s"
836 "HiDly=highest_propagation_delay (msec) HiInt=highest_override_interval (msec)%s"
837 "NoDly=number_of_non_lan_delay_neighbors%s"
838 "T=t_bit LPD=lan_prune_delay_hello_option%s%s",
839 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
841 vty_out(vty
, "Interface Address PrDly OvInt NoDly HiDly HiInt T | Neighbor LPD PrDly OvInt T%s", VTY_NEWLINE
);
843 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
844 struct pim_interface
*pim_ifp
;
845 struct in_addr ifaddr
;
846 struct listnode
*neighnode
;
847 struct pim_neighbor
*neigh
;
854 if (pim_ifp
->pim_sock_fd
< 0)
857 ifaddr
= pim_ifp
->primary_address
;
859 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
860 char neigh_src_str
[100];
862 pim_inet4_dump("<src?>", neigh
->source_addr
,
863 neigh_src_str
, sizeof(neigh_src_str
));
865 vty_out(vty
, "%-9s %-15s %5u %5u %5u %5u %5u %1u | %-15s %-3s %5u %5u %1u%s",
868 pim_ifp
->pim_propagation_delay_msec
,
869 pim_ifp
->pim_override_interval_msec
,
870 pim_ifp
->pim_number_of_nonlandelay_neighbors
,
871 pim_ifp
->pim_neighbors_highest_propagation_delay_msec
,
872 pim_ifp
->pim_neighbors_highest_override_interval_msec
,
873 PIM_FORCE_BOOLEAN(PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp
->options
)),
875 PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? "yes" : "no",
876 neigh
->propagation_delay_msec
,
877 neigh
->override_interval_msec
,
878 PIM_FORCE_BOOLEAN(PIM_OPTION_IS_SET(neigh
->hello_options
,
879 PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
)),
886 static void pim_show_jp_override_interval(struct vty
*vty
)
888 struct listnode
*node
;
889 struct interface
*ifp
;
892 "EffPDelay=effective_propagation_delay (msec)%s"
893 "EffOvrInt=override_interval (msec)%s"
894 "JPOvrInt=jp_override_interval (msec)%s%s",
895 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
897 vty_out(vty
, "Interface Address LAN_Delay EffPDelay EffOvrInt JPOvrInt%s", VTY_NEWLINE
);
899 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
900 struct pim_interface
*pim_ifp
;
901 struct in_addr ifaddr
;
908 if (pim_ifp
->pim_sock_fd
< 0)
911 ifaddr
= pim_ifp
->primary_address
;
913 vty_out(vty
, "%-9s %-15s %-9s %9u %9u %8u%s",
916 pim_if_lan_delay_enabled(ifp
) ? "enabled" : "disabled",
917 pim_if_effective_propagation_delay_msec(ifp
),
918 pim_if_effective_override_interval_msec(ifp
),
919 pim_if_jp_override_interval_msec(ifp
),
924 static void pim_show_neighbors_secondary(struct vty
*vty
)
926 struct listnode
*node
;
927 struct interface
*ifp
;
929 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
931 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
932 struct pim_interface
*pim_ifp
;
933 struct in_addr ifaddr
;
934 struct listnode
*neighnode
;
935 struct pim_neighbor
*neigh
;
942 if (pim_ifp
->pim_sock_fd
< 0)
945 ifaddr
= pim_ifp
->primary_address
;
947 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
948 char neigh_src_str
[100];
949 struct listnode
*prefix_node
;
952 if (!neigh
->prefix_list
)
955 pim_inet4_dump("<src?>", neigh
->source_addr
,
956 neigh_src_str
, sizeof(neigh_src_str
));
958 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
959 char neigh_sec_str
[100];
961 if (p
->family
!= AF_INET
)
964 pim_inet4_dump("<src?>", p
->u
.prefix4
,
965 neigh_sec_str
, sizeof(neigh_sec_str
));
967 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
978 static void pim_show_upstream(struct vty
*vty
)
980 struct listnode
*upnode
;
981 struct pim_upstream
*up
;
984 now
= pim_time_monotonic_sec();
986 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt%s", VTY_NEWLINE
);
988 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
996 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
997 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
998 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
999 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), up
->t_join_timer
);
1000 pim_time_timer_to_hhmmss (rs_timer
, sizeof (rs_timer
), up
->t_rs_timer
);
1001 pim_time_timer_to_hhmmss (ka_timer
, sizeof (ka_timer
), up
->t_ka_timer
);
1003 vty_out(vty
, "%-10s%-15s %-15s %-5s %-8s %-9s %-9s %-9s %6d%s",
1004 up
->rpf
.source_nexthop
.interface
->name
,
1007 pim_upstream_state2str (up
->join_state
),
1017 static void pim_show_join_desired(struct vty
*vty
)
1019 struct listnode
*ifnode
;
1020 struct listnode
*chnode
;
1021 struct interface
*ifp
;
1022 struct pim_interface
*pim_ifp
;
1023 struct pim_ifchannel
*ch
;
1028 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1031 /* scan all interfaces */
1032 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1033 pim_ifp
= ifp
->info
;
1037 /* scan per-interface (S,G) state */
1038 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, chnode
, ch
)) {
1039 struct pim_upstream
*up
= ch
->upstream
;
1041 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1042 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1044 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
1048 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
1049 pim_macro_chisin_joins(ch
) ? "yes" : "no",
1050 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
1051 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
1052 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
1058 static void pim_show_upstream_rpf(struct vty
*vty
)
1060 struct listnode
*upnode
;
1061 struct pim_upstream
*up
;
1064 "Source Group RpfIface RibNextHop RpfAddress %s",
1067 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
1070 char rpf_nexthop_str
[100];
1071 char rpf_addr_str
[100];
1072 struct pim_rpf
*rpf
;
1073 const char *rpf_ifname
;
1077 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1078 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1079 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
1080 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1082 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1084 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
1094 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
)
1096 char refresh_uptime
[10];
1098 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
1101 "RPF Cache Refresh Delay: %ld msecs%s"
1102 "RPF Cache Refresh Timer: %ld msecs%s"
1103 "RPF Cache Refresh Requests: %lld%s"
1104 "RPF Cache Refresh Events: %lld%s"
1105 "RPF Cache Refresh Last: %s%s"
1106 "Nexthop Lookups: %lld%s",
1107 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1108 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1109 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1110 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1111 refresh_uptime
, VTY_NEWLINE
,
1112 (long long) qpim_nexthop_lookups
, VTY_NEWLINE
);
1115 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1117 char uptime_scan_oil
[10];
1118 char uptime_mroute_add
[10];
1119 char uptime_mroute_del
[10];
1121 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1122 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1123 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1126 "Scan OIL - Last: %s Events: %lld%s"
1127 "MFC Add - Last: %s Events: %lld%s"
1128 "MFC Del - Last: %s Events: %lld%s",
1129 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1130 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1131 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
1134 static void pim_show_rpf(struct vty
*vty
)
1136 struct listnode
*up_node
;
1137 struct pim_upstream
*up
;
1138 time_t now
= pim_time_monotonic_sec();
1140 show_rpf_refresh_stats(vty
, now
);
1142 vty_out(vty
, "%s", VTY_NEWLINE
);
1145 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
1148 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, up_node
, up
)) {
1151 char rpf_addr_str
[100];
1152 char rib_nexthop_str
[100];
1153 const char *rpf_ifname
;
1154 struct pim_rpf
*rpf
= &up
->rpf
;
1156 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1157 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1158 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1159 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
1161 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1163 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
1169 rpf
->source_nexthop
.mrib_route_metric
,
1170 rpf
->source_nexthop
.mrib_metric_preference
,
1175 static void igmp_show_querier(struct vty
*vty
)
1177 struct listnode
*node
;
1178 struct interface
*ifp
;
1180 vty_out(vty
, "Interface Address Querier StartCount Query-Timer Other-Timer%s", VTY_NEWLINE
);
1182 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1183 struct pim_interface
*pim_ifp
= ifp
->info
;
1184 struct listnode
*sock_node
;
1185 struct igmp_sock
*igmp
;
1190 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1191 char query_hhmmss
[10];
1192 char other_hhmmss
[10];
1194 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
1195 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
1197 vty_out(vty
, "%-9s %-15s %-7s %10d %11s %11s%s",
1199 inet_ntoa(igmp
->ifaddr
),
1200 igmp
->t_igmp_query_timer
? "THIS" : "OTHER",
1201 igmp
->startup_query_count
,
1209 static void igmp_show_groups(struct vty
*vty
)
1211 struct listnode
*ifnode
;
1212 struct interface
*ifp
;
1215 now
= pim_time_monotonic_sec();
1217 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
1219 /* scan interfaces */
1220 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1221 struct pim_interface
*pim_ifp
= ifp
->info
;
1222 struct listnode
*sock_node
;
1223 struct igmp_sock
*igmp
;
1228 /* scan igmp sockets */
1229 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1230 char ifaddr_str
[100];
1231 struct listnode
*grpnode
;
1232 struct igmp_group
*grp
;
1234 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1236 /* scan igmp groups */
1237 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1238 char group_str
[100];
1242 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1243 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
1244 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
1246 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
1250 grp
->group_filtermode_isexcl
? "EXCL" : "INCL",
1252 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
1253 igmp_group_compat_mode(igmp
, grp
),
1257 } /* scan igmp groups */
1258 } /* scan igmp sockets */
1259 } /* scan interfaces */
1262 static void igmp_show_group_retransmission(struct vty
*vty
)
1264 struct listnode
*ifnode
;
1265 struct interface
*ifp
;
1267 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
1269 /* scan interfaces */
1270 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1271 struct pim_interface
*pim_ifp
= ifp
->info
;
1272 struct listnode
*sock_node
;
1273 struct igmp_sock
*igmp
;
1278 /* scan igmp sockets */
1279 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1280 char ifaddr_str
[100];
1281 struct listnode
*grpnode
;
1282 struct igmp_group
*grp
;
1284 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1286 /* scan igmp groups */
1287 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1288 char group_str
[100];
1289 char grp_retr_mmss
[10];
1290 struct listnode
*src_node
;
1291 struct igmp_source
*src
;
1292 int grp_retr_sources
= 0;
1294 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1295 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
1298 /* count group sources with retransmission state */
1299 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
1300 if (src
->source_query_retransmit_count
> 0) {
1305 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
1310 grp
->group_specific_query_retransmit_count
,
1314 } /* scan igmp groups */
1315 } /* scan igmp sockets */
1316 } /* scan interfaces */
1319 static void igmp_show_parameters(struct vty
*vty
)
1321 struct listnode
*ifnode
;
1322 struct interface
*ifp
;
1325 "QRV: Robustness Variable SQI: Startup Query Interval%s"
1326 "QQI: Query Interval OQPI: Other Querier Present Interval%s"
1327 "QRI: Query Response Interval LMQT: Last Member Query Time%s"
1328 "GMI: Group Membership Interval OHPI: Older Host Present Interval%s%s",
1329 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
1332 "Interface Address QRV QQI QRI GMI SQI OQPI LMQT OHPI %s",
1335 /* scan interfaces */
1336 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1337 struct pim_interface
*pim_ifp
= ifp
->info
;
1338 struct listnode
*sock_node
;
1339 struct igmp_sock
*igmp
;
1344 /* scan igmp sockets */
1345 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1346 char ifaddr_str
[100];
1347 long gmi_dsec
; /* Group Membership Interval */
1348 long oqpi_dsec
; /* Other Querier Present Interval */
1354 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1356 gmi_dsec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
1357 igmp
->querier_query_interval
,
1358 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1360 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
1362 oqpi_dsec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
1363 igmp
->querier_query_interval
,
1364 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1366 lmqt_dsec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
1367 igmp
->querier_robustness_variable
) / 100;
1369 ohpi_dsec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
1370 igmp
->querier_query_interval
,
1371 pim_ifp
->igmp_query_max_response_time_dsec
);
1373 qri_dsec
= pim_ifp
->igmp_query_max_response_time_dsec
;
1376 "%-9s %-15s %3d %3d %3ld.%ld %3ld.%ld %3d %3ld.%ld %3ld.%ld %3ld.%ld%s",
1379 igmp
->querier_robustness_variable
,
1380 igmp
->querier_query_interval
,
1381 qri_dsec
/ 10, qri_dsec
% 10,
1382 gmi_dsec
/ 10, gmi_dsec
% 10,
1384 oqpi_dsec
/ 10, oqpi_dsec
% 10,
1385 lmqt_dsec
/ 10, lmqt_dsec
% 10,
1386 ohpi_dsec
/ 10, ohpi_dsec
% 10,
1389 } /* scan igmp sockets */
1390 } /* scan interfaces */
1393 static void igmp_show_sources(struct vty
*vty
)
1395 struct listnode
*ifnode
;
1396 struct interface
*ifp
;
1399 now
= pim_time_monotonic_sec();
1401 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
1403 /* scan interfaces */
1404 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1405 struct pim_interface
*pim_ifp
= ifp
->info
;
1406 struct listnode
*sock_node
;
1407 struct igmp_sock
*igmp
;
1412 /* scan igmp sockets */
1413 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1414 char ifaddr_str
[100];
1415 struct listnode
*grpnode
;
1416 struct igmp_group
*grp
;
1418 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1420 /* scan igmp groups */
1421 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1422 char group_str
[100];
1423 struct listnode
*srcnode
;
1424 struct igmp_source
*src
;
1426 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1428 /* scan group sources */
1429 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1430 char source_str
[100];
1434 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1436 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
1438 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
1440 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
1446 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
1450 } /* scan group sources */
1451 } /* scan igmp groups */
1452 } /* scan igmp sockets */
1453 } /* scan interfaces */
1456 static void igmp_show_source_retransmission(struct vty
*vty
)
1458 struct listnode
*ifnode
;
1459 struct interface
*ifp
;
1461 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
1463 /* scan interfaces */
1464 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1465 struct pim_interface
*pim_ifp
= ifp
->info
;
1466 struct listnode
*sock_node
;
1467 struct igmp_sock
*igmp
;
1472 /* scan igmp sockets */
1473 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1474 char ifaddr_str
[100];
1475 struct listnode
*grpnode
;
1476 struct igmp_group
*grp
;
1478 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1480 /* scan igmp groups */
1481 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1482 char group_str
[100];
1483 struct listnode
*srcnode
;
1484 struct igmp_source
*src
;
1486 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1488 /* scan group sources */
1489 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1490 char source_str
[100];
1492 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1494 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
1499 src
->source_query_retransmit_count
,
1502 } /* scan group sources */
1503 } /* scan igmp groups */
1504 } /* scan igmp sockets */
1505 } /* scan interfaces */
1508 static void clear_igmp_interfaces()
1510 struct listnode
*ifnode
;
1511 struct listnode
*ifnextnode
;
1512 struct interface
*ifp
;
1514 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1515 pim_if_addr_del_all_igmp(ifp
);
1518 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1519 pim_if_addr_add_all(ifp
);
1523 static void clear_pim_interfaces()
1525 struct listnode
*ifnode
;
1526 struct listnode
*ifnextnode
;
1527 struct interface
*ifp
;
1529 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1531 pim_neighbor_delete_all(ifp
, "interface cleared");
1536 static void clear_interfaces()
1538 clear_igmp_interfaces();
1539 clear_pim_interfaces();
1542 DEFUN (clear_ip_interfaces
,
1543 clear_ip_interfaces_cmd
,
1544 "clear ip interfaces",
1547 "Reset interfaces\n")
1554 DEFUN (clear_ip_igmp_interfaces
,
1555 clear_ip_igmp_interfaces_cmd
,
1556 "clear ip igmp interfaces",
1560 "Reset IGMP interfaces\n")
1562 clear_igmp_interfaces();
1567 static void mroute_add_all()
1569 struct listnode
*node
;
1570 struct channel_oil
*c_oil
;
1572 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1573 if (pim_mroute_add(c_oil
)) {
1574 /* just log warning */
1575 char source_str
[100];
1576 char group_str
[100];
1577 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1578 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1579 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1580 __FILE__
, __PRETTY_FUNCTION__
,
1581 source_str
, group_str
);
1586 static void mroute_del_all()
1588 struct listnode
*node
;
1589 struct channel_oil
*c_oil
;
1591 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1592 if (pim_mroute_del(c_oil
)) {
1593 /* just log warning */
1594 char source_str
[100];
1595 char group_str
[100];
1596 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1597 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1598 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1599 __FILE__
, __PRETTY_FUNCTION__
,
1600 source_str
, group_str
);
1605 static void static_mroute_add_all()
1607 struct listnode
*node
;
1608 struct static_route
*s_route
;
1610 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1611 if (pim_mroute_add(&s_route
->c_oil
)) {
1612 /* just log warning */
1613 char source_str
[100];
1614 char group_str
[100];
1615 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1616 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1617 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1618 __FILE__
, __PRETTY_FUNCTION__
,
1619 source_str
, group_str
);
1624 static void static_mroute_del_all()
1626 struct listnode
*node
;
1627 struct static_route
*s_route
;
1629 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1630 if (pim_mroute_del(&s_route
->c_oil
)) {
1631 /* just log warning */
1632 char source_str
[100];
1633 char group_str
[100];
1634 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1635 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1636 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1637 __FILE__
, __PRETTY_FUNCTION__
,
1638 source_str
, group_str
);
1643 DEFUN (clear_ip_mroute
,
1644 clear_ip_mroute_cmd
,
1648 "Reset multicast routes\n")
1656 DEFUN (clear_ip_pim_interfaces
,
1657 clear_ip_pim_interfaces_cmd
,
1658 "clear ip pim interfaces",
1662 "Reset PIM interfaces\n")
1664 clear_pim_interfaces();
1669 DEFUN (clear_ip_pim_oil
,
1670 clear_ip_pim_oil_cmd
,
1675 "Rescan PIM OIL (output interface list)\n")
1682 DEFUN (show_ip_igmp_interface
,
1683 show_ip_igmp_interface_cmd
,
1684 "show ip igmp interface",
1688 "IGMP interface information\n")
1690 igmp_show_interfaces(vty
);
1695 DEFUN (show_ip_igmp_join
,
1696 show_ip_igmp_join_cmd
,
1697 "show ip igmp join",
1701 "IGMP static join information\n")
1703 igmp_show_interface_join(vty
);
1708 DEFUN (show_ip_igmp_groups
,
1709 show_ip_igmp_groups_cmd
,
1710 "show ip igmp groups",
1716 igmp_show_groups(vty
);
1721 DEFUN (show_ip_igmp_groups_retransmissions
,
1722 show_ip_igmp_groups_retransmissions_cmd
,
1723 "show ip igmp groups retransmissions",
1728 "IGMP group retransmissions\n")
1730 igmp_show_group_retransmission(vty
);
1735 DEFUN (show_ip_igmp_parameters
,
1736 show_ip_igmp_parameters_cmd
,
1737 "show ip igmp parameters",
1741 "IGMP parameters information\n")
1743 igmp_show_parameters(vty
);
1748 DEFUN (show_ip_igmp_sources
,
1749 show_ip_igmp_sources_cmd
,
1750 "show ip igmp sources",
1756 igmp_show_sources(vty
);
1761 DEFUN (show_ip_igmp_sources_retransmissions
,
1762 show_ip_igmp_sources_retransmissions_cmd
,
1763 "show ip igmp sources retransmissions",
1768 "IGMP source retransmissions\n")
1770 igmp_show_source_retransmission(vty
);
1775 DEFUN (show_ip_igmp_querier
,
1776 show_ip_igmp_querier_cmd
,
1777 "show ip igmp querier",
1781 "IGMP querier information\n")
1783 igmp_show_querier(vty
);
1788 DEFUN (show_ip_pim_address
,
1789 show_ip_pim_address_cmd
,
1790 "show ip pim address",
1794 "PIM interface address\n")
1796 show_interface_address(vty
);
1801 DEFUN (show_ip_pim_assert
,
1802 show_ip_pim_assert_cmd
,
1803 "show ip pim assert",
1807 "PIM interface assert\n")
1809 pim_show_assert(vty
);
1814 DEFUN (show_ip_pim_assert_internal
,
1815 show_ip_pim_assert_internal_cmd
,
1816 "show ip pim assert-internal",
1820 "PIM interface internal assert state\n")
1822 pim_show_assert_internal(vty
);
1827 DEFUN (show_ip_pim_assert_metric
,
1828 show_ip_pim_assert_metric_cmd
,
1829 "show ip pim assert-metric",
1833 "PIM interface assert metric\n")
1835 pim_show_assert_metric(vty
);
1840 DEFUN (show_ip_pim_assert_winner_metric
,
1841 show_ip_pim_assert_winner_metric_cmd
,
1842 "show ip pim assert-winner-metric",
1846 "PIM interface assert winner metric\n")
1848 pim_show_assert_winner_metric(vty
);
1853 DEFUN (show_ip_pim_dr
,
1855 "show ip pim designated-router",
1859 "PIM interface designated router\n")
1866 DEFUN (show_ip_pim_hello
,
1867 show_ip_pim_hello_cmd
,
1868 "show ip pim hello",
1872 "PIM interface hello information\n")
1874 pim_show_hello(vty
);
1879 DEFUN (show_ip_pim_interface
,
1880 show_ip_pim_interface_cmd
,
1881 "show ip pim interface",
1885 "PIM interface information\n")
1887 pim_show_interfaces(vty
);
1892 DEFUN (show_ip_pim_join
,
1893 show_ip_pim_join_cmd
,
1898 "PIM interface join information\n")
1905 DEFUN (show_ip_pim_lan_prune_delay
,
1906 show_ip_pim_lan_prune_delay_cmd
,
1907 "show ip pim lan-prune-delay",
1911 "PIM neighbors LAN prune delay parameters\n")
1913 pim_show_lan_prune_delay(vty
);
1918 DEFUN (show_ip_pim_local_membership
,
1919 show_ip_pim_local_membership_cmd
,
1920 "show ip pim local-membership",
1924 "PIM interface local-membership\n")
1926 pim_show_membership(vty
);
1931 DEFUN (show_ip_pim_jp_override_interval
,
1932 show_ip_pim_jp_override_interval_cmd
,
1933 "show ip pim jp-override-interval",
1937 "PIM interface J/P override interval\n")
1939 pim_show_jp_override_interval(vty
);
1944 DEFUN (show_ip_pim_neighbor
,
1945 show_ip_pim_neighbor_cmd
,
1946 "show ip pim neighbor",
1950 "PIM neighbor information\n")
1952 pim_show_neighbors(vty
);
1957 DEFUN (show_ip_pim_secondary
,
1958 show_ip_pim_secondary_cmd
,
1959 "show ip pim secondary",
1963 "PIM neighbor addresses\n")
1965 pim_show_neighbors_secondary(vty
);
1970 DEFUN (show_ip_pim_upstream
,
1971 show_ip_pim_upstream_cmd
,
1972 "show ip pim upstream",
1976 "PIM upstream information\n")
1978 pim_show_upstream(vty
);
1983 DEFUN (show_ip_pim_upstream_join_desired
,
1984 show_ip_pim_upstream_join_desired_cmd
,
1985 "show ip pim upstream-join-desired",
1989 "PIM upstream join-desired\n")
1991 pim_show_join_desired(vty
);
1996 DEFUN (show_ip_pim_upstream_rpf
,
1997 show_ip_pim_upstream_rpf_cmd
,
1998 "show ip pim upstream-rpf",
2002 "PIM upstream source rpf\n")
2004 pim_show_upstream_rpf(vty
);
2009 DEFUN (show_ip_pim_rp
,
2011 "show ip pim rp-info ",
2015 "PIM RP information\n")
2017 pim_rp_show_information (vty
);
2022 DEFUN (show_ip_pim_rpf
,
2023 show_ip_pim_rpf_cmd
,
2028 "PIM cached source rpf information\n")
2035 static void show_multicast_interfaces(struct vty
*vty
)
2037 struct listnode
*node
;
2038 struct interface
*ifp
;
2040 vty_out(vty
, "%s", VTY_NEWLINE
);
2042 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2045 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2046 struct pim_interface
*pim_ifp
;
2047 struct in_addr ifaddr
;
2048 struct sioc_vif_req vreq
;
2050 pim_ifp
= ifp
->info
;
2055 memset(&vreq
, 0, sizeof(vreq
));
2056 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2058 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2059 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2060 (unsigned long)SIOCGETVIFCNT
,
2062 pim_ifp
->mroute_vif_index
,
2064 safe_strerror(errno
),
2068 ifaddr
= pim_ifp
->primary_address
;
2070 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2074 pim_ifp
->mroute_vif_index
,
2075 (unsigned long) vreq
.icount
,
2076 (unsigned long) vreq
.ocount
,
2077 (unsigned long) vreq
.ibytes
,
2078 (unsigned long) vreq
.obytes
,
2083 DEFUN (show_ip_multicast
,
2084 show_ip_multicast_cmd
,
2085 "show ip multicast",
2088 "Multicast global information\n")
2090 time_t now
= pim_time_monotonic_sec();
2092 if (PIM_MROUTE_IS_ENABLED
) {
2095 vty_out(vty
, "Mroute socket descriptor: %d%s",
2096 qpim_mroute_socket_fd
,
2099 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
2100 vty_out(vty
, "Mroute socket uptime: %s%s",
2105 vty_out(vty
, "Multicast disabled%s",
2109 vty_out(vty
, "%s", VTY_NEWLINE
);
2110 vty_out(vty
, "Zclient update socket: ");
2111 if (qpim_zclient_update
) {
2112 vty_out(vty
, "%d failures=%d%s", qpim_zclient_update
->sock
,
2113 qpim_zclient_update
->fail
, VTY_NEWLINE
);
2116 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2119 pim_zlookup_show_ip_multicast (vty
);
2121 vty_out(vty
, "%s", VTY_NEWLINE
);
2122 vty_out(vty
, "Current highest VifIndex: %d%s",
2123 qpim_mroute_oif_highest_vif_index
,
2125 vty_out(vty
, "Maximum highest VifIndex: %d%s",
2126 PIM_MAX_USABLE_VIFS
,
2129 vty_out(vty
, "%s", VTY_NEWLINE
);
2130 vty_out(vty
, "Upstream Join Timer: %d secs%s",
2133 vty_out(vty
, "Join/Prune Holdtime: %d secs%s",
2137 vty_out(vty
, "%s", VTY_NEWLINE
);
2139 show_rpf_refresh_stats(vty
, now
);
2141 vty_out(vty
, "%s", VTY_NEWLINE
);
2143 show_scan_oil_stats(vty
, now
);
2145 show_multicast_interfaces(vty
);
2150 static void show_mroute(struct vty
*vty
)
2152 struct listnode
*node
;
2153 struct channel_oil
*c_oil
;
2154 struct static_route
*s_route
;
2157 vty_out(vty
, "Proto: I=IGMP P=PIM S=STATIC O=SOURCE%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
2159 vty_out(vty
, "Source Group Proto Input iVifI Output oVifI TTL Uptime %s",
2162 now
= pim_time_monotonic_sec();
2164 /* print list of PIM and IGMP routes */
2165 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2166 char group_str
[100];
2167 char source_str
[100];
2170 if (!c_oil
->installed
)
2173 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2174 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2176 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2177 struct interface
*ifp_in
;
2178 struct interface
*ifp_out
;
2179 char oif_uptime
[10];
2183 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
2187 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
2188 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2190 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
2193 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
2196 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
2199 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
2203 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2207 ifp_in
? ifp_in
->name
: "<iif?>",
2208 c_oil
->oil
.mfcc_parent
,
2209 ifp_out
? ifp_out
->name
: "<oif?>",
2217 /* Print list of static routes */
2218 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2219 char group_str
[100];
2220 char source_str
[100];
2223 if (!s_route
->c_oil
.installed
)
2226 pim_inet4_dump("<group?>", s_route
->group
, group_str
, sizeof(group_str
));
2227 pim_inet4_dump("<source?>", s_route
->source
, source_str
, sizeof(source_str
));
2229 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2230 struct interface
*ifp_in
;
2231 struct interface
*ifp_out
;
2232 char oif_uptime
[10];
2236 ttl
= s_route
->oif_ttls
[oif_vif_index
];
2240 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
2241 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2243 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
2248 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2252 ifp_in
? ifp_in
->name
: "<iif?>",
2254 ifp_out
? ifp_out
->name
: "<oif?>",
2263 DEFUN (show_ip_mroute
,
2274 static void show_mroute_count(struct vty
*vty
)
2276 struct listnode
*node
;
2277 struct channel_oil
*c_oil
;
2278 struct static_route
*s_route
;
2280 vty_out(vty
, "%s", VTY_NEWLINE
);
2282 vty_out(vty
, "Source Group Packets Bytes WrongIf %s",
2285 /* Print PIM and IGMP route counts */
2286 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2287 char group_str
[100];
2288 char source_str
[100];
2290 if (!c_oil
->installed
)
2293 pim_mroute_update_counters (c_oil
);
2295 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2296 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2298 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2307 /* Print static route counts */
2308 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2309 char group_str
[100];
2310 char source_str
[100];
2312 if (!s_route
->c_oil
.installed
)
2315 pim_mroute_update_counters (&s_route
->c_oil
);
2317 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2318 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2320 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2323 s_route
->c_oil
.cc
.pktcnt
,
2324 s_route
->c_oil
.cc
.bytecnt
,
2325 s_route
->c_oil
.cc
.wrong_if
,
2330 DEFUN (show_ip_mroute_count
,
2331 show_ip_mroute_count_cmd
,
2332 "show ip mroute count",
2336 "Route and packet count data\n")
2338 show_mroute_count(vty
);
2344 "show ip rib A.B.C.D",
2348 "Unicast address\n")
2351 struct in_addr addr
;
2352 const char *addr_str
;
2353 struct pim_nexthop nexthop
;
2354 char nexthop_addr_str
[100];
2357 addr_str
= argv
[idx_ipv4
]->arg
;
2358 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2360 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
2361 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2365 if (pim_nexthop_lookup(&nexthop
, addr
)) {
2366 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
2367 addr_str
, VTY_NEWLINE
);
2371 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
2374 pim_inet4_dump("<nexthop?>", nexthop
.mrib_nexthop_addr
,
2375 nexthop_addr_str
, sizeof(nexthop_addr_str
));
2377 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
2380 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2381 nexthop
.mrib_route_metric
,
2382 nexthop
.mrib_metric_preference
,
2388 static void show_ssmpingd(struct vty
*vty
)
2390 struct listnode
*node
;
2391 struct ssmpingd_sock
*ss
;
2394 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
2397 if (!qpim_ssmpingd_list
)
2400 now
= pim_time_monotonic_sec();
2402 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
2403 char source_str
[100];
2405 struct sockaddr_in bind_addr
;
2406 socklen_t len
= sizeof(bind_addr
);
2407 char bind_addr_str
[100];
2409 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
2411 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
2412 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
2413 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
2416 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
2417 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
2419 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
2423 ntohs(bind_addr
.sin_port
),
2425 (long long)ss
->requests
,
2430 DEFUN (show_ip_ssmpingd
,
2431 show_ip_ssmpingd_cmd
,
2442 pim_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
)
2445 result
= pim_rp_new (rp
, group
);
2449 vty_out (vty
, "%% Bad RP/group address specified: %s", rp
);
2455 vty_out (vty
, "%% No Path to RP address specified: %s", rp
);
2461 vty_out (vty
, "%% Group range specified cannot overlap");
2462 return CMD_ERR_NO_MATCH
;
2468 DEFUN (ip_pim_keep_alive
,
2469 ip_pim_keep_alive_cmd
,
2470 "ip pim keep-alive-timer <31-60000>",
2472 "pim multicast routing\n"
2476 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
2480 DEFUN (no_ip_pim_keep_alive
,
2481 no_ip_pim_keep_alive_cmd
,
2482 "no ip pim keep-alive-timer <31-60000>",
2485 "pim multicast routing\n"
2486 "Keep alive Timer\n"
2489 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
2493 DEFUN (ip_pim_rp_keep_alive
,
2494 ip_pim_rp_keep_alive_cmd
,
2495 "ip pim rp keep-alive-timer <31-60000>",
2497 "pim multicast routing\n"
2499 "Keep alive Timer\n"
2502 qpim_rp_keep_alive_time
= atoi (argv
[4]->arg
);
2506 DEFUN (no_ip_pim_rp_keep_alive
,
2507 no_ip_pim_rp_keep_alive_cmd
,
2508 "no ip pim rp keep-alive-timer <31-60000>",
2511 "pim multicast routing\n"
2513 "Keep alive Timer\n"
2516 qpim_rp_keep_alive_time
= PIM_RP_KEEPALIVE_PERIOD
;
2522 "ip pim rp A.B.C.D [A.B.C.D/M]",
2524 "pim multicast routing\n"
2526 "ip address of RP\n")
2529 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
);
2533 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
)
2535 int result
= pim_rp_del (rp
, group
);
2539 vty_out (vty
, "%% Unable to Decode specified RP");
2545 vty_out (vty
, "%% Unable to find specified RP");
2552 DEFUN (no_ip_pim_rp
,
2554 "no ip pim rp A.B.C.D [A.B.C.D/M]",
2557 "pim multicast routing\n"
2559 "ip address of RP\n")
2562 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
);
2565 DEFUN (ip_multicast_routing
,
2566 ip_multicast_routing_cmd
,
2567 "ip multicast-routing",
2569 "Enable IP multicast forwarding\n")
2571 pim_mroute_socket_enable();
2572 pim_if_add_vif_all();
2574 static_mroute_add_all();
2578 DEFUN (no_ip_multicast_routing
,
2579 no_ip_multicast_routing_cmd
,
2580 "no ip multicast-routing",
2583 "Global IP configuration subcommands\n"
2584 "Enable IP multicast forwarding\n")
2587 static_mroute_del_all();
2588 pim_if_del_vif_all();
2589 pim_mroute_socket_disable();
2595 "ip ssmpingd [A.B.C.D]",
2602 struct in_addr source_addr
;
2603 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2605 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2607 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2608 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2612 result
= pim_ssmpingd_start(source_addr
);
2614 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
2615 source_str
, result
, VTY_NEWLINE
);
2622 DEFUN (no_ip_ssmpingd
,
2624 "no ip ssmpingd [A.B.C.D]",
2632 struct in_addr source_addr
;
2633 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2635 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2637 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2638 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2642 result
= pim_ssmpingd_stop(source_addr
);
2644 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
2645 source_str
, result
, VTY_NEWLINE
);
2652 DEFUN (interface_ip_igmp
,
2653 interface_ip_igmp_cmd
,
2658 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2659 struct pim_interface
*pim_ifp
;
2661 pim_ifp
= ifp
->info
;
2664 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
2666 vty_out(vty
, "Could not enable IGMP on interface %s%s",
2667 ifp
->name
, VTY_NEWLINE
);
2672 PIM_IF_DO_IGMP(pim_ifp
->options
);
2675 pim_if_addr_add_all(ifp
);
2676 pim_if_membership_refresh(ifp
);
2681 DEFUN (interface_no_ip_igmp
,
2682 interface_no_ip_igmp_cmd
,
2688 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2689 struct pim_interface
*pim_ifp
;
2691 pim_ifp
= ifp
->info
;
2695 PIM_IF_DONT_IGMP(pim_ifp
->options
);
2697 pim_if_membership_clear(ifp
);
2699 pim_if_addr_del_all_igmp(ifp
);
2701 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
2708 DEFUN (interface_ip_igmp_join
,
2709 interface_ip_igmp_join_cmd
,
2710 "ip igmp join A.B.C.D A.B.C.D",
2713 "IGMP join multicast group\n"
2714 "Multicast group address\n"
2717 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2720 const char *group_str
;
2721 const char *source_str
;
2722 struct in_addr group_addr
;
2723 struct in_addr source_addr
;
2727 group_str
= argv
[idx_ipv4
]->arg
;
2728 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2730 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2731 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2735 /* Source address */
2736 source_str
= argv
[idx_ipv4_2
]->arg
;
2737 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2739 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2740 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2744 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
2746 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
2747 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2754 DEFUN (interface_no_ip_igmp_join
,
2755 interface_no_ip_igmp_join_cmd
,
2756 "no ip igmp join A.B.C.D A.B.C.D",
2760 "IGMP join multicast group\n"
2761 "Multicast group address\n"
2764 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2767 const char *group_str
;
2768 const char *source_str
;
2769 struct in_addr group_addr
;
2770 struct in_addr source_addr
;
2774 group_str
= argv
[idx_ipv4
]->arg
;
2775 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2777 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2778 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2782 /* Source address */
2783 source_str
= argv
[idx_ipv4_2
]->arg
;
2784 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2786 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2787 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2791 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
2793 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
2794 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2802 CLI reconfiguration affects the interface level (struct pim_interface).
2803 This function propagates the reconfiguration to every active socket
2806 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
2808 struct interface
*ifp
;
2809 struct pim_interface
*pim_ifp
;
2813 /* other querier present? */
2815 if (igmp
->t_other_querier_timer
)
2818 /* this is the querier */
2820 zassert(igmp
->interface
);
2821 zassert(igmp
->interface
->info
);
2823 ifp
= igmp
->interface
;
2824 pim_ifp
= ifp
->info
;
2826 if (PIM_DEBUG_IGMP_TRACE
) {
2827 char ifaddr_str
[100];
2828 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2829 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
2830 __PRETTY_FUNCTION__
,
2833 pim_ifp
->igmp_default_query_interval
);
2837 igmp_startup_mode_on() will reset QQI:
2839 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
2841 igmp_startup_mode_on(igmp
);
2844 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
2846 if (igmp
->t_igmp_query_timer
) {
2847 /* other querier present */
2848 zassert(igmp
->t_igmp_query_timer
);
2849 zassert(!igmp
->t_other_querier_timer
);
2851 pim_igmp_general_query_off(igmp
);
2852 pim_igmp_general_query_on(igmp
);
2854 zassert(igmp
->t_igmp_query_timer
);
2855 zassert(!igmp
->t_other_querier_timer
);
2858 /* this is the querier */
2860 zassert(!igmp
->t_igmp_query_timer
);
2861 zassert(igmp
->t_other_querier_timer
);
2863 pim_igmp_other_querier_timer_off(igmp
);
2864 pim_igmp_other_querier_timer_on(igmp
);
2866 zassert(!igmp
->t_igmp_query_timer
);
2867 zassert(igmp
->t_other_querier_timer
);
2871 static void change_query_interval(struct pim_interface
*pim_ifp
,
2874 struct listnode
*sock_node
;
2875 struct igmp_sock
*igmp
;
2877 pim_ifp
->igmp_default_query_interval
= query_interval
;
2879 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2880 igmp_sock_query_interval_reconfig(igmp
);
2881 igmp_sock_query_reschedule(igmp
);
2885 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
2886 int query_max_response_time_dsec
)
2888 struct listnode
*sock_node
;
2889 struct igmp_sock
*igmp
;
2891 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
2894 Below we modify socket/group/source timers in order to quickly
2895 reflect the change. Otherwise, those timers would eventually catch
2899 /* scan all sockets */
2900 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2901 struct listnode
*grp_node
;
2902 struct igmp_group
*grp
;
2904 /* reschedule socket general query */
2905 igmp_sock_query_reschedule(igmp
);
2907 /* scan socket groups */
2908 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
2909 struct listnode
*src_node
;
2910 struct igmp_source
*src
;
2912 /* reset group timers for groups in EXCLUDE mode */
2913 if (grp
->group_filtermode_isexcl
) {
2914 igmp_group_reset_gmi(grp
);
2917 /* scan group sources */
2918 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2920 /* reset source timers for sources with running timers */
2921 if (src
->t_source_timer
) {
2922 igmp_source_reset_gmi(igmp
, grp
, src
);
2929 #define IGMP_QUERY_INTERVAL_MIN (1)
2930 #define IGMP_QUERY_INTERVAL_MAX (1800)
2932 DEFUN (interface_ip_igmp_query_interval
,
2933 interface_ip_igmp_query_interval_cmd
,
2934 "ip igmp query-interval (1-1800)",
2937 IFACE_IGMP_QUERY_INTERVAL_STR
2938 "Query interval in seconds\n")
2940 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2941 struct pim_interface
*pim_ifp
;
2943 int query_interval_dsec
;
2945 pim_ifp
= ifp
->info
;
2949 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2955 query_interval
= atoi(argv
[4]->arg
);
2956 query_interval_dsec
= 10 * query_interval
;
2959 It seems we don't need to check bounds since command.c does it
2960 already, but we verify them anyway for extra safety.
2962 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
2963 vty_out(vty
, "General query interval %d lower than minimum %d%s",
2965 IGMP_QUERY_INTERVAL_MIN
,
2969 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
2970 vty_out(vty
, "General query interval %d higher than maximum %d%s",
2972 IGMP_QUERY_INTERVAL_MAX
,
2977 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2979 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
2980 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2985 change_query_interval(pim_ifp
, query_interval
);
2990 DEFUN (interface_no_ip_igmp_query_interval
,
2991 interface_no_ip_igmp_query_interval_cmd
,
2992 "no ip igmp query-interval",
2996 IFACE_IGMP_QUERY_INTERVAL_STR
)
2998 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2999 struct pim_interface
*pim_ifp
;
3000 int default_query_interval_dsec
;
3002 pim_ifp
= ifp
->info
;
3007 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
3009 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
3011 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
3012 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
3017 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
3022 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN (1)
3023 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX (25)
3025 DEFUN (interface_ip_igmp_query_max_response_time
,
3026 interface_ip_igmp_query_max_response_time_cmd
,
3027 "ip igmp query-max-response-time (1-25)",
3030 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3031 "Query response value in seconds\n")
3033 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3034 struct pim_interface
*pim_ifp
;
3035 int query_max_response_time
;
3037 pim_ifp
= ifp
->info
;
3041 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3047 query_max_response_time
= atoi(argv
[4]->arg
);
3050 It seems we don't need to check bounds since command.c does it
3051 already, but we verify them anyway for extra safety.
3053 if (query_max_response_time
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN
) {
3054 vty_out(vty
, "Query max response time %d sec lower than minimum %d sec%s",
3055 query_max_response_time
,
3056 IGMP_QUERY_MAX_RESPONSE_TIME_MIN
,
3060 if (query_max_response_time
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX
) {
3061 vty_out(vty
, "Query max response time %d sec higher than maximum %d sec%s",
3062 query_max_response_time
,
3063 IGMP_QUERY_MAX_RESPONSE_TIME_MAX
,
3068 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
) {
3070 "Can't set query max response time %d sec >= general query interval %d sec%s",
3071 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
3076 change_query_max_response_time(pim_ifp
, 10 * query_max_response_time
);
3081 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3082 interface_no_ip_igmp_query_max_response_time_cmd
,
3083 "no ip igmp query-max-response-time",
3087 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
)
3089 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3090 struct pim_interface
*pim_ifp
;
3091 int default_query_interval_dsec
;
3093 pim_ifp
= ifp
->info
;
3098 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3100 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3102 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3103 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3108 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3113 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
3114 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
3116 DEFUN (interface_ip_igmp_query_max_response_time_dsec
,
3117 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3118 "ip igmp query-max-response-time-dsec (10-250)",
3121 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3122 "Query response value in deciseconds\n")
3124 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3125 struct pim_interface
*pim_ifp
;
3126 int query_max_response_time_dsec
;
3127 int default_query_interval_dsec
;
3129 pim_ifp
= ifp
->info
;
3133 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3139 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
3142 It seems we don't need to check bounds since command.c does it
3143 already, but we verify them anyway for extra safety.
3145 if (query_max_response_time_dsec
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
) {
3146 vty_out(vty
, "Query max response time %d dsec lower than minimum %d dsec%s",
3147 query_max_response_time_dsec
,
3148 IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
,
3152 if (query_max_response_time_dsec
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
) {
3153 vty_out(vty
, "Query max response time %d dsec higher than maximum %d dsec%s",
3154 query_max_response_time_dsec
,
3155 IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
,
3160 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3162 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
3164 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
3165 query_max_response_time_dsec
, default_query_interval_dsec
,
3170 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
3175 DEFUN (interface_no_ip_igmp_query_max_response_time_dsec
,
3176 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3177 "no ip igmp query-max-response-time-dsec",
3181 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
3183 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3184 struct pim_interface
*pim_ifp
;
3185 int default_query_interval_dsec
;
3187 pim_ifp
= ifp
->info
;
3192 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3194 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3196 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3197 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3202 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3207 DEFUN (interface_ip_pim_drprio
,
3208 interface_ip_pim_drprio_cmd
,
3209 "ip pim drpriority (1-4294967295)",
3212 "Set the Designated Router Election Priority\n"
3213 "Value of the new DR Priority\n")
3215 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3217 struct pim_interface
*pim_ifp
;
3218 uint32_t old_dr_prio
;
3220 pim_ifp
= ifp
->info
;
3223 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
3227 old_dr_prio
= pim_ifp
->pim_dr_priority
;
3229 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
3231 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
3232 if (pim_if_dr_election(ifp
))
3233 pim_hello_restart_now(ifp
);
3239 DEFUN (interface_no_ip_pim_drprio
,
3240 interface_no_ip_pim_drprio_cmd
,
3241 "no ip pim drpriority [(1-4294967295)]",
3245 "Revert the Designated Router Priority to default\n"
3246 "Old Value of the Priority\n")
3248 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3249 struct pim_interface
*pim_ifp
;
3251 pim_ifp
= ifp
->info
;
3254 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3258 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
3259 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
3260 if (pim_if_dr_election(ifp
))
3261 pim_hello_restart_now(ifp
);
3268 pim_cmd_interface_add (struct interface
*ifp
, enum pim_interface_type itype
)
3270 struct pim_interface
*pim_ifp
= ifp
->info
;
3271 struct in_addr null
= { .s_addr
= 0 };
3274 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
3280 PIM_IF_DO_PIM(pim_ifp
->options
);
3283 pim_ifp
->itype
= itype
;
3284 pim_if_addr_add_all(ifp
);
3285 pim_if_membership_refresh(ifp
);
3287 pim_rp_check_rp (null
, pim_ifp
->primary_address
);
3292 DEFUN (interface_ip_pim_ssm
,
3293 interface_ip_pim_ssm_cmd
,
3299 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3301 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SSM
)) {
3302 vty_out(vty
, "Could not enable PIM SSM on interface%s", VTY_NEWLINE
);
3309 DEFUN (interface_ip_pim_sm
,
3310 interface_ip_pim_sm_cmd
,
3316 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3317 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SM
)) {
3318 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
3322 pim_if_create_pimreg();
3328 pim_cmd_interface_delete (struct interface
*ifp
)
3330 struct pim_interface
*pim_ifp
= ifp
->info
;
3335 PIM_IF_DONT_PIM(pim_ifp
->options
);
3337 pim_if_membership_clear(ifp
);
3340 pim_if_addr_del_all() removes all sockets from
3341 pim_ifp->igmp_socket_list.
3343 pim_if_addr_del_all(ifp
);
3346 pim_sock_delete() removes all neighbors from
3347 pim_ifp->pim_neighbor_list.
3349 pim_sock_delete(ifp
, "pim unconfigured on interface");
3351 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
3358 DEFUN (interface_no_ip_pim_ssm
,
3359 interface_no_ip_pim_ssm_cmd
,
3366 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3367 if (!pim_cmd_interface_delete(ifp
)) {
3368 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3375 DEFUN (interface_no_ip_pim_sm
,
3376 interface_no_ip_pim_sm_cmd
,
3383 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3384 if (!pim_cmd_interface_delete(ifp
)) {
3385 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3392 DEFUN (interface_ip_mroute
,
3393 interface_ip_mroute_cmd
,
3394 "ip mroute INTERFACE A.B.C.D",
3396 "Add multicast route\n"
3397 "Outgoing interface name\n"
3400 VTY_DECLVAR_CONTEXT(interface
, iif
);
3401 int idx_interface
= 2;
3403 struct interface
*oif
;
3404 const char *oifname
;
3405 const char *grp_str
;
3406 struct in_addr grp_addr
;
3407 struct in_addr src_addr
;
3410 oifname
= argv
[idx_interface
]->arg
;
3411 oif
= if_lookup_by_name(oifname
);
3413 vty_out(vty
, "No such interface name %s%s",
3414 oifname
, VTY_NEWLINE
);
3418 grp_str
= argv
[idx_ipv4
]->arg
;
3419 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3421 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3422 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3426 src_addr
.s_addr
= INADDR_ANY
;
3428 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3429 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3436 DEFUN (interface_ip_mroute_source
,
3437 interface_ip_mroute_source_cmd
,
3438 "ip mroute INTERFACE A.B.C.D A.B.C.D",
3440 "Add multicast route\n"
3441 "Outgoing interface name\n"
3445 VTY_DECLVAR_CONTEXT(interface
, iif
);
3446 int idx_interface
= 2;
3449 struct interface
*oif
;
3450 const char *oifname
;
3451 const char *grp_str
;
3452 struct in_addr grp_addr
;
3453 const char *src_str
;
3454 struct in_addr src_addr
;
3457 oifname
= argv
[idx_interface
]->arg
;
3458 oif
= if_lookup_by_name(oifname
);
3460 vty_out(vty
, "No such interface name %s%s",
3461 oifname
, VTY_NEWLINE
);
3465 grp_str
= argv
[idx_ipv4
]->arg
;
3466 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3468 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3469 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3473 src_str
= argv
[idx_ipv4_2
]->arg
;
3474 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3476 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3477 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3481 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3482 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3489 DEFUN (interface_no_ip_mroute
,
3490 interface_no_ip_mroute_cmd
,
3491 "no ip mroute INTERFACE A.B.C.D",
3494 "Add multicast route\n"
3495 "Outgoing interface name\n"
3498 VTY_DECLVAR_CONTEXT(interface
, iif
);
3499 int idx_interface
= 3;
3501 struct interface
*oif
;
3502 const char *oifname
;
3503 const char *grp_str
;
3504 struct in_addr grp_addr
;
3505 struct in_addr src_addr
;
3508 oifname
= argv
[idx_interface
]->arg
;
3509 oif
= if_lookup_by_name(oifname
);
3511 vty_out(vty
, "No such interface name %s%s",
3512 oifname
, VTY_NEWLINE
);
3516 grp_str
= argv
[idx_ipv4
]->arg
;
3517 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3519 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3520 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3524 src_addr
.s_addr
= INADDR_ANY
;
3526 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3527 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3534 DEFUN (interface_no_ip_mroute_source
,
3535 interface_no_ip_mroute_source_cmd
,
3536 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
3539 "Add multicast route\n"
3540 "Outgoing interface name\n"
3544 VTY_DECLVAR_CONTEXT(interface
, iif
);
3545 int idx_interface
= 3;
3548 struct interface
*oif
;
3549 const char *oifname
;
3550 const char *grp_str
;
3551 struct in_addr grp_addr
;
3552 const char *src_str
;
3553 struct in_addr src_addr
;
3556 oifname
= argv
[idx_interface
]->arg
;
3557 oif
= if_lookup_by_name(oifname
);
3559 vty_out(vty
, "No such interface name %s%s",
3560 oifname
, VTY_NEWLINE
);
3564 grp_str
= argv
[idx_ipv4
]->arg
;
3565 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3567 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3568 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3572 src_str
= argv
[idx_ipv4_2
]->arg
;
3573 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3575 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3576 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3580 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3581 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3588 DEFUN (interface_ip_pim_hello
,
3589 interface_ip_pim_hello_cmd
,
3590 "ip pim hello (1-180) [(1-180)]",
3594 IFACE_PIM_HELLO_TIME_STR
3595 IFACE_PIM_HELLO_HOLD_STR
)
3597 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3600 struct pim_interface
*pim_ifp
;
3602 pim_ifp
= ifp
->info
;
3605 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3609 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
3611 if (argc
> idx_hold
)
3612 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
3619 DEFUN (interface_no_ip_pim_hello
,
3620 interface_no_ip_pim_hello_cmd
,
3621 "no ip pim hello [(1-180) (1-180)]",
3626 IFACE_PIM_HELLO_TIME_STR
3627 IFACE_PIM_HELLO_HOLD_STR
)
3629 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3630 struct pim_interface
*pim_ifp
;
3632 pim_ifp
= ifp
->info
;
3635 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3639 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
3640 pim_ifp
->pim_default_holdtime
= -1;
3651 PIM_DO_DEBUG_IGMP_EVENTS
;
3652 PIM_DO_DEBUG_IGMP_PACKETS
;
3653 PIM_DO_DEBUG_IGMP_TRACE
;
3657 DEFUN (no_debug_igmp
,
3664 PIM_DONT_DEBUG_IGMP_EVENTS
;
3665 PIM_DONT_DEBUG_IGMP_PACKETS
;
3666 PIM_DONT_DEBUG_IGMP_TRACE
;
3671 DEFUN (debug_igmp_events
,
3672 debug_igmp_events_cmd
,
3673 "debug igmp events",
3676 DEBUG_IGMP_EVENTS_STR
)
3678 PIM_DO_DEBUG_IGMP_EVENTS
;
3682 DEFUN (no_debug_igmp_events
,
3683 no_debug_igmp_events_cmd
,
3684 "no debug igmp events",
3688 DEBUG_IGMP_EVENTS_STR
)
3690 PIM_DONT_DEBUG_IGMP_EVENTS
;
3695 DEFUN (debug_igmp_packets
,
3696 debug_igmp_packets_cmd
,
3697 "debug igmp packets",
3700 DEBUG_IGMP_PACKETS_STR
)
3702 PIM_DO_DEBUG_IGMP_PACKETS
;
3706 DEFUN (no_debug_igmp_packets
,
3707 no_debug_igmp_packets_cmd
,
3708 "no debug igmp packets",
3712 DEBUG_IGMP_PACKETS_STR
)
3714 PIM_DONT_DEBUG_IGMP_PACKETS
;
3719 DEFUN (debug_igmp_trace
,
3720 debug_igmp_trace_cmd
,
3724 DEBUG_IGMP_TRACE_STR
)
3726 PIM_DO_DEBUG_IGMP_TRACE
;
3730 DEFUN (no_debug_igmp_trace
,
3731 no_debug_igmp_trace_cmd
,
3732 "no debug igmp trace",
3736 DEBUG_IGMP_TRACE_STR
)
3738 PIM_DONT_DEBUG_IGMP_TRACE
;
3743 DEFUN (debug_mroute
,
3749 PIM_DO_DEBUG_MROUTE
;
3753 DEFUN (debug_mroute_detail
,
3754 debug_mroute_detail_cmd
,
3755 "debug mroute detail",
3760 PIM_DO_DEBUG_MROUTE_DETAIL
;
3764 DEFUN (no_debug_mroute
,
3765 no_debug_mroute_cmd
,
3771 PIM_DONT_DEBUG_MROUTE
;
3775 DEFUN (no_debug_mroute_detail
,
3776 no_debug_mroute_detail_cmd
,
3777 "no debug mroute detail",
3783 PIM_DONT_DEBUG_MROUTE_DETAIL
;
3787 DEFUN (debug_static
,
3793 PIM_DO_DEBUG_STATIC
;
3797 DEFUN (no_debug_static
,
3798 no_debug_static_cmd
,
3804 PIM_DONT_DEBUG_STATIC
;
3815 PIM_DO_DEBUG_PIM_EVENTS
;
3816 PIM_DO_DEBUG_PIM_PACKETS
;
3817 PIM_DO_DEBUG_PIM_TRACE
;
3821 DEFUN (no_debug_pim
,
3828 PIM_DONT_DEBUG_PIM_EVENTS
;
3829 PIM_DONT_DEBUG_PIM_PACKETS
;
3830 PIM_DONT_DEBUG_PIM_TRACE
;
3832 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3833 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3839 DEFUN (debug_pim_events
,
3840 debug_pim_events_cmd
,
3844 DEBUG_PIM_EVENTS_STR
)
3846 PIM_DO_DEBUG_PIM_EVENTS
;
3850 DEFUN (no_debug_pim_events
,
3851 no_debug_pim_events_cmd
,
3852 "no debug pim events",
3856 DEBUG_PIM_EVENTS_STR
)
3858 PIM_DONT_DEBUG_PIM_EVENTS
;
3863 DEFUN (debug_pim_packets
,
3864 debug_pim_packets_cmd
,
3865 "debug pim packets",
3868 DEBUG_PIM_PACKETS_STR
)
3870 PIM_DO_DEBUG_PIM_PACKETS
;
3871 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
3875 DEFUN (debug_pim_packets_filter
,
3876 debug_pim_packets_filter_cmd
,
3877 "debug pim packets <hello|joins|register>",
3880 DEBUG_PIM_PACKETS_STR
3881 DEBUG_PIM_HELLO_PACKETS_STR
3882 DEBUG_PIM_J_P_PACKETS_STR
3883 DEBUG_PIM_PIM_REG_PACKETS_STR
)
3885 int idx_hello_join
= 3;
3886 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3888 PIM_DO_DEBUG_PIM_HELLO
;
3889 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
3891 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3893 PIM_DO_DEBUG_PIM_J_P
;
3894 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
3896 else if (strncmp(argv
[idx_hello_join
]->arg
,"r",1) == 0)
3898 PIM_DO_DEBUG_PIM_REG
;
3899 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
3904 DEFUN (no_debug_pim_packets
,
3905 no_debug_pim_packets_cmd
,
3906 "no debug pim packets",
3910 DEBUG_PIM_PACKETS_STR
3911 DEBUG_PIM_HELLO_PACKETS_STR
3912 DEBUG_PIM_J_P_PACKETS_STR
)
3914 PIM_DONT_DEBUG_PIM_PACKETS
;
3915 vty_out (vty
, "PIM Packet debugging is off %s", VTY_NEWLINE
);
3919 DEFUN (no_debug_pim_packets_filter
,
3920 no_debug_pim_packets_filter_cmd
,
3921 "no debug pim packets <hello|joins|register>",
3925 DEBUG_PIM_PACKETS_STR
3926 DEBUG_PIM_HELLO_PACKETS_STR
3927 DEBUG_PIM_J_P_PACKETS_STR
)
3929 int idx_hello_join
= 4;
3930 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3932 PIM_DONT_DEBUG_PIM_HELLO
;
3933 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
3935 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3937 PIM_DONT_DEBUG_PIM_J_P
;
3938 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
3940 else if (strncmp (argv
[idx_hello_join
]->arg
, "r", 1) == 0)
3942 PIM_DONT_DEBUG_PIM_REG
;
3943 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
3949 DEFUN (debug_pim_packetdump_send
,
3950 debug_pim_packetdump_send_cmd
,
3951 "debug pim packet-dump send",
3954 DEBUG_PIM_PACKETDUMP_STR
3955 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3957 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
3961 DEFUN (no_debug_pim_packetdump_send
,
3962 no_debug_pim_packetdump_send_cmd
,
3963 "no debug pim packet-dump send",
3967 DEBUG_PIM_PACKETDUMP_STR
3968 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3970 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3975 DEFUN (debug_pim_packetdump_recv
,
3976 debug_pim_packetdump_recv_cmd
,
3977 "debug pim packet-dump receive",
3980 DEBUG_PIM_PACKETDUMP_STR
3981 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3983 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
3987 DEFUN (no_debug_pim_packetdump_recv
,
3988 no_debug_pim_packetdump_recv_cmd
,
3989 "no debug pim packet-dump receive",
3993 DEBUG_PIM_PACKETDUMP_STR
3994 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3996 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4001 DEFUN (debug_pim_trace
,
4002 debug_pim_trace_cmd
,
4006 DEBUG_PIM_TRACE_STR
)
4008 PIM_DO_DEBUG_PIM_TRACE
;
4012 DEFUN (no_debug_pim_trace
,
4013 no_debug_pim_trace_cmd
,
4014 "no debug pim trace",
4018 DEBUG_PIM_TRACE_STR
)
4020 PIM_DONT_DEBUG_PIM_TRACE
;
4025 DEFUN (debug_ssmpingd
,
4032 PIM_DO_DEBUG_SSMPINGD
;
4036 DEFUN (no_debug_ssmpingd
,
4037 no_debug_ssmpingd_cmd
,
4038 "no debug ssmpingd",
4044 PIM_DONT_DEBUG_SSMPINGD
;
4049 DEFUN (debug_pim_zebra
,
4050 debug_pim_zebra_cmd
,
4054 DEBUG_PIM_ZEBRA_STR
)
4060 DEFUN (no_debug_pim_zebra
,
4061 no_debug_pim_zebra_cmd
,
4062 "no debug pim zebra",
4066 DEBUG_PIM_ZEBRA_STR
)
4068 PIM_DONT_DEBUG_ZEBRA
;
4073 DEFUN (show_debugging_pim
,
4074 show_debugging_pim_cmd
,
4075 "show debugging pim",
4080 pim_debug_config_write(vty
);
4084 static struct igmp_sock
*find_igmp_sock_by_fd(int fd
)
4086 struct listnode
*ifnode
;
4087 struct interface
*ifp
;
4089 /* scan all interfaces */
4090 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
4091 struct pim_interface
*pim_ifp
;
4092 struct igmp_sock
*igmp
;
4097 pim_ifp
= ifp
->info
;
4099 /* lookup igmp socket under current interface */
4100 igmp
= igmp_sock_lookup_by_fd(pim_ifp
->igmp_socket_list
, fd
);
4108 DEFUN (test_igmp_receive_report
,
4109 test_igmp_receive_report_cmd
,
4110 "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...",
4112 "Test IGMP protocol\n"
4113 "Test IGMP message\n"
4114 "Test IGMP report\n"
4116 "IGMP group address\n"
4122 int idx_number_2
= 6;
4127 size_t ip_hlen
; /* ip header length in bytes */
4132 const char *grp_str
;
4133 struct in_addr grp_addr
;
4134 const char *record_type_str
;
4136 const char *src_str
;
4138 struct igmp_sock
*igmp
;
4141 struct in_addr
*sources
;
4142 struct in_addr
*src_addr
;
4145 socket
= argv
[idx_number
]->arg
;
4146 socket_fd
= atoi(socket
);
4147 igmp
= find_igmp_sock_by_fd(socket_fd
);
4149 vty_out(vty
, "Could not find IGMP socket %s: fd=%d%s",
4150 socket
, socket_fd
, VTY_NEWLINE
);
4154 grp_str
= argv
[idx_ipv4
]->arg
;
4155 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4157 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4158 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4162 record_type_str
= argv
[idx_number_2
]->arg
;
4163 record_type
= atoi(record_type_str
);
4168 ip_hdr
= (struct ip
*) buf
;
4169 ip_hdr
->ip_p
= PIM_IP_PROTO_IGMP
;
4170 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4171 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4172 ip_hdr
->ip_src
= igmp
->ifaddr
;
4173 ip_hdr
->ip_dst
= igmp
->ifaddr
;
4176 Build IGMP v3 report message
4178 igmp_msg
= buf
+ ip_hlen
;
4179 group_record
= igmp_msg
+ IGMP_V3_REPORT_GROUPPRECORD_OFFSET
;
4180 *igmp_msg
= PIM_IGMP_V3_MEMBERSHIP_REPORT
; /* type */
4181 *(uint16_t *) (igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = 0; /* for computing checksum */
4182 *(uint16_t *) (igmp_msg
+ IGMP_V3_REPORT_NUMGROUPS_OFFSET
) = htons(1); /* one group record */
4183 *(uint8_t *) (group_record
+ IGMP_V3_GROUP_RECORD_TYPE_OFFSET
) = record_type
;
4184 memcpy(group_record
+ IGMP_V3_GROUP_RECORD_GROUP_OFFSET
, &grp_addr
, sizeof(struct in_addr
));
4186 /* Scan LINE sources */
4187 sources
= (struct in_addr
*) (group_record
+ IGMP_V3_GROUP_RECORD_SOURCE_OFFSET
);
4189 for (argi
= idx_line
; argi
< argc
; ++argi
,++src_addr
) {
4190 src_str
= argv
[argi
]->arg
;
4191 result
= inet_pton(AF_INET
, src_str
, src_addr
);
4193 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4194 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4198 num_sources
= src_addr
- sources
;
4200 *(uint16_t *)(group_record
+ IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET
) = htons(num_sources
);
4202 igmp_msg_len
= IGMP_V3_MSG_MIN_SIZE
+ (num_sources
<< 4); /* v3 report for one single group record */
4204 /* compute checksum */
4205 *(uint16_t *)(igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = in_cksum(igmp_msg
, igmp_msg_len
);
4207 /* "receive" message */
4209 ip_msg_len
= ip_hlen
+ igmp_msg_len
;
4210 result
= pim_igmp_packet(igmp
, buf
, ip_msg_len
);
4212 vty_out(vty
, "pim_igmp_packet(len=%d) returned: %d%s",
4213 ip_msg_len
, result
, VTY_NEWLINE
);
4220 static int hexval(uint8_t ch
)
4222 return isdigit(ch
) ? (ch
- '0') : (10 + tolower(ch
) - 'a');
4225 DEFUN (test_pim_receive_dump
,
4226 test_pim_receive_dump_cmd
,
4227 "test pim receive dump INTERFACE A.B.C.D LINE...",
4229 "Test PIM protocol\n"
4230 "Test PIM message reception\n"
4231 "Test PIM packet dump reception from neighbor\n"
4233 "Neighbor address\n"
4236 int idx_interface
= 4;
4242 size_t ip_hlen
; /* ip header length in bytes */
4245 const char *neigh_str
;
4246 struct in_addr neigh_addr
;
4248 struct interface
*ifp
;
4252 /* Find interface */
4253 ifname
= argv
[idx_interface
]->arg
;
4254 ifp
= if_lookup_by_name(ifname
);
4256 vty_out(vty
, "No such interface name %s%s",
4257 ifname
, VTY_NEWLINE
);
4261 /* Neighbor address */
4262 neigh_str
= argv
[idx_ipv4
]->arg
;
4263 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4265 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4266 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4273 ip_hdr
= (struct ip
*) buf
;
4274 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4275 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4276 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4277 ip_hdr
->ip_src
= neigh_addr
;
4278 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4281 Build PIM hello message
4283 pim_msg
= buf
+ ip_hlen
;
4286 /* Scan LINE dump into buffer */
4287 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4288 const char *str
= argv
[argi
]->arg
;
4289 int str_len
= strlen(str
);
4290 int str_last
= str_len
- 1;
4294 vty_out(vty
, "%% Uneven hex array arg %d=%s%s",
4295 argi
, str
, VTY_NEWLINE
);
4299 for (i
= 0; i
< str_last
; i
+= 2) {
4302 uint8_t h1
= str
[i
];
4303 uint8_t h2
= str
[i
+ 1];
4305 if (!isxdigit(h1
) || !isxdigit(h2
)) {
4306 vty_out(vty
, "%% Non-hex octet %c%c at hex array arg %d=%s%s",
4307 h1
, h2
, argi
, str
, VTY_NEWLINE
);
4310 octet
= (hexval(h1
) << 4) + hexval(h2
);
4312 left
= sizeof(buf
) - ip_hlen
- pim_msg_size
;
4314 vty_out(vty
, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s",
4315 sizeof(buf
), left
, argi
, str
, octet
, VTY_NEWLINE
);
4319 pim_msg
[pim_msg_size
++] = octet
;
4323 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4325 vty_out(vty
, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s",
4326 sizeof(buf
), ip_msg_len
, pim_msg_size
, VTY_NEWLINE
);
4328 /* "receive" message */
4330 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4332 vty_out(vty
, "%% pim_pim_packet(len=%d) returned failure: %d%s",
4333 ip_msg_len
, result
, VTY_NEWLINE
);
4340 DEFUN (test_pim_receive_hello
,
4341 test_pim_receive_hello_cmd
,
4342 "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]",
4344 "Test PIM protocol\n"
4345 "Test PIM message reception\n"
4346 "Test PIM hello reception from neighbor\n"
4348 "Neighbor address\n"
4349 "Neighbor holdtime\n"
4350 "Neighbor DR priority\n"
4351 "Neighbor generation ID\n"
4352 "Neighbor propagation delay (msec)\n"
4353 "Neighbor override interval (msec)\n"
4354 "Neighbor LAN prune delay T-bit\n"
4355 "Neighbor secondary addresses\n")
4357 int idx_interface
= 4;
4360 int idx_number_2
= 7;
4361 int idx_number_3
= 8;
4362 int idx_number_4
= 9;
4363 int idx_number_5
= 10;
4364 int idx_number_6
= 11;
4369 size_t ip_hlen
; /* ip header length in bytes */
4373 const char *neigh_str
;
4374 struct in_addr neigh_addr
;
4376 struct interface
*ifp
;
4377 uint16_t neigh_holdtime
;
4378 uint16_t neigh_propagation_delay
;
4379 uint16_t neigh_override_interval
;
4380 int neigh_can_disable_join_suppression
;
4381 uint32_t neigh_dr_priority
;
4382 uint32_t neigh_generation_id
;
4386 /* Find interface */
4387 ifname
= argv
[idx_interface
]->arg
;
4388 ifp
= if_lookup_by_name(ifname
);
4390 vty_out(vty
, "No such interface name %s%s",
4391 ifname
, VTY_NEWLINE
);
4395 /* Neighbor address */
4396 neigh_str
= argv
[idx_ipv4
]->arg
;
4397 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4399 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4400 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4404 neigh_holdtime
= atoi(argv
[idx_number
]->arg
);
4405 neigh_dr_priority
= atoi(argv
[idx_number_2
]->arg
);
4406 neigh_generation_id
= atoi(argv
[idx_number_3
]->arg
);
4407 neigh_propagation_delay
= atoi(argv
[idx_number_4
]->arg
);
4408 neigh_override_interval
= atoi(argv
[idx_number_5
]->arg
);
4409 neigh_can_disable_join_suppression
= atoi(argv
[idx_number_6
]->arg
);
4414 ip_hdr
= (struct ip
*) buf
;
4415 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4416 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4417 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4418 ip_hdr
->ip_src
= neigh_addr
;
4419 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4422 Build PIM hello message
4424 pim_msg
= buf
+ ip_hlen
;
4426 /* Scan LINE addresses */
4427 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4428 const char *sec_str
= argv
[argi
]->arg
;
4429 struct in_addr sec_addr
;
4430 result
= inet_pton(AF_INET
, sec_str
, &sec_addr
);
4432 vty_out(vty
, "Bad neighbor secondary address %s: errno=%d: %s%s",
4433 sec_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4438 "FIXME WRITEME consider neighbor secondary address %s%s",
4439 sec_str
, VTY_NEWLINE
);
4442 pim_tlv_size
= pim_hello_build_tlv(ifp
->name
,
4443 pim_msg
+ PIM_PIM_MIN_LEN
,
4444 sizeof(buf
) - ip_hlen
- PIM_PIM_MIN_LEN
,
4447 neigh_generation_id
,
4448 neigh_propagation_delay
,
4449 neigh_override_interval
,
4450 neigh_can_disable_join_suppression
,
4451 0 /* FIXME secondary address list */);
4452 if (pim_tlv_size
< 0) {
4453 vty_out(vty
, "pim_hello_build_tlv() returned failure: %d%s",
4454 pim_tlv_size
, VTY_NEWLINE
);
4458 pim_msg_size
= pim_tlv_size
+ PIM_PIM_MIN_LEN
;
4460 pim_msg_build_header(pim_msg
, pim_msg_size
,
4461 PIM_MSG_TYPE_HELLO
);
4463 /* "receive" message */
4465 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4466 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4468 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4469 ip_msg_len
, result
, VTY_NEWLINE
);
4476 DEFUN (test_pim_receive_assert
,
4477 test_pim_receive_assert_cmd
,
4478 "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)",
4480 "Test PIM protocol\n"
4481 "Test PIM message reception\n"
4482 "Test reception of PIM assert\n"
4484 "Neighbor address\n"
4485 "Assert multicast group address\n"
4486 "Assert unicast source address\n"
4487 "Assert metric preference\n"
4488 "Assert route metric\n"
4489 "Assert RPT bit flag\n")
4491 int idx_interface
= 4;
4496 int idx_number_2
= 9;
4497 int idx_number_3
= 10;
4499 uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4502 size_t ip_hlen
; /* ip header length in bytes */
4505 const char *neigh_str
;
4506 struct in_addr neigh_addr
;
4507 const char *group_str
;
4508 struct in_addr group_addr
;
4509 const char *source_str
;
4510 struct in_addr source_addr
;
4512 struct interface
*ifp
;
4513 uint32_t assert_metric_preference
;
4514 uint32_t assert_route_metric
;
4515 uint32_t assert_rpt_bit_flag
;
4519 /* Find interface */
4520 ifname
= argv
[idx_interface
]->arg
;
4521 ifp
= if_lookup_by_name(ifname
);
4523 vty_out(vty
, "No such interface name %s%s",
4524 ifname
, VTY_NEWLINE
);
4528 /* Neighbor address */
4529 neigh_str
= argv
[idx_ipv4
]->arg
;
4530 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4532 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4533 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4538 group_str
= argv
[idx_ipv4_2
]->arg
;
4539 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4541 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4542 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4546 /* Source address */
4547 source_str
= argv
[idx_ipv4_3
]->arg
;
4548 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4550 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4551 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4555 assert_metric_preference
= atoi(argv
[idx_number
]->arg
);
4556 assert_route_metric
= atoi(argv
[idx_number_2
]->arg
);
4557 assert_rpt_bit_flag
= atoi(argv
[idx_number_3
]->arg
);
4559 remain
= buf_pastend
- buf
;
4560 if (remain
< (int) sizeof(struct ip
)) {
4561 vty_out(vty
, "No room for ip header: buf_size=%d < ip_header_size=%zu%s",
4562 remain
, sizeof(struct ip
), VTY_NEWLINE
);
4569 ip_hdr
= (struct ip
*) buf
;
4570 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4571 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4572 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4573 ip_hdr
->ip_src
= neigh_addr
;
4574 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4577 Build PIM assert message
4579 pim_msg
= buf
+ ip_hlen
; /* skip ip header */
4581 pim_msg_size
= pim_assert_build_msg(pim_msg
, buf_pastend
- pim_msg
, ifp
,
4582 group_addr
, source_addr
,
4583 assert_metric_preference
,
4584 assert_route_metric
,
4585 assert_rpt_bit_flag
);
4586 if (pim_msg_size
< 0) {
4587 vty_out(vty
, "Failure building PIM assert message: size=%d%s",
4588 pim_msg_size
, VTY_NEWLINE
);
4592 /* "receive" message */
4594 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4595 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4597 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4598 ip_msg_len
, result
, VTY_NEWLINE
);
4605 static int recv_joinprune(struct vty
*vty
,
4606 struct cmd_token
**argv
,
4610 const uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4614 size_t ip_hlen
; /* ip header length in bytes */
4616 uint16_t neigh_holdtime
;
4617 const char *neigh_dst_str
;
4618 struct in_addr neigh_dst_addr
;
4619 const char *neigh_src_str
;
4620 struct in_addr neigh_src_addr
;
4621 const char *group_str
;
4622 struct in_addr group_addr
;
4623 const char *source_str
;
4624 struct in_addr source_addr
;
4626 struct interface
*ifp
;
4629 /* Find interface */
4630 ifname
= argv
[0]->arg
;
4631 ifp
= if_lookup_by_name(ifname
);
4633 vty_out(vty
, "No such interface name %s%s",
4634 ifname
, VTY_NEWLINE
);
4638 neigh_holdtime
= atoi(argv
[1]->arg
);
4640 /* Neighbor destination address */
4641 neigh_dst_str
= argv
[2]->arg
;
4642 result
= inet_pton(AF_INET
, neigh_dst_str
, &neigh_dst_addr
);
4644 vty_out(vty
, "Bad neighbor destination address %s: errno=%d: %s%s",
4645 neigh_dst_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4649 /* Neighbor source address */
4650 neigh_src_str
= argv
[3]->arg
;
4651 result
= inet_pton(AF_INET
, neigh_src_str
, &neigh_src_addr
);
4653 vty_out(vty
, "Bad neighbor source address %s: errno=%d: %s%s",
4654 neigh_src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4658 /* Multicast group address */
4659 group_str
= argv
[4]->arg
;
4660 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4662 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4663 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4667 /* Multicast source address */
4668 source_str
= argv
[5]->arg
;
4669 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4671 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4672 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4679 ip_hdr
= (struct ip
*) buf
;
4680 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4681 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4682 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4683 ip_hdr
->ip_src
= neigh_src_addr
;
4684 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4689 pim_msg
= buf
+ ip_hlen
;
4691 pim_msg_size
= pim_msg_join_prune_encode (pim_msg
, buf_pastend
- pim_msg
, src_is_join
,
4692 source_addr
, group_addr
, neigh_dst_addr
,
4699 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4700 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4702 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4703 ip_msg_len
, result
, VTY_NEWLINE
);
4710 DEFUN (test_pim_receive_join
,
4711 test_pim_receive_join_cmd
,
4712 "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4714 "Test PIM protocol\n"
4715 "Test PIM message reception\n"
4716 "Test PIM join reception from neighbor\n"
4718 "Neighbor holdtime\n"
4719 "Upstream neighbor unicast destination address\n"
4720 "Downstream neighbor unicast source address\n"
4721 "Multicast group address\n"
4722 "Unicast source address\n")
4724 return recv_joinprune(vty
, argv
, 1 /* src_is_join=true */);
4727 DEFUN (test_pim_receive_prune
,
4728 test_pim_receive_prune_cmd
,
4729 "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4731 "Test PIM protocol\n"
4732 "Test PIM message reception\n"
4733 "Test PIM prune reception from neighbor\n"
4735 "Neighbor holdtime\n"
4736 "Upstream neighbor unicast destination address\n"
4737 "Downstream neighbor unicast source address\n"
4738 "Multicast group address\n"
4739 "Unicast source address\n")
4741 return recv_joinprune(vty
, argv
, 0 /* src_is_join=false */);
4744 DEFUN (test_pim_receive_upcall
,
4745 test_pim_receive_upcall_cmd
,
4746 "test pim receive upcall <nocache|wrongvif|wholepkt> (0-65535) A.B.C.D A.B.C.D",
4748 "Test PIM protocol\n"
4749 "Test PIM message reception\n"
4750 "Test reception of kernel upcall\n"
4751 "NOCACHE kernel upcall\n"
4752 "WRONGVIF kernel upcall\n"
4753 "WHOLEPKT kernel upcall\n"
4754 "Input interface vif index\n"
4755 "Multicast group address\n"
4756 "Multicast source address\n")
4763 const char *upcall_type
;
4764 const char *group_str
;
4765 const char *source_str
;
4768 upcall_type
= argv
[idx_type
]->arg
;
4770 if (upcall_type
[0] == 'n')
4771 msg
.im_msgtype
= IGMPMSG_NOCACHE
;
4772 else if (upcall_type
[1] == 'r')
4773 msg
.im_msgtype
= IGMPMSG_WRONGVIF
;
4774 else if (upcall_type
[1] == 'h')
4775 msg
.im_msgtype
= IGMPMSG_WHOLEPKT
;
4777 vty_out(vty
, "Unknown kernel upcall type: %s%s",
4778 upcall_type
, VTY_NEWLINE
);
4782 msg
.im_vif
= atoi(argv
[idx_number
]->arg
);
4785 group_str
= argv
[idx_ipv4
]->arg
;
4786 result
= inet_pton(AF_INET
, group_str
, &msg
.im_dst
);
4788 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4789 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4793 /* Source address */
4794 source_str
= argv
[idx_ipv4_2
]->arg
;
4795 result
= inet_pton(AF_INET
, source_str
, &msg
.im_src
);
4797 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4798 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4802 msg
.im_mbz
= 0; /* Must be zero */
4804 result
= pim_mroute_msg(-1, (char *) &msg
, sizeof(msg
));
4806 vty_out(vty
, "pim_mroute_msg(len=%zu) returned failure: %d%s",
4807 sizeof(msg
), result
, VTY_NEWLINE
);
4816 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
4817 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
4820 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
4821 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
4822 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
4823 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
4824 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
4825 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
4826 install_element (CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
4827 install_element (CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
4828 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
4829 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
4831 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
4832 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
4833 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
4834 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
4835 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
4836 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
4837 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
4838 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
4839 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
4840 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
4841 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
4842 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
4843 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
4844 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
4845 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
4846 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
4847 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
4848 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
4850 // Static mroutes NEB
4851 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
4852 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
4853 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
4854 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
4856 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
4857 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
4858 install_element (VIEW_NODE
, &show_ip_igmp_parameters_cmd
);
4859 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
4860 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
4861 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
4862 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
4863 install_element (VIEW_NODE
, &show_ip_igmp_querier_cmd
);
4864 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
4865 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
4866 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
4867 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
4868 install_element (VIEW_NODE
, &show_ip_pim_dr_cmd
);
4869 install_element (VIEW_NODE
, &show_ip_pim_hello_cmd
);
4870 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
4871 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
4872 install_element (VIEW_NODE
, &show_ip_pim_jp_override_interval_cmd
);
4873 install_element (VIEW_NODE
, &show_ip_pim_lan_prune_delay_cmd
);
4874 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
4875 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
4876 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
4877 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
4878 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
4879 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
4880 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
4881 install_element (VIEW_NODE
, &show_ip_pim_rp_cmd
);
4882 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
4883 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
4884 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
4885 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
4886 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
4887 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
4889 install_element (ENABLE_NODE
, &show_ip_pim_address_cmd
);
4891 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
4892 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
4893 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
4894 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
4895 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
4897 install_element (ENABLE_NODE
, &test_igmp_receive_report_cmd
);
4898 install_element (ENABLE_NODE
, &test_pim_receive_assert_cmd
);
4899 install_element (ENABLE_NODE
, &test_pim_receive_dump_cmd
);
4900 install_element (ENABLE_NODE
, &test_pim_receive_hello_cmd
);
4901 install_element (ENABLE_NODE
, &test_pim_receive_join_cmd
);
4902 install_element (ENABLE_NODE
, &test_pim_receive_prune_cmd
);
4903 install_element (ENABLE_NODE
, &test_pim_receive_upcall_cmd
);
4905 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
4906 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
4907 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
4908 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
4909 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
4910 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
4911 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
4912 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
4913 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
4914 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
4915 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
4916 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
4917 install_element (ENABLE_NODE
, &debug_static_cmd
);
4918 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
4919 install_element (ENABLE_NODE
, &debug_pim_cmd
);
4920 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
4921 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
4922 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
4923 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
4924 install_element (ENABLE_NODE
, &debug_pim_packets_filter_cmd
);
4925 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
4926 install_element (ENABLE_NODE
, &no_debug_pim_packets_filter_cmd
);
4927 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
4928 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
4929 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
4930 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
4931 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
4932 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
4933 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
4934 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
4935 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
4936 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
4938 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
4939 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
4940 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
4941 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
4942 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
4943 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
4944 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
4945 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
4946 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
4947 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
4948 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
4949 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
4950 install_element (CONFIG_NODE
, &debug_static_cmd
);
4951 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
4952 install_element (CONFIG_NODE
, &debug_pim_cmd
);
4953 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
4954 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
4955 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
4956 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
4957 install_element (CONFIG_NODE
, &debug_pim_packets_filter_cmd
);
4958 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
4959 install_element (CONFIG_NODE
, &no_debug_pim_packets_filter_cmd
);
4960 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
4961 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
4962 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
4963 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
4964 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
4965 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);