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
),
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 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1107 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1108 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1109 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1110 refresh_uptime
, VTY_NEWLINE
);
1113 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1115 char uptime_scan_oil
[10];
1116 char uptime_mroute_add
[10];
1117 char uptime_mroute_del
[10];
1119 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1120 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1121 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1124 "Scan OIL - Last: %s Events: %lld%s"
1125 "MFC Add - Last: %s Events: %lld%s"
1126 "MFC Del - Last: %s Events: %lld%s",
1127 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1128 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1129 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
1132 static void pim_show_rpf(struct vty
*vty
)
1134 struct listnode
*up_node
;
1135 struct pim_upstream
*up
;
1136 time_t now
= pim_time_monotonic_sec();
1138 show_rpf_refresh_stats(vty
, now
);
1140 vty_out(vty
, "%s", VTY_NEWLINE
);
1143 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
1146 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, up_node
, up
)) {
1149 char rpf_addr_str
[100];
1150 char rib_nexthop_str
[100];
1151 const char *rpf_ifname
;
1152 struct pim_rpf
*rpf
= &up
->rpf
;
1154 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1155 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1156 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1157 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
1159 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1161 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
1167 rpf
->source_nexthop
.mrib_route_metric
,
1168 rpf
->source_nexthop
.mrib_metric_preference
,
1173 static void igmp_show_querier(struct vty
*vty
)
1175 struct listnode
*node
;
1176 struct interface
*ifp
;
1178 vty_out(vty
, "Interface Address Querier StartCount Query-Timer Other-Timer%s", VTY_NEWLINE
);
1180 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1181 struct pim_interface
*pim_ifp
= ifp
->info
;
1182 struct listnode
*sock_node
;
1183 struct igmp_sock
*igmp
;
1188 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1189 char query_hhmmss
[10];
1190 char other_hhmmss
[10];
1192 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
1193 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
1195 vty_out(vty
, "%-9s %-15s %-7s %10d %11s %11s%s",
1197 inet_ntoa(igmp
->ifaddr
),
1198 igmp
->t_igmp_query_timer
? "THIS" : "OTHER",
1199 igmp
->startup_query_count
,
1207 static void igmp_show_groups(struct vty
*vty
)
1209 struct listnode
*ifnode
;
1210 struct interface
*ifp
;
1213 now
= pim_time_monotonic_sec();
1215 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
1217 /* scan interfaces */
1218 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1219 struct pim_interface
*pim_ifp
= ifp
->info
;
1220 struct listnode
*sock_node
;
1221 struct igmp_sock
*igmp
;
1226 /* scan igmp sockets */
1227 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1228 char ifaddr_str
[100];
1229 struct listnode
*grpnode
;
1230 struct igmp_group
*grp
;
1232 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1234 /* scan igmp groups */
1235 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1236 char group_str
[100];
1240 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1241 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
1242 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
1244 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
1248 grp
->group_filtermode_isexcl
? "EXCL" : "INCL",
1250 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
1251 igmp_group_compat_mode(igmp
, grp
),
1255 } /* scan igmp groups */
1256 } /* scan igmp sockets */
1257 } /* scan interfaces */
1260 static void igmp_show_group_retransmission(struct vty
*vty
)
1262 struct listnode
*ifnode
;
1263 struct interface
*ifp
;
1265 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
1267 /* scan interfaces */
1268 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1269 struct pim_interface
*pim_ifp
= ifp
->info
;
1270 struct listnode
*sock_node
;
1271 struct igmp_sock
*igmp
;
1276 /* scan igmp sockets */
1277 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1278 char ifaddr_str
[100];
1279 struct listnode
*grpnode
;
1280 struct igmp_group
*grp
;
1282 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1284 /* scan igmp groups */
1285 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1286 char group_str
[100];
1287 char grp_retr_mmss
[10];
1288 struct listnode
*src_node
;
1289 struct igmp_source
*src
;
1290 int grp_retr_sources
= 0;
1292 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1293 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
1296 /* count group sources with retransmission state */
1297 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
1298 if (src
->source_query_retransmit_count
> 0) {
1303 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
1308 grp
->group_specific_query_retransmit_count
,
1312 } /* scan igmp groups */
1313 } /* scan igmp sockets */
1314 } /* scan interfaces */
1317 static void igmp_show_parameters(struct vty
*vty
)
1319 struct listnode
*ifnode
;
1320 struct interface
*ifp
;
1323 "QRV: Robustness Variable SQI: Startup Query Interval%s"
1324 "QQI: Query Interval OQPI: Other Querier Present Interval%s"
1325 "QRI: Query Response Interval LMQT: Last Member Query Time%s"
1326 "GMI: Group Membership Interval OHPI: Older Host Present Interval%s%s",
1327 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
1330 "Interface Address QRV QQI QRI GMI SQI OQPI LMQT OHPI %s",
1333 /* scan interfaces */
1334 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1335 struct pim_interface
*pim_ifp
= ifp
->info
;
1336 struct listnode
*sock_node
;
1337 struct igmp_sock
*igmp
;
1342 /* scan igmp sockets */
1343 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1344 char ifaddr_str
[100];
1345 long gmi_dsec
; /* Group Membership Interval */
1346 long oqpi_dsec
; /* Other Querier Present Interval */
1352 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1354 gmi_dsec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
1355 igmp
->querier_query_interval
,
1356 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1358 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
1360 oqpi_dsec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
1361 igmp
->querier_query_interval
,
1362 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1364 lmqt_dsec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
1365 igmp
->querier_robustness_variable
) / 100;
1367 ohpi_dsec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
1368 igmp
->querier_query_interval
,
1369 pim_ifp
->igmp_query_max_response_time_dsec
);
1371 qri_dsec
= pim_ifp
->igmp_query_max_response_time_dsec
;
1374 "%-9s %-15s %3d %3d %3ld.%ld %3ld.%ld %3d %3ld.%ld %3ld.%ld %3ld.%ld%s",
1377 igmp
->querier_robustness_variable
,
1378 igmp
->querier_query_interval
,
1379 qri_dsec
/ 10, qri_dsec
% 10,
1380 gmi_dsec
/ 10, gmi_dsec
% 10,
1382 oqpi_dsec
/ 10, oqpi_dsec
% 10,
1383 lmqt_dsec
/ 10, lmqt_dsec
% 10,
1384 ohpi_dsec
/ 10, ohpi_dsec
% 10,
1387 } /* scan igmp sockets */
1388 } /* scan interfaces */
1391 static void igmp_show_sources(struct vty
*vty
)
1393 struct listnode
*ifnode
;
1394 struct interface
*ifp
;
1397 now
= pim_time_monotonic_sec();
1399 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
1401 /* scan interfaces */
1402 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1403 struct pim_interface
*pim_ifp
= ifp
->info
;
1404 struct listnode
*sock_node
;
1405 struct igmp_sock
*igmp
;
1410 /* scan igmp sockets */
1411 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1412 char ifaddr_str
[100];
1413 struct listnode
*grpnode
;
1414 struct igmp_group
*grp
;
1416 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1418 /* scan igmp groups */
1419 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1420 char group_str
[100];
1421 struct listnode
*srcnode
;
1422 struct igmp_source
*src
;
1424 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1426 /* scan group sources */
1427 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1428 char source_str
[100];
1432 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1434 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
1436 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
1438 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
1444 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
1448 } /* scan group sources */
1449 } /* scan igmp groups */
1450 } /* scan igmp sockets */
1451 } /* scan interfaces */
1454 static void igmp_show_source_retransmission(struct vty
*vty
)
1456 struct listnode
*ifnode
;
1457 struct interface
*ifp
;
1459 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
1461 /* scan interfaces */
1462 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1463 struct pim_interface
*pim_ifp
= ifp
->info
;
1464 struct listnode
*sock_node
;
1465 struct igmp_sock
*igmp
;
1470 /* scan igmp sockets */
1471 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1472 char ifaddr_str
[100];
1473 struct listnode
*grpnode
;
1474 struct igmp_group
*grp
;
1476 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1478 /* scan igmp groups */
1479 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1480 char group_str
[100];
1481 struct listnode
*srcnode
;
1482 struct igmp_source
*src
;
1484 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1486 /* scan group sources */
1487 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1488 char source_str
[100];
1490 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1492 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
1497 src
->source_query_retransmit_count
,
1500 } /* scan group sources */
1501 } /* scan igmp groups */
1502 } /* scan igmp sockets */
1503 } /* scan interfaces */
1506 static void clear_igmp_interfaces()
1508 struct listnode
*ifnode
;
1509 struct listnode
*ifnextnode
;
1510 struct interface
*ifp
;
1512 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1513 pim_if_addr_del_all_igmp(ifp
);
1516 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1517 pim_if_addr_add_all(ifp
);
1521 static void clear_pim_interfaces()
1523 struct listnode
*ifnode
;
1524 struct listnode
*ifnextnode
;
1525 struct interface
*ifp
;
1527 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1529 pim_neighbor_delete_all(ifp
, "interface cleared");
1534 static void clear_interfaces()
1536 clear_igmp_interfaces();
1537 clear_pim_interfaces();
1540 DEFUN (clear_ip_interfaces
,
1541 clear_ip_interfaces_cmd
,
1542 "clear ip interfaces",
1545 "Reset interfaces\n")
1552 DEFUN (clear_ip_igmp_interfaces
,
1553 clear_ip_igmp_interfaces_cmd
,
1554 "clear ip igmp interfaces",
1558 "Reset IGMP interfaces\n")
1560 clear_igmp_interfaces();
1565 static void mroute_add_all()
1567 struct listnode
*node
;
1568 struct channel_oil
*c_oil
;
1570 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1571 if (pim_mroute_add(c_oil
)) {
1572 /* just log warning */
1573 char source_str
[100];
1574 char group_str
[100];
1575 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1576 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1577 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1578 __FILE__
, __PRETTY_FUNCTION__
,
1579 source_str
, group_str
);
1584 static void mroute_del_all()
1586 struct listnode
*node
;
1587 struct channel_oil
*c_oil
;
1589 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1590 if (pim_mroute_del(c_oil
)) {
1591 /* just log warning */
1592 char source_str
[100];
1593 char group_str
[100];
1594 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1595 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1596 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1597 __FILE__
, __PRETTY_FUNCTION__
,
1598 source_str
, group_str
);
1603 static void static_mroute_add_all()
1605 struct listnode
*node
;
1606 struct static_route
*s_route
;
1608 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1609 if (pim_mroute_add(&s_route
->c_oil
)) {
1610 /* just log warning */
1611 char source_str
[100];
1612 char group_str
[100];
1613 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1614 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1615 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1616 __FILE__
, __PRETTY_FUNCTION__
,
1617 source_str
, group_str
);
1622 static void static_mroute_del_all()
1624 struct listnode
*node
;
1625 struct static_route
*s_route
;
1627 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1628 if (pim_mroute_del(&s_route
->c_oil
)) {
1629 /* just log warning */
1630 char source_str
[100];
1631 char group_str
[100];
1632 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1633 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1634 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1635 __FILE__
, __PRETTY_FUNCTION__
,
1636 source_str
, group_str
);
1641 DEFUN (clear_ip_mroute
,
1642 clear_ip_mroute_cmd
,
1646 "Reset multicast routes\n")
1654 DEFUN (clear_ip_pim_interfaces
,
1655 clear_ip_pim_interfaces_cmd
,
1656 "clear ip pim interfaces",
1660 "Reset PIM interfaces\n")
1662 clear_pim_interfaces();
1667 DEFUN (clear_ip_pim_oil
,
1668 clear_ip_pim_oil_cmd
,
1673 "Rescan PIM OIL (output interface list)\n")
1680 DEFUN (show_ip_igmp_interface
,
1681 show_ip_igmp_interface_cmd
,
1682 "show ip igmp interface",
1686 "IGMP interface information\n")
1688 igmp_show_interfaces(vty
);
1693 DEFUN (show_ip_igmp_join
,
1694 show_ip_igmp_join_cmd
,
1695 "show ip igmp join",
1699 "IGMP static join information\n")
1701 igmp_show_interface_join(vty
);
1706 DEFUN (show_ip_igmp_groups
,
1707 show_ip_igmp_groups_cmd
,
1708 "show ip igmp groups",
1714 igmp_show_groups(vty
);
1719 DEFUN (show_ip_igmp_groups_retransmissions
,
1720 show_ip_igmp_groups_retransmissions_cmd
,
1721 "show ip igmp groups retransmissions",
1726 "IGMP group retransmissions\n")
1728 igmp_show_group_retransmission(vty
);
1733 DEFUN (show_ip_igmp_parameters
,
1734 show_ip_igmp_parameters_cmd
,
1735 "show ip igmp parameters",
1739 "IGMP parameters information\n")
1741 igmp_show_parameters(vty
);
1746 DEFUN (show_ip_igmp_sources
,
1747 show_ip_igmp_sources_cmd
,
1748 "show ip igmp sources",
1754 igmp_show_sources(vty
);
1759 DEFUN (show_ip_igmp_sources_retransmissions
,
1760 show_ip_igmp_sources_retransmissions_cmd
,
1761 "show ip igmp sources retransmissions",
1766 "IGMP source retransmissions\n")
1768 igmp_show_source_retransmission(vty
);
1773 DEFUN (show_ip_igmp_querier
,
1774 show_ip_igmp_querier_cmd
,
1775 "show ip igmp querier",
1779 "IGMP querier information\n")
1781 igmp_show_querier(vty
);
1786 DEFUN (show_ip_pim_address
,
1787 show_ip_pim_address_cmd
,
1788 "show ip pim address",
1792 "PIM interface address\n")
1794 show_interface_address(vty
);
1799 DEFUN (show_ip_pim_assert
,
1800 show_ip_pim_assert_cmd
,
1801 "show ip pim assert",
1805 "PIM interface assert\n")
1807 pim_show_assert(vty
);
1812 DEFUN (show_ip_pim_assert_internal
,
1813 show_ip_pim_assert_internal_cmd
,
1814 "show ip pim assert-internal",
1818 "PIM interface internal assert state\n")
1820 pim_show_assert_internal(vty
);
1825 DEFUN (show_ip_pim_assert_metric
,
1826 show_ip_pim_assert_metric_cmd
,
1827 "show ip pim assert-metric",
1831 "PIM interface assert metric\n")
1833 pim_show_assert_metric(vty
);
1838 DEFUN (show_ip_pim_assert_winner_metric
,
1839 show_ip_pim_assert_winner_metric_cmd
,
1840 "show ip pim assert-winner-metric",
1844 "PIM interface assert winner metric\n")
1846 pim_show_assert_winner_metric(vty
);
1851 DEFUN (show_ip_pim_dr
,
1853 "show ip pim designated-router",
1857 "PIM interface designated router\n")
1864 DEFUN (show_ip_pim_hello
,
1865 show_ip_pim_hello_cmd
,
1866 "show ip pim hello",
1870 "PIM interface hello information\n")
1872 pim_show_hello(vty
);
1877 DEFUN (show_ip_pim_interface
,
1878 show_ip_pim_interface_cmd
,
1879 "show ip pim interface",
1883 "PIM interface information\n")
1885 pim_show_interfaces(vty
);
1890 DEFUN (show_ip_pim_join
,
1891 show_ip_pim_join_cmd
,
1896 "PIM interface join information\n")
1903 DEFUN (show_ip_pim_lan_prune_delay
,
1904 show_ip_pim_lan_prune_delay_cmd
,
1905 "show ip pim lan-prune-delay",
1909 "PIM neighbors LAN prune delay parameters\n")
1911 pim_show_lan_prune_delay(vty
);
1916 DEFUN (show_ip_pim_local_membership
,
1917 show_ip_pim_local_membership_cmd
,
1918 "show ip pim local-membership",
1922 "PIM interface local-membership\n")
1924 pim_show_membership(vty
);
1929 DEFUN (show_ip_pim_jp_override_interval
,
1930 show_ip_pim_jp_override_interval_cmd
,
1931 "show ip pim jp-override-interval",
1935 "PIM interface J/P override interval\n")
1937 pim_show_jp_override_interval(vty
);
1942 DEFUN (show_ip_pim_neighbor
,
1943 show_ip_pim_neighbor_cmd
,
1944 "show ip pim neighbor",
1948 "PIM neighbor information\n")
1950 pim_show_neighbors(vty
);
1955 DEFUN (show_ip_pim_secondary
,
1956 show_ip_pim_secondary_cmd
,
1957 "show ip pim secondary",
1961 "PIM neighbor addresses\n")
1963 pim_show_neighbors_secondary(vty
);
1968 DEFUN (show_ip_pim_upstream
,
1969 show_ip_pim_upstream_cmd
,
1970 "show ip pim upstream",
1974 "PIM upstream information\n")
1976 pim_show_upstream(vty
);
1981 DEFUN (show_ip_pim_upstream_join_desired
,
1982 show_ip_pim_upstream_join_desired_cmd
,
1983 "show ip pim upstream-join-desired",
1987 "PIM upstream join-desired\n")
1989 pim_show_join_desired(vty
);
1994 DEFUN (show_ip_pim_upstream_rpf
,
1995 show_ip_pim_upstream_rpf_cmd
,
1996 "show ip pim upstream-rpf",
2000 "PIM upstream source rpf\n")
2002 pim_show_upstream_rpf(vty
);
2007 DEFUN (show_ip_pim_rpf
,
2008 show_ip_pim_rpf_cmd
,
2013 "PIM cached source rpf information\n")
2020 static void show_multicast_interfaces(struct vty
*vty
)
2022 struct listnode
*node
;
2023 struct interface
*ifp
;
2025 vty_out(vty
, "%s", VTY_NEWLINE
);
2027 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2030 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2031 struct pim_interface
*pim_ifp
;
2032 struct in_addr ifaddr
;
2033 struct sioc_vif_req vreq
;
2035 pim_ifp
= ifp
->info
;
2040 memset(&vreq
, 0, sizeof(vreq
));
2041 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2043 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2044 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2045 (unsigned long)SIOCGETVIFCNT
,
2047 pim_ifp
->mroute_vif_index
,
2049 safe_strerror(errno
),
2053 ifaddr
= pim_ifp
->primary_address
;
2055 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2059 pim_ifp
->mroute_vif_index
,
2060 (unsigned long) vreq
.icount
,
2061 (unsigned long) vreq
.ocount
,
2062 (unsigned long) vreq
.ibytes
,
2063 (unsigned long) vreq
.obytes
,
2068 DEFUN (show_ip_multicast
,
2069 show_ip_multicast_cmd
,
2070 "show ip multicast",
2073 "Multicast global information\n")
2075 time_t now
= pim_time_monotonic_sec();
2077 if (PIM_MROUTE_IS_ENABLED
) {
2080 vty_out(vty
, "Mroute socket descriptor: %d%s",
2081 qpim_mroute_socket_fd
,
2084 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
2085 vty_out(vty
, "Mroute socket uptime: %s%s",
2090 vty_out(vty
, "Multicast disabled%s",
2094 vty_out(vty
, "%s", VTY_NEWLINE
);
2095 vty_out(vty
, "Zclient update socket: ");
2096 if (qpim_zclient_update
) {
2097 vty_out(vty
, "%d failures=%d%s", qpim_zclient_update
->sock
,
2098 qpim_zclient_update
->fail
, VTY_NEWLINE
);
2101 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2104 pim_zlookup_show_ip_multicast (vty
);
2106 vty_out(vty
, "%s", VTY_NEWLINE
);
2107 vty_out(vty
, "Current highest VifIndex: %d%s",
2108 qpim_mroute_oif_highest_vif_index
,
2110 vty_out(vty
, "Maximum highest VifIndex: %d%s",
2111 PIM_MAX_USABLE_VIFS
,
2114 vty_out(vty
, "%s", VTY_NEWLINE
);
2115 vty_out(vty
, "Upstream Join Timer: %d secs%s",
2118 vty_out(vty
, "Join/Prune Holdtime: %d secs%s",
2122 vty_out(vty
, "%s", VTY_NEWLINE
);
2124 show_rpf_refresh_stats(vty
, now
);
2126 vty_out(vty
, "%s", VTY_NEWLINE
);
2128 show_scan_oil_stats(vty
, now
);
2130 show_multicast_interfaces(vty
);
2135 static void show_mroute(struct vty
*vty
)
2137 struct listnode
*node
;
2138 struct channel_oil
*c_oil
;
2139 struct static_route
*s_route
;
2142 vty_out(vty
, "Proto: I=IGMP P=PIM S=STATIC O=SOURCE%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
2144 vty_out(vty
, "Source Group Proto Input iVifI Output oVifI TTL Uptime %s",
2147 now
= pim_time_monotonic_sec();
2149 /* print list of PIM and IGMP routes */
2150 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2151 char group_str
[100];
2152 char source_str
[100];
2155 if (!c_oil
->installed
)
2158 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2159 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2161 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2162 struct interface
*ifp_in
;
2163 struct interface
*ifp_out
;
2164 char oif_uptime
[10];
2168 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
2172 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
2173 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2175 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
2178 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
2181 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
2184 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
2188 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2192 ifp_in
? ifp_in
->name
: "<iif?>",
2193 c_oil
->oil
.mfcc_parent
,
2194 ifp_out
? ifp_out
->name
: "<oif?>",
2202 /* Print list of static routes */
2203 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2204 char group_str
[100];
2205 char source_str
[100];
2208 if (!s_route
->c_oil
.installed
)
2211 pim_inet4_dump("<group?>", s_route
->group
, group_str
, sizeof(group_str
));
2212 pim_inet4_dump("<source?>", s_route
->source
, source_str
, sizeof(source_str
));
2214 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2215 struct interface
*ifp_in
;
2216 struct interface
*ifp_out
;
2217 char oif_uptime
[10];
2221 ttl
= s_route
->oif_ttls
[oif_vif_index
];
2225 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
2226 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2228 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
2233 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2237 ifp_in
? ifp_in
->name
: "<iif?>",
2239 ifp_out
? ifp_out
->name
: "<oif?>",
2248 DEFUN (show_ip_mroute
,
2259 static void show_mroute_count(struct vty
*vty
)
2261 struct listnode
*node
;
2262 struct channel_oil
*c_oil
;
2263 struct static_route
*s_route
;
2265 vty_out(vty
, "%s", VTY_NEWLINE
);
2267 vty_out(vty
, "Source Group Packets Bytes WrongIf %s",
2270 /* Print PIM and IGMP route counts */
2271 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2272 char group_str
[100];
2273 char source_str
[100];
2275 if (!c_oil
->installed
)
2278 pim_mroute_update_counters (c_oil
);
2280 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2281 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2283 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2292 /* Print static route counts */
2293 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2294 char group_str
[100];
2295 char source_str
[100];
2297 if (!s_route
->c_oil
.installed
)
2300 pim_mroute_update_counters (&s_route
->c_oil
);
2302 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2303 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2305 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2308 s_route
->c_oil
.cc
.pktcnt
,
2309 s_route
->c_oil
.cc
.bytecnt
,
2310 s_route
->c_oil
.cc
.wrong_if
,
2315 DEFUN (show_ip_mroute_count
,
2316 show_ip_mroute_count_cmd
,
2317 "show ip mroute count",
2321 "Route and packet count data\n")
2323 show_mroute_count(vty
);
2329 "show ip rib A.B.C.D",
2333 "Unicast address\n")
2336 struct in_addr addr
;
2337 const char *addr_str
;
2338 struct pim_nexthop nexthop
;
2339 char nexthop_addr_str
[100];
2342 addr_str
= argv
[idx_ipv4
]->arg
;
2343 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2345 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
2346 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2350 if (pim_nexthop_lookup(&nexthop
, addr
, NULL
)) {
2351 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
2352 addr_str
, VTY_NEWLINE
);
2356 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
2359 pim_inet4_dump("<nexthop?>", nexthop
.mrib_nexthop_addr
,
2360 nexthop_addr_str
, sizeof(nexthop_addr_str
));
2362 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
2365 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2366 nexthop
.mrib_route_metric
,
2367 nexthop
.mrib_metric_preference
,
2373 static void show_ssmpingd(struct vty
*vty
)
2375 struct listnode
*node
;
2376 struct ssmpingd_sock
*ss
;
2379 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
2382 if (!qpim_ssmpingd_list
)
2385 now
= pim_time_monotonic_sec();
2387 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
2388 char source_str
[100];
2390 struct sockaddr_in bind_addr
;
2391 socklen_t len
= sizeof(bind_addr
);
2392 char bind_addr_str
[100];
2394 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
2396 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
2397 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
2398 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
2401 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
2402 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
2404 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
2408 ntohs(bind_addr
.sin_port
),
2410 (long long)ss
->requests
,
2415 DEFUN (show_ip_ssmpingd
,
2416 show_ip_ssmpingd_cmd
,
2427 pim_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
)
2430 result
= pim_rp_new (rp
, group
);
2434 vty_out (vty
, "%% Bad RP/group address specified: %s", rp
);
2440 vty_out (vty
, "%% No Path to RP address specified: %s", rp
);
2446 vty_out (vty
, "%% Group range specified cannot overlap");
2447 return CMD_ERR_NO_MATCH
;
2453 DEFUN (ip_pim_keep_alive
,
2454 ip_pim_keep_alive_cmd
,
2455 "ip pim keep-alive-timer <31-600>",
2457 "pim multicast routing\n"
2461 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
2465 DEFUN (no_ip_pim_keep_alive
,
2466 no_ip_pim_keep_alive_cmd
,
2467 "no ip pim keep-alive-timer <31-600>",
2470 "pim multicast routing\n"
2474 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
2480 "ip pim rp A.B.C.D [A.B.C.D/M]",
2482 "pim multicast routing\n"
2484 "ip address of RP\n")
2487 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
);
2491 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
)
2493 int result
= pim_rp_del (rp
, group
);
2497 vty_out (vty
, "%% Unable to Decode specified RP");
2503 vty_out (vty
, "%% Unable to find specified RP");
2510 DEFUN (no_ip_pim_rp
,
2512 "no ip pim rp A.B.C.D [A.B.C.D/M]",
2515 "pim multicast routing\n"
2517 "ip address of RP\n")
2520 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
);
2523 DEFUN (ip_multicast_routing
,
2524 ip_multicast_routing_cmd
,
2525 "ip multicast-routing",
2527 "Enable IP multicast forwarding\n")
2529 pim_mroute_socket_enable();
2530 pim_if_add_vif_all();
2532 static_mroute_add_all();
2536 DEFUN (no_ip_multicast_routing
,
2537 no_ip_multicast_routing_cmd
,
2538 "no ip multicast-routing",
2541 "Global IP configuration subcommands\n"
2542 "Enable IP multicast forwarding\n")
2545 static_mroute_del_all();
2546 pim_if_del_vif_all();
2547 pim_mroute_socket_disable();
2553 "ip ssmpingd [A.B.C.D]",
2560 struct in_addr source_addr
;
2561 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2563 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2565 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2566 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2570 result
= pim_ssmpingd_start(source_addr
);
2572 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
2573 source_str
, result
, VTY_NEWLINE
);
2580 DEFUN (no_ip_ssmpingd
,
2582 "no ip ssmpingd [A.B.C.D]",
2590 struct in_addr source_addr
;
2591 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2593 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2595 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2596 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2600 result
= pim_ssmpingd_stop(source_addr
);
2602 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
2603 source_str
, result
, VTY_NEWLINE
);
2610 DEFUN (interface_ip_igmp
,
2611 interface_ip_igmp_cmd
,
2616 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2617 struct pim_interface
*pim_ifp
;
2619 pim_ifp
= ifp
->info
;
2622 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
2624 vty_out(vty
, "Could not enable IGMP on interface %s%s",
2625 ifp
->name
, VTY_NEWLINE
);
2630 PIM_IF_DO_IGMP(pim_ifp
->options
);
2633 pim_if_addr_add_all(ifp
);
2634 pim_if_membership_refresh(ifp
);
2639 DEFUN (interface_no_ip_igmp
,
2640 interface_no_ip_igmp_cmd
,
2646 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2647 struct pim_interface
*pim_ifp
;
2649 pim_ifp
= ifp
->info
;
2653 PIM_IF_DONT_IGMP(pim_ifp
->options
);
2655 pim_if_membership_clear(ifp
);
2657 pim_if_addr_del_all_igmp(ifp
);
2659 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
2666 DEFUN (interface_ip_igmp_join
,
2667 interface_ip_igmp_join_cmd
,
2668 "ip igmp join A.B.C.D A.B.C.D",
2671 "IGMP join multicast group\n"
2672 "Multicast group address\n"
2675 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2678 const char *group_str
;
2679 const char *source_str
;
2680 struct in_addr group_addr
;
2681 struct in_addr source_addr
;
2685 group_str
= argv
[idx_ipv4
]->arg
;
2686 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2688 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2689 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2693 /* Source address */
2694 source_str
= argv
[idx_ipv4_2
]->arg
;
2695 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2697 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2698 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2702 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
2704 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
2705 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2712 DEFUN (interface_no_ip_igmp_join
,
2713 interface_no_ip_igmp_join_cmd
,
2714 "no ip igmp join A.B.C.D A.B.C.D",
2718 "IGMP join multicast group\n"
2719 "Multicast group address\n"
2722 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2725 const char *group_str
;
2726 const char *source_str
;
2727 struct in_addr group_addr
;
2728 struct in_addr source_addr
;
2732 group_str
= argv
[idx_ipv4
]->arg
;
2733 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2735 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2736 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2740 /* Source address */
2741 source_str
= argv
[idx_ipv4_2
]->arg
;
2742 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2744 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2745 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2749 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
2751 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
2752 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2760 CLI reconfiguration affects the interface level (struct pim_interface).
2761 This function propagates the reconfiguration to every active socket
2764 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
2766 struct interface
*ifp
;
2767 struct pim_interface
*pim_ifp
;
2771 /* other querier present? */
2773 if (igmp
->t_other_querier_timer
)
2776 /* this is the querier */
2778 zassert(igmp
->interface
);
2779 zassert(igmp
->interface
->info
);
2781 ifp
= igmp
->interface
;
2782 pim_ifp
= ifp
->info
;
2784 if (PIM_DEBUG_IGMP_TRACE
) {
2785 char ifaddr_str
[100];
2786 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2787 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
2788 __PRETTY_FUNCTION__
,
2791 pim_ifp
->igmp_default_query_interval
);
2795 igmp_startup_mode_on() will reset QQI:
2797 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
2799 igmp_startup_mode_on(igmp
);
2802 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
2804 if (igmp
->t_igmp_query_timer
) {
2805 /* other querier present */
2806 zassert(igmp
->t_igmp_query_timer
);
2807 zassert(!igmp
->t_other_querier_timer
);
2809 pim_igmp_general_query_off(igmp
);
2810 pim_igmp_general_query_on(igmp
);
2812 zassert(igmp
->t_igmp_query_timer
);
2813 zassert(!igmp
->t_other_querier_timer
);
2816 /* this is the querier */
2818 zassert(!igmp
->t_igmp_query_timer
);
2819 zassert(igmp
->t_other_querier_timer
);
2821 pim_igmp_other_querier_timer_off(igmp
);
2822 pim_igmp_other_querier_timer_on(igmp
);
2824 zassert(!igmp
->t_igmp_query_timer
);
2825 zassert(igmp
->t_other_querier_timer
);
2829 static void change_query_interval(struct pim_interface
*pim_ifp
,
2832 struct listnode
*sock_node
;
2833 struct igmp_sock
*igmp
;
2835 pim_ifp
->igmp_default_query_interval
= query_interval
;
2837 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2838 igmp_sock_query_interval_reconfig(igmp
);
2839 igmp_sock_query_reschedule(igmp
);
2843 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
2844 int query_max_response_time_dsec
)
2846 struct listnode
*sock_node
;
2847 struct igmp_sock
*igmp
;
2849 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
2852 Below we modify socket/group/source timers in order to quickly
2853 reflect the change. Otherwise, those timers would eventually catch
2857 /* scan all sockets */
2858 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2859 struct listnode
*grp_node
;
2860 struct igmp_group
*grp
;
2862 /* reschedule socket general query */
2863 igmp_sock_query_reschedule(igmp
);
2865 /* scan socket groups */
2866 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
2867 struct listnode
*src_node
;
2868 struct igmp_source
*src
;
2870 /* reset group timers for groups in EXCLUDE mode */
2871 if (grp
->group_filtermode_isexcl
) {
2872 igmp_group_reset_gmi(grp
);
2875 /* scan group sources */
2876 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2878 /* reset source timers for sources with running timers */
2879 if (src
->t_source_timer
) {
2880 igmp_source_reset_gmi(igmp
, grp
, src
);
2887 #define IGMP_QUERY_INTERVAL_MIN (1)
2888 #define IGMP_QUERY_INTERVAL_MAX (1800)
2890 DEFUN (interface_ip_igmp_query_interval
,
2891 interface_ip_igmp_query_interval_cmd
,
2892 "ip igmp query-interval (1-1800)",
2895 IFACE_IGMP_QUERY_INTERVAL_STR
2896 "Query interval in seconds\n")
2898 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2899 struct pim_interface
*pim_ifp
;
2901 int query_interval_dsec
;
2903 pim_ifp
= ifp
->info
;
2907 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2913 query_interval
= atoi(argv
[4]->arg
);
2914 query_interval_dsec
= 10 * query_interval
;
2917 It seems we don't need to check bounds since command.c does it
2918 already, but we verify them anyway for extra safety.
2920 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
2921 vty_out(vty
, "General query interval %d lower than minimum %d%s",
2923 IGMP_QUERY_INTERVAL_MIN
,
2927 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
2928 vty_out(vty
, "General query interval %d higher than maximum %d%s",
2930 IGMP_QUERY_INTERVAL_MAX
,
2935 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2937 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
2938 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2943 change_query_interval(pim_ifp
, query_interval
);
2948 DEFUN (interface_no_ip_igmp_query_interval
,
2949 interface_no_ip_igmp_query_interval_cmd
,
2950 "no ip igmp query-interval",
2954 IFACE_IGMP_QUERY_INTERVAL_STR
)
2956 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2957 struct pim_interface
*pim_ifp
;
2958 int default_query_interval_dsec
;
2960 pim_ifp
= ifp
->info
;
2965 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
2967 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2969 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
2970 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2975 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
2980 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN (1)
2981 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX (25)
2983 DEFUN (interface_ip_igmp_query_max_response_time
,
2984 interface_ip_igmp_query_max_response_time_cmd
,
2985 "ip igmp query-max-response-time (1-25)",
2988 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
2989 "Query response value in seconds\n")
2991 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2992 struct pim_interface
*pim_ifp
;
2993 int query_max_response_time
;
2995 pim_ifp
= ifp
->info
;
2999 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3005 query_max_response_time
= atoi(argv
[4]->arg
);
3008 It seems we don't need to check bounds since command.c does it
3009 already, but we verify them anyway for extra safety.
3011 if (query_max_response_time
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN
) {
3012 vty_out(vty
, "Query max response time %d sec lower than minimum %d sec%s",
3013 query_max_response_time
,
3014 IGMP_QUERY_MAX_RESPONSE_TIME_MIN
,
3018 if (query_max_response_time
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX
) {
3019 vty_out(vty
, "Query max response time %d sec higher than maximum %d sec%s",
3020 query_max_response_time
,
3021 IGMP_QUERY_MAX_RESPONSE_TIME_MAX
,
3026 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
) {
3028 "Can't set query max response time %d sec >= general query interval %d sec%s",
3029 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
3034 change_query_max_response_time(pim_ifp
, 10 * query_max_response_time
);
3039 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3040 interface_no_ip_igmp_query_max_response_time_cmd
,
3041 "no ip igmp query-max-response-time",
3045 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
)
3047 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3048 struct pim_interface
*pim_ifp
;
3049 int default_query_interval_dsec
;
3051 pim_ifp
= ifp
->info
;
3056 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3058 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3060 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3061 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3066 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3071 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
3072 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
3074 DEFUN (interface_ip_igmp_query_max_response_time_dsec
,
3075 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3076 "ip igmp query-max-response-time-dsec (10-250)",
3079 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3080 "Query response value in deciseconds\n")
3082 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3083 struct pim_interface
*pim_ifp
;
3084 int query_max_response_time_dsec
;
3085 int default_query_interval_dsec
;
3087 pim_ifp
= ifp
->info
;
3091 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3097 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
3100 It seems we don't need to check bounds since command.c does it
3101 already, but we verify them anyway for extra safety.
3103 if (query_max_response_time_dsec
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
) {
3104 vty_out(vty
, "Query max response time %d dsec lower than minimum %d dsec%s",
3105 query_max_response_time_dsec
,
3106 IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
,
3110 if (query_max_response_time_dsec
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
) {
3111 vty_out(vty
, "Query max response time %d dsec higher than maximum %d dsec%s",
3112 query_max_response_time_dsec
,
3113 IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
,
3118 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3120 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
3122 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
3123 query_max_response_time_dsec
, default_query_interval_dsec
,
3128 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
3133 DEFUN (interface_no_ip_igmp_query_max_response_time_dsec
,
3134 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3135 "no ip igmp query-max-response-time-dsec",
3139 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
3141 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3142 struct pim_interface
*pim_ifp
;
3143 int default_query_interval_dsec
;
3145 pim_ifp
= ifp
->info
;
3150 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3152 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3154 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3155 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3160 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3165 DEFUN (interface_ip_pim_drprio
,
3166 interface_ip_pim_drprio_cmd
,
3167 "ip pim drpriority (1-4294967295)",
3170 "Set the Designated Router Election Priority\n"
3171 "Value of the new DR Priority\n")
3173 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3175 struct pim_interface
*pim_ifp
;
3176 uint32_t old_dr_prio
;
3178 pim_ifp
= ifp
->info
;
3181 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
3185 old_dr_prio
= pim_ifp
->pim_dr_priority
;
3187 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
3189 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
3190 if (pim_if_dr_election(ifp
))
3191 pim_hello_restart_now(ifp
);
3197 DEFUN (interface_no_ip_pim_drprio
,
3198 interface_no_ip_pim_drprio_cmd
,
3199 "no ip pim drpriority [(1-4294967295)]",
3203 "Revert the Designated Router Priority to default\n"
3204 "Old Value of the Priority\n")
3206 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3207 struct pim_interface
*pim_ifp
;
3209 pim_ifp
= ifp
->info
;
3212 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3216 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
3217 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
3218 if (pim_if_dr_election(ifp
))
3219 pim_hello_restart_now(ifp
);
3226 pim_cmd_interface_add (struct interface
*ifp
, enum pim_interface_type itype
)
3228 struct pim_interface
*pim_ifp
= ifp
->info
;
3229 struct in_addr null
= { .s_addr
= 0 };
3232 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
3238 PIM_IF_DO_PIM(pim_ifp
->options
);
3241 pim_ifp
->itype
= itype
;
3242 pim_if_addr_add_all(ifp
);
3243 pim_if_membership_refresh(ifp
);
3245 pim_rp_check_rp (null
, pim_ifp
->primary_address
);
3250 DEFUN (interface_ip_pim_ssm
,
3251 interface_ip_pim_ssm_cmd
,
3257 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3259 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SSM
)) {
3260 vty_out(vty
, "Could not enable PIM SSM on interface%s", VTY_NEWLINE
);
3267 DEFUN (interface_ip_pim_sm
,
3268 interface_ip_pim_sm_cmd
,
3274 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3275 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SM
)) {
3276 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
3280 pim_if_create_pimreg();
3286 pim_cmd_interface_delete (struct interface
*ifp
)
3288 struct pim_interface
*pim_ifp
= ifp
->info
;
3293 PIM_IF_DONT_PIM(pim_ifp
->options
);
3295 pim_if_membership_clear(ifp
);
3298 pim_if_addr_del_all() removes all sockets from
3299 pim_ifp->igmp_socket_list.
3301 pim_if_addr_del_all(ifp
);
3304 pim_sock_delete() removes all neighbors from
3305 pim_ifp->pim_neighbor_list.
3307 pim_sock_delete(ifp
, "pim unconfigured on interface");
3309 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
3316 DEFUN (interface_no_ip_pim_ssm
,
3317 interface_no_ip_pim_ssm_cmd
,
3324 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3325 if (!pim_cmd_interface_delete(ifp
)) {
3326 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3333 DEFUN (interface_no_ip_pim_sm
,
3334 interface_no_ip_pim_sm_cmd
,
3341 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3342 if (!pim_cmd_interface_delete(ifp
)) {
3343 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3350 DEFUN (interface_ip_mroute
,
3351 interface_ip_mroute_cmd
,
3352 "ip mroute INTERFACE A.B.C.D",
3354 "Add multicast route\n"
3355 "Outgoing interface name\n"
3358 VTY_DECLVAR_CONTEXT(interface
, iif
);
3359 int idx_interface
= 2;
3361 struct interface
*oif
;
3362 const char *oifname
;
3363 const char *grp_str
;
3364 struct in_addr grp_addr
;
3365 struct in_addr src_addr
;
3368 oifname
= argv
[idx_interface
]->arg
;
3369 oif
= if_lookup_by_name(oifname
);
3371 vty_out(vty
, "No such interface name %s%s",
3372 oifname
, VTY_NEWLINE
);
3376 grp_str
= argv
[idx_ipv4
]->arg
;
3377 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3379 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3380 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3384 src_addr
.s_addr
= INADDR_ANY
;
3386 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3387 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3394 DEFUN (interface_ip_mroute_source
,
3395 interface_ip_mroute_source_cmd
,
3396 "ip mroute INTERFACE A.B.C.D A.B.C.D",
3398 "Add multicast route\n"
3399 "Outgoing interface name\n"
3403 VTY_DECLVAR_CONTEXT(interface
, iif
);
3404 int idx_interface
= 2;
3407 struct interface
*oif
;
3408 const char *oifname
;
3409 const char *grp_str
;
3410 struct in_addr grp_addr
;
3411 const char *src_str
;
3412 struct in_addr src_addr
;
3415 oifname
= argv
[idx_interface
]->arg
;
3416 oif
= if_lookup_by_name(oifname
);
3418 vty_out(vty
, "No such interface name %s%s",
3419 oifname
, VTY_NEWLINE
);
3423 grp_str
= argv
[idx_ipv4
]->arg
;
3424 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3426 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3427 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3431 src_str
= argv
[idx_ipv4_2
]->arg
;
3432 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3434 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3435 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3439 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3440 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3447 DEFUN (interface_no_ip_mroute
,
3448 interface_no_ip_mroute_cmd
,
3449 "no ip mroute INTERFACE A.B.C.D",
3452 "Add multicast route\n"
3453 "Outgoing interface name\n"
3456 VTY_DECLVAR_CONTEXT(interface
, iif
);
3457 int idx_interface
= 3;
3459 struct interface
*oif
;
3460 const char *oifname
;
3461 const char *grp_str
;
3462 struct in_addr grp_addr
;
3463 struct in_addr src_addr
;
3466 oifname
= argv
[idx_interface
]->arg
;
3467 oif
= if_lookup_by_name(oifname
);
3469 vty_out(vty
, "No such interface name %s%s",
3470 oifname
, VTY_NEWLINE
);
3474 grp_str
= argv
[idx_ipv4
]->arg
;
3475 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3477 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3478 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3482 src_addr
.s_addr
= INADDR_ANY
;
3484 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3485 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3492 DEFUN (interface_no_ip_mroute_source
,
3493 interface_no_ip_mroute_source_cmd
,
3494 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
3497 "Add multicast route\n"
3498 "Outgoing interface name\n"
3502 VTY_DECLVAR_CONTEXT(interface
, iif
);
3503 int idx_interface
= 3;
3506 struct interface
*oif
;
3507 const char *oifname
;
3508 const char *grp_str
;
3509 struct in_addr grp_addr
;
3510 const char *src_str
;
3511 struct in_addr src_addr
;
3514 oifname
= argv
[idx_interface
]->arg
;
3515 oif
= if_lookup_by_name(oifname
);
3517 vty_out(vty
, "No such interface name %s%s",
3518 oifname
, VTY_NEWLINE
);
3522 grp_str
= argv
[idx_ipv4
]->arg
;
3523 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3525 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3526 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3530 src_str
= argv
[idx_ipv4_2
]->arg
;
3531 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3533 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3534 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3538 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3539 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3546 DEFUN (interface_ip_pim_hello
,
3547 interface_ip_pim_hello_cmd
,
3548 "ip pim hello (1-180) [(1-180)]",
3552 IFACE_PIM_HELLO_TIME_STR
3553 IFACE_PIM_HELLO_HOLD_STR
)
3555 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3558 struct pim_interface
*pim_ifp
;
3560 pim_ifp
= ifp
->info
;
3563 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3567 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
3569 if (argc
> idx_hold
)
3570 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
3577 DEFUN (interface_no_ip_pim_hello
,
3578 interface_no_ip_pim_hello_cmd
,
3579 "no ip pim hello [(1-180) (1-180)]",
3584 IFACE_PIM_HELLO_TIME_STR
3585 IFACE_PIM_HELLO_HOLD_STR
)
3587 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3588 struct pim_interface
*pim_ifp
;
3590 pim_ifp
= ifp
->info
;
3593 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3597 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
3598 pim_ifp
->pim_default_holdtime
= -1;
3609 PIM_DO_DEBUG_IGMP_EVENTS
;
3610 PIM_DO_DEBUG_IGMP_PACKETS
;
3611 PIM_DO_DEBUG_IGMP_TRACE
;
3615 DEFUN (no_debug_igmp
,
3622 PIM_DONT_DEBUG_IGMP_EVENTS
;
3623 PIM_DONT_DEBUG_IGMP_PACKETS
;
3624 PIM_DONT_DEBUG_IGMP_TRACE
;
3629 DEFUN (debug_igmp_events
,
3630 debug_igmp_events_cmd
,
3631 "debug igmp events",
3634 DEBUG_IGMP_EVENTS_STR
)
3636 PIM_DO_DEBUG_IGMP_EVENTS
;
3640 DEFUN (no_debug_igmp_events
,
3641 no_debug_igmp_events_cmd
,
3642 "no debug igmp events",
3646 DEBUG_IGMP_EVENTS_STR
)
3648 PIM_DONT_DEBUG_IGMP_EVENTS
;
3653 DEFUN (debug_igmp_packets
,
3654 debug_igmp_packets_cmd
,
3655 "debug igmp packets",
3658 DEBUG_IGMP_PACKETS_STR
)
3660 PIM_DO_DEBUG_IGMP_PACKETS
;
3664 DEFUN (no_debug_igmp_packets
,
3665 no_debug_igmp_packets_cmd
,
3666 "no debug igmp packets",
3670 DEBUG_IGMP_PACKETS_STR
)
3672 PIM_DONT_DEBUG_IGMP_PACKETS
;
3677 DEFUN (debug_igmp_trace
,
3678 debug_igmp_trace_cmd
,
3682 DEBUG_IGMP_TRACE_STR
)
3684 PIM_DO_DEBUG_IGMP_TRACE
;
3688 DEFUN (no_debug_igmp_trace
,
3689 no_debug_igmp_trace_cmd
,
3690 "no debug igmp trace",
3694 DEBUG_IGMP_TRACE_STR
)
3696 PIM_DONT_DEBUG_IGMP_TRACE
;
3701 DEFUN (debug_mroute
,
3707 PIM_DO_DEBUG_MROUTE
;
3711 DEFUN (debug_mroute_detail
,
3712 debug_mroute_detail_cmd
,
3713 "debug mroute detail",
3718 PIM_DO_DEBUG_MROUTE_DETAIL
;
3722 DEFUN (no_debug_mroute
,
3723 no_debug_mroute_cmd
,
3729 PIM_DONT_DEBUG_MROUTE
;
3733 DEFUN (no_debug_mroute_detail
,
3734 no_debug_mroute_detail_cmd
,
3735 "no debug mroute detail",
3741 PIM_DONT_DEBUG_MROUTE_DETAIL
;
3745 DEFUN (debug_static
,
3751 PIM_DO_DEBUG_STATIC
;
3755 DEFUN (no_debug_static
,
3756 no_debug_static_cmd
,
3762 PIM_DONT_DEBUG_STATIC
;
3773 PIM_DO_DEBUG_PIM_EVENTS
;
3774 PIM_DO_DEBUG_PIM_PACKETS
;
3775 PIM_DO_DEBUG_PIM_TRACE
;
3779 DEFUN (no_debug_pim
,
3786 PIM_DONT_DEBUG_PIM_EVENTS
;
3787 PIM_DONT_DEBUG_PIM_PACKETS
;
3788 PIM_DONT_DEBUG_PIM_TRACE
;
3790 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3791 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3797 DEFUN (debug_pim_events
,
3798 debug_pim_events_cmd
,
3802 DEBUG_PIM_EVENTS_STR
)
3804 PIM_DO_DEBUG_PIM_EVENTS
;
3808 DEFUN (no_debug_pim_events
,
3809 no_debug_pim_events_cmd
,
3810 "no debug pim events",
3814 DEBUG_PIM_EVENTS_STR
)
3816 PIM_DONT_DEBUG_PIM_EVENTS
;
3821 DEFUN (debug_pim_packets
,
3822 debug_pim_packets_cmd
,
3823 "debug pim packets",
3826 DEBUG_PIM_PACKETS_STR
)
3828 PIM_DO_DEBUG_PIM_PACKETS
;
3829 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
3833 DEFUN (debug_pim_packets_filter
,
3834 debug_pim_packets_filter_cmd
,
3835 "debug pim packets <hello|joins|register>",
3838 DEBUG_PIM_PACKETS_STR
3839 DEBUG_PIM_HELLO_PACKETS_STR
3840 DEBUG_PIM_J_P_PACKETS_STR
3841 DEBUG_PIM_PIM_REG_PACKETS_STR
)
3843 int idx_hello_join
= 3;
3844 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3846 PIM_DO_DEBUG_PIM_HELLO
;
3847 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
3849 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3851 PIM_DO_DEBUG_PIM_J_P
;
3852 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
3854 else if (strncmp(argv
[idx_hello_join
]->arg
,"r",1) == 0)
3856 PIM_DO_DEBUG_PIM_REG
;
3857 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
3862 DEFUN (no_debug_pim_packets
,
3863 no_debug_pim_packets_cmd
,
3864 "no debug pim packets",
3868 DEBUG_PIM_PACKETS_STR
3869 DEBUG_PIM_HELLO_PACKETS_STR
3870 DEBUG_PIM_J_P_PACKETS_STR
)
3872 PIM_DONT_DEBUG_PIM_PACKETS
;
3873 vty_out (vty
, "PIM Packet debugging is off %s", VTY_NEWLINE
);
3877 DEFUN (no_debug_pim_packets_filter
,
3878 no_debug_pim_packets_filter_cmd
,
3879 "no debug pim packets <hello|joins|register>",
3883 DEBUG_PIM_PACKETS_STR
3884 DEBUG_PIM_HELLO_PACKETS_STR
3885 DEBUG_PIM_J_P_PACKETS_STR
)
3887 int idx_hello_join
= 4;
3888 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3890 PIM_DONT_DEBUG_PIM_HELLO
;
3891 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
3893 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3895 PIM_DONT_DEBUG_PIM_J_P
;
3896 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
3898 else if (strncmp (argv
[idx_hello_join
]->arg
, "r", 1) == 0)
3900 PIM_DONT_DEBUG_PIM_REG
;
3901 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
3907 DEFUN (debug_pim_packetdump_send
,
3908 debug_pim_packetdump_send_cmd
,
3909 "debug pim packet-dump send",
3912 DEBUG_PIM_PACKETDUMP_STR
3913 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3915 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
3919 DEFUN (no_debug_pim_packetdump_send
,
3920 no_debug_pim_packetdump_send_cmd
,
3921 "no debug pim packet-dump send",
3925 DEBUG_PIM_PACKETDUMP_STR
3926 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3928 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3933 DEFUN (debug_pim_packetdump_recv
,
3934 debug_pim_packetdump_recv_cmd
,
3935 "debug pim packet-dump receive",
3938 DEBUG_PIM_PACKETDUMP_STR
3939 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3941 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
3945 DEFUN (no_debug_pim_packetdump_recv
,
3946 no_debug_pim_packetdump_recv_cmd
,
3947 "no debug pim packet-dump receive",
3951 DEBUG_PIM_PACKETDUMP_STR
3952 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3954 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3959 DEFUN (debug_pim_trace
,
3960 debug_pim_trace_cmd
,
3964 DEBUG_PIM_TRACE_STR
)
3966 PIM_DO_DEBUG_PIM_TRACE
;
3970 DEFUN (no_debug_pim_trace
,
3971 no_debug_pim_trace_cmd
,
3972 "no debug pim trace",
3976 DEBUG_PIM_TRACE_STR
)
3978 PIM_DONT_DEBUG_PIM_TRACE
;
3983 DEFUN (debug_ssmpingd
,
3990 PIM_DO_DEBUG_SSMPINGD
;
3994 DEFUN (no_debug_ssmpingd
,
3995 no_debug_ssmpingd_cmd
,
3996 "no debug ssmpingd",
4002 PIM_DONT_DEBUG_SSMPINGD
;
4007 DEFUN (debug_pim_zebra
,
4008 debug_pim_zebra_cmd
,
4012 DEBUG_PIM_ZEBRA_STR
)
4018 DEFUN (no_debug_pim_zebra
,
4019 no_debug_pim_zebra_cmd
,
4020 "no debug pim zebra",
4024 DEBUG_PIM_ZEBRA_STR
)
4026 PIM_DONT_DEBUG_ZEBRA
;
4031 DEFUN (show_debugging_pim
,
4032 show_debugging_pim_cmd
,
4033 "show debugging pim",
4038 pim_debug_config_write(vty
);
4042 static struct igmp_sock
*find_igmp_sock_by_fd(int fd
)
4044 struct listnode
*ifnode
;
4045 struct interface
*ifp
;
4047 /* scan all interfaces */
4048 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
4049 struct pim_interface
*pim_ifp
;
4050 struct igmp_sock
*igmp
;
4055 pim_ifp
= ifp
->info
;
4057 /* lookup igmp socket under current interface */
4058 igmp
= igmp_sock_lookup_by_fd(pim_ifp
->igmp_socket_list
, fd
);
4066 DEFUN (test_igmp_receive_report
,
4067 test_igmp_receive_report_cmd
,
4068 "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...",
4070 "Test IGMP protocol\n"
4071 "Test IGMP message\n"
4072 "Test IGMP report\n"
4074 "IGMP group address\n"
4080 int idx_number_2
= 6;
4085 size_t ip_hlen
; /* ip header length in bytes */
4090 const char *grp_str
;
4091 struct in_addr grp_addr
;
4092 const char *record_type_str
;
4094 const char *src_str
;
4096 struct igmp_sock
*igmp
;
4099 struct in_addr
*sources
;
4100 struct in_addr
*src_addr
;
4103 socket
= argv
[idx_number
]->arg
;
4104 socket_fd
= atoi(socket
);
4105 igmp
= find_igmp_sock_by_fd(socket_fd
);
4107 vty_out(vty
, "Could not find IGMP socket %s: fd=%d%s",
4108 socket
, socket_fd
, VTY_NEWLINE
);
4112 grp_str
= argv
[idx_ipv4
]->arg
;
4113 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4115 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4116 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4120 record_type_str
= argv
[idx_number_2
]->arg
;
4121 record_type
= atoi(record_type_str
);
4126 ip_hdr
= (struct ip
*) buf
;
4127 ip_hdr
->ip_p
= PIM_IP_PROTO_IGMP
;
4128 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4129 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4130 ip_hdr
->ip_src
= igmp
->ifaddr
;
4131 ip_hdr
->ip_dst
= igmp
->ifaddr
;
4134 Build IGMP v3 report message
4136 igmp_msg
= buf
+ ip_hlen
;
4137 group_record
= igmp_msg
+ IGMP_V3_REPORT_GROUPPRECORD_OFFSET
;
4138 *igmp_msg
= PIM_IGMP_V3_MEMBERSHIP_REPORT
; /* type */
4139 *(uint16_t *) (igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = 0; /* for computing checksum */
4140 *(uint16_t *) (igmp_msg
+ IGMP_V3_REPORT_NUMGROUPS_OFFSET
) = htons(1); /* one group record */
4141 *(uint8_t *) (group_record
+ IGMP_V3_GROUP_RECORD_TYPE_OFFSET
) = record_type
;
4142 memcpy(group_record
+ IGMP_V3_GROUP_RECORD_GROUP_OFFSET
, &grp_addr
, sizeof(struct in_addr
));
4144 /* Scan LINE sources */
4145 sources
= (struct in_addr
*) (group_record
+ IGMP_V3_GROUP_RECORD_SOURCE_OFFSET
);
4147 for (argi
= idx_line
; argi
< argc
; ++argi
,++src_addr
) {
4148 src_str
= argv
[argi
]->arg
;
4149 result
= inet_pton(AF_INET
, src_str
, src_addr
);
4151 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4152 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4156 num_sources
= src_addr
- sources
;
4158 *(uint16_t *)(group_record
+ IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET
) = htons(num_sources
);
4160 igmp_msg_len
= IGMP_V3_MSG_MIN_SIZE
+ (num_sources
<< 4); /* v3 report for one single group record */
4162 /* compute checksum */
4163 *(uint16_t *)(igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = in_cksum(igmp_msg
, igmp_msg_len
);
4165 /* "receive" message */
4167 ip_msg_len
= ip_hlen
+ igmp_msg_len
;
4168 result
= pim_igmp_packet(igmp
, buf
, ip_msg_len
);
4170 vty_out(vty
, "pim_igmp_packet(len=%d) returned: %d%s",
4171 ip_msg_len
, result
, VTY_NEWLINE
);
4178 static int hexval(uint8_t ch
)
4180 return isdigit(ch
) ? (ch
- '0') : (10 + tolower(ch
) - 'a');
4183 DEFUN (test_pim_receive_dump
,
4184 test_pim_receive_dump_cmd
,
4185 "test pim receive dump INTERFACE A.B.C.D LINE...",
4187 "Test PIM protocol\n"
4188 "Test PIM message reception\n"
4189 "Test PIM packet dump reception from neighbor\n"
4191 "Neighbor address\n"
4194 int idx_interface
= 4;
4200 size_t ip_hlen
; /* ip header length in bytes */
4203 const char *neigh_str
;
4204 struct in_addr neigh_addr
;
4206 struct interface
*ifp
;
4210 /* Find interface */
4211 ifname
= argv
[idx_interface
]->arg
;
4212 ifp
= if_lookup_by_name(ifname
);
4214 vty_out(vty
, "No such interface name %s%s",
4215 ifname
, VTY_NEWLINE
);
4219 /* Neighbor address */
4220 neigh_str
= argv
[idx_ipv4
]->arg
;
4221 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4223 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4224 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4231 ip_hdr
= (struct ip
*) buf
;
4232 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4233 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4234 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4235 ip_hdr
->ip_src
= neigh_addr
;
4236 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4239 Build PIM hello message
4241 pim_msg
= buf
+ ip_hlen
;
4244 /* Scan LINE dump into buffer */
4245 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4246 const char *str
= argv
[argi
]->arg
;
4247 int str_len
= strlen(str
);
4248 int str_last
= str_len
- 1;
4252 vty_out(vty
, "%% Uneven hex array arg %d=%s%s",
4253 argi
, str
, VTY_NEWLINE
);
4257 for (i
= 0; i
< str_last
; i
+= 2) {
4260 uint8_t h1
= str
[i
];
4261 uint8_t h2
= str
[i
+ 1];
4263 if (!isxdigit(h1
) || !isxdigit(h2
)) {
4264 vty_out(vty
, "%% Non-hex octet %c%c at hex array arg %d=%s%s",
4265 h1
, h2
, argi
, str
, VTY_NEWLINE
);
4268 octet
= (hexval(h1
) << 4) + hexval(h2
);
4270 left
= sizeof(buf
) - ip_hlen
- pim_msg_size
;
4272 vty_out(vty
, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s",
4273 sizeof(buf
), left
, argi
, str
, octet
, VTY_NEWLINE
);
4277 pim_msg
[pim_msg_size
++] = octet
;
4281 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4283 vty_out(vty
, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s",
4284 sizeof(buf
), ip_msg_len
, pim_msg_size
, VTY_NEWLINE
);
4286 /* "receive" message */
4288 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4290 vty_out(vty
, "%% pim_pim_packet(len=%d) returned failure: %d%s",
4291 ip_msg_len
, result
, VTY_NEWLINE
);
4298 DEFUN (test_pim_receive_hello
,
4299 test_pim_receive_hello_cmd
,
4300 "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]",
4302 "Test PIM protocol\n"
4303 "Test PIM message reception\n"
4304 "Test PIM hello reception from neighbor\n"
4306 "Neighbor address\n"
4307 "Neighbor holdtime\n"
4308 "Neighbor DR priority\n"
4309 "Neighbor generation ID\n"
4310 "Neighbor propagation delay (msec)\n"
4311 "Neighbor override interval (msec)\n"
4312 "Neighbor LAN prune delay T-bit\n"
4313 "Neighbor secondary addresses\n")
4315 int idx_interface
= 4;
4318 int idx_number_2
= 7;
4319 int idx_number_3
= 8;
4320 int idx_number_4
= 9;
4321 int idx_number_5
= 10;
4322 int idx_number_6
= 11;
4327 size_t ip_hlen
; /* ip header length in bytes */
4331 const char *neigh_str
;
4332 struct in_addr neigh_addr
;
4334 struct interface
*ifp
;
4335 uint16_t neigh_holdtime
;
4336 uint16_t neigh_propagation_delay
;
4337 uint16_t neigh_override_interval
;
4338 int neigh_can_disable_join_suppression
;
4339 uint32_t neigh_dr_priority
;
4340 uint32_t neigh_generation_id
;
4344 /* Find interface */
4345 ifname
= argv
[idx_interface
]->arg
;
4346 ifp
= if_lookup_by_name(ifname
);
4348 vty_out(vty
, "No such interface name %s%s",
4349 ifname
, VTY_NEWLINE
);
4353 /* Neighbor address */
4354 neigh_str
= argv
[idx_ipv4
]->arg
;
4355 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4357 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4358 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4362 neigh_holdtime
= atoi(argv
[idx_number
]->arg
);
4363 neigh_dr_priority
= atoi(argv
[idx_number_2
]->arg
);
4364 neigh_generation_id
= atoi(argv
[idx_number_3
]->arg
);
4365 neigh_propagation_delay
= atoi(argv
[idx_number_4
]->arg
);
4366 neigh_override_interval
= atoi(argv
[idx_number_5
]->arg
);
4367 neigh_can_disable_join_suppression
= atoi(argv
[idx_number_6
]->arg
);
4372 ip_hdr
= (struct ip
*) buf
;
4373 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4374 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4375 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4376 ip_hdr
->ip_src
= neigh_addr
;
4377 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4380 Build PIM hello message
4382 pim_msg
= buf
+ ip_hlen
;
4384 /* Scan LINE addresses */
4385 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4386 const char *sec_str
= argv
[argi
]->arg
;
4387 struct in_addr sec_addr
;
4388 result
= inet_pton(AF_INET
, sec_str
, &sec_addr
);
4390 vty_out(vty
, "Bad neighbor secondary address %s: errno=%d: %s%s",
4391 sec_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4396 "FIXME WRITEME consider neighbor secondary address %s%s",
4397 sec_str
, VTY_NEWLINE
);
4400 pim_tlv_size
= pim_hello_build_tlv(ifp
->name
,
4401 pim_msg
+ PIM_PIM_MIN_LEN
,
4402 sizeof(buf
) - ip_hlen
- PIM_PIM_MIN_LEN
,
4405 neigh_generation_id
,
4406 neigh_propagation_delay
,
4407 neigh_override_interval
,
4408 neigh_can_disable_join_suppression
,
4409 0 /* FIXME secondary address list */);
4410 if (pim_tlv_size
< 0) {
4411 vty_out(vty
, "pim_hello_build_tlv() returned failure: %d%s",
4412 pim_tlv_size
, VTY_NEWLINE
);
4416 pim_msg_size
= pim_tlv_size
+ PIM_PIM_MIN_LEN
;
4418 pim_msg_build_header(pim_msg
, pim_msg_size
,
4419 PIM_MSG_TYPE_HELLO
);
4421 /* "receive" message */
4423 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4424 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4426 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4427 ip_msg_len
, result
, VTY_NEWLINE
);
4434 DEFUN (test_pim_receive_assert
,
4435 test_pim_receive_assert_cmd
,
4436 "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)",
4438 "Test PIM protocol\n"
4439 "Test PIM message reception\n"
4440 "Test reception of PIM assert\n"
4442 "Neighbor address\n"
4443 "Assert multicast group address\n"
4444 "Assert unicast source address\n"
4445 "Assert metric preference\n"
4446 "Assert route metric\n"
4447 "Assert RPT bit flag\n")
4449 int idx_interface
= 4;
4454 int idx_number_2
= 9;
4455 int idx_number_3
= 10;
4457 uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4460 size_t ip_hlen
; /* ip header length in bytes */
4463 const char *neigh_str
;
4464 struct in_addr neigh_addr
;
4465 const char *group_str
;
4466 struct in_addr group_addr
;
4467 const char *source_str
;
4468 struct in_addr source_addr
;
4470 struct interface
*ifp
;
4471 uint32_t assert_metric_preference
;
4472 uint32_t assert_route_metric
;
4473 uint32_t assert_rpt_bit_flag
;
4477 /* Find interface */
4478 ifname
= argv
[idx_interface
]->arg
;
4479 ifp
= if_lookup_by_name(ifname
);
4481 vty_out(vty
, "No such interface name %s%s",
4482 ifname
, VTY_NEWLINE
);
4486 /* Neighbor address */
4487 neigh_str
= argv
[idx_ipv4
]->arg
;
4488 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4490 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4491 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4496 group_str
= argv
[idx_ipv4_2
]->arg
;
4497 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4499 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4500 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4504 /* Source address */
4505 source_str
= argv
[idx_ipv4_3
]->arg
;
4506 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4508 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4509 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4513 assert_metric_preference
= atoi(argv
[idx_number
]->arg
);
4514 assert_route_metric
= atoi(argv
[idx_number_2
]->arg
);
4515 assert_rpt_bit_flag
= atoi(argv
[idx_number_3
]->arg
);
4517 remain
= buf_pastend
- buf
;
4518 if (remain
< (int) sizeof(struct ip
)) {
4519 vty_out(vty
, "No room for ip header: buf_size=%d < ip_header_size=%zu%s",
4520 remain
, sizeof(struct ip
), VTY_NEWLINE
);
4527 ip_hdr
= (struct ip
*) buf
;
4528 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4529 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4530 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4531 ip_hdr
->ip_src
= neigh_addr
;
4532 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4535 Build PIM assert message
4537 pim_msg
= buf
+ ip_hlen
; /* skip ip header */
4539 pim_msg_size
= pim_assert_build_msg(pim_msg
, buf_pastend
- pim_msg
, ifp
,
4540 group_addr
, source_addr
,
4541 assert_metric_preference
,
4542 assert_route_metric
,
4543 assert_rpt_bit_flag
);
4544 if (pim_msg_size
< 0) {
4545 vty_out(vty
, "Failure building PIM assert message: size=%d%s",
4546 pim_msg_size
, VTY_NEWLINE
);
4550 /* "receive" message */
4552 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4553 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4555 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4556 ip_msg_len
, result
, VTY_NEWLINE
);
4563 static int recv_joinprune(struct vty
*vty
,
4564 struct cmd_token
**argv
,
4568 const uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4572 size_t ip_hlen
; /* ip header length in bytes */
4574 uint16_t neigh_holdtime
;
4575 const char *neigh_dst_str
;
4576 struct in_addr neigh_dst_addr
;
4577 const char *neigh_src_str
;
4578 struct in_addr neigh_src_addr
;
4579 const char *group_str
;
4580 struct in_addr group_addr
;
4581 const char *source_str
;
4582 struct in_addr source_addr
;
4584 struct interface
*ifp
;
4587 /* Find interface */
4588 ifname
= argv
[0]->arg
;
4589 ifp
= if_lookup_by_name(ifname
);
4591 vty_out(vty
, "No such interface name %s%s",
4592 ifname
, VTY_NEWLINE
);
4596 neigh_holdtime
= atoi(argv
[1]->arg
);
4598 /* Neighbor destination address */
4599 neigh_dst_str
= argv
[2]->arg
;
4600 result
= inet_pton(AF_INET
, neigh_dst_str
, &neigh_dst_addr
);
4602 vty_out(vty
, "Bad neighbor destination address %s: errno=%d: %s%s",
4603 neigh_dst_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4607 /* Neighbor source address */
4608 neigh_src_str
= argv
[3]->arg
;
4609 result
= inet_pton(AF_INET
, neigh_src_str
, &neigh_src_addr
);
4611 vty_out(vty
, "Bad neighbor source address %s: errno=%d: %s%s",
4612 neigh_src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4616 /* Multicast group address */
4617 group_str
= argv
[4]->arg
;
4618 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4620 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4621 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4625 /* Multicast source address */
4626 source_str
= argv
[5]->arg
;
4627 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4629 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4630 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4637 ip_hdr
= (struct ip
*) buf
;
4638 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4639 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4640 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4641 ip_hdr
->ip_src
= neigh_src_addr
;
4642 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4647 pim_msg
= buf
+ ip_hlen
;
4649 pim_msg_size
= pim_msg_join_prune_encode (pim_msg
, buf_pastend
- pim_msg
, src_is_join
,
4650 source_addr
, group_addr
, neigh_dst_addr
,
4657 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4658 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4660 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4661 ip_msg_len
, result
, VTY_NEWLINE
);
4668 DEFUN (test_pim_receive_join
,
4669 test_pim_receive_join_cmd
,
4670 "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4672 "Test PIM protocol\n"
4673 "Test PIM message reception\n"
4674 "Test PIM join reception from neighbor\n"
4676 "Neighbor holdtime\n"
4677 "Upstream neighbor unicast destination address\n"
4678 "Downstream neighbor unicast source address\n"
4679 "Multicast group address\n"
4680 "Unicast source address\n")
4682 return recv_joinprune(vty
, argv
, 1 /* src_is_join=true */);
4685 DEFUN (test_pim_receive_prune
,
4686 test_pim_receive_prune_cmd
,
4687 "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4689 "Test PIM protocol\n"
4690 "Test PIM message reception\n"
4691 "Test PIM prune reception from neighbor\n"
4693 "Neighbor holdtime\n"
4694 "Upstream neighbor unicast destination address\n"
4695 "Downstream neighbor unicast source address\n"
4696 "Multicast group address\n"
4697 "Unicast source address\n")
4699 return recv_joinprune(vty
, argv
, 0 /* src_is_join=false */);
4702 DEFUN (test_pim_receive_upcall
,
4703 test_pim_receive_upcall_cmd
,
4704 "test pim receive upcall <nocache|wrongvif|wholepkt> (0-65535) A.B.C.D A.B.C.D",
4706 "Test PIM protocol\n"
4707 "Test PIM message reception\n"
4708 "Test reception of kernel upcall\n"
4709 "NOCACHE kernel upcall\n"
4710 "WRONGVIF kernel upcall\n"
4711 "WHOLEPKT kernel upcall\n"
4712 "Input interface vif index\n"
4713 "Multicast group address\n"
4714 "Multicast source address\n")
4721 const char *upcall_type
;
4722 const char *group_str
;
4723 const char *source_str
;
4726 upcall_type
= argv
[idx_type
]->arg
;
4728 if (upcall_type
[0] == 'n')
4729 msg
.im_msgtype
= IGMPMSG_NOCACHE
;
4730 else if (upcall_type
[1] == 'r')
4731 msg
.im_msgtype
= IGMPMSG_WRONGVIF
;
4732 else if (upcall_type
[1] == 'h')
4733 msg
.im_msgtype
= IGMPMSG_WHOLEPKT
;
4735 vty_out(vty
, "Unknown kernel upcall type: %s%s",
4736 upcall_type
, VTY_NEWLINE
);
4740 msg
.im_vif
= atoi(argv
[idx_number
]->arg
);
4743 group_str
= argv
[idx_ipv4
]->arg
;
4744 result
= inet_pton(AF_INET
, group_str
, &msg
.im_dst
);
4746 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4747 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4751 /* Source address */
4752 source_str
= argv
[idx_ipv4_2
]->arg
;
4753 result
= inet_pton(AF_INET
, source_str
, &msg
.im_src
);
4755 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4756 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4760 msg
.im_mbz
= 0; /* Must be zero */
4762 result
= pim_mroute_msg(-1, (char *) &msg
, sizeof(msg
));
4764 vty_out(vty
, "pim_mroute_msg(len=%zu) returned failure: %d%s",
4765 sizeof(msg
), result
, VTY_NEWLINE
);
4774 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
4775 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
4778 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
4779 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
4780 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
4781 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
4782 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
4783 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
4784 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
4785 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
4787 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
4788 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
4789 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
4790 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
4791 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
4792 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
4793 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
4794 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
4795 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
4796 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
4797 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
4798 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
4799 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
4800 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
4801 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
4802 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
4803 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
4804 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
4806 // Static mroutes NEB
4807 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
4808 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
4809 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
4810 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
4812 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
4813 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
4814 install_element (VIEW_NODE
, &show_ip_igmp_parameters_cmd
);
4815 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
4816 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
4817 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
4818 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
4819 install_element (VIEW_NODE
, &show_ip_igmp_querier_cmd
);
4820 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
4821 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
4822 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
4823 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
4824 install_element (VIEW_NODE
, &show_ip_pim_dr_cmd
);
4825 install_element (VIEW_NODE
, &show_ip_pim_hello_cmd
);
4826 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
4827 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
4828 install_element (VIEW_NODE
, &show_ip_pim_jp_override_interval_cmd
);
4829 install_element (VIEW_NODE
, &show_ip_pim_lan_prune_delay_cmd
);
4830 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
4831 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
4832 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
4833 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
4834 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
4835 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
4836 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
4837 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
4838 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
4839 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
4840 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
4841 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
4842 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
4844 install_element (ENABLE_NODE
, &show_ip_pim_address_cmd
);
4846 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
4847 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
4848 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
4849 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
4850 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
4852 install_element (ENABLE_NODE
, &test_igmp_receive_report_cmd
);
4853 install_element (ENABLE_NODE
, &test_pim_receive_assert_cmd
);
4854 install_element (ENABLE_NODE
, &test_pim_receive_dump_cmd
);
4855 install_element (ENABLE_NODE
, &test_pim_receive_hello_cmd
);
4856 install_element (ENABLE_NODE
, &test_pim_receive_join_cmd
);
4857 install_element (ENABLE_NODE
, &test_pim_receive_prune_cmd
);
4858 install_element (ENABLE_NODE
, &test_pim_receive_upcall_cmd
);
4860 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
4861 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
4862 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
4863 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
4864 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
4865 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
4866 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
4867 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
4868 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
4869 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
4870 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
4871 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
4872 install_element (ENABLE_NODE
, &debug_static_cmd
);
4873 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
4874 install_element (ENABLE_NODE
, &debug_pim_cmd
);
4875 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
4876 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
4877 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
4878 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
4879 install_element (ENABLE_NODE
, &debug_pim_packets_filter_cmd
);
4880 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
4881 install_element (ENABLE_NODE
, &no_debug_pim_packets_filter_cmd
);
4882 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
4883 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
4884 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
4885 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
4886 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
4887 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
4888 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
4889 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
4890 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
4891 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
4893 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
4894 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
4895 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
4896 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
4897 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
4898 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
4899 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
4900 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
4901 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
4902 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
4903 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
4904 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
4905 install_element (CONFIG_NODE
, &debug_static_cmd
);
4906 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
4907 install_element (CONFIG_NODE
, &debug_pim_cmd
);
4908 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
4909 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
4910 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
4911 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
4912 install_element (CONFIG_NODE
, &debug_pim_packets_filter_cmd
);
4913 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
4914 install_element (CONFIG_NODE
, &no_debug_pim_packets_filter_cmd
);
4915 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
4916 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
4917 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
4918 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
4919 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
4920 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);