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"
55 static struct cmd_node pim_global_node
= {
61 static struct cmd_node interface_node
= {
67 static void pim_if_membership_clear(struct interface
*ifp
)
69 struct pim_interface
*pim_ifp
;
74 if (PIM_IF_TEST_PIM(pim_ifp
->options
) &&
75 PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
79 pim_ifchannel_membership_clear(ifp
);
83 When PIM is disabled on interface, IGMPv3 local membership
84 information is not injected into PIM interface state.
86 The function pim_if_membership_refresh() fetches all IGMPv3 local
87 membership information into PIM. It is intented to be called
88 whenever PIM is enabled on the interface in order to collect missed
89 local membership information.
91 static void pim_if_membership_refresh(struct interface
*ifp
)
93 struct pim_interface
*pim_ifp
;
94 struct listnode
*sock_node
;
95 struct igmp_sock
*igmp
;
100 if (!PIM_IF_TEST_PIM(pim_ifp
->options
))
102 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
106 First clear off membership from all PIM (S,G) entries on the
110 pim_ifchannel_membership_clear(ifp
);
113 Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on
117 /* scan igmp sockets */
118 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
119 struct listnode
*grpnode
;
120 struct igmp_group
*grp
;
122 /* scan igmp groups */
123 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
124 struct listnode
*srcnode
;
125 struct igmp_source
*src
;
127 /* scan group sources */
128 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
130 if (IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
)) {
133 memset (&sg
, 0, sizeof (struct prefix
));
134 sg
.u
.sg
.src
= src
->source_addr
;
135 sg
.u
.sg
.grp
= grp
->group_addr
;
136 pim_ifchannel_local_membership_add(ifp
, &sg
);
139 } /* scan group sources */
140 } /* scan igmp groups */
141 } /* scan igmp sockets */
144 Finally delete every PIM (S,G) entry lacking all state info
147 pim_ifchannel_delete_on_noinfo(ifp
);
151 static void pim_show_assert(struct vty
*vty
)
153 struct listnode
*ifnode
;
154 struct interface
*ifp
;
157 now
= pim_time_monotonic_sec();
160 "Interface Address Source Group State Winner Uptime Timer%s",
163 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
164 struct pim_interface
*pim_ifp
;
165 struct in_addr ifaddr
;
166 struct listnode
*ch_node
;
167 struct pim_ifchannel
*ch
;
174 ifaddr
= pim_ifp
->primary_address
;
176 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
177 char ch_src_str
[100];
178 char ch_grp_str
[100];
179 char winner_str
[100];
183 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
184 ch_src_str
, sizeof(ch_src_str
));
185 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
186 ch_grp_str
, sizeof(ch_grp_str
));
187 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
,
188 winner_str
, sizeof(winner_str
));
190 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
191 pim_time_timer_to_mmss(timer
, sizeof(timer
),
192 ch
->t_ifassert_timer
);
194 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
199 pim_ifchannel_ifassert_name(ch
->ifassert_state
),
204 } /* scan interface channels */
205 } /* scan interfaces */
208 static void pim_show_assert_internal(struct vty
*vty
)
210 struct listnode
*ifnode
;
211 struct interface
*ifp
;
215 "ECA: Evaluate CouldAssert%s"
216 "ATD: AssertTrackingDesired%s"
217 "eATD: Evaluate AssertTrackingDesired%s%s",
218 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
221 "Interface Address Source Group CA eCA ATD eATD%s",
224 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
225 struct pim_interface
*pim_ifp
;
226 struct in_addr ifaddr
;
227 struct listnode
*ch_node
;
228 struct pim_ifchannel
*ch
;
235 ifaddr
= pim_ifp
->primary_address
;
237 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
238 char ch_src_str
[100];
239 char ch_grp_str
[100];
241 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
242 ch_src_str
, sizeof(ch_src_str
));
243 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
244 ch_grp_str
, sizeof(ch_grp_str
));
245 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
250 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
251 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
252 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes" : "no",
253 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no",
255 } /* scan interface channels */
256 } /* scan interfaces */
259 static void pim_show_assert_metric(struct vty
*vty
)
261 struct listnode
*ifnode
;
262 struct interface
*ifp
;
265 "Interface Address Source Group RPT Pref Metric Address %s",
268 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
269 struct pim_interface
*pim_ifp
;
270 struct in_addr ifaddr
;
271 struct listnode
*ch_node
;
272 struct pim_ifchannel
*ch
;
279 ifaddr
= pim_ifp
->primary_address
;
281 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
282 char ch_src_str
[100];
283 char ch_grp_str
[100];
285 struct pim_assert_metric am
;
287 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
, pim_ifp
->primary_address
);
289 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
290 ch_src_str
, sizeof(ch_src_str
));
291 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
292 ch_grp_str
, sizeof(ch_grp_str
));
293 pim_inet4_dump("<addr?>", am
.ip_address
,
294 addr_str
, sizeof(addr_str
));
296 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s%s",
301 am
.rpt_bit_flag
? "yes" : "no",
302 am
.metric_preference
,
306 } /* scan interface channels */
307 } /* scan interfaces */
310 static void pim_show_assert_winner_metric(struct vty
*vty
)
312 struct listnode
*ifnode
;
313 struct interface
*ifp
;
316 "Interface Address Source Group RPT Pref Metric Address %s",
319 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
320 struct pim_interface
*pim_ifp
;
321 struct in_addr ifaddr
;
322 struct listnode
*ch_node
;
323 struct pim_ifchannel
*ch
;
330 ifaddr
= pim_ifp
->primary_address
;
332 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
333 char ch_src_str
[100];
334 char ch_grp_str
[100];
336 struct pim_assert_metric
*am
;
340 am
= &ch
->ifassert_winner_metric
;
342 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
343 ch_src_str
, sizeof(ch_src_str
));
344 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
345 ch_grp_str
, sizeof(ch_grp_str
));
346 pim_inet4_dump("<addr?>", am
->ip_address
,
347 addr_str
, sizeof(addr_str
));
349 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
350 snprintf(pref_str
, sizeof(pref_str
), "INFI");
352 snprintf(pref_str
, sizeof(pref_str
), "%4u", am
->metric_preference
);
354 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
355 snprintf(metr_str
, sizeof(metr_str
), "INFI");
357 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
359 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
364 am
->rpt_bit_flag
? "yes" : "no",
369 } /* scan interface channels */
370 } /* scan interfaces */
373 static void pim_show_membership(struct vty
*vty
)
375 struct listnode
*ifnode
;
376 struct interface
*ifp
;
379 "Interface Address Source Group Membership%s",
382 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
383 struct pim_interface
*pim_ifp
;
384 struct in_addr ifaddr
;
385 struct listnode
*ch_node
;
386 struct pim_ifchannel
*ch
;
393 ifaddr
= pim_ifp
->primary_address
;
395 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
396 char ch_src_str
[100];
397 char ch_grp_str
[100];
399 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
400 ch_src_str
, sizeof(ch_src_str
));
401 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
402 ch_grp_str
, sizeof(ch_grp_str
));
404 vty_out(vty
, "%-9s %-15s %-15s %-15s %-10s%s",
409 ch
->local_ifmembership
== PIM_IFMEMBERSHIP_NOINFO
?
410 "NOINFO" : "INCLUDE",
412 } /* scan interface channels */
413 } /* scan interfaces */
417 static void igmp_show_interfaces(struct vty
*vty
)
419 struct listnode
*node
;
420 struct interface
*ifp
;
423 now
= pim_time_monotonic_sec();
426 "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s",
429 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
430 struct pim_interface
*pim_ifp
;
431 struct listnode
*sock_node
;
432 struct igmp_sock
*igmp
;
439 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
443 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
445 mloop
= pim_socket_mcastloop_get(igmp
->fd
);
447 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
449 inet_ntoa(igmp
->ifaddr
),
453 if_is_multicast(ifp
) ? "yes" : "no",
454 if_is_broadcast(ifp
) ? "yes" : "no",
455 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
456 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
457 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
458 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
464 static void igmp_show_interface_join(struct vty
*vty
)
466 struct listnode
*node
;
467 struct interface
*ifp
;
470 now
= pim_time_monotonic_sec();
473 "Interface Address Source Group Socket Uptime %s",
476 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
477 struct pim_interface
*pim_ifp
;
478 struct listnode
*join_node
;
479 struct igmp_join
*ij
;
480 struct in_addr pri_addr
;
481 char pri_addr_str
[100];
488 if (!pim_ifp
->igmp_join_list
)
491 pri_addr
= pim_find_primary_addr(ifp
);
492 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
494 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, join_node
, ij
)) {
496 char source_str
[100];
499 pim_time_uptime(uptime
, sizeof(uptime
), now
- ij
->sock_creation
);
500 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
501 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
503 vty_out(vty
, "%-9s %-15s %-15s %-15s %6d %8s%s",
511 } /* for (pim_ifp->igmp_join_list) */
517 static void show_interface_address(struct vty
*vty
)
519 struct listnode
*ifpnode
;
520 struct interface
*ifp
;
523 "Interface Primary Secondary %s",
526 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifpnode
, ifp
)) {
527 struct listnode
*ifcnode
;
528 struct connected
*ifc
;
529 struct in_addr pri_addr
;
530 char pri_addr_str
[100];
532 pri_addr
= pim_find_primary_addr(ifp
);
534 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
536 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, ifcnode
, ifc
)) {
537 char sec_addr_str
[100];
538 struct prefix
*p
= ifc
->address
;
540 if (p
->family
!= AF_INET
)
543 if (p
->u
.prefix4
.s_addr
== pri_addr
.s_addr
) {
544 sec_addr_str
[0] = '\0';
547 pim_inet4_dump("<sec?>", p
->u
.prefix4
, sec_addr_str
, sizeof(sec_addr_str
));
550 vty_out(vty
, "%-9s %-15s %-15s%s",
559 static void pim_show_dr(struct vty
*vty
)
561 struct listnode
*node
;
562 struct interface
*ifp
;
565 now
= pim_time_monotonic_sec();
568 "NonPri: Number of neighbors missing DR Priority hello option%s"
569 "DrPri: Designated Router Priority sent%s%s",
570 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
572 vty_out(vty
, "Interface Address DR Uptime Elections Changes NonPri DrPri%s", VTY_NEWLINE
);
574 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
575 struct pim_interface
*pim_ifp
;
576 struct in_addr ifaddr
;
585 if (pim_ifp
->pim_sock_fd
< 0)
588 ifaddr
= pim_ifp
->primary_address
;
590 pim_time_uptime_begin(dr_uptime
, sizeof(dr_uptime
),
591 now
, pim_ifp
->pim_dr_election_last
);
593 pim_inet4_dump("<dr?>", pim_ifp
->pim_dr_addr
,
594 dr_str
, sizeof(dr_str
));
596 vty_out(vty
, "%-9s %-15s %-15s %8s %9d %7d %6d %10d%s",
601 pim_ifp
->pim_dr_election_count
,
602 pim_ifp
->pim_dr_election_changes
,
603 pim_ifp
->pim_dr_num_nondrpri_neighbors
,
604 pim_ifp
->pim_dr_priority
,
609 static void pim_show_hello(struct vty
*vty
)
611 struct listnode
*node
;
612 struct interface
*ifp
;
615 now
= pim_time_monotonic_sec();
617 vty_out(vty
, "Interface Address Period Timer StatStart Recv Rfail Send Sfail LGenid%s", VTY_NEWLINE
);
619 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
620 struct pim_interface
*pim_ifp
;
621 struct in_addr ifaddr
;
622 char hello_period
[10];
623 char hello_timer
[10];
624 char stat_uptime
[10];
631 if (pim_ifp
->pim_sock_fd
< 0)
634 ifaddr
= pim_ifp
->primary_address
;
636 pim_time_timer_to_mmss(hello_timer
, sizeof(hello_timer
), pim_ifp
->t_pim_hello_timer
);
637 pim_time_mmss(hello_period
, sizeof(hello_period
), pim_ifp
->pim_hello_period
);
638 pim_time_uptime(stat_uptime
, sizeof(stat_uptime
), now
- pim_ifp
->pim_ifstat_start
);
640 vty_out(vty
, "%-9s %-15s %6s %5s %9s %4u %5u %4u %5u %08x%s",
646 pim_ifp
->pim_ifstat_hello_recv
,
647 pim_ifp
->pim_ifstat_hello_recvfail
,
648 pim_ifp
->pim_ifstat_hello_sent
,
649 pim_ifp
->pim_ifstat_hello_sendfail
,
650 pim_ifp
->pim_generation_id
,
655 static void pim_show_interfaces(struct vty
*vty
)
657 struct listnode
*node
;
658 struct interface
*ifp
;
661 now
= pim_time_monotonic_sec();
663 vty_out(vty
, "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s", VTY_NEWLINE
);
665 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
666 struct pim_interface
*pim_ifp
;
667 struct in_addr ifaddr
;
676 if (pim_ifp
->pim_sock_fd
< 0)
679 ifaddr
= pim_ifp
->primary_address
;
681 pim_time_uptime(uptime
, sizeof(uptime
), now
- pim_ifp
->pim_sock_creation
);
683 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
685 vty_out(vty
, "%-9s %-15s %7d %6d %8s %5s %5s %5s %5s %5s %3s%s",
689 pim_ifp
->pim_sock_fd
,
691 if_is_multicast(ifp
) ? "yes" : "no",
692 if_is_broadcast(ifp
) ? "yes" : "no",
693 (mloop
< 0) ? "?" : (mloop
? "yes" : "no"),
694 (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no",
695 (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no",
696 PIM_IF_IS_DELETED(ifp
) ? "yes" : "no",
701 static void pim_show_join(struct vty
*vty
)
703 struct listnode
*ifnode
;
704 struct interface
*ifp
;
707 now
= pim_time_monotonic_sec();
710 "Interface Address Source Group State Uptime Expire Prune%s",
713 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
714 struct pim_interface
*pim_ifp
;
715 struct in_addr ifaddr
;
716 struct listnode
*ch_node
;
717 struct pim_ifchannel
*ch
;
724 ifaddr
= pim_ifp
->primary_address
;
726 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, ch_node
, ch
)) {
727 char ch_src_str
[100];
728 char ch_grp_str
[100];
733 pim_inet4_dump("<ch_src?>", ch
->sg
.u
.sg
.src
,
734 ch_src_str
, sizeof(ch_src_str
));
735 pim_inet4_dump("<ch_grp?>", ch
->sg
.u
.sg
.grp
,
736 ch_grp_str
, sizeof(ch_grp_str
));
738 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
739 pim_time_timer_to_mmss(expire
, sizeof(expire
),
740 ch
->t_ifjoin_expiry_timer
);
741 pim_time_timer_to_mmss(prune
, sizeof(prune
),
742 ch
->t_ifjoin_prune_pending_timer
);
744 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
749 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
),
754 } /* scan interface channels */
755 } /* scan interfaces */
759 static void pim_show_neighbors(struct vty
*vty
)
761 struct listnode
*node
;
762 struct interface
*ifp
;
765 now
= pim_time_monotonic_sec();
768 "Recv flags: H=holdtime L=lan_prune_delay P=dr_priority G=generation_id A=address_list%s"
769 " T=can_disable_join_suppression%s%s",
770 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
772 vty_out(vty
, "Interface Address Neighbor Uptime Timer Holdt DrPri GenId Recv %s", VTY_NEWLINE
);
774 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
775 struct pim_interface
*pim_ifp
;
776 struct in_addr ifaddr
;
777 struct listnode
*neighnode
;
778 struct pim_neighbor
*neigh
;
785 if (pim_ifp
->pim_sock_fd
< 0)
788 ifaddr
= pim_ifp
->primary_address
;
790 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
794 char neigh_src_str
[100];
797 pim_inet4_dump("<src?>", neigh
->source_addr
,
798 neigh_src_str
, sizeof(neigh_src_str
));
799 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
800 pim_time_mmss(holdtime
, sizeof(holdtime
), neigh
->holdtime
);
801 pim_time_timer_to_mmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
803 recv
[0] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
) ? 'H' : ' ';
804 recv
[1] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? 'L' : ' ';
805 recv
[2] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
) ? 'P' : ' ';
806 recv
[3] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
) ? 'G' : ' ';
807 recv
[4] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
) ? 'A' : ' ';
808 recv
[5] = PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
) ? 'T' : ' ';
811 vty_out(vty
, "%-9s %-15s %-15s %8s %5s %5s %5u %08x %6s%s",
819 neigh
->generation_id
,
828 static void pim_show_lan_prune_delay(struct vty
*vty
)
830 struct listnode
*node
;
831 struct interface
*ifp
;
834 "PrDly=propagation_delay (msec) OvInt=override_interval (msec)%s"
835 "HiDly=highest_propagation_delay (msec) HiInt=highest_override_interval (msec)%s"
836 "NoDly=number_of_non_lan_delay_neighbors%s"
837 "T=t_bit LPD=lan_prune_delay_hello_option%s%s",
838 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
840 vty_out(vty
, "Interface Address PrDly OvInt NoDly HiDly HiInt T | Neighbor LPD PrDly OvInt T%s", VTY_NEWLINE
);
842 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
843 struct pim_interface
*pim_ifp
;
844 struct in_addr ifaddr
;
845 struct listnode
*neighnode
;
846 struct pim_neighbor
*neigh
;
853 if (pim_ifp
->pim_sock_fd
< 0)
856 ifaddr
= pim_ifp
->primary_address
;
858 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
859 char neigh_src_str
[100];
861 pim_inet4_dump("<src?>", neigh
->source_addr
,
862 neigh_src_str
, sizeof(neigh_src_str
));
864 vty_out(vty
, "%-9s %-15s %5u %5u %5u %5u %5u %1u | %-15s %-3s %5u %5u %1u%s",
867 pim_ifp
->pim_propagation_delay_msec
,
868 pim_ifp
->pim_override_interval_msec
,
869 pim_ifp
->pim_number_of_nonlandelay_neighbors
,
870 pim_ifp
->pim_neighbors_highest_propagation_delay_msec
,
871 pim_ifp
->pim_neighbors_highest_override_interval_msec
,
872 PIM_FORCE_BOOLEAN(PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp
->options
)),
874 PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
) ? "yes" : "no",
875 neigh
->propagation_delay_msec
,
876 neigh
->override_interval_msec
,
877 PIM_FORCE_BOOLEAN(PIM_OPTION_IS_SET(neigh
->hello_options
,
878 PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
)),
885 static void pim_show_jp_override_interval(struct vty
*vty
)
887 struct listnode
*node
;
888 struct interface
*ifp
;
891 "EffPDelay=effective_propagation_delay (msec)%s"
892 "EffOvrInt=override_interval (msec)%s"
893 "JPOvrInt=jp_override_interval (msec)%s%s",
894 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
896 vty_out(vty
, "Interface Address LAN_Delay EffPDelay EffOvrInt JPOvrInt%s", VTY_NEWLINE
);
898 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
899 struct pim_interface
*pim_ifp
;
900 struct in_addr ifaddr
;
907 if (pim_ifp
->pim_sock_fd
< 0)
910 ifaddr
= pim_ifp
->primary_address
;
912 vty_out(vty
, "%-9s %-15s %-9s %9u %9u %8u%s",
915 pim_if_lan_delay_enabled(ifp
) ? "enabled" : "disabled",
916 pim_if_effective_propagation_delay_msec(ifp
),
917 pim_if_effective_override_interval_msec(ifp
),
918 pim_if_jp_override_interval_msec(ifp
),
923 static void pim_show_neighbors_secondary(struct vty
*vty
)
925 struct listnode
*node
;
926 struct interface
*ifp
;
928 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
930 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
931 struct pim_interface
*pim_ifp
;
932 struct in_addr ifaddr
;
933 struct listnode
*neighnode
;
934 struct pim_neighbor
*neigh
;
941 if (pim_ifp
->pim_sock_fd
< 0)
944 ifaddr
= pim_ifp
->primary_address
;
946 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
947 char neigh_src_str
[100];
948 struct listnode
*prefix_node
;
951 if (!neigh
->prefix_list
)
954 pim_inet4_dump("<src?>", neigh
->source_addr
,
955 neigh_src_str
, sizeof(neigh_src_str
));
957 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
958 char neigh_sec_str
[100];
960 if (p
->family
!= AF_INET
)
963 pim_inet4_dump("<src?>", p
->u
.prefix4
,
964 neigh_sec_str
, sizeof(neigh_sec_str
));
966 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
977 static void pim_show_upstream(struct vty
*vty
)
979 struct listnode
*upnode
;
980 struct pim_upstream
*up
;
983 now
= pim_time_monotonic_sec();
985 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RSTimer RefCnt%s", VTY_NEWLINE
);
987 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
994 pim_inet4_dump("<src?>", up
->sg
.u
.sg
.src
, src_str
, sizeof(src_str
));
995 pim_inet4_dump("<grp?>", up
->sg
.u
.sg
.grp
, grp_str
, sizeof(grp_str
));
996 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
997 pim_time_timer_to_hhmmss(join_timer
, sizeof(join_timer
), up
->t_join_timer
);
998 pim_time_timer_to_hhmmss (rs_timer
, sizeof (rs_timer
), up
->t_rs_timer
);
1000 vty_out(vty
, "%-10s%-15s %-15s %-5s %-8s %-9s %-9s %6d%s",
1001 up
->rpf
.source_nexthop
.interface
->name
,
1004 pim_upstream_state2str (up
),
1013 static void pim_show_join_desired(struct vty
*vty
)
1015 struct listnode
*ifnode
;
1016 struct listnode
*chnode
;
1017 struct interface
*ifp
;
1018 struct pim_interface
*pim_ifp
;
1019 struct pim_ifchannel
*ch
;
1024 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1027 /* scan all interfaces */
1028 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1029 pim_ifp
= ifp
->info
;
1033 /* scan per-interface (S,G) state */
1034 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_ifchannel_list
, chnode
, ch
)) {
1035 struct pim_upstream
*up
= ch
->upstream
;
1037 pim_inet4_dump("<src?>", up
->sg
.u
.sg
.src
, src_str
, sizeof(src_str
));
1038 pim_inet4_dump("<grp?>", up
->sg
.u
.sg
.grp
, grp_str
, sizeof(grp_str
));
1040 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
1044 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
1045 pim_macro_chisin_joins(ch
) ? "yes" : "no",
1046 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
1047 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
1048 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
1054 static void pim_show_upstream_rpf(struct vty
*vty
)
1056 struct listnode
*upnode
;
1057 struct pim_upstream
*up
;
1060 "Source Group RpfIface RibNextHop RpfAddress %s",
1063 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, upnode
, up
)) {
1066 char rpf_nexthop_str
[100];
1067 char rpf_addr_str
[100];
1068 struct pim_rpf
*rpf
;
1069 const char *rpf_ifname
;
1073 pim_inet4_dump("<src?>", up
->sg
.u
.sg
.src
, src_str
, sizeof(src_str
));
1074 pim_inet4_dump("<grp?>", up
->sg
.u
.sg
.grp
, grp_str
, sizeof(grp_str
));
1075 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
1076 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1078 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1080 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
1090 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
)
1092 char refresh_uptime
[10];
1094 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
1097 "RPF Cache Refresh Delay: %ld msecs%s"
1098 "RPF Cache Refresh Timer: %ld msecs%s"
1099 "RPF Cache Refresh Requests: %lld%s"
1100 "RPF Cache Refresh Events: %lld%s"
1101 "RPF Cache Refresh Last: %s%s",
1102 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1103 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1104 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1105 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1106 refresh_uptime
, VTY_NEWLINE
);
1109 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1111 char uptime_scan_oil
[10];
1112 char uptime_mroute_add
[10];
1113 char uptime_mroute_del
[10];
1115 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1116 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1117 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1120 "Scan OIL - Last: %s Events: %lld%s"
1121 "MFC Add - Last: %s Events: %lld%s"
1122 "MFC Del - Last: %s Events: %lld%s",
1123 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1124 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1125 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
1128 static void pim_show_rpf(struct vty
*vty
)
1130 struct listnode
*up_node
;
1131 struct pim_upstream
*up
;
1132 time_t now
= pim_time_monotonic_sec();
1134 show_rpf_refresh_stats(vty
, now
);
1136 vty_out(vty
, "%s", VTY_NEWLINE
);
1139 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
1142 for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list
, up_node
, up
)) {
1145 char rpf_addr_str
[100];
1146 char rib_nexthop_str
[100];
1147 const char *rpf_ifname
;
1148 struct pim_rpf
*rpf
= &up
->rpf
;
1150 pim_inet4_dump("<src?>", up
->sg
.u
.sg
.src
, src_str
, sizeof(src_str
));
1151 pim_inet4_dump("<grp?>", up
->sg
.u
.sg
.grp
, grp_str
, sizeof(grp_str
));
1152 pim_inet4_dump("<rpf?>", rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1153 pim_inet4_dump("<nexthop?>", rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
1155 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1157 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
1163 rpf
->source_nexthop
.mrib_route_metric
,
1164 rpf
->source_nexthop
.mrib_metric_preference
,
1169 static void igmp_show_querier(struct vty
*vty
)
1171 struct listnode
*node
;
1172 struct interface
*ifp
;
1174 vty_out(vty
, "Interface Address Querier StartCount Query-Timer Other-Timer%s", VTY_NEWLINE
);
1176 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1177 struct pim_interface
*pim_ifp
= ifp
->info
;
1178 struct listnode
*sock_node
;
1179 struct igmp_sock
*igmp
;
1184 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1185 char query_hhmmss
[10];
1186 char other_hhmmss
[10];
1188 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
1189 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
1191 vty_out(vty
, "%-9s %-15s %-7s %10d %11s %11s%s",
1193 inet_ntoa(igmp
->ifaddr
),
1194 igmp
->t_igmp_query_timer
? "THIS" : "OTHER",
1195 igmp
->startup_query_count
,
1203 static void igmp_show_groups(struct vty
*vty
)
1205 struct listnode
*ifnode
;
1206 struct interface
*ifp
;
1209 now
= pim_time_monotonic_sec();
1211 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
1213 /* scan interfaces */
1214 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1215 struct pim_interface
*pim_ifp
= ifp
->info
;
1216 struct listnode
*sock_node
;
1217 struct igmp_sock
*igmp
;
1222 /* scan igmp sockets */
1223 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1224 char ifaddr_str
[100];
1225 struct listnode
*grpnode
;
1226 struct igmp_group
*grp
;
1228 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1230 /* scan igmp groups */
1231 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1232 char group_str
[100];
1236 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1237 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
1238 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
1240 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
1244 grp
->group_filtermode_isexcl
? "EXCL" : "INCL",
1246 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
1247 igmp_group_compat_mode(igmp
, grp
),
1251 } /* scan igmp groups */
1252 } /* scan igmp sockets */
1253 } /* scan interfaces */
1256 static void igmp_show_group_retransmission(struct vty
*vty
)
1258 struct listnode
*ifnode
;
1259 struct interface
*ifp
;
1261 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
1263 /* scan interfaces */
1264 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1265 struct pim_interface
*pim_ifp
= ifp
->info
;
1266 struct listnode
*sock_node
;
1267 struct igmp_sock
*igmp
;
1272 /* scan igmp sockets */
1273 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1274 char ifaddr_str
[100];
1275 struct listnode
*grpnode
;
1276 struct igmp_group
*grp
;
1278 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1280 /* scan igmp groups */
1281 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1282 char group_str
[100];
1283 char grp_retr_mmss
[10];
1284 struct listnode
*src_node
;
1285 struct igmp_source
*src
;
1286 int grp_retr_sources
= 0;
1288 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1289 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
1292 /* count group sources with retransmission state */
1293 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
1294 if (src
->source_query_retransmit_count
> 0) {
1299 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
1304 grp
->group_specific_query_retransmit_count
,
1308 } /* scan igmp groups */
1309 } /* scan igmp sockets */
1310 } /* scan interfaces */
1313 static void igmp_show_parameters(struct vty
*vty
)
1315 struct listnode
*ifnode
;
1316 struct interface
*ifp
;
1319 "QRV: Robustness Variable SQI: Startup Query Interval%s"
1320 "QQI: Query Interval OQPI: Other Querier Present Interval%s"
1321 "QRI: Query Response Interval LMQT: Last Member Query Time%s"
1322 "GMI: Group Membership Interval OHPI: Older Host Present Interval%s%s",
1323 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
1326 "Interface Address QRV QQI QRI GMI SQI OQPI LMQT OHPI %s",
1329 /* scan interfaces */
1330 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1331 struct pim_interface
*pim_ifp
= ifp
->info
;
1332 struct listnode
*sock_node
;
1333 struct igmp_sock
*igmp
;
1338 /* scan igmp sockets */
1339 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1340 char ifaddr_str
[100];
1341 long gmi_dsec
; /* Group Membership Interval */
1342 long oqpi_dsec
; /* Other Querier Present Interval */
1348 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1350 gmi_dsec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
1351 igmp
->querier_query_interval
,
1352 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1354 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
1356 oqpi_dsec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
1357 igmp
->querier_query_interval
,
1358 pim_ifp
->igmp_query_max_response_time_dsec
) / 100;
1360 lmqt_dsec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
1361 igmp
->querier_robustness_variable
) / 100;
1363 ohpi_dsec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
1364 igmp
->querier_query_interval
,
1365 pim_ifp
->igmp_query_max_response_time_dsec
);
1367 qri_dsec
= pim_ifp
->igmp_query_max_response_time_dsec
;
1370 "%-9s %-15s %3d %3d %3ld.%ld %3ld.%ld %3d %3ld.%ld %3ld.%ld %3ld.%ld%s",
1373 igmp
->querier_robustness_variable
,
1374 igmp
->querier_query_interval
,
1375 qri_dsec
/ 10, qri_dsec
% 10,
1376 gmi_dsec
/ 10, gmi_dsec
% 10,
1378 oqpi_dsec
/ 10, oqpi_dsec
% 10,
1379 lmqt_dsec
/ 10, lmqt_dsec
% 10,
1380 ohpi_dsec
/ 10, ohpi_dsec
% 10,
1383 } /* scan igmp sockets */
1384 } /* scan interfaces */
1387 static void igmp_show_sources(struct vty
*vty
)
1389 struct listnode
*ifnode
;
1390 struct interface
*ifp
;
1393 now
= pim_time_monotonic_sec();
1395 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
1397 /* scan interfaces */
1398 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1399 struct pim_interface
*pim_ifp
= ifp
->info
;
1400 struct listnode
*sock_node
;
1401 struct igmp_sock
*igmp
;
1406 /* scan igmp sockets */
1407 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1408 char ifaddr_str
[100];
1409 struct listnode
*grpnode
;
1410 struct igmp_group
*grp
;
1412 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1414 /* scan igmp groups */
1415 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1416 char group_str
[100];
1417 struct listnode
*srcnode
;
1418 struct igmp_source
*src
;
1420 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1422 /* scan group sources */
1423 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1424 char source_str
[100];
1428 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1430 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
1432 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
1434 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
1440 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
1444 } /* scan group sources */
1445 } /* scan igmp groups */
1446 } /* scan igmp sockets */
1447 } /* scan interfaces */
1450 static void igmp_show_source_retransmission(struct vty
*vty
)
1452 struct listnode
*ifnode
;
1453 struct interface
*ifp
;
1455 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
1457 /* scan interfaces */
1458 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
1459 struct pim_interface
*pim_ifp
= ifp
->info
;
1460 struct listnode
*sock_node
;
1461 struct igmp_sock
*igmp
;
1466 /* scan igmp sockets */
1467 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
1468 char ifaddr_str
[100];
1469 struct listnode
*grpnode
;
1470 struct igmp_group
*grp
;
1472 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
1474 /* scan igmp groups */
1475 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
1476 char group_str
[100];
1477 struct listnode
*srcnode
;
1478 struct igmp_source
*src
;
1480 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
1482 /* scan group sources */
1483 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
1484 char source_str
[100];
1486 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
1488 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
1493 src
->source_query_retransmit_count
,
1496 } /* scan group sources */
1497 } /* scan igmp groups */
1498 } /* scan igmp sockets */
1499 } /* scan interfaces */
1502 static void clear_igmp_interfaces()
1504 struct listnode
*ifnode
;
1505 struct listnode
*ifnextnode
;
1506 struct interface
*ifp
;
1508 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1509 pim_if_addr_del_all_igmp(ifp
);
1512 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1513 pim_if_addr_add_all(ifp
);
1517 static void clear_pim_interfaces()
1519 struct listnode
*ifnode
;
1520 struct listnode
*ifnextnode
;
1521 struct interface
*ifp
;
1523 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
1525 pim_neighbor_delete_all(ifp
, "interface cleared");
1530 static void clear_interfaces()
1532 clear_igmp_interfaces();
1533 clear_pim_interfaces();
1536 DEFUN (clear_ip_interfaces
,
1537 clear_ip_interfaces_cmd
,
1538 "clear ip interfaces",
1541 "Reset interfaces\n")
1548 DEFUN (clear_ip_igmp_interfaces
,
1549 clear_ip_igmp_interfaces_cmd
,
1550 "clear ip igmp interfaces",
1554 "Reset IGMP interfaces\n")
1556 clear_igmp_interfaces();
1561 static void mroute_add_all()
1563 struct listnode
*node
;
1564 struct channel_oil
*c_oil
;
1566 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1567 if (pim_mroute_add(c_oil
)) {
1568 /* just log warning */
1569 char source_str
[100];
1570 char group_str
[100];
1571 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1572 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1573 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1574 __FILE__
, __PRETTY_FUNCTION__
,
1575 source_str
, group_str
);
1580 static void mroute_del_all()
1582 struct listnode
*node
;
1583 struct channel_oil
*c_oil
;
1585 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
1586 if (pim_mroute_del(c_oil
)) {
1587 /* just log warning */
1588 char source_str
[100];
1589 char group_str
[100];
1590 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1591 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1592 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1593 __FILE__
, __PRETTY_FUNCTION__
,
1594 source_str
, group_str
);
1599 static void static_mroute_add_all()
1601 struct listnode
*node
;
1602 struct static_route
*s_route
;
1604 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1605 if (pim_mroute_add(&s_route
->c_oil
)) {
1606 /* just log warning */
1607 char source_str
[100];
1608 char group_str
[100];
1609 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1610 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1611 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
1612 __FILE__
, __PRETTY_FUNCTION__
,
1613 source_str
, group_str
);
1618 static void static_mroute_del_all()
1620 struct listnode
*node
;
1621 struct static_route
*s_route
;
1623 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
1624 if (pim_mroute_del(&s_route
->c_oil
)) {
1625 /* just log warning */
1626 char source_str
[100];
1627 char group_str
[100];
1628 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
1629 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
1630 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
1631 __FILE__
, __PRETTY_FUNCTION__
,
1632 source_str
, group_str
);
1637 DEFUN (clear_ip_mroute
,
1638 clear_ip_mroute_cmd
,
1642 "Reset multicast routes\n")
1650 DEFUN (clear_ip_pim_interfaces
,
1651 clear_ip_pim_interfaces_cmd
,
1652 "clear ip pim interfaces",
1656 "Reset PIM interfaces\n")
1658 clear_pim_interfaces();
1663 DEFUN (clear_ip_pim_oil
,
1664 clear_ip_pim_oil_cmd
,
1669 "Rescan PIM OIL (output interface list)\n")
1676 DEFUN (show_ip_igmp_interface
,
1677 show_ip_igmp_interface_cmd
,
1678 "show ip igmp interface",
1682 "IGMP interface information\n")
1684 igmp_show_interfaces(vty
);
1689 DEFUN (show_ip_igmp_join
,
1690 show_ip_igmp_join_cmd
,
1691 "show ip igmp join",
1695 "IGMP static join information\n")
1697 igmp_show_interface_join(vty
);
1702 DEFUN (show_ip_igmp_groups
,
1703 show_ip_igmp_groups_cmd
,
1704 "show ip igmp groups",
1710 igmp_show_groups(vty
);
1715 DEFUN (show_ip_igmp_groups_retransmissions
,
1716 show_ip_igmp_groups_retransmissions_cmd
,
1717 "show ip igmp groups retransmissions",
1722 "IGMP group retransmissions\n")
1724 igmp_show_group_retransmission(vty
);
1729 DEFUN (show_ip_igmp_parameters
,
1730 show_ip_igmp_parameters_cmd
,
1731 "show ip igmp parameters",
1735 "IGMP parameters information\n")
1737 igmp_show_parameters(vty
);
1742 DEFUN (show_ip_igmp_sources
,
1743 show_ip_igmp_sources_cmd
,
1744 "show ip igmp sources",
1750 igmp_show_sources(vty
);
1755 DEFUN (show_ip_igmp_sources_retransmissions
,
1756 show_ip_igmp_sources_retransmissions_cmd
,
1757 "show ip igmp sources retransmissions",
1762 "IGMP source retransmissions\n")
1764 igmp_show_source_retransmission(vty
);
1769 DEFUN (show_ip_igmp_querier
,
1770 show_ip_igmp_querier_cmd
,
1771 "show ip igmp querier",
1775 "IGMP querier information\n")
1777 igmp_show_querier(vty
);
1782 DEFUN (show_ip_pim_address
,
1783 show_ip_pim_address_cmd
,
1784 "show ip pim address",
1788 "PIM interface address\n")
1790 show_interface_address(vty
);
1795 DEFUN (show_ip_pim_assert
,
1796 show_ip_pim_assert_cmd
,
1797 "show ip pim assert",
1801 "PIM interface assert\n")
1803 pim_show_assert(vty
);
1808 DEFUN (show_ip_pim_assert_internal
,
1809 show_ip_pim_assert_internal_cmd
,
1810 "show ip pim assert-internal",
1814 "PIM interface internal assert state\n")
1816 pim_show_assert_internal(vty
);
1821 DEFUN (show_ip_pim_assert_metric
,
1822 show_ip_pim_assert_metric_cmd
,
1823 "show ip pim assert-metric",
1827 "PIM interface assert metric\n")
1829 pim_show_assert_metric(vty
);
1834 DEFUN (show_ip_pim_assert_winner_metric
,
1835 show_ip_pim_assert_winner_metric_cmd
,
1836 "show ip pim assert-winner-metric",
1840 "PIM interface assert winner metric\n")
1842 pim_show_assert_winner_metric(vty
);
1847 DEFUN (show_ip_pim_dr
,
1849 "show ip pim designated-router",
1853 "PIM interface designated router\n")
1860 DEFUN (show_ip_pim_hello
,
1861 show_ip_pim_hello_cmd
,
1862 "show ip pim hello",
1866 "PIM interface hello information\n")
1868 pim_show_hello(vty
);
1873 DEFUN (show_ip_pim_interface
,
1874 show_ip_pim_interface_cmd
,
1875 "show ip pim interface",
1879 "PIM interface information\n")
1881 pim_show_interfaces(vty
);
1886 DEFUN (show_ip_pim_join
,
1887 show_ip_pim_join_cmd
,
1892 "PIM interface join information\n")
1899 DEFUN (show_ip_pim_lan_prune_delay
,
1900 show_ip_pim_lan_prune_delay_cmd
,
1901 "show ip pim lan-prune-delay",
1905 "PIM neighbors LAN prune delay parameters\n")
1907 pim_show_lan_prune_delay(vty
);
1912 DEFUN (show_ip_pim_local_membership
,
1913 show_ip_pim_local_membership_cmd
,
1914 "show ip pim local-membership",
1918 "PIM interface local-membership\n")
1920 pim_show_membership(vty
);
1925 DEFUN (show_ip_pim_jp_override_interval
,
1926 show_ip_pim_jp_override_interval_cmd
,
1927 "show ip pim jp-override-interval",
1931 "PIM interface J/P override interval\n")
1933 pim_show_jp_override_interval(vty
);
1938 DEFUN (show_ip_pim_neighbor
,
1939 show_ip_pim_neighbor_cmd
,
1940 "show ip pim neighbor",
1944 "PIM neighbor information\n")
1946 pim_show_neighbors(vty
);
1951 DEFUN (show_ip_pim_secondary
,
1952 show_ip_pim_secondary_cmd
,
1953 "show ip pim secondary",
1957 "PIM neighbor addresses\n")
1959 pim_show_neighbors_secondary(vty
);
1964 DEFUN (show_ip_pim_upstream
,
1965 show_ip_pim_upstream_cmd
,
1966 "show ip pim upstream",
1970 "PIM upstream information\n")
1972 pim_show_upstream(vty
);
1977 DEFUN (show_ip_pim_upstream_join_desired
,
1978 show_ip_pim_upstream_join_desired_cmd
,
1979 "show ip pim upstream-join-desired",
1983 "PIM upstream join-desired\n")
1985 pim_show_join_desired(vty
);
1990 DEFUN (show_ip_pim_upstream_rpf
,
1991 show_ip_pim_upstream_rpf_cmd
,
1992 "show ip pim upstream-rpf",
1996 "PIM upstream source rpf\n")
1998 pim_show_upstream_rpf(vty
);
2003 DEFUN (show_ip_pim_rpf
,
2004 show_ip_pim_rpf_cmd
,
2009 "PIM cached source rpf information\n")
2016 static void show_multicast_interfaces(struct vty
*vty
)
2018 struct listnode
*node
;
2019 struct interface
*ifp
;
2021 vty_out(vty
, "%s", VTY_NEWLINE
);
2023 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2026 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2027 struct pim_interface
*pim_ifp
;
2028 struct in_addr ifaddr
;
2029 struct sioc_vif_req vreq
;
2031 pim_ifp
= ifp
->info
;
2036 memset(&vreq
, 0, sizeof(vreq
));
2037 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2039 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2040 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2041 (unsigned long)SIOCGETVIFCNT
,
2043 pim_ifp
->mroute_vif_index
,
2045 safe_strerror(errno
),
2049 ifaddr
= pim_ifp
->primary_address
;
2051 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2055 pim_ifp
->mroute_vif_index
,
2056 (unsigned long) vreq
.icount
,
2057 (unsigned long) vreq
.ocount
,
2058 (unsigned long) vreq
.ibytes
,
2059 (unsigned long) vreq
.obytes
,
2064 DEFUN (show_ip_multicast
,
2065 show_ip_multicast_cmd
,
2066 "show ip multicast",
2069 "Multicast global information\n")
2071 time_t now
= pim_time_monotonic_sec();
2073 if (PIM_MROUTE_IS_ENABLED
) {
2076 vty_out(vty
, "Mroute socket descriptor: %d%s",
2077 qpim_mroute_socket_fd
,
2080 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
2081 vty_out(vty
, "Mroute socket uptime: %s%s",
2086 vty_out(vty
, "Multicast disabled%s",
2090 vty_out(vty
, "%s", VTY_NEWLINE
);
2091 vty_out(vty
, "Zclient update socket: ");
2092 if (qpim_zclient_update
) {
2093 vty_out(vty
, "%d failures=%d%s", qpim_zclient_update
->sock
,
2094 qpim_zclient_update
->fail
, VTY_NEWLINE
);
2097 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2099 vty_out(vty
, "Zclient lookup socket: ");
2100 if (qpim_zclient_lookup
) {
2101 vty_out(vty
, "%d failures=%d%s", qpim_zclient_lookup
->sock
,
2102 qpim_zclient_lookup
->fail
, VTY_NEWLINE
);
2105 vty_out(vty
, "<null zclient>%s", VTY_NEWLINE
);
2108 vty_out(vty
, "%s", VTY_NEWLINE
);
2109 vty_out(vty
, "Current highest VifIndex: %d%s",
2110 qpim_mroute_oif_highest_vif_index
,
2112 vty_out(vty
, "Maximum highest VifIndex: %d%s",
2113 PIM_MAX_USABLE_VIFS
,
2116 vty_out(vty
, "%s", VTY_NEWLINE
);
2117 vty_out(vty
, "Upstream Join Timer: %d secs%s",
2120 vty_out(vty
, "Join/Prune Holdtime: %d secs%s",
2124 vty_out(vty
, "%s", VTY_NEWLINE
);
2126 show_rpf_refresh_stats(vty
, now
);
2128 vty_out(vty
, "%s", VTY_NEWLINE
);
2130 show_scan_oil_stats(vty
, now
);
2132 show_multicast_interfaces(vty
);
2137 static void show_mroute(struct vty
*vty
)
2139 struct listnode
*node
;
2140 struct channel_oil
*c_oil
;
2141 struct static_route
*s_route
;
2144 vty_out(vty
, "Proto: I=IGMP P=PIM S=STATIC O=SOURCE%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
2146 vty_out(vty
, "Source Group Proto Input iVifI Output oVifI TTL Uptime %s",
2149 now
= pim_time_monotonic_sec();
2151 /* print list of PIM and IGMP routes */
2152 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2153 char group_str
[100];
2154 char source_str
[100];
2157 if (!c_oil
->installed
)
2160 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2161 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2163 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2164 struct interface
*ifp_in
;
2165 struct interface
*ifp_out
;
2166 char oif_uptime
[10];
2170 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
2174 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
2175 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2177 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
2180 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
2183 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
2186 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
2190 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2194 ifp_in
? ifp_in
->name
: "<iif?>",
2195 c_oil
->oil
.mfcc_parent
,
2196 ifp_out
? ifp_out
->name
: "<oif?>",
2204 /* Print list of static routes */
2205 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2206 char group_str
[100];
2207 char source_str
[100];
2210 if (!s_route
->c_oil
.installed
)
2213 pim_inet4_dump("<group?>", s_route
->group
, group_str
, sizeof(group_str
));
2214 pim_inet4_dump("<source?>", s_route
->source
, source_str
, sizeof(source_str
));
2216 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
2217 struct interface
*ifp_in
;
2218 struct interface
*ifp_out
;
2219 char oif_uptime
[10];
2223 ttl
= s_route
->oif_ttls
[oif_vif_index
];
2227 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
2228 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
2230 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
2235 vty_out(vty
, "%-15s %-15s %-5s %-5s %5d %-6s %5d %3d %8s %s",
2239 ifp_in
? ifp_in
->name
: "<iif?>",
2241 ifp_out
? ifp_out
->name
: "<oif?>",
2250 DEFUN (show_ip_mroute
,
2261 static void show_mroute_count(struct vty
*vty
)
2263 struct listnode
*node
;
2264 struct channel_oil
*c_oil
;
2265 struct static_route
*s_route
;
2267 vty_out(vty
, "%s", VTY_NEWLINE
);
2269 vty_out(vty
, "Source Group Packets Bytes WrongIf %s",
2272 /* Print PIM and IGMP route counts */
2273 for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list
, node
, c_oil
)) {
2274 char group_str
[100];
2275 char source_str
[100];
2277 if (!c_oil
->installed
)
2280 pim_mroute_update_counters (c_oil
);
2282 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2283 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2285 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2294 /* Print static route counts */
2295 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
2296 char group_str
[100];
2297 char source_str
[100];
2299 if (!s_route
->c_oil
.installed
)
2302 pim_mroute_update_counters (&s_route
->c_oil
);
2304 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2305 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2307 vty_out(vty
, "%-15s %-15s %7ld %10ld %7ld %s",
2310 s_route
->c_oil
.cc
.pktcnt
,
2311 s_route
->c_oil
.cc
.bytecnt
,
2312 s_route
->c_oil
.cc
.wrong_if
,
2317 DEFUN (show_ip_mroute_count
,
2318 show_ip_mroute_count_cmd
,
2319 "show ip mroute count",
2323 "Route and packet count data\n")
2325 show_mroute_count(vty
);
2331 "show ip rib A.B.C.D",
2335 "Unicast address\n")
2338 struct in_addr addr
;
2339 const char *addr_str
;
2340 struct pim_nexthop nexthop
;
2341 char nexthop_addr_str
[100];
2344 addr_str
= argv
[idx_ipv4
]->arg
;
2345 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2347 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
2348 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2352 if (pim_nexthop_lookup(&nexthop
, addr
, NULL
)) {
2353 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
2354 addr_str
, VTY_NEWLINE
);
2358 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
2361 pim_inet4_dump("<nexthop?>", nexthop
.mrib_nexthop_addr
,
2362 nexthop_addr_str
, sizeof(nexthop_addr_str
));
2364 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
2367 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2368 nexthop
.mrib_route_metric
,
2369 nexthop
.mrib_metric_preference
,
2375 static void show_ssmpingd(struct vty
*vty
)
2377 struct listnode
*node
;
2378 struct ssmpingd_sock
*ss
;
2381 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
2384 if (!qpim_ssmpingd_list
)
2387 now
= pim_time_monotonic_sec();
2389 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
2390 char source_str
[100];
2392 struct sockaddr_in bind_addr
;
2393 socklen_t len
= sizeof(bind_addr
);
2394 char bind_addr_str
[100];
2396 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
2398 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
2399 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
2400 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
2403 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
2404 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
2406 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
2410 ntohs(bind_addr
.sin_port
),
2412 (long long)ss
->requests
,
2417 DEFUN (show_ip_ssmpingd
,
2418 show_ip_ssmpingd_cmd
,
2430 "ip pim rp A.B.C.D",
2432 "pim multicast routing\n"
2434 "ip address of RP\n")
2439 result
= inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &qpim_rp
.rpf_addr
.s_addr
);
2441 vty_out(vty
, "%% Bad RP address specified: %s", argv
[idx_ipv4
]->arg
);
2445 if (!pim_rp_setup ())
2447 vty_out(vty
, "%% No Path to RP address specified: %s", argv
[idx_ipv4
]->arg
);
2454 DEFUN (no_ip_pim_rp
,
2456 "no ip pim rp [A.B.C.D]",
2459 "pim multicast routing\n"
2461 "ip address of RP\n")
2463 qpim_rp
.rpf_addr
.s_addr
= INADDR_NONE
;
2468 DEFUN (ip_multicast_routing
,
2469 ip_multicast_routing_cmd
,
2470 "ip multicast-routing",
2472 "Enable IP multicast forwarding\n")
2474 pim_mroute_socket_enable();
2475 pim_if_add_vif_all();
2477 static_mroute_add_all();
2481 DEFUN (no_ip_multicast_routing
,
2482 no_ip_multicast_routing_cmd
,
2483 "no ip multicast-routing",
2486 "Global IP configuration subcommands\n"
2487 "Enable IP multicast forwarding\n")
2490 static_mroute_del_all();
2491 pim_if_del_vif_all();
2492 pim_mroute_socket_disable();
2498 "ip ssmpingd [A.B.C.D]",
2505 struct in_addr source_addr
;
2506 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2508 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2510 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2511 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2515 result
= pim_ssmpingd_start(source_addr
);
2517 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
2518 source_str
, result
, VTY_NEWLINE
);
2525 DEFUN (no_ip_ssmpingd
,
2527 "no ip ssmpingd [A.B.C.D]",
2535 struct in_addr source_addr
;
2536 const char *source_str
= (argc
> idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
2538 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2540 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
2541 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2545 result
= pim_ssmpingd_stop(source_addr
);
2547 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
2548 source_str
, result
, VTY_NEWLINE
);
2555 DEFUN (interface_ip_igmp
,
2556 interface_ip_igmp_cmd
,
2561 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2562 struct pim_interface
*pim_ifp
;
2564 pim_ifp
= ifp
->info
;
2567 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
2569 vty_out(vty
, "Could not enable IGMP on interface %s%s",
2570 ifp
->name
, VTY_NEWLINE
);
2575 PIM_IF_DO_IGMP(pim_ifp
->options
);
2578 pim_if_addr_add_all(ifp
);
2579 pim_if_membership_refresh(ifp
);
2584 DEFUN (interface_no_ip_igmp
,
2585 interface_no_ip_igmp_cmd
,
2591 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2592 struct pim_interface
*pim_ifp
;
2594 pim_ifp
= ifp
->info
;
2598 PIM_IF_DONT_IGMP(pim_ifp
->options
);
2600 pim_if_membership_clear(ifp
);
2602 pim_if_addr_del_all_igmp(ifp
);
2604 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
2611 DEFUN (interface_ip_igmp_join
,
2612 interface_ip_igmp_join_cmd
,
2613 "ip igmp join A.B.C.D A.B.C.D",
2616 "IGMP join multicast group\n"
2617 "Multicast group address\n"
2620 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2623 const char *group_str
;
2624 const char *source_str
;
2625 struct in_addr group_addr
;
2626 struct in_addr source_addr
;
2630 group_str
= argv
[idx_ipv4
]->arg
;
2631 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2633 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2634 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2638 /* Source address */
2639 source_str
= argv
[idx_ipv4_2
]->arg
;
2640 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2642 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2643 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2647 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
2649 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
2650 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2657 DEFUN (interface_no_ip_igmp_join
,
2658 interface_no_ip_igmp_join_cmd
,
2659 "no ip igmp join A.B.C.D A.B.C.D",
2663 "IGMP join multicast group\n"
2664 "Multicast group address\n"
2667 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2670 const char *group_str
;
2671 const char *source_str
;
2672 struct in_addr group_addr
;
2673 struct in_addr source_addr
;
2677 group_str
= argv
[idx_ipv4
]->arg
;
2678 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
2680 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
2681 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2685 /* Source address */
2686 source_str
= argv
[idx_ipv4_2
]->arg
;
2687 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
2689 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
2690 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
2694 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
2696 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
2697 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
2705 CLI reconfiguration affects the interface level (struct pim_interface).
2706 This function propagates the reconfiguration to every active socket
2709 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
2711 struct interface
*ifp
;
2712 struct pim_interface
*pim_ifp
;
2716 /* other querier present? */
2718 if (igmp
->t_other_querier_timer
)
2721 /* this is the querier */
2723 zassert(igmp
->interface
);
2724 zassert(igmp
->interface
->info
);
2726 ifp
= igmp
->interface
;
2727 pim_ifp
= ifp
->info
;
2729 if (PIM_DEBUG_IGMP_TRACE
) {
2730 char ifaddr_str
[100];
2731 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2732 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
2733 __PRETTY_FUNCTION__
,
2736 pim_ifp
->igmp_default_query_interval
);
2740 igmp_startup_mode_on() will reset QQI:
2742 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
2744 igmp_startup_mode_on(igmp
);
2747 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
2749 if (igmp
->t_igmp_query_timer
) {
2750 /* other querier present */
2751 zassert(igmp
->t_igmp_query_timer
);
2752 zassert(!igmp
->t_other_querier_timer
);
2754 pim_igmp_general_query_off(igmp
);
2755 pim_igmp_general_query_on(igmp
);
2757 zassert(igmp
->t_igmp_query_timer
);
2758 zassert(!igmp
->t_other_querier_timer
);
2761 /* this is the querier */
2763 zassert(!igmp
->t_igmp_query_timer
);
2764 zassert(igmp
->t_other_querier_timer
);
2766 pim_igmp_other_querier_timer_off(igmp
);
2767 pim_igmp_other_querier_timer_on(igmp
);
2769 zassert(!igmp
->t_igmp_query_timer
);
2770 zassert(igmp
->t_other_querier_timer
);
2774 static void change_query_interval(struct pim_interface
*pim_ifp
,
2777 struct listnode
*sock_node
;
2778 struct igmp_sock
*igmp
;
2780 pim_ifp
->igmp_default_query_interval
= query_interval
;
2782 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2783 igmp_sock_query_interval_reconfig(igmp
);
2784 igmp_sock_query_reschedule(igmp
);
2788 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
2789 int query_max_response_time_dsec
)
2791 struct listnode
*sock_node
;
2792 struct igmp_sock
*igmp
;
2794 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
2797 Below we modify socket/group/source timers in order to quickly
2798 reflect the change. Otherwise, those timers would eventually catch
2802 /* scan all sockets */
2803 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2804 struct listnode
*grp_node
;
2805 struct igmp_group
*grp
;
2807 /* reschedule socket general query */
2808 igmp_sock_query_reschedule(igmp
);
2810 /* scan socket groups */
2811 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
2812 struct listnode
*src_node
;
2813 struct igmp_source
*src
;
2815 /* reset group timers for groups in EXCLUDE mode */
2816 if (grp
->group_filtermode_isexcl
) {
2817 igmp_group_reset_gmi(grp
);
2820 /* scan group sources */
2821 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2823 /* reset source timers for sources with running timers */
2824 if (src
->t_source_timer
) {
2825 igmp_source_reset_gmi(igmp
, grp
, src
);
2832 #define IGMP_QUERY_INTERVAL_MIN (1)
2833 #define IGMP_QUERY_INTERVAL_MAX (1800)
2835 DEFUN (interface_ip_igmp_query_interval
,
2836 interface_ip_igmp_query_interval_cmd
,
2837 "ip igmp query-interval (1-1800)",
2840 IFACE_IGMP_QUERY_INTERVAL_STR
2841 "Query interval in seconds\n")
2843 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2844 struct pim_interface
*pim_ifp
;
2846 int query_interval_dsec
;
2848 pim_ifp
= ifp
->info
;
2852 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2858 query_interval
= atoi(argv
[4]->arg
);
2859 query_interval_dsec
= 10 * query_interval
;
2862 It seems we don't need to check bounds since command.c does it
2863 already, but we verify them anyway for extra safety.
2865 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
2866 vty_out(vty
, "General query interval %d lower than minimum %d%s",
2868 IGMP_QUERY_INTERVAL_MIN
,
2872 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
2873 vty_out(vty
, "General query interval %d higher than maximum %d%s",
2875 IGMP_QUERY_INTERVAL_MAX
,
2880 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2882 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
2883 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2888 change_query_interval(pim_ifp
, query_interval
);
2893 DEFUN (interface_no_ip_igmp_query_interval
,
2894 interface_no_ip_igmp_query_interval_cmd
,
2895 "no ip igmp query-interval",
2899 IFACE_IGMP_QUERY_INTERVAL_STR
)
2901 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2902 struct pim_interface
*pim_ifp
;
2903 int default_query_interval_dsec
;
2905 pim_ifp
= ifp
->info
;
2910 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
2912 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
2914 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
2915 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
2920 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
2925 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN (1)
2926 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX (25)
2928 DEFUN (interface_ip_igmp_query_max_response_time
,
2929 interface_ip_igmp_query_max_response_time_cmd
,
2930 "ip igmp query-max-response-time (1-25)",
2933 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
2934 "Query response value in seconds\n")
2936 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2937 struct pim_interface
*pim_ifp
;
2938 int query_max_response_time
;
2940 pim_ifp
= ifp
->info
;
2944 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
2950 query_max_response_time
= atoi(argv
[4]->arg
);
2953 It seems we don't need to check bounds since command.c does it
2954 already, but we verify them anyway for extra safety.
2956 if (query_max_response_time
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN
) {
2957 vty_out(vty
, "Query max response time %d sec lower than minimum %d sec%s",
2958 query_max_response_time
,
2959 IGMP_QUERY_MAX_RESPONSE_TIME_MIN
,
2963 if (query_max_response_time
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX
) {
2964 vty_out(vty
, "Query max response time %d sec higher than maximum %d sec%s",
2965 query_max_response_time
,
2966 IGMP_QUERY_MAX_RESPONSE_TIME_MAX
,
2971 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
) {
2973 "Can't set query max response time %d sec >= general query interval %d sec%s",
2974 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
2979 change_query_max_response_time(pim_ifp
, 10 * query_max_response_time
);
2984 DEFUN (interface_no_ip_igmp_query_max_response_time
,
2985 interface_no_ip_igmp_query_max_response_time_cmd
,
2986 "no ip igmp query-max-response-time",
2990 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
)
2992 VTY_DECLVAR_CONTEXT(interface
, ifp
);
2993 struct pim_interface
*pim_ifp
;
2994 int default_query_interval_dsec
;
2996 pim_ifp
= ifp
->info
;
3001 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3003 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3005 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3006 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3011 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3016 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
3017 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
3019 DEFUN (interface_ip_igmp_query_max_response_time_dsec
,
3020 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3021 "ip igmp query-max-response-time-dsec (10-250)",
3024 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3025 "Query response value in deciseconds\n")
3027 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3028 struct pim_interface
*pim_ifp
;
3029 int query_max_response_time_dsec
;
3030 int default_query_interval_dsec
;
3032 pim_ifp
= ifp
->info
;
3036 "IGMP not enabled on interface %s. Please enable IGMP first.%s",
3042 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
3045 It seems we don't need to check bounds since command.c does it
3046 already, but we verify them anyway for extra safety.
3048 if (query_max_response_time_dsec
< IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
) {
3049 vty_out(vty
, "Query max response time %d dsec lower than minimum %d dsec%s",
3050 query_max_response_time_dsec
,
3051 IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC
,
3055 if (query_max_response_time_dsec
> IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
) {
3056 vty_out(vty
, "Query max response time %d dsec higher than maximum %d dsec%s",
3057 query_max_response_time_dsec
,
3058 IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC
,
3063 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3065 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
3067 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
3068 query_max_response_time_dsec
, default_query_interval_dsec
,
3073 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
3078 DEFUN (interface_no_ip_igmp_query_max_response_time_dsec
,
3079 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3080 "no ip igmp query-max-response-time-dsec",
3084 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
3086 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3087 struct pim_interface
*pim_ifp
;
3088 int default_query_interval_dsec
;
3090 pim_ifp
= ifp
->info
;
3095 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
3097 if (IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
>= default_query_interval_dsec
) {
3099 "Can't set default query max response time %d dsec >= general query interval %d dsec.%s",
3100 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
, default_query_interval_dsec
,
3105 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
3110 DEFUN (interface_ip_pim_drprio
,
3111 interface_ip_pim_drprio_cmd
,
3112 "ip pim drpriority (1-4294967295)",
3115 "Set the Designated Router Election Priority\n"
3116 "Value of the new DR Priority\n")
3118 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3120 struct pim_interface
*pim_ifp
;
3121 uint32_t old_dr_prio
;
3123 pim_ifp
= ifp
->info
;
3126 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
3130 old_dr_prio
= pim_ifp
->pim_dr_priority
;
3132 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
3134 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
3135 if (pim_if_dr_election(ifp
))
3136 pim_hello_restart_now(ifp
);
3142 DEFUN (interface_no_ip_pim_drprio
,
3143 interface_no_ip_pim_drprio_cmd
,
3144 "no ip pim drpriority [(1-4294967295)]",
3148 "Revert the Designated Router Priority to default\n"
3149 "Old Value of the Priority\n")
3151 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3152 struct pim_interface
*pim_ifp
;
3154 pim_ifp
= ifp
->info
;
3157 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3161 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
3162 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
3163 if (pim_if_dr_election(ifp
))
3164 pim_hello_restart_now(ifp
);
3171 pim_cmd_interface_add (struct interface
*ifp
, enum pim_interface_type itype
)
3173 struct pim_interface
*pim_ifp
= ifp
->info
;
3174 struct in_addr null
= { .s_addr
= 0 };
3177 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
3183 PIM_IF_DO_PIM(pim_ifp
->options
);
3186 pim_ifp
->itype
= itype
;
3187 pim_if_addr_add_all(ifp
);
3188 pim_if_membership_refresh(ifp
);
3190 pim_rp_check_rp (null
, pim_ifp
->primary_address
);
3195 DEFUN (interface_ip_pim_ssm
,
3196 interface_ip_pim_ssm_cmd
,
3202 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3204 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SSM
)) {
3205 vty_out(vty
, "Could not enable PIM SSM on interface%s", VTY_NEWLINE
);
3212 DEFUN (interface_ip_pim_sm
,
3213 interface_ip_pim_sm_cmd
,
3219 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3220 if (!pim_cmd_interface_add(ifp
, PIM_INTERFACE_SM
)) {
3221 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
3225 pim_if_create_pimreg();
3231 pim_cmd_interface_delete (struct interface
*ifp
)
3233 struct pim_interface
*pim_ifp
= ifp
->info
;
3238 PIM_IF_DONT_PIM(pim_ifp
->options
);
3240 pim_if_membership_clear(ifp
);
3243 pim_if_addr_del_all() removes all sockets from
3244 pim_ifp->igmp_socket_list.
3246 pim_if_addr_del_all(ifp
);
3249 pim_sock_delete() removes all neighbors from
3250 pim_ifp->pim_neighbor_list.
3252 pim_sock_delete(ifp
, "pim unconfigured on interface");
3254 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
3261 DEFUN (interface_no_ip_pim_ssm
,
3262 interface_no_ip_pim_ssm_cmd
,
3269 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3270 if (!pim_cmd_interface_delete(ifp
)) {
3271 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3278 DEFUN (interface_no_ip_pim_sm
,
3279 interface_no_ip_pim_sm_cmd
,
3286 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3287 if (!pim_cmd_interface_delete(ifp
)) {
3288 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
3295 DEFUN (interface_ip_mroute
,
3296 interface_ip_mroute_cmd
,
3297 "ip mroute INTERFACE A.B.C.D",
3299 "Add multicast route\n"
3300 "Outgoing interface name\n"
3303 VTY_DECLVAR_CONTEXT(interface
, iif
);
3304 int idx_interface
= 2;
3306 struct interface
*oif
;
3307 const char *oifname
;
3308 const char *grp_str
;
3309 struct in_addr grp_addr
;
3310 struct in_addr src_addr
;
3313 oifname
= argv
[idx_interface
]->arg
;
3314 oif
= if_lookup_by_name(oifname
);
3316 vty_out(vty
, "No such interface name %s%s",
3317 oifname
, VTY_NEWLINE
);
3321 grp_str
= argv
[idx_ipv4
]->arg
;
3322 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3324 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3325 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3329 src_addr
.s_addr
= INADDR_ANY
;
3331 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3332 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3339 DEFUN (interface_ip_mroute_source
,
3340 interface_ip_mroute_source_cmd
,
3341 "ip mroute INTERFACE A.B.C.D A.B.C.D",
3343 "Add multicast route\n"
3344 "Outgoing interface name\n"
3348 VTY_DECLVAR_CONTEXT(interface
, iif
);
3349 int idx_interface
= 2;
3352 struct interface
*oif
;
3353 const char *oifname
;
3354 const char *grp_str
;
3355 struct in_addr grp_addr
;
3356 const char *src_str
;
3357 struct in_addr src_addr
;
3360 oifname
= argv
[idx_interface
]->arg
;
3361 oif
= if_lookup_by_name(oifname
);
3363 vty_out(vty
, "No such interface name %s%s",
3364 oifname
, VTY_NEWLINE
);
3368 grp_str
= argv
[idx_ipv4
]->arg
;
3369 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3371 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3372 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3376 src_str
= argv
[idx_ipv4_2
]->arg
;
3377 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3379 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3380 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3384 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
3385 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
3392 DEFUN (interface_no_ip_mroute
,
3393 interface_no_ip_mroute_cmd
,
3394 "no ip mroute INTERFACE A.B.C.D",
3397 "Add multicast route\n"
3398 "Outgoing interface name\n"
3401 VTY_DECLVAR_CONTEXT(interface
, iif
);
3402 int idx_interface
= 3;
3404 struct interface
*oif
;
3405 const char *oifname
;
3406 const char *grp_str
;
3407 struct in_addr grp_addr
;
3408 struct in_addr src_addr
;
3411 oifname
= argv
[idx_interface
]->arg
;
3412 oif
= if_lookup_by_name(oifname
);
3414 vty_out(vty
, "No such interface name %s%s",
3415 oifname
, VTY_NEWLINE
);
3419 grp_str
= argv
[idx_ipv4
]->arg
;
3420 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3422 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3423 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3427 src_addr
.s_addr
= INADDR_ANY
;
3429 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3430 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3437 DEFUN (interface_no_ip_mroute_source
,
3438 interface_no_ip_mroute_source_cmd
,
3439 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
3442 "Add multicast route\n"
3443 "Outgoing interface name\n"
3447 VTY_DECLVAR_CONTEXT(interface
, iif
);
3448 int idx_interface
= 3;
3451 struct interface
*oif
;
3452 const char *oifname
;
3453 const char *grp_str
;
3454 struct in_addr grp_addr
;
3455 const char *src_str
;
3456 struct in_addr src_addr
;
3459 oifname
= argv
[idx_interface
]->arg
;
3460 oif
= if_lookup_by_name(oifname
);
3462 vty_out(vty
, "No such interface name %s%s",
3463 oifname
, VTY_NEWLINE
);
3467 grp_str
= argv
[idx_ipv4
]->arg
;
3468 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
3470 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
3471 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3475 src_str
= argv
[idx_ipv4_2
]->arg
;
3476 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
3478 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
3479 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3483 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
3484 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
3491 DEFUN (interface_ip_pim_hello
,
3492 interface_ip_pim_hello_cmd
,
3493 "ip pim hello (1-180) [(1-180)]",
3497 IFACE_PIM_HELLO_TIME_STR
3498 IFACE_PIM_HELLO_HOLD_STR
)
3500 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3503 struct pim_interface
*pim_ifp
;
3505 pim_ifp
= ifp
->info
;
3508 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3512 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
3514 if (argc
> idx_hold
)
3515 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
3522 DEFUN (interface_no_ip_pim_hello
,
3523 interface_no_ip_pim_hello_cmd
,
3524 "no ip pim hello [(1-180) (1-180)]",
3529 IFACE_PIM_HELLO_TIME_STR
3530 IFACE_PIM_HELLO_HOLD_STR
)
3532 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3533 struct pim_interface
*pim_ifp
;
3535 pim_ifp
= ifp
->info
;
3538 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
3542 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
3543 pim_ifp
->pim_default_holdtime
= -1;
3554 PIM_DO_DEBUG_IGMP_EVENTS
;
3555 PIM_DO_DEBUG_IGMP_PACKETS
;
3556 PIM_DO_DEBUG_IGMP_TRACE
;
3560 DEFUN (no_debug_igmp
,
3567 PIM_DONT_DEBUG_IGMP_EVENTS
;
3568 PIM_DONT_DEBUG_IGMP_PACKETS
;
3569 PIM_DONT_DEBUG_IGMP_TRACE
;
3574 DEFUN (debug_igmp_events
,
3575 debug_igmp_events_cmd
,
3576 "debug igmp events",
3579 DEBUG_IGMP_EVENTS_STR
)
3581 PIM_DO_DEBUG_IGMP_EVENTS
;
3585 DEFUN (no_debug_igmp_events
,
3586 no_debug_igmp_events_cmd
,
3587 "no debug igmp events",
3591 DEBUG_IGMP_EVENTS_STR
)
3593 PIM_DONT_DEBUG_IGMP_EVENTS
;
3598 DEFUN (debug_igmp_packets
,
3599 debug_igmp_packets_cmd
,
3600 "debug igmp packets",
3603 DEBUG_IGMP_PACKETS_STR
)
3605 PIM_DO_DEBUG_IGMP_PACKETS
;
3609 DEFUN (no_debug_igmp_packets
,
3610 no_debug_igmp_packets_cmd
,
3611 "no debug igmp packets",
3615 DEBUG_IGMP_PACKETS_STR
)
3617 PIM_DONT_DEBUG_IGMP_PACKETS
;
3622 DEFUN (debug_igmp_trace
,
3623 debug_igmp_trace_cmd
,
3627 DEBUG_IGMP_TRACE_STR
)
3629 PIM_DO_DEBUG_IGMP_TRACE
;
3633 DEFUN (no_debug_igmp_trace
,
3634 no_debug_igmp_trace_cmd
,
3635 "no debug igmp trace",
3639 DEBUG_IGMP_TRACE_STR
)
3641 PIM_DONT_DEBUG_IGMP_TRACE
;
3646 DEFUN (debug_mroute
,
3652 PIM_DO_DEBUG_MROUTE
;
3656 DEFUN (no_debug_mroute
,
3657 no_debug_mroute_cmd
,
3663 PIM_DONT_DEBUG_MROUTE
;
3668 DEFUN (debug_static
,
3674 PIM_DO_DEBUG_STATIC
;
3678 DEFUN (no_debug_static
,
3679 no_debug_static_cmd
,
3685 PIM_DONT_DEBUG_STATIC
;
3696 PIM_DO_DEBUG_PIM_EVENTS
;
3697 PIM_DO_DEBUG_PIM_PACKETS
;
3698 PIM_DO_DEBUG_PIM_TRACE
;
3702 DEFUN (no_debug_pim
,
3709 PIM_DONT_DEBUG_PIM_EVENTS
;
3710 PIM_DONT_DEBUG_PIM_PACKETS
;
3711 PIM_DONT_DEBUG_PIM_TRACE
;
3713 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3714 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3720 DEFUN (debug_pim_events
,
3721 debug_pim_events_cmd
,
3725 DEBUG_PIM_EVENTS_STR
)
3727 PIM_DO_DEBUG_PIM_EVENTS
;
3731 DEFUN (no_debug_pim_events
,
3732 no_debug_pim_events_cmd
,
3733 "no debug pim events",
3737 DEBUG_PIM_EVENTS_STR
)
3739 PIM_DONT_DEBUG_PIM_EVENTS
;
3744 DEFUN (debug_pim_packets
,
3745 debug_pim_packets_cmd
,
3746 "debug pim packets",
3749 DEBUG_PIM_PACKETS_STR
)
3751 PIM_DO_DEBUG_PIM_PACKETS
;
3752 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
3756 DEFUN (debug_pim_packets_filter
,
3757 debug_pim_packets_filter_cmd
,
3758 "debug pim packets <hello|joins|register>",
3761 DEBUG_PIM_PACKETS_STR
3762 DEBUG_PIM_HELLO_PACKETS_STR
3763 DEBUG_PIM_J_P_PACKETS_STR
3764 DEBUG_PIM_PIM_REG_PACKETS_STR
)
3766 int idx_hello_join
= 3;
3767 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3769 PIM_DO_DEBUG_PIM_HELLO
;
3770 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
3772 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3774 PIM_DO_DEBUG_PIM_J_P
;
3775 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
3777 else if (strncmp(argv
[idx_hello_join
]->arg
,"r",1) == 0)
3779 PIM_DO_DEBUG_PIM_REG
;
3780 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
3785 DEFUN (no_debug_pim_packets
,
3786 no_debug_pim_packets_cmd
,
3787 "no debug pim packets",
3791 DEBUG_PIM_PACKETS_STR
3792 DEBUG_PIM_HELLO_PACKETS_STR
3793 DEBUG_PIM_J_P_PACKETS_STR
)
3795 PIM_DONT_DEBUG_PIM_PACKETS
;
3796 vty_out (vty
, "PIM Packet debugging is off %s", VTY_NEWLINE
);
3800 DEFUN (no_debug_pim_packets_filter
,
3801 no_debug_pim_packets_filter_cmd
,
3802 "no debug pim packets <hello|joins|register>",
3806 DEBUG_PIM_PACKETS_STR
3807 DEBUG_PIM_HELLO_PACKETS_STR
3808 DEBUG_PIM_J_P_PACKETS_STR
)
3810 int idx_hello_join
= 4;
3811 if (strncmp(argv
[idx_hello_join
]->arg
,"h",1) == 0)
3813 PIM_DONT_DEBUG_PIM_HELLO
;
3814 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
3816 else if (strncmp(argv
[idx_hello_join
]->arg
,"j",1) == 0)
3818 PIM_DONT_DEBUG_PIM_J_P
;
3819 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
3821 else if (strncmp (argv
[idx_hello_join
]->arg
, "r", 1) == 0)
3823 PIM_DONT_DEBUG_PIM_REG
;
3824 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
3830 DEFUN (debug_pim_packetdump_send
,
3831 debug_pim_packetdump_send_cmd
,
3832 "debug pim packet-dump send",
3835 DEBUG_PIM_PACKETDUMP_STR
3836 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3838 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
3842 DEFUN (no_debug_pim_packetdump_send
,
3843 no_debug_pim_packetdump_send_cmd
,
3844 "no debug pim packet-dump send",
3848 DEBUG_PIM_PACKETDUMP_STR
3849 DEBUG_PIM_PACKETDUMP_SEND_STR
)
3851 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
3856 DEFUN (debug_pim_packetdump_recv
,
3857 debug_pim_packetdump_recv_cmd
,
3858 "debug pim packet-dump receive",
3861 DEBUG_PIM_PACKETDUMP_STR
3862 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3864 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
3868 DEFUN (no_debug_pim_packetdump_recv
,
3869 no_debug_pim_packetdump_recv_cmd
,
3870 "no debug pim packet-dump receive",
3874 DEBUG_PIM_PACKETDUMP_STR
3875 DEBUG_PIM_PACKETDUMP_RECV_STR
)
3877 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
3882 DEFUN (debug_pim_trace
,
3883 debug_pim_trace_cmd
,
3887 DEBUG_PIM_TRACE_STR
)
3889 PIM_DO_DEBUG_PIM_TRACE
;
3893 DEFUN (no_debug_pim_trace
,
3894 no_debug_pim_trace_cmd
,
3895 "no debug pim trace",
3899 DEBUG_PIM_TRACE_STR
)
3901 PIM_DONT_DEBUG_PIM_TRACE
;
3906 DEFUN (debug_ssmpingd
,
3913 PIM_DO_DEBUG_SSMPINGD
;
3917 DEFUN (no_debug_ssmpingd
,
3918 no_debug_ssmpingd_cmd
,
3919 "no debug ssmpingd",
3925 PIM_DONT_DEBUG_SSMPINGD
;
3930 DEFUN (debug_pim_zebra
,
3931 debug_pim_zebra_cmd
,
3935 DEBUG_PIM_ZEBRA_STR
)
3941 DEFUN (no_debug_pim_zebra
,
3942 no_debug_pim_zebra_cmd
,
3943 "no debug pim zebra",
3947 DEBUG_PIM_ZEBRA_STR
)
3949 PIM_DONT_DEBUG_ZEBRA
;
3954 DEFUN (show_debugging_pim
,
3955 show_debugging_pim_cmd
,
3956 "show debugging pim",
3961 pim_debug_config_write(vty
);
3965 static struct igmp_sock
*find_igmp_sock_by_fd(int fd
)
3967 struct listnode
*ifnode
;
3968 struct interface
*ifp
;
3970 /* scan all interfaces */
3971 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
3972 struct pim_interface
*pim_ifp
;
3973 struct igmp_sock
*igmp
;
3978 pim_ifp
= ifp
->info
;
3980 /* lookup igmp socket under current interface */
3981 igmp
= igmp_sock_lookup_by_fd(pim_ifp
->igmp_socket_list
, fd
);
3989 DEFUN (test_igmp_receive_report
,
3990 test_igmp_receive_report_cmd
,
3991 "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...",
3993 "Test IGMP protocol\n"
3994 "Test IGMP message\n"
3995 "Test IGMP report\n"
3997 "IGMP group address\n"
4003 int idx_number_2
= 6;
4008 size_t ip_hlen
; /* ip header length in bytes */
4013 const char *grp_str
;
4014 struct in_addr grp_addr
;
4015 const char *record_type_str
;
4017 const char *src_str
;
4019 struct igmp_sock
*igmp
;
4022 struct in_addr
*sources
;
4023 struct in_addr
*src_addr
;
4026 socket
= argv
[idx_number
]->arg
;
4027 socket_fd
= atoi(socket
);
4028 igmp
= find_igmp_sock_by_fd(socket_fd
);
4030 vty_out(vty
, "Could not find IGMP socket %s: fd=%d%s",
4031 socket
, socket_fd
, VTY_NEWLINE
);
4035 grp_str
= argv
[idx_ipv4
]->arg
;
4036 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4038 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4039 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4043 record_type_str
= argv
[idx_number_2
]->arg
;
4044 record_type
= atoi(record_type_str
);
4049 ip_hdr
= (struct ip
*) buf
;
4050 ip_hdr
->ip_p
= PIM_IP_PROTO_IGMP
;
4051 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4052 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4053 ip_hdr
->ip_src
= igmp
->ifaddr
;
4054 ip_hdr
->ip_dst
= igmp
->ifaddr
;
4057 Build IGMP v3 report message
4059 igmp_msg
= buf
+ ip_hlen
;
4060 group_record
= igmp_msg
+ IGMP_V3_REPORT_GROUPPRECORD_OFFSET
;
4061 *igmp_msg
= PIM_IGMP_V3_MEMBERSHIP_REPORT
; /* type */
4062 *(uint16_t *) (igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = 0; /* for computing checksum */
4063 *(uint16_t *) (igmp_msg
+ IGMP_V3_REPORT_NUMGROUPS_OFFSET
) = htons(1); /* one group record */
4064 *(uint8_t *) (group_record
+ IGMP_V3_GROUP_RECORD_TYPE_OFFSET
) = record_type
;
4065 memcpy(group_record
+ IGMP_V3_GROUP_RECORD_GROUP_OFFSET
, &grp_addr
, sizeof(struct in_addr
));
4067 /* Scan LINE sources */
4068 sources
= (struct in_addr
*) (group_record
+ IGMP_V3_GROUP_RECORD_SOURCE_OFFSET
);
4070 for (argi
= idx_line
; argi
< argc
; ++argi
,++src_addr
) {
4071 src_str
= argv
[argi
]->arg
;
4072 result
= inet_pton(AF_INET
, src_str
, src_addr
);
4074 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4075 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4079 num_sources
= src_addr
- sources
;
4081 *(uint16_t *)(group_record
+ IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET
) = htons(num_sources
);
4083 igmp_msg_len
= IGMP_V3_MSG_MIN_SIZE
+ (num_sources
<< 4); /* v3 report for one single group record */
4085 /* compute checksum */
4086 *(uint16_t *)(igmp_msg
+ IGMP_V3_CHECKSUM_OFFSET
) = in_cksum(igmp_msg
, igmp_msg_len
);
4088 /* "receive" message */
4090 ip_msg_len
= ip_hlen
+ igmp_msg_len
;
4091 result
= pim_igmp_packet(igmp
, buf
, ip_msg_len
);
4093 vty_out(vty
, "pim_igmp_packet(len=%d) returned: %d%s",
4094 ip_msg_len
, result
, VTY_NEWLINE
);
4101 static int hexval(uint8_t ch
)
4103 return isdigit(ch
) ? (ch
- '0') : (10 + tolower(ch
) - 'a');
4106 DEFUN (test_pim_receive_dump
,
4107 test_pim_receive_dump_cmd
,
4108 "test pim receive dump INTERFACE A.B.C.D LINE...",
4110 "Test PIM protocol\n"
4111 "Test PIM message reception\n"
4112 "Test PIM packet dump reception from neighbor\n"
4114 "Neighbor address\n"
4117 int idx_interface
= 4;
4123 size_t ip_hlen
; /* ip header length in bytes */
4126 const char *neigh_str
;
4127 struct in_addr neigh_addr
;
4129 struct interface
*ifp
;
4133 /* Find interface */
4134 ifname
= argv
[idx_interface
]->arg
;
4135 ifp
= if_lookup_by_name(ifname
);
4137 vty_out(vty
, "No such interface name %s%s",
4138 ifname
, VTY_NEWLINE
);
4142 /* Neighbor address */
4143 neigh_str
= argv
[idx_ipv4
]->arg
;
4144 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4146 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4147 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4154 ip_hdr
= (struct ip
*) buf
;
4155 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4156 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4157 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4158 ip_hdr
->ip_src
= neigh_addr
;
4159 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4162 Build PIM hello message
4164 pim_msg
= buf
+ ip_hlen
;
4167 /* Scan LINE dump into buffer */
4168 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4169 const char *str
= argv
[argi
]->arg
;
4170 int str_len
= strlen(str
);
4171 int str_last
= str_len
- 1;
4175 vty_out(vty
, "%% Uneven hex array arg %d=%s%s",
4176 argi
, str
, VTY_NEWLINE
);
4180 for (i
= 0; i
< str_last
; i
+= 2) {
4183 uint8_t h1
= str
[i
];
4184 uint8_t h2
= str
[i
+ 1];
4186 if (!isxdigit(h1
) || !isxdigit(h2
)) {
4187 vty_out(vty
, "%% Non-hex octet %c%c at hex array arg %d=%s%s",
4188 h1
, h2
, argi
, str
, VTY_NEWLINE
);
4191 octet
= (hexval(h1
) << 4) + hexval(h2
);
4193 left
= sizeof(buf
) - ip_hlen
- pim_msg_size
;
4195 vty_out(vty
, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s",
4196 sizeof(buf
), left
, argi
, str
, octet
, VTY_NEWLINE
);
4200 pim_msg
[pim_msg_size
++] = octet
;
4204 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4206 vty_out(vty
, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s",
4207 sizeof(buf
), ip_msg_len
, pim_msg_size
, VTY_NEWLINE
);
4209 /* "receive" message */
4211 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4213 vty_out(vty
, "%% pim_pim_packet(len=%d) returned failure: %d%s",
4214 ip_msg_len
, result
, VTY_NEWLINE
);
4221 DEFUN (test_pim_receive_hello
,
4222 test_pim_receive_hello_cmd
,
4223 "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]",
4225 "Test PIM protocol\n"
4226 "Test PIM message reception\n"
4227 "Test PIM hello reception from neighbor\n"
4229 "Neighbor address\n"
4230 "Neighbor holdtime\n"
4231 "Neighbor DR priority\n"
4232 "Neighbor generation ID\n"
4233 "Neighbor propagation delay (msec)\n"
4234 "Neighbor override interval (msec)\n"
4235 "Neighbor LAN prune delay T-bit\n"
4236 "Neighbor secondary addresses\n")
4238 int idx_interface
= 4;
4241 int idx_number_2
= 7;
4242 int idx_number_3
= 8;
4243 int idx_number_4
= 9;
4244 int idx_number_5
= 10;
4245 int idx_number_6
= 11;
4250 size_t ip_hlen
; /* ip header length in bytes */
4254 const char *neigh_str
;
4255 struct in_addr neigh_addr
;
4257 struct interface
*ifp
;
4258 uint16_t neigh_holdtime
;
4259 uint16_t neigh_propagation_delay
;
4260 uint16_t neigh_override_interval
;
4261 int neigh_can_disable_join_suppression
;
4262 uint32_t neigh_dr_priority
;
4263 uint32_t neigh_generation_id
;
4267 /* Find interface */
4268 ifname
= argv
[idx_interface
]->arg
;
4269 ifp
= if_lookup_by_name(ifname
);
4271 vty_out(vty
, "No such interface name %s%s",
4272 ifname
, VTY_NEWLINE
);
4276 /* Neighbor address */
4277 neigh_str
= argv
[idx_ipv4
]->arg
;
4278 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4280 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4281 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4285 neigh_holdtime
= atoi(argv
[idx_number
]->arg
);
4286 neigh_dr_priority
= atoi(argv
[idx_number_2
]->arg
);
4287 neigh_generation_id
= atoi(argv
[idx_number_3
]->arg
);
4288 neigh_propagation_delay
= atoi(argv
[idx_number_4
]->arg
);
4289 neigh_override_interval
= atoi(argv
[idx_number_5
]->arg
);
4290 neigh_can_disable_join_suppression
= atoi(argv
[idx_number_6
]->arg
);
4295 ip_hdr
= (struct ip
*) buf
;
4296 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4297 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4298 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4299 ip_hdr
->ip_src
= neigh_addr
;
4300 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4303 Build PIM hello message
4305 pim_msg
= buf
+ ip_hlen
;
4307 /* Scan LINE addresses */
4308 for (argi
= idx_line
; argi
< argc
; ++argi
) {
4309 const char *sec_str
= argv
[argi
]->arg
;
4310 struct in_addr sec_addr
;
4311 result
= inet_pton(AF_INET
, sec_str
, &sec_addr
);
4313 vty_out(vty
, "Bad neighbor secondary address %s: errno=%d: %s%s",
4314 sec_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4319 "FIXME WRITEME consider neighbor secondary address %s%s",
4320 sec_str
, VTY_NEWLINE
);
4323 pim_tlv_size
= pim_hello_build_tlv(ifp
->name
,
4324 pim_msg
+ PIM_PIM_MIN_LEN
,
4325 sizeof(buf
) - ip_hlen
- PIM_PIM_MIN_LEN
,
4328 neigh_generation_id
,
4329 neigh_propagation_delay
,
4330 neigh_override_interval
,
4331 neigh_can_disable_join_suppression
,
4332 0 /* FIXME secondary address list */);
4333 if (pim_tlv_size
< 0) {
4334 vty_out(vty
, "pim_hello_build_tlv() returned failure: %d%s",
4335 pim_tlv_size
, VTY_NEWLINE
);
4339 pim_msg_size
= pim_tlv_size
+ PIM_PIM_MIN_LEN
;
4341 pim_msg_build_header(pim_msg
, pim_msg_size
,
4342 PIM_MSG_TYPE_HELLO
);
4344 /* "receive" message */
4346 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4347 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4349 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4350 ip_msg_len
, result
, VTY_NEWLINE
);
4357 DEFUN (test_pim_receive_assert
,
4358 test_pim_receive_assert_cmd
,
4359 "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)",
4361 "Test PIM protocol\n"
4362 "Test PIM message reception\n"
4363 "Test reception of PIM assert\n"
4365 "Neighbor address\n"
4366 "Assert multicast group address\n"
4367 "Assert unicast source address\n"
4368 "Assert metric preference\n"
4369 "Assert route metric\n"
4370 "Assert RPT bit flag\n")
4372 int idx_interface
= 4;
4377 int idx_number_2
= 9;
4378 int idx_number_3
= 10;
4380 uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4383 size_t ip_hlen
; /* ip header length in bytes */
4386 const char *neigh_str
;
4387 struct in_addr neigh_addr
;
4388 const char *group_str
;
4389 struct in_addr group_addr
;
4390 const char *source_str
;
4391 struct in_addr source_addr
;
4393 struct interface
*ifp
;
4394 uint32_t assert_metric_preference
;
4395 uint32_t assert_route_metric
;
4396 uint32_t assert_rpt_bit_flag
;
4400 /* Find interface */
4401 ifname
= argv
[idx_interface
]->arg
;
4402 ifp
= if_lookup_by_name(ifname
);
4404 vty_out(vty
, "No such interface name %s%s",
4405 ifname
, VTY_NEWLINE
);
4409 /* Neighbor address */
4410 neigh_str
= argv
[idx_ipv4
]->arg
;
4411 result
= inet_pton(AF_INET
, neigh_str
, &neigh_addr
);
4413 vty_out(vty
, "Bad neighbor address %s: errno=%d: %s%s",
4414 neigh_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4419 group_str
= argv
[idx_ipv4_2
]->arg
;
4420 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4422 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4423 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4427 /* Source address */
4428 source_str
= argv
[idx_ipv4_3
]->arg
;
4429 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4431 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4432 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4436 assert_metric_preference
= atoi(argv
[idx_number
]->arg
);
4437 assert_route_metric
= atoi(argv
[idx_number_2
]->arg
);
4438 assert_rpt_bit_flag
= atoi(argv
[idx_number_3
]->arg
);
4440 remain
= buf_pastend
- buf
;
4441 if (remain
< (int) sizeof(struct ip
)) {
4442 vty_out(vty
, "No room for ip header: buf_size=%d < ip_header_size=%zu%s",
4443 remain
, sizeof(struct ip
), VTY_NEWLINE
);
4450 ip_hdr
= (struct ip
*) buf
;
4451 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4452 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4453 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4454 ip_hdr
->ip_src
= neigh_addr
;
4455 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4458 Build PIM assert message
4460 pim_msg
= buf
+ ip_hlen
; /* skip ip header */
4462 pim_msg_size
= pim_assert_build_msg(pim_msg
, buf_pastend
- pim_msg
, ifp
,
4463 group_addr
, source_addr
,
4464 assert_metric_preference
,
4465 assert_route_metric
,
4466 assert_rpt_bit_flag
);
4467 if (pim_msg_size
< 0) {
4468 vty_out(vty
, "Failure building PIM assert message: size=%d%s",
4469 pim_msg_size
, VTY_NEWLINE
);
4473 /* "receive" message */
4475 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4476 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4478 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4479 ip_msg_len
, result
, VTY_NEWLINE
);
4486 static int recv_joinprune(struct vty
*vty
,
4487 struct cmd_token
**argv
,
4491 const uint8_t *buf_pastend
= buf
+ sizeof(buf
);
4495 size_t ip_hlen
; /* ip header length in bytes */
4497 uint16_t neigh_holdtime
;
4498 const char *neigh_dst_str
;
4499 struct in_addr neigh_dst_addr
;
4500 const char *neigh_src_str
;
4501 struct in_addr neigh_src_addr
;
4502 const char *group_str
;
4503 struct in_addr group_addr
;
4504 const char *source_str
;
4505 struct in_addr source_addr
;
4507 struct interface
*ifp
;
4510 /* Find interface */
4511 ifname
= argv
[0]->arg
;
4512 ifp
= if_lookup_by_name(ifname
);
4514 vty_out(vty
, "No such interface name %s%s",
4515 ifname
, VTY_NEWLINE
);
4519 neigh_holdtime
= atoi(argv
[1]->arg
);
4521 /* Neighbor destination address */
4522 neigh_dst_str
= argv
[2]->arg
;
4523 result
= inet_pton(AF_INET
, neigh_dst_str
, &neigh_dst_addr
);
4525 vty_out(vty
, "Bad neighbor destination address %s: errno=%d: %s%s",
4526 neigh_dst_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4530 /* Neighbor source address */
4531 neigh_src_str
= argv
[3]->arg
;
4532 result
= inet_pton(AF_INET
, neigh_src_str
, &neigh_src_addr
);
4534 vty_out(vty
, "Bad neighbor source address %s: errno=%d: %s%s",
4535 neigh_src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4539 /* Multicast group address */
4540 group_str
= argv
[4]->arg
;
4541 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4543 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4544 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4548 /* Multicast source address */
4549 source_str
= argv
[5]->arg
;
4550 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4552 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4553 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4560 ip_hdr
= (struct ip
*) buf
;
4561 ip_hdr
->ip_p
= PIM_IP_PROTO_PIM
;
4562 ip_hlen
= PIM_IP_HEADER_MIN_LEN
; /* ip header length in bytes */
4563 ip_hdr
->ip_hl
= ip_hlen
>> 2; /* ip header length in 4-byte words */
4564 ip_hdr
->ip_src
= neigh_src_addr
;
4565 ip_hdr
->ip_dst
= qpim_all_pim_routers_addr
;
4570 pim_msg
= buf
+ ip_hlen
;
4572 pim_msg_size
= pim_msg_join_prune_encode (pim_msg
, buf_pastend
- pim_msg
, src_is_join
,
4573 source_addr
, group_addr
, neigh_dst_addr
,
4580 ip_msg_len
= ip_hlen
+ pim_msg_size
;
4581 result
= pim_pim_packet(ifp
, buf
, ip_msg_len
);
4583 vty_out(vty
, "pim_pim_packet(len=%d) returned failure: %d%s",
4584 ip_msg_len
, result
, VTY_NEWLINE
);
4591 DEFUN (test_pim_receive_join
,
4592 test_pim_receive_join_cmd
,
4593 "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4595 "Test PIM protocol\n"
4596 "Test PIM message reception\n"
4597 "Test PIM join reception from neighbor\n"
4599 "Neighbor holdtime\n"
4600 "Upstream neighbor unicast destination address\n"
4601 "Downstream neighbor unicast source address\n"
4602 "Multicast group address\n"
4603 "Unicast source address\n")
4605 return recv_joinprune(vty
, argv
, 1 /* src_is_join=true */);
4608 DEFUN (test_pim_receive_prune
,
4609 test_pim_receive_prune_cmd
,
4610 "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
4612 "Test PIM protocol\n"
4613 "Test PIM message reception\n"
4614 "Test PIM prune reception from neighbor\n"
4616 "Neighbor holdtime\n"
4617 "Upstream neighbor unicast destination address\n"
4618 "Downstream neighbor unicast source address\n"
4619 "Multicast group address\n"
4620 "Unicast source address\n")
4622 return recv_joinprune(vty
, argv
, 0 /* src_is_join=false */);
4625 DEFUN (test_pim_receive_upcall
,
4626 test_pim_receive_upcall_cmd
,
4627 "test pim receive upcall <nocache|wrongvif|wholepkt> (0-65535) A.B.C.D A.B.C.D",
4629 "Test PIM protocol\n"
4630 "Test PIM message reception\n"
4631 "Test reception of kernel upcall\n"
4632 "NOCACHE kernel upcall\n"
4633 "WRONGVIF kernel upcall\n"
4634 "WHOLEPKT kernel upcall\n"
4635 "Input interface vif index\n"
4636 "Multicast group address\n"
4637 "Multicast source address\n")
4644 const char *upcall_type
;
4645 const char *group_str
;
4646 const char *source_str
;
4649 upcall_type
= argv
[idx_type
]->arg
;
4651 if (upcall_type
[0] == 'n')
4652 msg
.im_msgtype
= IGMPMSG_NOCACHE
;
4653 else if (upcall_type
[1] == 'r')
4654 msg
.im_msgtype
= IGMPMSG_WRONGVIF
;
4655 else if (upcall_type
[1] == 'h')
4656 msg
.im_msgtype
= IGMPMSG_WHOLEPKT
;
4658 vty_out(vty
, "Unknown kernel upcall type: %s%s",
4659 upcall_type
, VTY_NEWLINE
);
4663 msg
.im_vif
= atoi(argv
[idx_number
]->arg
);
4666 group_str
= argv
[idx_ipv4
]->arg
;
4667 result
= inet_pton(AF_INET
, group_str
, &msg
.im_dst
);
4669 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4670 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4674 /* Source address */
4675 source_str
= argv
[idx_ipv4_2
]->arg
;
4676 result
= inet_pton(AF_INET
, source_str
, &msg
.im_src
);
4678 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4679 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4683 msg
.im_mbz
= 0; /* Must be zero */
4685 result
= pim_mroute_msg(-1, (char *) &msg
, sizeof(msg
));
4687 vty_out(vty
, "pim_mroute_msg(len=%zu) returned failure: %d%s",
4688 sizeof(msg
), result
, VTY_NEWLINE
);
4697 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
4698 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
4701 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
4702 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
4703 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
4704 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
4705 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
4706 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
4708 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
4709 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
4710 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
4711 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
4712 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
4713 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
4714 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
4715 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
4716 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
4717 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
4718 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
4719 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
4720 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
4721 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
4722 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
4723 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
4724 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
4725 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
4727 // Static mroutes NEB
4728 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
4729 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
4730 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
4731 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
4733 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
4734 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
4735 install_element (VIEW_NODE
, &show_ip_igmp_parameters_cmd
);
4736 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
4737 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
4738 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
4739 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
4740 install_element (VIEW_NODE
, &show_ip_igmp_querier_cmd
);
4741 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
4742 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
4743 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
4744 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
4745 install_element (VIEW_NODE
, &show_ip_pim_dr_cmd
);
4746 install_element (VIEW_NODE
, &show_ip_pim_hello_cmd
);
4747 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
4748 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
4749 install_element (VIEW_NODE
, &show_ip_pim_jp_override_interval_cmd
);
4750 install_element (VIEW_NODE
, &show_ip_pim_lan_prune_delay_cmd
);
4751 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
4752 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
4753 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
4754 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
4755 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
4756 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
4757 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
4758 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
4759 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
4760 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
4761 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
4762 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
4763 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
4765 install_element (ENABLE_NODE
, &show_ip_pim_address_cmd
);
4767 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
4768 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
4769 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
4770 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
4771 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
4773 install_element (ENABLE_NODE
, &test_igmp_receive_report_cmd
);
4774 install_element (ENABLE_NODE
, &test_pim_receive_assert_cmd
);
4775 install_element (ENABLE_NODE
, &test_pim_receive_dump_cmd
);
4776 install_element (ENABLE_NODE
, &test_pim_receive_hello_cmd
);
4777 install_element (ENABLE_NODE
, &test_pim_receive_join_cmd
);
4778 install_element (ENABLE_NODE
, &test_pim_receive_prune_cmd
);
4779 install_element (ENABLE_NODE
, &test_pim_receive_upcall_cmd
);
4781 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
4782 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
4783 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
4784 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
4785 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
4786 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
4787 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
4788 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
4789 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
4790 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
4791 install_element (ENABLE_NODE
, &debug_static_cmd
);
4792 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
4793 install_element (ENABLE_NODE
, &debug_pim_cmd
);
4794 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
4795 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
4796 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
4797 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
4798 install_element (ENABLE_NODE
, &debug_pim_packets_filter_cmd
);
4799 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
4800 install_element (ENABLE_NODE
, &no_debug_pim_packets_filter_cmd
);
4801 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
4802 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
4803 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
4804 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
4805 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
4806 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
4807 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
4808 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
4809 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
4810 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
4812 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
4813 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
4814 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
4815 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
4816 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
4817 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
4818 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
4819 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
4820 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
4821 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
4822 install_element (CONFIG_NODE
, &debug_static_cmd
);
4823 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
4824 install_element (CONFIG_NODE
, &debug_pim_cmd
);
4825 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
4826 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
4827 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
4828 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
4829 install_element (CONFIG_NODE
, &debug_pim_packets_filter_cmd
);
4830 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
4831 install_element (CONFIG_NODE
, &no_debug_pim_packets_filter_cmd
);
4832 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
4833 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
4834 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
4835 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
4836 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
4837 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);