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,
33 #include "pim_mroute.h"
35 #include "pim_iface.h"
37 #include "pim_mroute.h"
40 #include "pim_igmpv3.h"
45 #include "pim_neighbor.h"
47 #include "pim_ifchannel.h"
48 #include "pim_hello.h"
50 #include "pim_upstream.h"
52 #include "pim_macro.h"
53 #include "pim_ssmpingd.h"
54 #include "pim_zebra.h"
55 #include "pim_static.h"
57 #include "pim_zlookup.h"
62 static struct cmd_node pim_global_node
= {
68 static struct cmd_node interface_node
= {
74 static struct cmd_node debug_node
=
81 static void pim_if_membership_clear(struct interface
*ifp
)
83 struct pim_interface
*pim_ifp
;
88 if (PIM_IF_TEST_PIM(pim_ifp
->options
) &&
89 PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
93 pim_ifchannel_membership_clear(ifp
);
97 When PIM is disabled on interface, IGMPv3 local membership
98 information is not injected into PIM interface state.
100 The function pim_if_membership_refresh() fetches all IGMPv3 local
101 membership information into PIM. It is intented to be called
102 whenever PIM is enabled on the interface in order to collect missed
103 local membership information.
105 static void pim_if_membership_refresh(struct interface
*ifp
)
107 struct pim_interface
*pim_ifp
;
108 struct listnode
*sock_node
;
109 struct igmp_sock
*igmp
;
114 if (!PIM_IF_TEST_PIM(pim_ifp
->options
))
116 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
120 First clear off membership from all PIM (S,G) entries on the
124 pim_ifchannel_membership_clear(ifp
);
127 Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on
131 /* scan igmp sockets */
132 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
133 struct listnode
*grpnode
;
134 struct igmp_group
*grp
;
136 /* scan igmp groups */
137 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
138 struct listnode
*srcnode
;
139 struct igmp_source
*src
;
141 /* scan group sources */
142 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
144 if (IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
)) {
147 memset (&sg
, 0, sizeof (struct prefix_sg
));
148 sg
.src
= src
->source_addr
;
149 sg
.grp
= grp
->group_addr
;
150 pim_ifchannel_local_membership_add(ifp
, &sg
);
153 } /* scan group sources */
154 } /* scan igmp groups */
155 } /* scan igmp sockets */
158 Finally delete every PIM (S,G) entry lacking all state info
161 pim_ifchannel_delete_on_noinfo(ifp
);
165 static void pim_show_assert(struct vty
*vty
)
167 struct pim_interface
*pim_ifp
;
168 struct pim_ifchannel
*ch
;
169 struct listnode
*ch_node
;
170 struct in_addr ifaddr
;
173 now
= pim_time_monotonic_sec();
176 "Interface Address Source Group State Winner Uptime Timer%s",
179 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
180 char ch_src_str
[INET_ADDRSTRLEN
];
181 char ch_grp_str
[INET_ADDRSTRLEN
];
182 char winner_str
[INET_ADDRSTRLEN
];
186 pim_ifp
= ch
->interface
->info
;
191 ifaddr
= pim_ifp
->primary_address
;
193 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
194 ch_src_str
, sizeof(ch_src_str
));
195 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
196 ch_grp_str
, sizeof(ch_grp_str
));
197 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
,
198 winner_str
, sizeof(winner_str
));
200 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
201 pim_time_timer_to_mmss(timer
, sizeof(timer
),
202 ch
->t_ifassert_timer
);
204 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
209 pim_ifchannel_ifassert_name(ch
->ifassert_state
),
214 } /* scan interface channels */
217 static void pim_show_assert_internal(struct vty
*vty
)
219 struct pim_interface
*pim_ifp
;
220 struct listnode
*ch_node
;
221 struct pim_ifchannel
*ch
;
222 struct in_addr ifaddr
;
226 "ECA: Evaluate CouldAssert%s"
227 "ATD: AssertTrackingDesired%s"
228 "eATD: Evaluate AssertTrackingDesired%s%s",
229 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
232 "Interface Address Source Group CA eCA ATD eATD%s",
235 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
236 pim_ifp
= ch
->interface
->info
;
241 ifaddr
= pim_ifp
->primary_address
;
243 char ch_src_str
[INET_ADDRSTRLEN
];
244 char ch_grp_str
[INET_ADDRSTRLEN
];
246 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
247 ch_src_str
, sizeof(ch_src_str
));
248 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
249 ch_grp_str
, sizeof(ch_grp_str
));
250 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
255 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
256 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
257 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes" : "no",
258 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no",
260 } /* scan interface channels */
263 static void pim_show_assert_metric(struct vty
*vty
)
265 struct pim_interface
*pim_ifp
;
266 struct listnode
*ch_node
;
267 struct pim_ifchannel
*ch
;
268 struct in_addr ifaddr
;
271 "Interface Address Source Group RPT Pref Metric Address %s",
274 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
275 pim_ifp
= ch
->interface
->info
;
280 ifaddr
= pim_ifp
->primary_address
;
282 char ch_src_str
[INET_ADDRSTRLEN
];
283 char ch_grp_str
[INET_ADDRSTRLEN
];
284 char addr_str
[INET_ADDRSTRLEN
];
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
.src
,
290 ch_src_str
, sizeof(ch_src_str
));
291 pim_inet4_dump("<ch_grp?>", ch
->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 */
309 static void pim_show_assert_winner_metric(struct vty
*vty
)
311 struct pim_interface
*pim_ifp
;
312 struct listnode
*ch_node
;
313 struct pim_ifchannel
*ch
;
314 struct in_addr ifaddr
;
317 "Interface Address Source Group RPT Pref Metric Address %s",
320 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
321 pim_ifp
= ch
->interface
->info
;
326 ifaddr
= pim_ifp
->primary_address
;
328 char ch_src_str
[INET_ADDRSTRLEN
];
329 char ch_grp_str
[INET_ADDRSTRLEN
];
330 char addr_str
[INET_ADDRSTRLEN
];
331 struct pim_assert_metric
*am
;
335 am
= &ch
->ifassert_winner_metric
;
337 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
338 ch_src_str
, sizeof(ch_src_str
));
339 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
340 ch_grp_str
, sizeof(ch_grp_str
));
341 pim_inet4_dump("<addr?>", am
->ip_address
,
342 addr_str
, sizeof(addr_str
));
344 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
345 snprintf(pref_str
, sizeof(pref_str
), "INFI");
347 snprintf(pref_str
, sizeof(pref_str
), "%4u", am
->metric_preference
);
349 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
350 snprintf(metr_str
, sizeof(metr_str
), "INFI");
352 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
354 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
359 am
->rpt_bit_flag
? "yes" : "no",
364 } /* scan interface channels */
367 static void json_object_pim_ifp_add(struct json_object
*json
, struct interface
*ifp
)
369 struct pim_interface
*pim_ifp
;
372 json_object_string_add(json
, "name", ifp
->name
);
373 json_object_string_add(json
, "state", if_is_up(ifp
) ? "up" : "down");
374 json_object_string_add(json
, "address", inet_ntoa(pim_ifp
->primary_address
));
375 json_object_int_add(json
, "index", ifp
->ifindex
);
377 if (if_is_multicast(ifp
))
378 json_object_boolean_true_add(json
, "flagMulticast");
380 if (if_is_broadcast(ifp
))
381 json_object_boolean_true_add(json
, "flagBroadcast");
383 if (ifp
->flags
& IFF_ALLMULTI
)
384 json_object_boolean_true_add(json
, "flagAllMulticast");
386 if (ifp
->flags
& IFF_PROMISC
)
387 json_object_boolean_true_add(json
, "flagPromiscuous");
389 if (PIM_IF_IS_DELETED(ifp
))
390 json_object_boolean_true_add(json
, "flagDeleted");
392 if (pim_if_lan_delay_enabled(ifp
))
393 json_object_boolean_true_add(json
, "lanDelayEnabled");
396 static void pim_show_membership(struct vty
*vty
, u_char uj
)
398 struct pim_interface
*pim_ifp
;
399 struct listnode
*ch_node
;
400 struct pim_ifchannel
*ch
;
402 json_object
*json
= NULL
;
403 json_object
*json_iface
= NULL
;
404 json_object
*json_row
= NULL
;
405 json_object
*json_tmp
= NULL
;
407 json
= json_object_new_object();
409 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
411 pim_ifp
= ch
->interface
->info
;
416 char ch_src_str
[INET_ADDRSTRLEN
];
417 char ch_grp_str
[INET_ADDRSTRLEN
];
419 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
420 ch_src_str
, sizeof(ch_src_str
));
421 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
422 ch_grp_str
, sizeof(ch_grp_str
));
424 json_object_object_get_ex(json
, ch
->interface
->name
, &json_iface
);
427 json_iface
= json_object_new_object();
428 json_object_pim_ifp_add(json_iface
, ch
->interface
);
429 json_object_object_add(json
, ch
->interface
->name
, json_iface
);
432 json_row
= json_object_new_object();
433 json_object_string_add(json_row
, "source", ch_src_str
);
434 json_object_string_add(json_row
, "group", ch_grp_str
);
435 json_object_string_add(json_row
, "localMembership",
436 ch
->local_ifmembership
== PIM_IFMEMBERSHIP_NOINFO
? "NOINFO" : "INCLUDE");
437 json_object_object_add(json_iface
, ch_grp_str
, json_row
);
438 } /* scan interface channels */
441 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
444 "Interface Address Source Group Membership%s",
448 * Example of the json data we are traversing
454 * "address":"10.1.20.1",
456 * "flagMulticast":true,
457 * "flagBroadcast":true,
458 * "lanDelayEnabled":true,
461 * "group":"226.10.10.10",
462 * "localMembership":"INCLUDE"
468 /* foreach interface */
469 json_object_object_foreach(json
, key
, val
) {
471 /* Find all of the keys where the val is an object. In the example
472 * above the only one is 226.10.10.10
474 json_object_object_foreach(val
, if_field_key
, if_field_val
) {
475 type
= json_object_get_type(if_field_val
);
477 if (type
== json_type_object
) {
478 vty_out(vty
, "%-9s ", key
);
480 json_object_object_get_ex(val
, "address", &json_tmp
);
481 vty_out(vty
, "%-15s ", json_object_get_string(json_tmp
));
483 json_object_object_get_ex(if_field_val
, "source", &json_tmp
);
484 vty_out(vty
, "%-15s ", json_object_get_string(json_tmp
));
487 vty_out(vty
, "%-15s ", if_field_key
);
489 json_object_object_get_ex(if_field_val
, "localMembership", &json_tmp
);
490 vty_out(vty
, "%-10s%s", json_object_get_string(json_tmp
), VTY_NEWLINE
);
496 json_object_free(json
);
499 static void pim_print_ifp_flags(struct vty
*vty
, struct interface
*ifp
, int mloop
)
501 vty_out(vty
, "Flags%s", VTY_NEWLINE
);
502 vty_out(vty
, "-----%s", VTY_NEWLINE
);
503 vty_out(vty
, "All Multicast : %s%s", (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no", VTY_NEWLINE
);
504 vty_out(vty
, "Broadcast : %s%s", if_is_broadcast(ifp
)? "yes" : "no", VTY_NEWLINE
);
505 vty_out(vty
, "Deleted : %s%s", PIM_IF_IS_DELETED(ifp
) ? "yes" : "no", VTY_NEWLINE
);
506 vty_out(vty
, "Interface Index : %d%s", ifp
->ifindex
, VTY_NEWLINE
);
507 vty_out(vty
, "Multicast : %s%s", if_is_multicast(ifp
) ? "yes" : "no", VTY_NEWLINE
);
508 vty_out(vty
, "Multicast Loop : %d%s", mloop
, VTY_NEWLINE
);
509 vty_out(vty
, "Promiscuous : %s%s", (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no", VTY_NEWLINE
);
510 vty_out(vty
, "%s", VTY_NEWLINE
);
511 vty_out(vty
, "%s", VTY_NEWLINE
);
514 static void igmp_show_interfaces(struct vty
*vty
, u_char uj
)
516 struct listnode
*node
;
517 struct interface
*ifp
;
519 json_object
*json
= NULL
;
520 json_object
*json_row
= NULL
;
522 now
= pim_time_monotonic_sec();
525 json
= json_object_new_object();
528 "Interface State Address V Querier Query Timer Uptime%s",
531 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
532 struct pim_interface
*pim_ifp
;
533 struct listnode
*sock_node
;
534 struct igmp_sock
*igmp
;
541 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
543 char query_hhmmss
[10];
545 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
546 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
549 json_row
= json_object_new_object();
550 json_object_pim_ifp_add(json_row
, ifp
);
551 json_object_string_add(json_row
, "upTime", uptime
);
552 json_object_int_add(json_row
, "version", pim_ifp
->igmp_version
);
554 if (igmp
->t_igmp_query_timer
) {
555 json_object_boolean_true_add(json_row
, "querier");
556 json_object_string_add(json_row
, "queryTimer", query_hhmmss
);
559 json_object_object_add(json
, ifp
->name
, json_row
);
562 vty_out(vty
, "%-9s %5s %15s %d %7s %11s %8s%s",
564 if_is_up(ifp
) ? "up" : "down",
565 inet_ntoa(igmp
->ifaddr
),
566 pim_ifp
->igmp_version
,
567 igmp
->t_igmp_query_timer
? "local" : "other",
576 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
577 json_object_free(json
);
581 static void igmp_show_interfaces_single(struct vty
*vty
, const char *ifname
, u_char uj
)
583 struct igmp_sock
*igmp
;
584 struct interface
*ifp
;
585 struct listnode
*node
;
586 struct listnode
*sock_node
;
587 struct pim_interface
*pim_ifp
;
589 char query_hhmmss
[10];
590 char other_hhmmss
[10];
591 int found_ifname
= 0;
594 long gmi_msec
; /* Group Membership Interval */
597 long oqpi_msec
; /* Other Querier Present Interval */
601 json_object
*json
= NULL
;
602 json_object
*json_row
= NULL
;
605 json
= json_object_new_object();
607 now
= pim_time_monotonic_sec();
609 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
615 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
618 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
620 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
621 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
622 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
624 gmi_msec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
625 igmp
->querier_query_interval
,
626 pim_ifp
->igmp_query_max_response_time_dsec
);
628 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
630 oqpi_msec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
631 igmp
->querier_query_interval
,
632 pim_ifp
->igmp_query_max_response_time_dsec
);
634 lmqt_msec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
635 igmp
->querier_robustness_variable
);
637 ohpi_msec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
638 igmp
->querier_query_interval
,
639 pim_ifp
->igmp_query_max_response_time_dsec
) * 100;
641 qri_msec
= pim_ifp
->igmp_query_max_response_time_dsec
* 100;
642 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
645 json_row
= json_object_new_object();
646 json_object_pim_ifp_add(json_row
, ifp
);
647 json_object_string_add(json_row
, "upTime", uptime
);
648 json_object_string_add(json_row
, "querier", igmp
->t_igmp_query_timer
? "local" : "other");
649 json_object_int_add(json_row
, "queryStartCount", igmp
->startup_query_count
);
650 json_object_string_add(json_row
, "queryQueryTimer", query_hhmmss
);
651 json_object_string_add(json_row
, "queryOtherTimer", other_hhmmss
);
652 json_object_int_add(json_row
, "version", pim_ifp
->igmp_version
);
653 json_object_int_add(json_row
, "timerGroupMembershipIntervalMsec", gmi_msec
);
654 json_object_int_add(json_row
, "timerLastMemberQueryMsec", lmqt_msec
);
655 json_object_int_add(json_row
, "timerOlderHostPresentIntervalMsec", ohpi_msec
);
656 json_object_int_add(json_row
, "timerOtherQuerierPresentIntervalMsec", oqpi_msec
);
657 json_object_int_add(json_row
, "timerQueryInterval", igmp
->querier_query_interval
);
658 json_object_int_add(json_row
, "timerQueryResponseIntervalMsec", qri_msec
);
659 json_object_int_add(json_row
, "timerRobustnessVariable", igmp
->querier_robustness_variable
);
660 json_object_int_add(json_row
, "timerStartupQueryInterval", sqi
);
662 json_object_object_add(json
, ifp
->name
, json_row
);
665 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
666 vty_out(vty
, "State : %s%s", if_is_up(ifp
) ? "up" : "down", VTY_NEWLINE
);
667 vty_out(vty
, "Address : %s%s", inet_ntoa(pim_ifp
->primary_address
), VTY_NEWLINE
);
668 vty_out(vty
, "Uptime : %s%s", uptime
, VTY_NEWLINE
);
669 vty_out(vty
, "Version : %d%s", pim_ifp
->igmp_version
, VTY_NEWLINE
);
670 vty_out(vty
, "%s", VTY_NEWLINE
);
671 vty_out(vty
, "%s", VTY_NEWLINE
);
673 vty_out(vty
, "Querier%s", VTY_NEWLINE
);
674 vty_out(vty
, "-------%s", VTY_NEWLINE
);
675 vty_out(vty
, "Querier : %s%s", igmp
->t_igmp_query_timer
? "local" : "other", VTY_NEWLINE
);
676 vty_out(vty
, "Start Count : %d%s", igmp
->startup_query_count
, VTY_NEWLINE
);
677 vty_out(vty
, "Query Timer : %s%s", query_hhmmss
, VTY_NEWLINE
);
678 vty_out(vty
, "Other Timer : %s%s", other_hhmmss
, VTY_NEWLINE
);
679 vty_out(vty
, "%s", VTY_NEWLINE
);
680 vty_out(vty
, "%s", VTY_NEWLINE
);
682 vty_out(vty
, "Timers%s", VTY_NEWLINE
);
683 vty_out(vty
, "------%s", VTY_NEWLINE
);
684 vty_out(vty
, "Group Membership Interval : %lis%s", gmi_msec
/1000, VTY_NEWLINE
);
685 vty_out(vty
, "Last Member Query Time : %lis%s", lmqt_msec
/1000, VTY_NEWLINE
);
686 vty_out(vty
, "Older Host Present Interval : %lis%s", ohpi_msec
/1000, VTY_NEWLINE
);
687 vty_out(vty
, "Other Querier Present Interval : %lis%s", oqpi_msec
/1000, VTY_NEWLINE
);
688 vty_out(vty
, "Query Interval : %ds%s", igmp
->querier_query_interval
, VTY_NEWLINE
);
689 vty_out(vty
, "Query Response Interval : %lis%s", qri_msec
/1000, VTY_NEWLINE
);
690 vty_out(vty
, "Robustness Variable : %d%s", igmp
->querier_robustness_variable
, VTY_NEWLINE
);
691 vty_out(vty
, "Startup Query Interval : %ds%s", sqi
, VTY_NEWLINE
);
692 vty_out(vty
, "%s", VTY_NEWLINE
);
693 vty_out(vty
, "%s", VTY_NEWLINE
);
695 pim_print_ifp_flags(vty
, ifp
, mloop
);
701 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
702 json_object_free(json
);
705 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
709 static void igmp_show_interface_join(struct vty
*vty
)
711 struct listnode
*node
;
712 struct interface
*ifp
;
715 now
= pim_time_monotonic_sec();
718 "Interface Address Source Group Socket Uptime %s",
721 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
722 struct pim_interface
*pim_ifp
;
723 struct listnode
*join_node
;
724 struct igmp_join
*ij
;
725 struct in_addr pri_addr
;
726 char pri_addr_str
[INET_ADDRSTRLEN
];
733 if (!pim_ifp
->igmp_join_list
)
736 pri_addr
= pim_find_primary_addr(ifp
);
737 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
739 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, join_node
, ij
)) {
740 char group_str
[INET_ADDRSTRLEN
];
741 char source_str
[INET_ADDRSTRLEN
];
744 pim_time_uptime(uptime
, sizeof(uptime
), now
- ij
->sock_creation
);
745 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
746 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
748 vty_out(vty
, "%-9s %-15s %-15s %-15s %6d %8s%s",
756 } /* for (pim_ifp->igmp_join_list) */
762 static void pim_show_interfaces_single(struct vty
*vty
, const char *ifname
, u_char uj
)
764 struct in_addr ifaddr
;
765 struct interface
*ifp
;
766 struct listnode
*neighnode
;
767 struct listnode
*node
;
768 struct listnode
*upnode
;
769 struct pim_interface
*pim_ifp
;
770 struct pim_neighbor
*neigh
;
771 struct pim_upstream
*up
;
773 char dr_str
[INET_ADDRSTRLEN
];
776 char grp_str
[INET_ADDRSTRLEN
];
777 char hello_period
[10];
778 char hello_timer
[10];
779 char neigh_src_str
[INET_ADDRSTRLEN
];
780 char src_str
[INET_ADDRSTRLEN
];
781 char stat_uptime
[10];
784 int found_ifname
= 0;
786 json_object
*json
= NULL
;
787 json_object
*json_row
= NULL
;
788 json_object
*json_pim_neighbor
= NULL
;
789 json_object
*json_pim_neighbors
= NULL
;
790 json_object
*json_group
= NULL
;
791 json_object
*json_group_source
= NULL
;
792 json_object
*json_fhr_sources
= NULL
;
793 struct pim_secondary_addr
*sec_addr
;
794 struct listnode
*sec_node
;
796 now
= pim_time_monotonic_sec();
799 json
= json_object_new_object();
801 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
807 if (pim_ifp
->pim_sock_fd
< 0)
810 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
814 ifaddr
= pim_ifp
->primary_address
;
815 pim_inet4_dump("<dr?>", pim_ifp
->pim_dr_addr
, dr_str
, sizeof(dr_str
));
816 pim_time_uptime_begin(dr_uptime
, sizeof(dr_uptime
), now
, pim_ifp
->pim_dr_election_last
);
817 pim_time_timer_to_hhmmss(hello_timer
, sizeof(hello_timer
), pim_ifp
->t_pim_hello_timer
);
818 pim_time_mmss(hello_period
, sizeof(hello_period
), pim_ifp
->pim_hello_period
);
819 pim_time_uptime(stat_uptime
, sizeof(stat_uptime
), now
- pim_ifp
->pim_ifstat_start
);
820 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
823 json_row
= json_object_new_object();
824 json_object_pim_ifp_add(json_row
, ifp
);
826 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
827 json_object_string_add(json_row
, "useSource", inet_ntoa(pim_ifp
->update_source
));
829 if (pim_ifp
->sec_addr_list
) {
830 json_object
*sec_list
= NULL
;
832 sec_list
= json_object_new_array();
833 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
834 json_object_array_add(sec_list
, json_object_new_string(inet_ntoa(sec_addr
->addr
)));
836 json_object_object_add(json_row
, "secondaryAddressList", sec_list
);
840 if (pim_ifp
->pim_neighbor_list
->count
) {
841 json_pim_neighbors
= json_object_new_object();
843 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
844 json_pim_neighbor
= json_object_new_object();
845 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
846 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
847 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
849 json_object_string_add(json_pim_neighbor
, "address", neigh_src_str
);
850 json_object_string_add(json_pim_neighbor
, "upTime", uptime
);
851 json_object_string_add(json_pim_neighbor
, "holdtime", expire
);
853 json_object_object_add(json_pim_neighbors
, neigh_src_str
, json_pim_neighbor
);
856 json_object_object_add(json_row
, "neighbors", json_pim_neighbors
);
859 json_object_string_add(json_row
, "drAddress", dr_str
);
860 json_object_int_add(json_row
, "drPriority", pim_ifp
->pim_dr_priority
);
861 json_object_string_add(json_row
, "drUptime", dr_uptime
);
862 json_object_int_add(json_row
, "drElections", pim_ifp
->pim_dr_election_count
);
863 json_object_int_add(json_row
, "drChanges", pim_ifp
->pim_dr_election_changes
);
866 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
867 if (ifp
== up
->rpf
.source_nexthop
.interface
) {
868 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
869 if (!json_fhr_sources
) {
870 json_fhr_sources
= json_object_new_object();
873 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
874 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
875 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
877 /* Does this group live in json_fhr_sources? If not create it. */
878 json_object_object_get_ex(json_fhr_sources
, grp_str
, &json_group
);
881 json_group
= json_object_new_object();
882 json_object_object_add(json_fhr_sources
, grp_str
, json_group
);
885 json_group_source
= json_object_new_object();
886 json_object_string_add(json_group_source
, "source", src_str
);
887 json_object_string_add(json_group_source
, "group", grp_str
);
888 json_object_string_add(json_group_source
, "upTime", uptime
);
889 json_object_object_add(json_group
, src_str
, json_group_source
);
894 if (json_fhr_sources
) {
895 json_object_object_add(json_row
, "firstHopRouter", json_fhr_sources
);
898 json_object_int_add(json_row
, "helloPeriod", pim_ifp
->pim_hello_period
);
899 json_object_string_add(json_row
, "helloTimer", hello_timer
);
900 json_object_string_add(json_row
, "helloStatStart", stat_uptime
);
901 json_object_int_add(json_row
, "helloReceived", pim_ifp
->pim_ifstat_hello_recv
);
902 json_object_int_add(json_row
, "helloReceivedFailed", pim_ifp
->pim_ifstat_hello_recvfail
);
903 json_object_int_add(json_row
, "helloSend", pim_ifp
->pim_ifstat_hello_sent
);
904 json_object_int_add(json_row
, "hellosendFailed", pim_ifp
->pim_ifstat_hello_sendfail
);
905 json_object_int_add(json_row
, "helloGenerationId", pim_ifp
->pim_generation_id
);
906 json_object_int_add(json_row
, "flagMulticastLoop", mloop
);
908 json_object_int_add(json_row
, "effectivePropagationDelay", pim_if_effective_propagation_delay_msec(ifp
));
909 json_object_int_add(json_row
, "effectiveOverrideInterval", pim_if_effective_override_interval_msec(ifp
));
910 json_object_int_add(json_row
, "joinPruneOverrideInterval", pim_if_jp_override_interval_msec(ifp
));
912 json_object_int_add(json_row
, "propagationDelay", pim_ifp
->pim_propagation_delay_msec
);
913 json_object_int_add(json_row
, "propagationDelayHighest", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
);
914 json_object_int_add(json_row
, "overrideInterval", pim_ifp
->pim_override_interval_msec
);
915 json_object_int_add(json_row
, "overrideIntervalHighest", pim_ifp
->pim_neighbors_highest_override_interval_msec
);
916 json_object_object_add(json
, ifp
->name
, json_row
);
919 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
920 vty_out(vty
, "State : %s%s", if_is_up(ifp
) ? "up" : "down", VTY_NEWLINE
);
921 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
922 vty_out(vty
, "Use Source : %s%s", inet_ntoa(pim_ifp
->update_source
), VTY_NEWLINE
);
924 if (pim_ifp
->sec_addr_list
) {
925 vty_out(vty
, "Address : %s (primary)%s",
926 inet_ntoa(ifaddr
), VTY_NEWLINE
);
927 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
928 vty_out(vty
, " %s%s",
929 inet_ntoa(sec_addr
->addr
), VTY_NEWLINE
);
932 vty_out(vty
, "Address : %s%s", inet_ntoa(ifaddr
), VTY_NEWLINE
);
934 vty_out(vty
, "%s", VTY_NEWLINE
);
939 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
942 vty_out(vty
, "PIM Neighbors%s", VTY_NEWLINE
);
943 vty_out(vty
, "-------------%s", VTY_NEWLINE
);
947 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
948 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
949 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
950 vty_out(vty
, "%-15s : up for %s, holdtime expires in %s%s", neigh_src_str
, uptime
, expire
, VTY_NEWLINE
);
954 vty_out(vty
, "%s", VTY_NEWLINE
);
955 vty_out(vty
, "%s", VTY_NEWLINE
);
958 vty_out(vty
, "Designated Router%s", VTY_NEWLINE
);
959 vty_out(vty
, "-----------------%s", VTY_NEWLINE
);
960 vty_out(vty
, "Address : %s%s", dr_str
, VTY_NEWLINE
);
961 vty_out(vty
, "Priority : %d%s", pim_ifp
->pim_dr_priority
, VTY_NEWLINE
);
962 vty_out(vty
, "Uptime : %s%s", dr_uptime
, VTY_NEWLINE
);
963 vty_out(vty
, "Elections : %d%s", pim_ifp
->pim_dr_election_count
, VTY_NEWLINE
);
964 vty_out(vty
, "Changes : %d%s", pim_ifp
->pim_dr_election_changes
, VTY_NEWLINE
);
965 vty_out(vty
, "%s", VTY_NEWLINE
);
966 vty_out(vty
, "%s", VTY_NEWLINE
);
970 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
971 if (strcmp(ifp
->name
, up
->rpf
.source_nexthop
.interface
->name
) == 0) {
972 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
975 vty_out(vty
, "FHR - First Hop Router%s", VTY_NEWLINE
);
976 vty_out(vty
, "----------------------%s", VTY_NEWLINE
);
980 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
981 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
982 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
983 vty_out(vty
, "%s : %s is a source, uptime is %s%s", grp_str
, src_str
, uptime
, VTY_NEWLINE
);
989 vty_out(vty
, "%s", VTY_NEWLINE
);
990 vty_out(vty
, "%s", VTY_NEWLINE
);
993 vty_out(vty
, "Hellos%s", VTY_NEWLINE
);
994 vty_out(vty
, "------%s", VTY_NEWLINE
);
995 vty_out(vty
, "Period : %d%s", pim_ifp
->pim_hello_period
, VTY_NEWLINE
);
996 vty_out(vty
, "Timer : %s%s", hello_timer
, VTY_NEWLINE
);
997 vty_out(vty
, "StatStart : %s%s", stat_uptime
, VTY_NEWLINE
);
998 vty_out(vty
, "Receive : %d%s", pim_ifp
->pim_ifstat_hello_recv
, VTY_NEWLINE
);
999 vty_out(vty
, "Receive Failed : %d%s", pim_ifp
->pim_ifstat_hello_recvfail
, VTY_NEWLINE
);
1000 vty_out(vty
, "Send : %d%s", pim_ifp
->pim_ifstat_hello_sent
, VTY_NEWLINE
);
1001 vty_out(vty
, "Send Failed : %d%s", pim_ifp
->pim_ifstat_hello_sendfail
, VTY_NEWLINE
);
1002 vty_out(vty
, "Generation ID : %08x%s", pim_ifp
->pim_generation_id
, VTY_NEWLINE
);
1003 vty_out(vty
, "%s", VTY_NEWLINE
);
1004 vty_out(vty
, "%s", VTY_NEWLINE
);
1006 pim_print_ifp_flags(vty
, ifp
, mloop
);
1008 vty_out(vty
, "Join Prune Interval%s", VTY_NEWLINE
);
1009 vty_out(vty
, "-------------------%s", VTY_NEWLINE
);
1010 vty_out(vty
, "LAN Delay : %s%s", pim_if_lan_delay_enabled(ifp
) ? "yes" : "no", VTY_NEWLINE
);
1011 vty_out(vty
, "Effective Propagation Delay : %d msec%s", pim_if_effective_propagation_delay_msec(ifp
), VTY_NEWLINE
);
1012 vty_out(vty
, "Effective Override Interval : %d msec%s", pim_if_effective_override_interval_msec(ifp
), VTY_NEWLINE
);
1013 vty_out(vty
, "Join Prune Override Interval : %d msec%s", pim_if_jp_override_interval_msec(ifp
), VTY_NEWLINE
);
1014 vty_out(vty
, "%s", VTY_NEWLINE
);
1015 vty_out(vty
, "%s", VTY_NEWLINE
);
1017 vty_out(vty
, "LAN Prune Delay%s", VTY_NEWLINE
);
1018 vty_out(vty
, "---------------%s", VTY_NEWLINE
);
1019 vty_out(vty
, "Propagation Delay : %d msec%s", pim_ifp
->pim_propagation_delay_msec
, VTY_NEWLINE
);
1020 vty_out(vty
, "Propagation Delay (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
, VTY_NEWLINE
);
1021 vty_out(vty
, "Override Interval : %d msec%s", pim_ifp
->pim_override_interval_msec
, VTY_NEWLINE
);
1022 vty_out(vty
, "Override Interval (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_override_interval_msec
, VTY_NEWLINE
);
1023 vty_out(vty
, "%s", VTY_NEWLINE
);
1024 vty_out(vty
, "%s", VTY_NEWLINE
);
1029 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1030 json_object_free(json
);
1033 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
1037 static void pim_show_interfaces(struct vty
*vty
, u_char uj
)
1039 struct interface
*ifp
;
1040 struct listnode
*node
;
1041 struct listnode
*upnode
;
1042 struct pim_interface
*pim_ifp
;
1043 struct pim_upstream
*up
;
1046 json_object
*json
= NULL
;
1047 json_object
*json_row
= NULL
;
1048 json_object
*json_tmp
;
1050 json
= json_object_new_object();
1052 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1053 pim_ifp
= ifp
->info
;
1058 if (pim_ifp
->pim_sock_fd
< 0)
1061 pim_nbrs
= pim_ifp
->pim_neighbor_list
->count
;
1064 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
))
1065 if (ifp
== up
->rpf
.source_nexthop
.interface
)
1066 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1069 json_row
= json_object_new_object();
1070 json_object_pim_ifp_add(json_row
, ifp
);
1071 json_object_int_add(json_row
, "pimNeighbors", pim_nbrs
);
1072 json_object_int_add(json_row
, "firstHopRouter", fhr
);
1073 json_object_string_add(json_row
, "pimDesignatedRouter", inet_ntoa(pim_ifp
->pim_dr_addr
));
1075 if (pim_ifp
->pim_dr_addr
.s_addr
== pim_ifp
->primary_address
.s_addr
)
1076 json_object_boolean_true_add(json_row
, "pimDesignatedRouterLocal");
1078 json_object_object_add(json
, ifp
->name
, json_row
);
1082 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1084 vty_out(vty
, "Interface State Address PIM Nbrs PIM DR FHR%s", VTY_NEWLINE
);
1086 json_object_object_foreach(json
, key
, val
) {
1087 vty_out(vty
, "%-9s ", key
);
1089 json_object_object_get_ex(val
, "state", &json_tmp
);
1090 vty_out(vty
, "%5s ", json_object_get_string(json_tmp
));
1092 json_object_object_get_ex(val
, "address", &json_tmp
);
1093 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1095 json_object_object_get_ex(val
, "pimNeighbors", &json_tmp
);
1096 vty_out(vty
, "%8d ", json_object_get_int(json_tmp
));
1098 if (json_object_object_get_ex(val
, "pimDesignatedRouterLocal", &json_tmp
)) {
1099 vty_out(vty
, "%15s ", "local");
1101 json_object_object_get_ex(val
, "pimDesignatedRouter", &json_tmp
);
1102 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1105 json_object_object_get_ex(val
, "firstHopRouter", &json_tmp
);
1106 vty_out(vty
, "%3d%s", json_object_get_int(json_tmp
), VTY_NEWLINE
);
1110 json_object_free(json
);
1113 static void pim_show_join(struct vty
*vty
, u_char uj
)
1115 struct pim_interface
*pim_ifp
;
1116 struct in_addr ifaddr
;
1117 struct listnode
*ch_node
;
1118 struct pim_ifchannel
*ch
;
1120 json_object
*json
= NULL
;
1121 json_object
*json_iface
= NULL
;
1122 json_object
*json_row
= NULL
;
1123 json_object
*json_grp
= NULL
;
1125 now
= pim_time_monotonic_sec();
1128 json
= json_object_new_object();
1131 "Interface Address Source Group State Uptime Expire Prune%s",
1134 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
1136 pim_ifp
= ch
->interface
->info
;
1141 ifaddr
= pim_ifp
->primary_address
;
1143 char ch_src_str
[INET_ADDRSTRLEN
];
1144 char ch_grp_str
[INET_ADDRSTRLEN
];
1149 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
1150 ch_src_str
, sizeof(ch_src_str
));
1151 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
1152 ch_grp_str
, sizeof(ch_grp_str
));
1154 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
1155 pim_time_timer_to_mmss(expire
, sizeof(expire
),
1156 ch
->t_ifjoin_expiry_timer
);
1157 pim_time_timer_to_mmss(prune
, sizeof(prune
),
1158 ch
->t_ifjoin_prune_pending_timer
);
1161 json_object_object_get_ex(json
, ch
->interface
->name
, &json_iface
);
1164 json_iface
= json_object_new_object();
1165 json_object_pim_ifp_add(json_iface
, ch
->interface
);
1166 json_object_object_add(json
, ch
->interface
->name
, json_iface
);
1169 json_row
= json_object_new_object();
1170 json_object_string_add(json_row
, "source", ch_src_str
);
1171 json_object_string_add(json_row
, "group", ch_grp_str
);
1172 json_object_string_add(json_row
, "upTime", uptime
);
1173 json_object_string_add(json_row
, "expire", expire
);
1174 json_object_string_add(json_row
, "prune", prune
);
1175 json_object_string_add(json_row
, "channelJoinName",
1176 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
));
1177 if (PIM_IF_FLAG_TEST_S_G_RPT(ch
->flags
))
1178 json_object_int_add(json_row
, "SGRpt", 1);
1180 json_object_object_get_ex(json_iface
, ch_grp_str
, &json_grp
);
1183 json_grp
= json_object_new_object();
1184 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1185 json_object_object_add(json_iface
, ch_grp_str
, json_grp
);
1188 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1190 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
1191 ch
->interface
->name
,
1195 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
),
1201 } /* scan interface channels */
1204 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1205 json_object_free(json
);
1209 static void pim_show_neighbors_single(struct vty
*vty
, const char *neighbor
, u_char uj
)
1211 struct listnode
*node
;
1212 struct listnode
*neighnode
;
1213 struct interface
*ifp
;
1214 struct pim_interface
*pim_ifp
;
1215 struct pim_neighbor
*neigh
;
1217 int found_neighbor
= 0;
1218 int option_address_list
;
1219 int option_dr_priority
;
1220 int option_generation_id
;
1221 int option_holdtime
;
1222 int option_lan_prune_delay
;
1226 char neigh_src_str
[INET_ADDRSTRLEN
];
1228 json_object
*json
= NULL
;
1229 json_object
*json_ifp
= NULL
;
1230 json_object
*json_row
= NULL
;
1232 now
= pim_time_monotonic_sec();
1235 json
= json_object_new_object();
1237 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1238 pim_ifp
= ifp
->info
;
1243 if (pim_ifp
->pim_sock_fd
< 0)
1246 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1247 pim_inet4_dump("<src?>", neigh
->source_addr
,
1248 neigh_src_str
, sizeof(neigh_src_str
));
1251 * The user can specify either the interface name or the PIM neighbor IP.
1252 * If this pim_ifp matches neither then skip.
1254 if (strcmp(neighbor
, "detail") &&
1255 strcmp(neighbor
, ifp
->name
) &&
1256 strcmp(neighbor
, neigh_src_str
))
1260 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1261 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1263 option_address_list
= 0;
1264 option_dr_priority
= 0;
1265 option_generation_id
= 0;
1266 option_holdtime
= 0;
1267 option_lan_prune_delay
= 0;
1270 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
))
1271 option_address_list
= 1;
1273 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
))
1274 option_dr_priority
= 1;
1276 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
))
1277 option_generation_id
= 1;
1279 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
))
1280 option_holdtime
= 1;
1282 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
))
1283 option_lan_prune_delay
= 1;
1285 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
))
1290 /* Does this ifp live in json? If not create it. */
1291 json_object_object_get_ex(json
, ifp
->name
, &json_ifp
);
1294 json_ifp
= json_object_new_object();
1295 json_object_pim_ifp_add(json_ifp
, ifp
);
1296 json_object_object_add(json
, ifp
->name
, json_ifp
);
1299 json_row
= json_object_new_object();
1300 json_object_string_add(json_row
, "interface", ifp
->name
);
1301 json_object_string_add(json_row
, "address", neigh_src_str
);
1302 json_object_string_add(json_row
, "upTime", uptime
);
1303 json_object_string_add(json_row
, "holdtime", expire
);
1304 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1305 json_object_int_add(json_row
, "generationId", neigh
->generation_id
);
1307 if (option_address_list
)
1308 json_object_boolean_true_add(json_row
, "helloOptionAddressList");
1310 if (option_dr_priority
)
1311 json_object_boolean_true_add(json_row
, "helloOptionDrPriority");
1313 if (option_generation_id
)
1314 json_object_boolean_true_add(json_row
, "helloOptionGenerationId");
1316 if (option_holdtime
)
1317 json_object_boolean_true_add(json_row
, "helloOptionHoldtime");
1319 if (option_lan_prune_delay
)
1320 json_object_boolean_true_add(json_row
, "helloOptionLanPruneDelay");
1323 json_object_boolean_true_add(json_row
, "helloOptionTBit");
1325 json_object_object_add(json_ifp
, neigh_src_str
, json_row
);
1328 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
1329 vty_out(vty
, "Neighbor : %s%s", neigh_src_str
, VTY_NEWLINE
);
1330 vty_out(vty
, " Uptime : %s%s", uptime
, VTY_NEWLINE
);
1331 vty_out(vty
, " Holdtime : %s%s", expire
, VTY_NEWLINE
);
1332 vty_out(vty
, " DR Priority : %d%s", neigh
->dr_priority
, VTY_NEWLINE
);
1333 vty_out(vty
, " Generation ID : %08x%s", neigh
->generation_id
, VTY_NEWLINE
);
1334 vty_out(vty
, " Override Interval (msec) : %d%s", neigh
->override_interval_msec
, VTY_NEWLINE
);
1335 vty_out(vty
, " Propagation Delay (msec) : %d%s", neigh
->propagation_delay_msec
, VTY_NEWLINE
);
1336 vty_out(vty
, " Hello Option - Address List : %s%s", option_address_list
? "yes" : "no", VTY_NEWLINE
);
1337 vty_out(vty
, " Hello Option - DR Priority : %s%s", option_dr_priority
? "yes" : "no", VTY_NEWLINE
);
1338 vty_out(vty
, " Hello Option - Generation ID : %s%s", option_generation_id
? "yes" : "no", VTY_NEWLINE
);
1339 vty_out(vty
, " Hello Option - Holdtime : %s%s", option_holdtime
? "yes" : "no", VTY_NEWLINE
);
1340 vty_out(vty
, " Hello Option - LAN Prune Delay : %s%s", option_lan_prune_delay
? "yes" : "no", VTY_NEWLINE
);
1341 vty_out(vty
, " Hello Option - T-bit : %s%s", option_t_bit
? "yes" : "no", VTY_NEWLINE
);
1342 vty_out(vty
, "%s", VTY_NEWLINE
);
1348 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1349 json_object_free(json
);
1352 if (!found_neighbor
)
1353 vty_out (vty
, "%% No such interface or neighbor%s", VTY_NEWLINE
);
1359 pim_show_state(struct vty
*vty
, const char *src_or_group
, const char *group
, u_char uj
)
1361 struct channel_oil
*c_oil
;
1362 struct listnode
*node
;
1363 json_object
*json
= NULL
;
1364 json_object
*json_group
= NULL
;
1365 json_object
*json_ifp_in
= NULL
;
1366 json_object
*json_ifp_out
= NULL
;
1367 json_object
*json_source
= NULL
;
1370 now
= pim_time_monotonic_sec();
1373 json
= json_object_new_object();
1375 vty_out(vty
, "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G)");
1376 vty_out(vty
, "%sInstalled Source Group IIF OIL%s", VTY_NEWLINE
, VTY_NEWLINE
);
1379 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
1380 char grp_str
[INET_ADDRSTRLEN
];
1381 char src_str
[INET_ADDRSTRLEN
];
1382 char in_ifname
[INTERFACE_NAMSIZ
+1];
1383 char out_ifname
[INTERFACE_NAMSIZ
+1];
1385 struct interface
*ifp_in
;
1388 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
1389 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
1390 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
1393 strcpy(in_ifname
, ifp_in
->name
);
1395 strcpy(in_ifname
, "<iif?>");
1399 if (strcmp(src_or_group
, src_str
) && strcmp(src_or_group
, grp_str
))
1402 if (group
&& strcmp(group
, grp_str
))
1408 /* Find the group, create it if it doesn't exist */
1409 json_object_object_get_ex(json
, grp_str
, &json_group
);
1412 json_group
= json_object_new_object();
1413 json_object_object_add(json
, grp_str
, json_group
);
1416 /* Find the source nested under the group, create it if it doesn't exist */
1417 json_object_object_get_ex(json_group
, src_str
, &json_source
);
1420 json_source
= json_object_new_object();
1421 json_object_object_add(json_group
, src_str
, json_source
);
1424 /* Find the inbound interface nested under the source, create it if it doesn't exist */
1425 json_object_object_get_ex(json_source
, in_ifname
, &json_ifp_in
);
1428 json_ifp_in
= json_object_new_object();
1429 json_object_object_add(json_source
, in_ifname
, json_ifp_in
);
1430 json_object_int_add (json_source
, "Installed", c_oil
->installed
);
1431 json_object_int_add (json_source
, "RefCount", c_oil
->oil_ref_count
);
1432 json_object_int_add (json_source
, "OilListSize", c_oil
->oil_size
);
1433 json_object_int_add (json_source
, "OilRescan", c_oil
->oil_inherited_rescan
);
1434 json_object_int_add (json_source
, "LastUsed", c_oil
->cc
.lastused
);
1435 json_object_int_add (json_source
, "PacketCount", c_oil
->cc
.pktcnt
);
1436 json_object_int_add (json_source
, "ByteCount", c_oil
->cc
.bytecnt
);
1437 json_object_int_add (json_source
, "WrongInterface", c_oil
->cc
.wrong_if
);
1440 vty_out(vty
, "%-9d %-15s %-15s %-7s ",
1447 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
1448 struct interface
*ifp_out
;
1449 char oif_uptime
[10];
1452 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
1456 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
1457 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
1460 strcpy(out_ifname
, ifp_out
->name
);
1462 strcpy(out_ifname
, "<oif?>");
1465 json_ifp_out
= json_object_new_object();
1466 json_object_string_add(json_ifp_out
, "source", src_str
);
1467 json_object_string_add(json_ifp_out
, "group", grp_str
);
1468 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
1469 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
1470 json_object_int_add(json_ifp_out
, "installed", c_oil
->installed
);
1472 json_object_object_add(json_ifp_in
, out_ifname
, json_ifp_out
);
1477 vty_out(vty
, "%s(%c%c%c%c)", out_ifname
,
1478 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1479 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1480 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1481 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ');
1484 vty_out(vty
, ", %s(%c%c%c%c)", out_ifname
,
1485 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1486 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1487 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1488 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ' );
1493 vty_out(vty
, "%s", VTY_NEWLINE
);
1498 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1499 json_object_free(json
);
1501 vty_out(vty
, "%s", VTY_NEWLINE
);
1505 static void pim_show_neighbors(struct vty
*vty
, u_char uj
)
1507 struct listnode
*node
;
1508 struct listnode
*neighnode
;
1509 struct interface
*ifp
;
1510 struct pim_interface
*pim_ifp
;
1511 struct pim_neighbor
*neigh
;
1515 char neigh_src_str
[INET_ADDRSTRLEN
];
1516 json_object
*json
= NULL
;
1517 json_object
*json_ifp_rows
= NULL
;
1518 json_object
*json_row
= NULL
;
1520 now
= pim_time_monotonic_sec();
1523 json
= json_object_new_object();
1525 vty_out(vty
, "Interface Neighbor Uptime Holdtime DR Pri%s", VTY_NEWLINE
);
1528 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1529 pim_ifp
= ifp
->info
;
1534 if (pim_ifp
->pim_sock_fd
< 0)
1538 json_ifp_rows
= json_object_new_object();
1540 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1541 pim_inet4_dump("<src?>", neigh
->source_addr
,
1542 neigh_src_str
, sizeof(neigh_src_str
));
1543 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1544 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1547 json_row
= json_object_new_object();
1548 json_object_string_add(json_row
, "interface", ifp
->name
);
1549 json_object_string_add(json_row
, "neighbor", neigh_src_str
);
1550 json_object_string_add(json_row
, "upTime", uptime
);
1551 json_object_string_add(json_row
, "holdTime", expire
);
1552 json_object_int_add(json_row
, "holdTimeMax", neigh
->holdtime
);
1553 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1554 json_object_object_add(json_ifp_rows
, neigh_src_str
, json_row
);
1557 vty_out(vty
, "%-9s %15s %8s %8s %6d%s",
1568 json_object_object_add(json
, ifp
->name
, json_ifp_rows
);
1569 json_ifp_rows
= NULL
;
1574 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1575 json_object_free(json
);
1579 static void pim_show_neighbors_secondary(struct vty
*vty
)
1581 struct listnode
*node
;
1582 struct interface
*ifp
;
1584 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
1586 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1587 struct pim_interface
*pim_ifp
;
1588 struct in_addr ifaddr
;
1589 struct listnode
*neighnode
;
1590 struct pim_neighbor
*neigh
;
1592 pim_ifp
= ifp
->info
;
1597 if (pim_ifp
->pim_sock_fd
< 0)
1600 ifaddr
= pim_ifp
->primary_address
;
1602 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1603 char neigh_src_str
[INET_ADDRSTRLEN
];
1604 struct listnode
*prefix_node
;
1607 if (!neigh
->prefix_list
)
1610 pim_inet4_dump("<src?>", neigh
->source_addr
,
1611 neigh_src_str
, sizeof(neigh_src_str
));
1613 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
1614 char neigh_sec_str
[INET_ADDRSTRLEN
];
1616 if (p
->family
!= AF_INET
)
1619 pim_inet4_dump("<src?>", p
->u
.prefix4
,
1620 neigh_sec_str
, sizeof(neigh_sec_str
));
1622 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
1634 json_object_pim_upstream_add (json_object
*json
, struct pim_upstream
*up
)
1636 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED
)
1637 json_object_boolean_true_add(json
, "drJoinDesired");
1639 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED
)
1640 json_object_boolean_true_add(json
, "drJoinDesiredUpdated");
1642 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1643 json_object_boolean_true_add(json
, "firstHopRouter");
1645 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_IGMP
)
1646 json_object_boolean_true_add(json
, "sourceIgmp");
1648 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_PIM
)
1649 json_object_boolean_true_add(json
, "sourcePim");
1651 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_STREAM
)
1652 json_object_boolean_true_add(json
, "sourceStream");
1654 /* XXX: need to print ths flag in the plain text display as well */
1655 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_MSDP
)
1656 json_object_boolean_true_add(json
, "sourceMsdp");
1660 pim_upstream_state2brief_str (enum pim_upstream_state join_state
, char *state_str
)
1664 case PIM_UPSTREAM_NOTJOINED
:
1665 strcpy (state_str
, "NotJ");
1667 case PIM_UPSTREAM_JOINED
:
1668 strcpy (state_str
, "J");
1671 strcpy (state_str
, "Unk");
1677 pim_reg_state2brief_str (enum pim_reg_state reg_state
, char *state_str
)
1681 case PIM_REG_NOINFO
:
1682 strcpy (state_str
, "RegNI");
1685 strcpy (state_str
, "RegJ");
1687 case PIM_REG_JOIN_PENDING
:
1689 strcpy (state_str
, "RegP");
1692 strcpy (state_str
, "Unk");
1697 static void pim_show_upstream(struct vty
*vty
, u_char uj
)
1699 struct listnode
*upnode
;
1700 struct pim_upstream
*up
;
1702 json_object
*json
= NULL
;
1703 json_object
*json_group
= NULL
;
1704 json_object
*json_row
= NULL
;
1706 now
= pim_time_monotonic_sec();
1709 json
= json_object_new_object();
1711 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt%s", VTY_NEWLINE
);
1713 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
1714 char src_str
[INET_ADDRSTRLEN
];
1715 char grp_str
[INET_ADDRSTRLEN
];
1717 char join_timer
[10];
1720 char msdp_reg_timer
[10];
1721 char state_str
[PIM_REG_STATE_STR_LEN
];
1723 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1724 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1725 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
1726 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), up
->t_join_timer
);
1729 * If we have a J/P timer for the neighbor display that
1731 if (!up
->t_join_timer
)
1733 struct pim_neighbor
*nbr
;
1735 nbr
= pim_neighbor_find (up
->rpf
.source_nexthop
.interface
,
1736 up
->rpf
.rpf_addr
.u
.prefix4
);
1738 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), nbr
->jp_timer
);
1741 pim_time_timer_to_hhmmss (rs_timer
, sizeof (rs_timer
), up
->t_rs_timer
);
1742 pim_time_timer_to_hhmmss (ka_timer
, sizeof (ka_timer
), up
->t_ka_timer
);
1743 pim_time_timer_to_hhmmss (msdp_reg_timer
, sizeof (msdp_reg_timer
), up
->t_msdp_reg_timer
);
1745 pim_upstream_state2brief_str (up
->join_state
, state_str
);
1746 if (up
->reg_state
!= PIM_REG_NOINFO
) {
1747 char tmp_str
[PIM_REG_STATE_STR_LEN
];
1749 sprintf (state_str
+ strlen (state_str
), ",%s",
1750 pim_reg_state2brief_str (up
->reg_state
, tmp_str
));
1754 json_object_object_get_ex(json
, grp_str
, &json_group
);
1757 json_group
= json_object_new_object();
1758 json_object_object_add(json
, grp_str
, json_group
);
1761 json_row
= json_object_new_object();
1762 json_object_pim_upstream_add(json_row
, up
);
1763 json_object_string_add(json_row
, "inboundInterface", up
->rpf
.source_nexthop
.interface
->name
);
1764 json_object_string_add(json_row
, "source", src_str
);
1765 json_object_string_add(json_row
, "group", grp_str
);
1766 json_object_string_add(json_row
, "state", state_str
);
1767 json_object_string_add(json_row
, "joinState", pim_upstream_state2str (up
->join_state
));
1768 json_object_string_add(json_row
, "regState", pim_reg_state2str (up
->reg_state
, state_str
));
1769 json_object_string_add(json_row
, "upTime", uptime
);
1770 json_object_string_add(json_row
, "joinTimer", join_timer
);
1771 json_object_string_add(json_row
, "resetTimer", rs_timer
);
1772 json_object_string_add(json_row
, "keepaliveTimer", ka_timer
);
1773 json_object_string_add(json_row
, "msdpRegTimer", msdp_reg_timer
);
1774 json_object_int_add(json_row
, "refCount", up
->ref_count
);
1775 json_object_int_add(json_row
, "sptBit", up
->sptbit
);
1776 json_object_object_add(json_group
, src_str
, json_row
);
1778 vty_out(vty
, "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d%s",
1779 up
->rpf
.source_nexthop
.interface
->name
,
1793 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1794 json_object_free(json
);
1798 static void pim_show_join_desired(struct vty
*vty
, u_char uj
)
1800 struct listnode
*chnode
;
1801 struct pim_interface
*pim_ifp
;
1802 struct pim_ifchannel
*ch
;
1803 char src_str
[INET_ADDRSTRLEN
];
1804 char grp_str
[INET_ADDRSTRLEN
];
1805 json_object
*json
= NULL
;
1806 json_object
*json_group
= NULL
;
1807 json_object
*json_row
= NULL
;
1810 json
= json_object_new_object();
1813 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1816 /* scan per-interface (S,G) state */
1817 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, chnode
, ch
)) {
1818 /* scan all interfaces */
1819 pim_ifp
= ch
->interface
->info
;
1823 struct pim_upstream
*up
= ch
->upstream
;
1825 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1826 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1829 json_object_object_get_ex(json
, grp_str
, &json_group
);
1832 json_group
= json_object_new_object();
1833 json_object_object_add(json
, grp_str
, json_group
);
1836 json_row
= json_object_new_object();
1837 json_object_pim_upstream_add(json_row
, up
);
1838 json_object_string_add(json_row
, "interface", ch
->interface
->name
);
1839 json_object_string_add(json_row
, "source", src_str
);
1840 json_object_string_add(json_row
, "group", grp_str
);
1842 if (pim_macro_ch_lost_assert(ch
))
1843 json_object_boolean_true_add(json_row
, "lostAssert");
1845 if (pim_macro_chisin_joins(ch
))
1846 json_object_boolean_true_add(json_row
, "joins");
1848 if (pim_macro_chisin_pim_include(ch
))
1849 json_object_boolean_true_add(json_row
, "pimInclude");
1851 if (pim_upstream_evaluate_join_desired(up
))
1852 json_object_boolean_true_add(json_row
, "evaluateJoinDesired");
1854 json_object_object_add(json_group
, src_str
, json_row
);
1857 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
1858 ch
->interface
->name
,
1861 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
1862 pim_macro_chisin_joins(ch
) ? "yes" : "no",
1863 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
1864 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
1865 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
1871 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1872 json_object_free(json
);
1876 static void pim_show_upstream_rpf(struct vty
*vty
, u_char uj
)
1878 struct listnode
*upnode
;
1879 struct pim_upstream
*up
;
1880 json_object
*json
= NULL
;
1881 json_object
*json_group
= NULL
;
1882 json_object
*json_row
= NULL
;
1885 json
= json_object_new_object();
1888 "Source Group RpfIface RibNextHop RpfAddress %s",
1891 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
1892 char src_str
[INET_ADDRSTRLEN
];
1893 char grp_str
[INET_ADDRSTRLEN
];
1894 char rpf_nexthop_str
[PREFIX_STRLEN
];
1895 char rpf_addr_str
[PREFIX_STRLEN
];
1896 struct pim_rpf
*rpf
;
1897 const char *rpf_ifname
;
1901 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1902 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1903 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
1904 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1906 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1909 json_object_object_get_ex(json
, grp_str
, &json_group
);
1912 json_group
= json_object_new_object();
1913 json_object_object_add(json
, grp_str
, json_group
);
1916 json_row
= json_object_new_object();
1917 json_object_pim_upstream_add(json_row
, up
);
1918 json_object_string_add(json_row
, "source", src_str
);
1919 json_object_string_add(json_row
, "group", grp_str
);
1920 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
1921 json_object_string_add(json_row
, "ribNexthop", rpf_nexthop_str
);
1922 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
1923 json_object_object_add(json_group
, src_str
, json_row
);
1925 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
1936 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1937 json_object_free(json
);
1941 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
, json_object
*json
)
1943 char refresh_uptime
[10];
1945 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
1948 json_object_int_add(json
, "rpfCacheRefreshDelayMsecs", qpim_rpf_cache_refresh_delay_msec
);
1949 json_object_int_add(json
, "rpfCacheRefreshTimer", pim_time_timer_remain_msec(qpim_rpf_cache_refresher
));
1950 json_object_int_add(json
, "rpfCacheRefreshRequests", qpim_rpf_cache_refresh_requests
);
1951 json_object_int_add(json
, "rpfCacheRefreshEvents", qpim_rpf_cache_refresh_events
);
1952 json_object_string_add(json
, "rpfCacheRefreshLast", refresh_uptime
);
1953 json_object_int_add(json
, "nexthopLookups", qpim_nexthop_lookups
);
1954 json_object_int_add(json
, "nexthopLookupsAvoided", nexthop_lookups_avoided
);
1957 "RPF Cache Refresh Delay: %ld msecs%s"
1958 "RPF Cache Refresh Timer: %ld msecs%s"
1959 "RPF Cache Refresh Requests: %lld%s"
1960 "RPF Cache Refresh Events: %lld%s"
1961 "RPF Cache Refresh Last: %s%s"
1962 "Nexthop Lookups: %lld%s"
1963 "Nexthop Lookups Avoided: %lld%s",
1964 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1965 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1966 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1967 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1968 refresh_uptime
, VTY_NEWLINE
,
1969 (long long) qpim_nexthop_lookups
, VTY_NEWLINE
,
1970 (long long)nexthop_lookups_avoided
, VTY_NEWLINE
);
1974 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1976 char uptime_scan_oil
[10];
1977 char uptime_mroute_add
[10];
1978 char uptime_mroute_del
[10];
1980 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1981 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1982 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1985 "Scan OIL - Last: %s Events: %lld%s"
1986 "MFC Add - Last: %s Events: %lld%s"
1987 "MFC Del - Last: %s Events: %lld%s",
1988 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1989 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1990 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
1993 static void pim_show_rpf(struct vty
*vty
, u_char uj
)
1995 struct listnode
*up_node
;
1996 struct pim_upstream
*up
;
1997 time_t now
= pim_time_monotonic_sec();
1998 json_object
*json
= NULL
;
1999 json_object
*json_group
= NULL
;
2000 json_object
*json_row
= NULL
;
2003 json
= json_object_new_object();
2004 show_rpf_refresh_stats(vty
, now
, json
);
2006 show_rpf_refresh_stats(vty
, now
, json
);
2007 vty_out(vty
, "%s", VTY_NEWLINE
);
2009 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
2013 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, up_node
, up
)) {
2014 char src_str
[INET_ADDRSTRLEN
];
2015 char grp_str
[INET_ADDRSTRLEN
];
2016 char rpf_addr_str
[PREFIX_STRLEN
];
2017 char rib_nexthop_str
[PREFIX_STRLEN
];
2018 const char *rpf_ifname
;
2019 struct pim_rpf
*rpf
= &up
->rpf
;
2021 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
2022 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
2023 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
2024 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
2026 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
2029 json_object_object_get_ex(json
, grp_str
, &json_group
);
2032 json_group
= json_object_new_object();
2033 json_object_object_add(json
, grp_str
, json_group
);
2036 json_row
= json_object_new_object();
2037 json_object_string_add(json_row
, "source", src_str
);
2038 json_object_string_add(json_row
, "group", grp_str
);
2039 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
2040 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
2041 json_object_string_add(json_row
, "ribNexthop", rib_nexthop_str
);
2042 json_object_int_add(json_row
, "routeMetric", rpf
->source_nexthop
.mrib_route_metric
);
2043 json_object_int_add(json_row
, "routePreference", rpf
->source_nexthop
.mrib_metric_preference
);
2044 json_object_object_add(json_group
, src_str
, json_row
);
2047 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
2053 rpf
->source_nexthop
.mrib_route_metric
,
2054 rpf
->source_nexthop
.mrib_metric_preference
,
2060 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2061 json_object_free(json
);
2066 pim_print_pnc_cache_walkcb (struct hash_backet
*backet
, void *arg
)
2068 struct pim_nexthop_cache
*pnc
= backet
->data
;
2069 struct vty
*vty
= arg
;
2070 struct nexthop
*nh_node
= NULL
;
2071 ifindex_t first_ifindex
;
2072 struct interface
*ifp
= NULL
;
2077 for (nh_node
= pnc
->nexthop
; nh_node
; nh_node
= nh_node
->next
)
2079 first_ifindex
= nh_node
->ifindex
;
2080 ifp
= if_lookup_by_index (first_ifindex
, VRF_DEFAULT
);
2082 vty_out (vty
, "%-15s ", inet_ntoa (pnc
->rpf
.rpf_addr
.u
.prefix4
));
2083 vty_out (vty
, "%-14s ", ifp
? ifp
->name
: "NULL");
2084 vty_out (vty
, "%s ", inet_ntoa (nh_node
->gate
.ipv4
));
2085 vty_out (vty
, "%s", VTY_NEWLINE
);
2091 pim_show_nexthop (struct vty
*vty
)
2094 if (pimg
&& !pimg
->rpf_hash
)
2096 vty_out (vty
, "no nexthop cache %s", VTY_NEWLINE
);
2100 vty_out (vty
, "Number of registered addresses: %lu %s",
2101 pimg
->rpf_hash
->count
, VTY_NEWLINE
);
2102 vty_out (vty
, "Address Interface Nexthop%s", VTY_NEWLINE
);
2103 vty_out (vty
, "-------------------------------------------%s", VTY_NEWLINE
);
2105 hash_walk (pimg
->rpf_hash
, pim_print_pnc_cache_walkcb
, vty
);
2109 static void igmp_show_groups(struct vty
*vty
, u_char uj
)
2111 struct listnode
*ifnode
;
2112 struct interface
*ifp
;
2114 json_object
*json
= NULL
;
2115 json_object
*json_iface
= NULL
;
2116 json_object
*json_row
= NULL
;
2118 now
= pim_time_monotonic_sec();
2121 json
= json_object_new_object();
2123 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
2125 /* scan interfaces */
2126 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2127 struct pim_interface
*pim_ifp
= ifp
->info
;
2128 struct listnode
*sock_node
;
2129 struct igmp_sock
*igmp
;
2134 /* scan igmp sockets */
2135 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2136 char ifaddr_str
[INET_ADDRSTRLEN
];
2137 struct listnode
*grpnode
;
2138 struct igmp_group
*grp
;
2140 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2142 /* scan igmp groups */
2143 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2144 char group_str
[INET_ADDRSTRLEN
];
2148 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2149 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
2150 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
2153 json_object_object_get_ex(json
, ifp
->name
, &json_iface
);
2156 json_iface
= json_object_new_object();
2157 json_object_pim_ifp_add(json_iface
, ifp
);
2158 json_object_object_add(json
, ifp
->name
, json_iface
);
2161 json_row
= json_object_new_object();
2162 json_object_string_add(json_row
, "source", ifaddr_str
);
2163 json_object_string_add(json_row
, "group", group_str
);
2165 if (grp
->igmp_version
== 3)
2166 json_object_string_add(json_row
, "mode", grp
->group_filtermode_isexcl
? "EXCLUDE" : "INCLUDE");
2168 json_object_string_add(json_row
, "timer", hhmmss
);
2169 json_object_int_add(json_row
, "sourcesCount", grp
->group_source_list
? listcount(grp
->group_source_list
) : 0);
2170 json_object_int_add(json_row
, "version", grp
->igmp_version
);
2171 json_object_string_add(json_row
, "uptime", uptime
);
2172 json_object_object_add(json_iface
, group_str
, json_row
);
2175 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
2179 grp
->igmp_version
== 3 ? (grp
->group_filtermode_isexcl
? "EXCL" : "INCL") : "----",
2181 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
2186 } /* scan igmp groups */
2187 } /* scan igmp sockets */
2188 } /* scan interfaces */
2191 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2192 json_object_free(json
);
2196 static void igmp_show_group_retransmission(struct vty
*vty
)
2198 struct listnode
*ifnode
;
2199 struct interface
*ifp
;
2201 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
2203 /* scan interfaces */
2204 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2205 struct pim_interface
*pim_ifp
= ifp
->info
;
2206 struct listnode
*sock_node
;
2207 struct igmp_sock
*igmp
;
2212 /* scan igmp sockets */
2213 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2214 char ifaddr_str
[INET_ADDRSTRLEN
];
2215 struct listnode
*grpnode
;
2216 struct igmp_group
*grp
;
2218 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2220 /* scan igmp groups */
2221 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2222 char group_str
[INET_ADDRSTRLEN
];
2223 char grp_retr_mmss
[10];
2224 struct listnode
*src_node
;
2225 struct igmp_source
*src
;
2226 int grp_retr_sources
= 0;
2228 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2229 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
2232 /* count group sources with retransmission state */
2233 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2234 if (src
->source_query_retransmit_count
> 0) {
2239 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
2244 grp
->group_specific_query_retransmit_count
,
2248 } /* scan igmp groups */
2249 } /* scan igmp sockets */
2250 } /* scan interfaces */
2253 static void igmp_show_sources(struct vty
*vty
)
2255 struct listnode
*ifnode
;
2256 struct interface
*ifp
;
2259 now
= pim_time_monotonic_sec();
2261 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
2263 /* scan interfaces */
2264 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2265 struct pim_interface
*pim_ifp
= ifp
->info
;
2266 struct listnode
*sock_node
;
2267 struct igmp_sock
*igmp
;
2272 /* scan igmp sockets */
2273 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2274 char ifaddr_str
[INET_ADDRSTRLEN
];
2275 struct listnode
*grpnode
;
2276 struct igmp_group
*grp
;
2278 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2280 /* scan igmp groups */
2281 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2282 char group_str
[INET_ADDRSTRLEN
];
2283 struct listnode
*srcnode
;
2284 struct igmp_source
*src
;
2286 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2288 /* scan group sources */
2289 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2290 char source_str
[INET_ADDRSTRLEN
];
2294 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2296 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
2298 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
2300 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
2306 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
2310 } /* scan group sources */
2311 } /* scan igmp groups */
2312 } /* scan igmp sockets */
2313 } /* scan interfaces */
2316 static void igmp_show_source_retransmission(struct vty
*vty
)
2318 struct listnode
*ifnode
;
2319 struct interface
*ifp
;
2321 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
2323 /* scan interfaces */
2324 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2325 struct pim_interface
*pim_ifp
= ifp
->info
;
2326 struct listnode
*sock_node
;
2327 struct igmp_sock
*igmp
;
2332 /* scan igmp sockets */
2333 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2334 char ifaddr_str
[INET_ADDRSTRLEN
];
2335 struct listnode
*grpnode
;
2336 struct igmp_group
*grp
;
2338 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2340 /* scan igmp groups */
2341 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2342 char group_str
[INET_ADDRSTRLEN
];
2343 struct listnode
*srcnode
;
2344 struct igmp_source
*src
;
2346 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2348 /* scan group sources */
2349 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2350 char source_str
[INET_ADDRSTRLEN
];
2352 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2354 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
2359 src
->source_query_retransmit_count
,
2362 } /* scan group sources */
2363 } /* scan igmp groups */
2364 } /* scan igmp sockets */
2365 } /* scan interfaces */
2368 static void clear_igmp_interfaces()
2370 struct listnode
*ifnode
;
2371 struct listnode
*ifnextnode
;
2372 struct interface
*ifp
;
2374 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2375 pim_if_addr_del_all_igmp(ifp
);
2378 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2379 pim_if_addr_add_all(ifp
);
2383 static void clear_pim_interfaces()
2385 struct listnode
*ifnode
;
2386 struct listnode
*ifnextnode
;
2387 struct interface
*ifp
;
2389 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2391 pim_neighbor_delete_all(ifp
, "interface cleared");
2396 static void clear_interfaces()
2398 clear_igmp_interfaces();
2399 clear_pim_interfaces();
2402 DEFUN (clear_ip_interfaces
,
2403 clear_ip_interfaces_cmd
,
2404 "clear ip interfaces",
2407 "Reset interfaces\n")
2414 DEFUN (clear_ip_igmp_interfaces
,
2415 clear_ip_igmp_interfaces_cmd
,
2416 "clear ip igmp interfaces",
2420 "Reset IGMP interfaces\n")
2422 clear_igmp_interfaces();
2427 static void mroute_add_all()
2429 struct listnode
*node
;
2430 struct channel_oil
*c_oil
;
2432 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2433 if (pim_mroute_add(c_oil
, __PRETTY_FUNCTION__
)) {
2434 /* just log warning */
2435 char source_str
[INET_ADDRSTRLEN
];
2436 char group_str
[INET_ADDRSTRLEN
];
2437 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2438 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2439 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
2440 __FILE__
, __PRETTY_FUNCTION__
,
2441 source_str
, group_str
);
2446 static void mroute_del_all()
2448 struct listnode
*node
;
2449 struct channel_oil
*c_oil
;
2451 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2452 if (pim_mroute_del(c_oil
, __PRETTY_FUNCTION__
)) {
2453 /* just log warning */
2454 char source_str
[INET_ADDRSTRLEN
];
2455 char group_str
[INET_ADDRSTRLEN
];
2456 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2457 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2458 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
2459 __FILE__
, __PRETTY_FUNCTION__
,
2460 source_str
, group_str
);
2465 DEFUN (clear_ip_mroute
,
2466 clear_ip_mroute_cmd
,
2470 "Reset multicast routes\n")
2478 DEFUN (clear_ip_pim_interfaces
,
2479 clear_ip_pim_interfaces_cmd
,
2480 "clear ip pim interfaces",
2484 "Reset PIM interfaces\n")
2486 clear_pim_interfaces();
2491 DEFUN (clear_ip_pim_oil
,
2492 clear_ip_pim_oil_cmd
,
2497 "Rescan PIM OIL (output interface list)\n")
2504 DEFUN (show_ip_igmp_interface
,
2505 show_ip_igmp_interface_cmd
,
2506 "show ip igmp interface [detail|WORD] [json]",
2510 "IGMP interface information\n"
2513 "JavaScript Object Notation\n")
2515 u_char uj
= use_json(argc
, argv
);
2518 if (argv_find(argv
, argc
, "detail", &idx
) ||
2519 argv_find(argv
, argc
, "WORD", &idx
))
2520 igmp_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2522 igmp_show_interfaces(vty
, uj
);
2527 DEFUN (show_ip_igmp_join
,
2528 show_ip_igmp_join_cmd
,
2529 "show ip igmp join",
2533 "IGMP static join information\n")
2535 igmp_show_interface_join(vty
);
2540 DEFUN (show_ip_igmp_groups
,
2541 show_ip_igmp_groups_cmd
,
2542 "show ip igmp groups [json]",
2547 "JavaScript Object Notation\n")
2549 u_char uj
= use_json(argc
, argv
);
2550 igmp_show_groups(vty
, uj
);
2555 DEFUN (show_ip_igmp_groups_retransmissions
,
2556 show_ip_igmp_groups_retransmissions_cmd
,
2557 "show ip igmp groups retransmissions",
2562 "IGMP group retransmissions\n")
2564 igmp_show_group_retransmission(vty
);
2569 DEFUN (show_ip_igmp_sources
,
2570 show_ip_igmp_sources_cmd
,
2571 "show ip igmp sources",
2577 igmp_show_sources(vty
);
2582 DEFUN (show_ip_igmp_sources_retransmissions
,
2583 show_ip_igmp_sources_retransmissions_cmd
,
2584 "show ip igmp sources retransmissions",
2589 "IGMP source retransmissions\n")
2591 igmp_show_source_retransmission(vty
);
2596 DEFUN (show_ip_pim_assert
,
2597 show_ip_pim_assert_cmd
,
2598 "show ip pim assert",
2602 "PIM interface assert\n")
2604 pim_show_assert(vty
);
2609 DEFUN (show_ip_pim_assert_internal
,
2610 show_ip_pim_assert_internal_cmd
,
2611 "show ip pim assert-internal",
2615 "PIM interface internal assert state\n")
2617 pim_show_assert_internal(vty
);
2622 DEFUN (show_ip_pim_assert_metric
,
2623 show_ip_pim_assert_metric_cmd
,
2624 "show ip pim assert-metric",
2628 "PIM interface assert metric\n")
2630 pim_show_assert_metric(vty
);
2635 DEFUN (show_ip_pim_assert_winner_metric
,
2636 show_ip_pim_assert_winner_metric_cmd
,
2637 "show ip pim assert-winner-metric",
2641 "PIM interface assert winner metric\n")
2643 pim_show_assert_winner_metric(vty
);
2648 DEFUN (show_ip_pim_interface
,
2649 show_ip_pim_interface_cmd
,
2650 "show ip pim interface [detail|WORD] [json]",
2654 "PIM interface information\n"
2657 "JavaScript Object Notation\n")
2659 u_char uj
= use_json(argc
, argv
);
2662 if (argv_find(argv
, argc
, "WORD", &idx
) ||
2663 argv_find(argv
, argc
, "detail", &idx
))
2664 pim_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2667 pim_show_interfaces(vty
, uj
);
2672 DEFUN (show_ip_pim_join
,
2673 show_ip_pim_join_cmd
,
2674 "show ip pim join [json]",
2678 "PIM interface join information\n"
2681 u_char uj
= use_json(argc
, argv
);
2682 pim_show_join(vty
, uj
);
2687 DEFUN (show_ip_pim_local_membership
,
2688 show_ip_pim_local_membership_cmd
,
2689 "show ip pim local-membership [json]",
2693 "PIM interface local-membership\n"
2696 u_char uj
= use_json(argc
, argv
);
2697 pim_show_membership(vty
, uj
);
2702 DEFUN (show_ip_pim_neighbor
,
2703 show_ip_pim_neighbor_cmd
,
2704 "show ip pim neighbor [detail|WORD] [json]",
2708 "PIM neighbor information\n"
2710 "Name of interface or neighbor\n"
2711 "JavaScript Object Notation\n")
2713 u_char uj
= use_json(argc
, argv
);
2716 if (argv_find(argv
, argc
, "detail", &idx
) ||
2717 argv_find(argv
, argc
, "WORD", &idx
))
2718 pim_show_neighbors_single(vty
, argv
[idx
]->arg
, uj
);
2720 pim_show_neighbors(vty
, uj
);
2725 DEFUN (show_ip_pim_secondary
,
2726 show_ip_pim_secondary_cmd
,
2727 "show ip pim secondary",
2731 "PIM neighbor addresses\n")
2733 pim_show_neighbors_secondary(vty
);
2738 DEFUN (show_ip_pim_state
,
2739 show_ip_pim_state_cmd
,
2740 "show ip pim state [A.B.C.D [A.B.C.D]] [json]",
2744 "PIM state information\n"
2745 "Unicast or Multicast address\n"
2746 "Multicast address\n"
2747 "JavaScript Object Notation\n")
2749 const char *src_or_group
= NULL
;
2750 const char *group
= NULL
;
2751 u_char uj
= use_json(argc
, argv
);
2757 src_or_group
= argv
[4]->arg
;
2758 group
= argv
[5]->arg
;
2761 src_or_group
= argv
[4]->arg
;
2763 pim_show_state(vty
, src_or_group
, group
, uj
);
2768 DEFUN (show_ip_pim_upstream
,
2769 show_ip_pim_upstream_cmd
,
2770 "show ip pim upstream [json]",
2774 "PIM upstream information\n"
2775 "JavaScript Object Notation\n")
2777 u_char uj
= use_json(argc
, argv
);
2778 pim_show_upstream(vty
, uj
);
2783 DEFUN (show_ip_pim_upstream_join_desired
,
2784 show_ip_pim_upstream_join_desired_cmd
,
2785 "show ip pim upstream-join-desired [json]",
2789 "PIM upstream join-desired\n"
2790 "JavaScript Object Notation\n")
2792 u_char uj
= use_json(argc
, argv
);
2793 pim_show_join_desired(vty
, uj
);
2798 DEFUN (show_ip_pim_upstream_rpf
,
2799 show_ip_pim_upstream_rpf_cmd
,
2800 "show ip pim upstream-rpf [json]",
2804 "PIM upstream source rpf\n"
2805 "JavaScript Object Notation\n")
2807 u_char uj
= use_json(argc
, argv
);
2808 pim_show_upstream_rpf(vty
, uj
);
2813 DEFUN (show_ip_pim_rp
,
2815 "show ip pim rp-info [json]",
2819 "PIM RP information\n"
2820 "JavaScript Object Notation\n")
2822 u_char uj
= use_json(argc
, argv
);
2823 pim_rp_show_information (vty
, uj
);
2828 DEFUN (show_ip_pim_rpf
,
2829 show_ip_pim_rpf_cmd
,
2830 "show ip pim rpf [json]",
2834 "PIM cached source rpf information\n"
2835 "JavaScript Object Notation\n")
2837 u_char uj
= use_json(argc
, argv
);
2838 pim_show_rpf(vty
, uj
);
2843 DEFUN (show_ip_pim_nexthop
,
2844 show_ip_pim_nexthop_cmd
,
2845 "show ip pim nexthop",
2849 "PIM cached nexthop rpf information\n")
2851 pim_show_nexthop (vty
);
2856 DEFUN (show_ip_pim_nexthop_lookup
,
2857 show_ip_pim_nexthop_lookup_cmd
,
2858 "show ip pim nexthop-lookup A.B.C.D A.B.C.D",
2862 "PIM cached nexthop rpf lookup\n"
2863 "Source/RP address\n"
2864 "Multicast Group address\n")
2866 struct pim_nexthop_cache pnc
;
2867 struct prefix nht_p
;
2869 struct in_addr src_addr
, grp_addr
;
2870 struct in_addr vif_source
;
2871 const char *addr_str
, *addr_str1
;
2873 struct pim_nexthop nexthop
;
2874 char nexthop_addr_str
[PREFIX_STRLEN
];
2875 char grp_str
[PREFIX_STRLEN
];
2877 addr_str
= (const char *)argv
[0];
2878 result
= inet_pton (AF_INET
, addr_str
, &src_addr
);
2881 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
2882 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
2886 if (pim_is_group_224_4 (src_addr
))
2888 vty_out (vty
, "Invalid argument. Expected Valid Source Address.%s", VTY_NEWLINE
);
2892 addr_str1
= (const char *)argv
[1];
2893 result
= inet_pton (AF_INET
, addr_str1
, &grp_addr
);
2896 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
2897 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
2901 if (!pim_is_group_224_4 (grp_addr
))
2903 vty_out (vty
, "Invalid argument. Expected Valid Multicast Group Address.%s", VTY_NEWLINE
);
2907 if (!pim_rp_set_upstream_addr (&vif_source
, src_addr
, grp_addr
))
2910 memset (&pnc
, 0, sizeof (struct pim_nexthop_cache
));
2911 nht_p
.family
= AF_INET
;
2912 nht_p
.prefixlen
= IPV4_MAX_BITLEN
;
2913 nht_p
.u
.prefix4
= vif_source
;
2914 grp
.family
= AF_INET
;
2915 grp
.prefixlen
= IPV4_MAX_BITLEN
;
2916 grp
.u
.prefix4
= grp_addr
;
2917 memset (&nexthop
, 0, sizeof (nexthop
));
2919 if ((pim_find_or_track_nexthop (&nht_p
, NULL
, NULL
, &pnc
)) == 1)
2921 //Compute PIM RPF using Cached nexthop
2922 pim_ecmp_nexthop_search (&pnc
, &nexthop
, &nht_p
, &grp
, 0);
2925 pim_ecmp_nexthop_lookup (&nexthop
, vif_source
, &nht_p
, &grp
, 0);
2927 pim_addr_dump ("<grp?>", &grp
, grp_str
, sizeof (grp_str
));
2928 pim_addr_dump ("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
2929 nexthop_addr_str
, sizeof (nexthop_addr_str
));
2930 vty_out (vty
, "Group %s --- Nexthop %s Interface %s %s", grp_str
,
2931 nexthop_addr_str
, nexthop
.interface
->name
, VTY_NEWLINE
);
2936 static void show_multicast_interfaces(struct vty
*vty
)
2938 struct listnode
*node
;
2939 struct interface
*ifp
;
2941 vty_out(vty
, "%s", VTY_NEWLINE
);
2943 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2946 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2947 struct pim_interface
*pim_ifp
;
2948 struct in_addr ifaddr
;
2949 struct sioc_vif_req vreq
;
2951 pim_ifp
= ifp
->info
;
2956 memset(&vreq
, 0, sizeof(vreq
));
2957 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2959 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2960 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2961 (unsigned long)SIOCGETVIFCNT
,
2963 pim_ifp
->mroute_vif_index
,
2965 safe_strerror(errno
),
2969 ifaddr
= pim_ifp
->primary_address
;
2971 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2975 pim_ifp
->mroute_vif_index
,
2976 (unsigned long) vreq
.icount
,
2977 (unsigned long) vreq
.ocount
,
2978 (unsigned long) vreq
.ibytes
,
2979 (unsigned long) vreq
.obytes
,
2984 DEFUN (show_ip_multicast
,
2985 show_ip_multicast_cmd
,
2986 "show ip multicast",
2989 "Multicast global information\n")
2991 time_t now
= pim_time_monotonic_sec();
2995 vty_out(vty
, "Mroute socket descriptor: %d%s",
2996 qpim_mroute_socket_fd
,
2999 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
3000 vty_out(vty
, "Mroute socket uptime: %s%s",
3004 vty_out(vty
, "%s", VTY_NEWLINE
);
3006 pim_zebra_zclient_update (vty
);
3007 pim_zlookup_show_ip_multicast (vty
);
3009 vty_out(vty
, "%s", VTY_NEWLINE
);
3010 vty_out(vty
, "Maximum highest VifIndex: %d%s",
3011 PIM_MAX_USABLE_VIFS
,
3014 vty_out (vty
, "%s", VTY_NEWLINE
);
3015 vty_out (vty
, "Upstream Join Timer: %d secs%s",
3016 qpim_t_periodic
, VTY_NEWLINE
);
3017 vty_out (vty
, "Join/Prune Holdtime: %d secs%s",
3018 PIM_JP_HOLDTIME
, VTY_NEWLINE
);
3019 vty_out (vty
, "PIM ECMP: %s%s",
3020 qpim_ecmp_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3021 vty_out (vty
, "PIM ECMP Rebalance: %s%s",
3022 qpim_ecmp_rebalance_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3024 vty_out (vty
, "%s", VTY_NEWLINE
);
3026 show_rpf_refresh_stats(vty
, now
, NULL
);
3028 vty_out(vty
, "%s", VTY_NEWLINE
);
3030 show_scan_oil_stats(vty
, now
);
3032 show_multicast_interfaces(vty
);
3037 static void show_mroute(struct vty
*vty
, u_char uj
)
3039 struct listnode
*node
;
3040 struct channel_oil
*c_oil
;
3041 struct static_route
*s_route
;
3043 json_object
*json
= NULL
;
3044 json_object
*json_group
= NULL
;
3045 json_object
*json_source
= NULL
;
3046 json_object
*json_oil
= NULL
;
3047 json_object
*json_ifp_out
= NULL
;
3050 char grp_str
[INET_ADDRSTRLEN
];
3051 char src_str
[INET_ADDRSTRLEN
];
3052 char in_ifname
[INTERFACE_NAMSIZ
+1];
3053 char out_ifname
[INTERFACE_NAMSIZ
+1];
3055 struct interface
*ifp_in
;
3059 json
= json_object_new_object();
3061 vty_out(vty
, "Source Group Proto Input Output TTL Uptime%s",
3065 now
= pim_time_monotonic_sec();
3067 /* print list of PIM and IGMP routes */
3068 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3071 if (!c_oil
->installed
&& !uj
)
3074 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
3075 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
3076 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
3079 strcpy(in_ifname
, ifp_in
->name
);
3081 strcpy(in_ifname
, "<iif?>");
3085 /* Find the group, create it if it doesn't exist */
3086 json_object_object_get_ex(json
, grp_str
, &json_group
);
3089 json_group
= json_object_new_object();
3090 json_object_object_add(json
, grp_str
, json_group
);
3093 /* Find the source nested under the group, create it if it doesn't exist */
3094 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3097 json_source
= json_object_new_object();
3098 json_object_object_add(json_group
, src_str
, json_source
);
3101 /* Find the inbound interface nested under the source, create it if it doesn't exist */
3102 json_object_int_add(json_source
, "installed", c_oil
->installed
);
3103 json_object_int_add(json_source
, "refCount", c_oil
->oil_ref_count
);
3104 json_object_int_add(json_source
, "oilSize", c_oil
->oil_size
);
3105 json_object_int_add(json_source
, "OilInheritedRescan", c_oil
->oil_inherited_rescan
);
3106 json_object_string_add(json_source
, "iif", in_ifname
);
3110 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3111 struct interface
*ifp_out
;
3112 char oif_uptime
[10];
3115 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
3119 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3120 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
3124 strcpy(out_ifname
, ifp_out
->name
);
3126 strcpy(out_ifname
, "<oif?>");
3129 json_ifp_out
= json_object_new_object();
3130 json_object_string_add(json_ifp_out
, "source", src_str
);
3131 json_object_string_add(json_ifp_out
, "group", grp_str
);
3133 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
)
3134 json_object_boolean_true_add(json_ifp_out
, "protocolPim");
3136 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
)
3137 json_object_boolean_true_add(json_ifp_out
, "protocolIgmp");
3139 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
)
3140 json_object_boolean_true_add(json_ifp_out
, "protocolSource");
3142 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
)
3143 json_object_boolean_true_add(json_ifp_out
, "protocolInherited");
3145 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3146 json_object_int_add(json_ifp_out
, "iVifI", c_oil
->oil
.mfcc_parent
);
3147 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3148 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3149 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3150 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3152 json_oil
= json_object_new_object();
3153 json_object_object_add(json_source
, "oil", json_oil
);
3155 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3157 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
3158 strcpy(proto
, "PIM");
3161 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
3162 strcpy(proto
, "IGMP");
3165 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
3166 strcpy(proto
, "SRC");
3169 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) {
3170 strcpy(proto
, "STAR");
3173 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3187 in_ifname
[0] = '\0';
3193 if (!uj
&& !found_oif
) {
3194 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3206 /* Print list of static routes */
3207 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3210 if (!s_route
->c_oil
.installed
)
3213 pim_inet4_dump("<group?>", s_route
->group
, grp_str
, sizeof(grp_str
));
3214 pim_inet4_dump("<source?>", s_route
->source
, src_str
, sizeof(src_str
));
3215 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
3219 strcpy(in_ifname
, ifp_in
->name
);
3221 strcpy(in_ifname
, "<iif?>");
3225 /* Find the group, create it if it doesn't exist */
3226 json_object_object_get_ex(json
, grp_str
, &json_group
);
3229 json_group
= json_object_new_object();
3230 json_object_object_add(json
, grp_str
, json_group
);
3233 /* Find the source nested under the group, create it if it doesn't exist */
3234 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3237 json_source
= json_object_new_object();
3238 json_object_object_add(json_group
, src_str
, json_source
);
3241 json_object_string_add(json_source
, "iif", in_ifname
);
3244 strcpy(proto
, "STATIC");
3247 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3248 struct interface
*ifp_out
;
3249 char oif_uptime
[10];
3252 ttl
= s_route
->oif_ttls
[oif_vif_index
];
3256 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3257 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
3261 strcpy(out_ifname
, ifp_out
->name
);
3263 strcpy(out_ifname
, "<oif?>");
3266 json_ifp_out
= json_object_new_object();
3267 json_object_string_add(json_ifp_out
, "source", src_str
);
3268 json_object_string_add(json_ifp_out
, "group", grp_str
);
3269 json_object_boolean_true_add(json_ifp_out
, "protocolStatic");
3270 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3271 json_object_int_add(json_ifp_out
, "iVifI", c_oil
->oil
.mfcc_parent
);
3272 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3273 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3274 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3275 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3277 json_oil
= json_object_new_object();
3278 json_object_object_add(json_source
, "oil", json_oil
);
3280 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3282 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3295 in_ifname
[0] = '\0';
3301 if (!uj
&& !found_oif
) {
3302 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3315 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3316 json_object_free(json
);
3320 DEFUN (show_ip_mroute
,
3322 "show ip mroute [json]",
3328 u_char uj
= use_json(argc
, argv
);
3329 show_mroute(vty
, uj
);
3333 static void show_mroute_count(struct vty
*vty
)
3335 struct listnode
*node
;
3336 struct channel_oil
*c_oil
;
3337 struct static_route
*s_route
;
3339 vty_out(vty
, "%s", VTY_NEWLINE
);
3341 vty_out(vty
, "Source Group LastUsed Packets Bytes WrongIf %s",
3344 /* Print PIM and IGMP route counts */
3345 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3346 char group_str
[INET_ADDRSTRLEN
];
3347 char source_str
[INET_ADDRSTRLEN
];
3349 if (!c_oil
->installed
)
3352 pim_mroute_update_counters (c_oil
);
3354 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3355 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3357 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3360 c_oil
->cc
.lastused
/100,
3367 /* Print static route counts */
3368 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3369 char group_str
[INET_ADDRSTRLEN
];
3370 char source_str
[INET_ADDRSTRLEN
];
3372 if (!s_route
->c_oil
.installed
)
3375 pim_mroute_update_counters (&s_route
->c_oil
);
3377 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3378 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3380 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3383 s_route
->c_oil
.cc
.lastused
,
3384 s_route
->c_oil
.cc
.pktcnt
,
3385 s_route
->c_oil
.cc
.bytecnt
,
3386 s_route
->c_oil
.cc
.wrong_if
,
3391 DEFUN (show_ip_mroute_count
,
3392 show_ip_mroute_count_cmd
,
3393 "show ip mroute count",
3397 "Route and packet count data\n")
3399 show_mroute_count(vty
);
3405 "show ip rib A.B.C.D",
3409 "Unicast address\n")
3412 struct in_addr addr
;
3413 const char *addr_str
;
3414 struct pim_nexthop nexthop
;
3415 char nexthop_addr_str
[PREFIX_STRLEN
];
3418 memset (&nexthop
, 0, sizeof (nexthop
));
3419 addr_str
= argv
[idx_ipv4
]->arg
;
3420 result
= inet_pton(AF_INET
, addr_str
, &addr
);
3422 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
3423 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3427 if (pim_nexthop_lookup(&nexthop
, addr
, 0)) {
3428 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
3429 addr_str
, VTY_NEWLINE
);
3433 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
3436 pim_addr_dump("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
3437 nexthop_addr_str
, sizeof(nexthop_addr_str
));
3439 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
3442 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
3443 nexthop
.mrib_route_metric
,
3444 nexthop
.mrib_metric_preference
,
3450 static void show_ssmpingd(struct vty
*vty
)
3452 struct listnode
*node
;
3453 struct ssmpingd_sock
*ss
;
3456 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
3459 if (!qpim_ssmpingd_list
)
3462 now
= pim_time_monotonic_sec();
3464 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
3465 char source_str
[INET_ADDRSTRLEN
];
3467 struct sockaddr_in bind_addr
;
3468 socklen_t len
= sizeof(bind_addr
);
3469 char bind_addr_str
[INET_ADDRSTRLEN
];
3471 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
3473 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
3474 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
3475 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
3478 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
3479 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
3481 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
3485 ntohs(bind_addr
.sin_port
),
3487 (long long)ss
->requests
,
3492 DEFUN (show_ip_ssmpingd
,
3493 show_ip_ssmpingd_cmd
,
3504 pim_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
, const char *plist
)
3508 result
= pim_rp_new (rp
, group
, plist
);
3510 if (result
== PIM_MALLOC_FAIL
)
3512 vty_out (vty
, "%% Out of memory%s", VTY_NEWLINE
);
3516 if (result
== PIM_GROUP_BAD_ADDRESS
)
3518 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3522 if (result
== PIM_RP_BAD_ADDRESS
)
3524 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3528 if (result
== PIM_RP_NO_PATH
)
3530 vty_out (vty
, "%% No Path to RP address specified: %s%s", rp
, VTY_NEWLINE
);
3534 if (result
== PIM_GROUP_OVERLAP
)
3536 vty_out (vty
, "%% Group range specified cannot overlap%s", VTY_NEWLINE
);
3540 if (result
== PIM_GROUP_PFXLIST_OVERLAP
)
3542 vty_out (vty
, "%% This group is already covered by a RP prefix-list%s", VTY_NEWLINE
);
3546 if (result
== PIM_RP_PFXLIST_IN_USE
)
3548 vty_out (vty
, "%% The same prefix-list cannot be applied to multiple RPs%s", VTY_NEWLINE
);
3555 DEFUN (ip_pim_joinprune_time
,
3556 ip_pim_joinprune_time_cmd
,
3557 "ip pim join-prune-interval <60-600>",
3559 "pim multicast routing\n"
3560 "Join Prune Send Interval\n"
3563 qpim_t_periodic
= atoi(argv
[3]->arg
);
3567 DEFUN (no_ip_pim_joinprune_time
,
3568 no_ip_pim_joinprune_time_cmd
,
3569 "no ip pim join-prune-interval <60-600>",
3572 "pim multicast routing\n"
3573 "Join Prune Send Interval\n"
3576 qpim_t_periodic
= PIM_DEFAULT_T_PERIODIC
;
3580 DEFUN (ip_pim_register_suppress
,
3581 ip_pim_register_suppress_cmd
,
3582 "ip pim register-suppress-time <5-60000>",
3584 "pim multicast routing\n"
3585 "Register Suppress Timer\n"
3588 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
3592 DEFUN (no_ip_pim_register_suppress
,
3593 no_ip_pim_register_suppress_cmd
,
3594 "no ip pim register-suppress-time <5-60000>",
3597 "pim multicast routing\n"
3598 "Register Suppress Timer\n"
3601 qpim_register_suppress_time
= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
;
3605 DEFUN (ip_pim_keep_alive
,
3606 ip_pim_keep_alive_cmd
,
3607 "ip pim keep-alive-timer <31-60000>",
3609 "pim multicast routing\n"
3610 "Keep alive Timer\n"
3613 qpim_rp_keep_alive_time
= atoi (argv
[4]->arg
);
3617 DEFUN (no_ip_pim_keep_alive
,
3618 no_ip_pim_keep_alive_cmd
,
3619 "no ip pim keep-alive-timer <31-60000>",
3622 "pim multicast routing\n"
3623 "Keep alive Timer\n"
3626 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
3630 DEFUN (ip_pim_packets
,
3632 "ip pim packets <1-100>",
3634 "pim multicast routing\n"
3635 "packets to process at one time per fd\n"
3636 "Number of packets\n")
3638 qpim_packet_process
= atoi (argv
[3]->arg
);
3642 DEFUN (no_ip_pim_packets
,
3643 no_ip_pim_packets_cmd
,
3644 "no ip pim packets <1-100>",
3647 "pim multicast routing\n"
3648 "packets to process at one time per fd\n"
3649 "Number of packets\n")
3651 qpim_packet_process
= PIM_DEFAULT_PACKET_PROCESS
;
3657 "ip pim rp A.B.C.D [A.B.C.D/M]",
3659 "pim multicast routing\n"
3661 "ip address of RP\n"
3662 "Group Address range to cover\n")
3666 if (argc
== (idx_ipv4
+ 1))
3667 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
, NULL
);
3669 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3672 DEFUN (ip_pim_rp_prefix_list
,
3673 ip_pim_rp_prefix_list_cmd
,
3674 "ip pim rp A.B.C.D prefix-list WORD",
3676 "pim multicast routing\n"
3678 "ip address of RP\n"
3679 "group prefix-list filter\n"
3680 "Name of a prefix-list\n")
3682 return pim_rp_cmd_worker (vty
, argv
[3]->arg
, NULL
, argv
[5]->arg
);
3686 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
,
3689 int result
= pim_rp_del (rp
, group
, plist
);
3691 if (result
== PIM_GROUP_BAD_ADDRESS
)
3693 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3697 if (result
== PIM_RP_BAD_ADDRESS
)
3699 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3703 if (result
== PIM_RP_NOT_FOUND
)
3705 vty_out (vty
, "%% Unable to find specified RP%s", VTY_NEWLINE
);
3712 DEFUN (no_ip_pim_rp
,
3714 "no ip pim rp A.B.C.D [A.B.C.D/M]",
3717 "pim multicast routing\n"
3719 "ip address of RP\n"
3720 "Group Address range to cover\n")
3724 if (argc
== (idx_ipv4
+ 1))
3725 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
, NULL
);
3727 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3730 DEFUN (no_ip_pim_rp_prefix_list
,
3731 no_ip_pim_rp_prefix_list_cmd
,
3732 "no ip pim rp A.B.C.D prefix-list WORD",
3735 "pim multicast routing\n"
3737 "ip address of RP\n"
3738 "group prefix-list filter\n"
3739 "Name of a prefix-list\n")
3741 return pim_no_rp_cmd_worker (vty
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
3745 pim_ssm_cmd_worker (struct vty
*vty
, const char *plist
)
3747 int result
= pim_ssm_range_set (VRF_DEFAULT
, plist
);
3749 if (result
== PIM_SSM_ERR_NONE
)
3754 case PIM_SSM_ERR_NO_VRF
:
3755 vty_out (vty
, "%% VRF doesn't exist%s", VTY_NEWLINE
);
3757 case PIM_SSM_ERR_DUP
:
3758 vty_out (vty
, "%% duplicate config%s", VTY_NEWLINE
);
3761 vty_out (vty
, "%% ssm range config failed%s", VTY_NEWLINE
);
3767 DEFUN (ip_pim_ssm_prefix_list
,
3768 ip_pim_ssm_prefix_list_cmd
,
3769 "ip pim ssm prefix-list WORD",
3771 "pim multicast routing\n"
3772 "Source Specific Multicast\n"
3773 "group range prefix-list filter\n"
3774 "Name of a prefix-list\n")
3776 return pim_ssm_cmd_worker (vty
, argv
[0]->arg
);
3779 DEFUN (no_ip_pim_ssm_prefix_list
,
3780 no_ip_pim_ssm_prefix_list_cmd
,
3781 "no ip pim ssm prefix-list",
3784 "pim multicast routing\n"
3785 "Source Specific Multicast\n"
3786 "group range prefix-list filter\n")
3788 return pim_ssm_cmd_worker (vty
, NULL
);
3791 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3792 no_ip_pim_ssm_prefix_list_name_cmd
,
3793 "no ip pim ssm prefix-list WORD",
3796 "pim multicast routing\n"
3797 "Source Specific Multicast\n"
3798 "group range prefix-list filter\n"
3799 "Name of a prefix-list\n")
3801 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3803 if (ssm
->plist_name
&& !strcmp(ssm
->plist_name
, argv
[0]->arg
))
3804 return pim_ssm_cmd_worker (vty
, NULL
);
3806 vty_out (vty
, "%% pim ssm prefix-list %s doesn't exist%s",
3807 argv
[0]->arg
, VTY_NEWLINE
);
3813 ip_pim_ssm_show_group_range(struct vty
*vty
, u_char uj
)
3815 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3816 const char *range_str
= ssm
->plist_name
?ssm
->plist_name
:PIM_SSM_STANDARD_RANGE
;
3821 json
= json_object_new_object();
3822 json_object_string_add(json
, "ssmGroups", range_str
);
3823 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3824 json_object_free(json
);
3827 vty_out(vty
, "SSM group range : %s%s", range_str
, VTY_NEWLINE
);
3830 DEFUN (show_ip_pim_ssm_range
,
3831 show_ip_pim_ssm_range_cmd
,
3832 "show ip pim group-type [json]",
3837 "JavaScript Object Notation\n")
3839 u_char uj
= use_json(argc
, argv
);
3840 ip_pim_ssm_show_group_range(vty
, uj
);
3846 ip_pim_ssm_show_group_type(struct vty
*vty
, u_char uj
, const char *group
)
3848 struct in_addr group_addr
;
3849 const char *type_str
;
3852 result
= inet_pton(AF_INET
, group
, &group_addr
);
3854 type_str
= "invalid";
3857 if (pim_is_group_224_4 (group_addr
))
3858 type_str
= pim_is_grp_ssm (group_addr
)?"SSM":"ASM";
3860 type_str
= "not-multicast";
3866 json
= json_object_new_object();
3867 json_object_string_add(json
, "groupType", type_str
);
3868 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3869 json_object_free(json
);
3872 vty_out(vty
, "Group type : %s%s", type_str
, VTY_NEWLINE
);
3875 DEFUN (show_ip_pim_group_type
,
3876 show_ip_pim_group_type_cmd
,
3877 "show ip pim group-type A.B.C.D [json]",
3881 "multicast group type\n"
3883 "JavaScript Object Notation\n")
3885 u_char uj
= use_json(argc
, argv
);
3886 ip_pim_ssm_show_group_type(vty
, uj
, argv
[0]->arg
);
3891 DEFUN_HIDDEN (ip_multicast_routing
,
3892 ip_multicast_routing_cmd
,
3893 "ip multicast-routing",
3895 "Enable IP multicast forwarding\n")
3900 DEFUN_HIDDEN (no_ip_multicast_routing
,
3901 no_ip_multicast_routing_cmd
,
3902 "no ip multicast-routing",
3905 "Global IP configuration subcommands\n"
3906 "Enable IP multicast forwarding\n")
3908 vty_out (vty
, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE
);
3914 "ip ssmpingd [A.B.C.D]",
3921 struct in_addr source_addr
;
3922 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3924 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
3926 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
3927 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3931 result
= pim_ssmpingd_start(source_addr
);
3933 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
3934 source_str
, result
, VTY_NEWLINE
);
3941 DEFUN (no_ip_ssmpingd
,
3943 "no ip ssmpingd [A.B.C.D]",
3951 struct in_addr source_addr
;
3952 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3954 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
3956 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
3957 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3961 result
= pim_ssmpingd_stop(source_addr
);
3963 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
3964 source_str
, result
, VTY_NEWLINE
);
3975 "pim multicast routing\n"
3976 "Enable PIM ECMP \n")
3978 qpim_ecmp_enable
= 1;
3983 DEFUN (no_ip_pim_ecmp
,
3988 "pim multicast routing\n"
3989 "Disable PIM ECMP \n")
3991 qpim_ecmp_enable
= 0;
3996 DEFUN (ip_pim_ecmp_rebalance
,
3997 ip_pim_ecmp_rebalance_cmd
,
3998 "ip pim ecmp rebalance",
4000 "pim multicast routing\n"
4001 "Enable PIM ECMP \n"
4002 "Enable PIM ECMP Rebalance\n")
4004 qpim_ecmp_rebalance_enable
= 1;
4009 DEFUN (no_ip_pim_ecmp_rebalance
,
4010 no_ip_pim_ecmp_rebalance_cmd
,
4011 "no ip pim ecmp rebalance",
4014 "pim multicast routing\n"
4015 "Disable PIM ECMP \n"
4016 "Disable PIM ECMP Rebalance\n")
4018 qpim_ecmp_rebalance_enable
= 0;
4024 pim_cmd_igmp_start (struct vty
*vty
, struct interface
*ifp
)
4026 struct pim_interface
*pim_ifp
;
4028 pim_ifp
= ifp
->info
;
4031 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
4033 vty_out(vty
, "Could not enable IGMP on interface %s%s",
4034 ifp
->name
, VTY_NEWLINE
);
4039 PIM_IF_DO_IGMP(pim_ifp
->options
);
4042 pim_if_addr_add_all(ifp
);
4043 pim_if_membership_refresh(ifp
);
4048 DEFUN (interface_ip_igmp
,
4049 interface_ip_igmp_cmd
,
4054 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4056 return pim_cmd_igmp_start(vty
, ifp
);
4059 DEFUN (interface_no_ip_igmp
,
4060 interface_no_ip_igmp_cmd
,
4066 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4067 struct pim_interface
*pim_ifp
;
4069 pim_ifp
= ifp
->info
;
4073 PIM_IF_DONT_IGMP(pim_ifp
->options
);
4075 pim_if_membership_clear(ifp
);
4077 pim_if_addr_del_all_igmp(ifp
);
4079 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
4086 DEFUN (interface_ip_igmp_join
,
4087 interface_ip_igmp_join_cmd
,
4088 "ip igmp join A.B.C.D A.B.C.D",
4091 "IGMP join multicast group\n"
4092 "Multicast group address\n"
4095 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4098 const char *group_str
;
4099 const char *source_str
;
4100 struct in_addr group_addr
;
4101 struct in_addr source_addr
;
4105 group_str
= argv
[idx_ipv4
]->arg
;
4106 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4108 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4109 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4113 /* Source address */
4114 source_str
= argv
[idx_ipv4_2
]->arg
;
4115 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4117 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4118 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4122 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
4124 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
4125 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4132 DEFUN (interface_no_ip_igmp_join
,
4133 interface_no_ip_igmp_join_cmd
,
4134 "no ip igmp join A.B.C.D A.B.C.D",
4138 "IGMP join multicast group\n"
4139 "Multicast group address\n"
4142 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4145 const char *group_str
;
4146 const char *source_str
;
4147 struct in_addr group_addr
;
4148 struct in_addr source_addr
;
4152 group_str
= argv
[idx_ipv4
]->arg
;
4153 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4155 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4156 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4160 /* Source address */
4161 source_str
= argv
[idx_ipv4_2
]->arg
;
4162 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4164 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4165 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4169 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
4171 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
4172 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4180 CLI reconfiguration affects the interface level (struct pim_interface).
4181 This function propagates the reconfiguration to every active socket
4184 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
4186 struct interface
*ifp
;
4187 struct pim_interface
*pim_ifp
;
4191 /* other querier present? */
4193 if (igmp
->t_other_querier_timer
)
4196 /* this is the querier */
4198 zassert(igmp
->interface
);
4199 zassert(igmp
->interface
->info
);
4201 ifp
= igmp
->interface
;
4202 pim_ifp
= ifp
->info
;
4204 if (PIM_DEBUG_IGMP_TRACE
) {
4205 char ifaddr_str
[INET_ADDRSTRLEN
];
4206 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
4207 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
4208 __PRETTY_FUNCTION__
,
4211 pim_ifp
->igmp_default_query_interval
);
4215 igmp_startup_mode_on() will reset QQI:
4217 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
4219 igmp_startup_mode_on(igmp
);
4222 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
4224 if (igmp
->t_igmp_query_timer
) {
4225 /* other querier present */
4226 zassert(igmp
->t_igmp_query_timer
);
4227 zassert(!igmp
->t_other_querier_timer
);
4229 pim_igmp_general_query_off(igmp
);
4230 pim_igmp_general_query_on(igmp
);
4232 zassert(igmp
->t_igmp_query_timer
);
4233 zassert(!igmp
->t_other_querier_timer
);
4236 /* this is the querier */
4238 zassert(!igmp
->t_igmp_query_timer
);
4239 zassert(igmp
->t_other_querier_timer
);
4241 pim_igmp_other_querier_timer_off(igmp
);
4242 pim_igmp_other_querier_timer_on(igmp
);
4244 zassert(!igmp
->t_igmp_query_timer
);
4245 zassert(igmp
->t_other_querier_timer
);
4249 static void change_query_interval(struct pim_interface
*pim_ifp
,
4252 struct listnode
*sock_node
;
4253 struct igmp_sock
*igmp
;
4255 pim_ifp
->igmp_default_query_interval
= query_interval
;
4257 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4258 igmp_sock_query_interval_reconfig(igmp
);
4259 igmp_sock_query_reschedule(igmp
);
4263 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
4264 int query_max_response_time_dsec
)
4266 struct listnode
*sock_node
;
4267 struct igmp_sock
*igmp
;
4269 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
4272 Below we modify socket/group/source timers in order to quickly
4273 reflect the change. Otherwise, those timers would eventually catch
4277 /* scan all sockets */
4278 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4279 struct listnode
*grp_node
;
4280 struct igmp_group
*grp
;
4282 /* reschedule socket general query */
4283 igmp_sock_query_reschedule(igmp
);
4285 /* scan socket groups */
4286 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
4287 struct listnode
*src_node
;
4288 struct igmp_source
*src
;
4290 /* reset group timers for groups in EXCLUDE mode */
4291 if (grp
->group_filtermode_isexcl
) {
4292 igmp_group_reset_gmi(grp
);
4295 /* scan group sources */
4296 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
4298 /* reset source timers for sources with running timers */
4299 if (src
->t_source_timer
) {
4300 igmp_source_reset_gmi(igmp
, grp
, src
);
4307 #define IGMP_QUERY_INTERVAL_MIN (1)
4308 #define IGMP_QUERY_INTERVAL_MAX (1800)
4310 DEFUN (interface_ip_igmp_query_interval
,
4311 interface_ip_igmp_query_interval_cmd
,
4312 "ip igmp query-interval (1-1800)",
4315 IFACE_IGMP_QUERY_INTERVAL_STR
4316 "Query interval in seconds\n")
4318 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4319 struct pim_interface
*pim_ifp
;
4321 int query_interval_dsec
;
4324 pim_ifp
= ifp
->info
;
4327 ret
= pim_cmd_igmp_start(vty
, ifp
);
4328 if (ret
!= CMD_SUCCESS
)
4330 pim_ifp
= ifp
->info
;
4333 query_interval
= atoi(argv
[3]->arg
);
4334 query_interval_dsec
= 10 * query_interval
;
4337 It seems we don't need to check bounds since command.c does it
4338 already, but we verify them anyway for extra safety.
4340 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
4341 vty_out(vty
, "General query interval %d lower than minimum %d%s",
4343 IGMP_QUERY_INTERVAL_MIN
,
4347 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
4348 vty_out(vty
, "General query interval %d higher than maximum %d%s",
4350 IGMP_QUERY_INTERVAL_MAX
,
4355 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4357 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
4358 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4363 change_query_interval(pim_ifp
, query_interval
);
4368 DEFUN (interface_no_ip_igmp_query_interval
,
4369 interface_no_ip_igmp_query_interval_cmd
,
4370 "no ip igmp query-interval",
4374 IFACE_IGMP_QUERY_INTERVAL_STR
)
4376 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4377 struct pim_interface
*pim_ifp
;
4378 int default_query_interval_dsec
;
4380 pim_ifp
= ifp
->info
;
4385 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
4387 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4389 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
4390 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4395 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
4400 DEFUN (interface_ip_igmp_version
,
4401 interface_ip_igmp_version_cmd
,
4402 "ip igmp version (2-3)",
4406 "IGMP version number\n")
4408 VTY_DECLVAR_CONTEXT(interface
,ifp
);
4409 struct pim_interface
*pim_ifp
;
4413 pim_ifp
= ifp
->info
;
4416 ret
= pim_cmd_igmp_start(vty
, ifp
);
4417 if (ret
!= CMD_SUCCESS
)
4419 pim_ifp
= ifp
->info
;
4422 igmp_version
= atoi(argv
[3]->arg
);
4423 pim_ifp
->igmp_version
= igmp_version
;
4428 DEFUN (interface_no_ip_igmp_version
,
4429 interface_no_ip_igmp_version_cmd
,
4430 "no ip igmp version (2-3)",
4435 "IGMP version number\n")
4437 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4438 struct pim_interface
*pim_ifp
;
4440 pim_ifp
= ifp
->info
;
4445 pim_ifp
->igmp_version
= IGMP_DEFAULT_VERSION
;
4450 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4451 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4453 DEFUN (interface_ip_igmp_query_max_response_time
,
4454 interface_ip_igmp_query_max_response_time_cmd
,
4455 "ip igmp query-max-response-time (10-250)",
4458 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4459 "Query response value in deci-seconds\n")
4461 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4462 struct pim_interface
*pim_ifp
;
4463 int query_max_response_time
;
4466 pim_ifp
= ifp
->info
;
4469 ret
= pim_cmd_igmp_start(vty
, ifp
);
4470 if (ret
!= CMD_SUCCESS
)
4472 pim_ifp
= ifp
->info
;
4475 query_max_response_time
= atoi(argv
[3]->arg
);
4477 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
* 10) {
4479 "Can't set query max response time %d sec >= general query interval %d sec%s",
4480 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
4485 change_query_max_response_time(pim_ifp
, query_max_response_time
);
4490 DEFUN (interface_no_ip_igmp_query_max_response_time
,
4491 interface_no_ip_igmp_query_max_response_time_cmd
,
4492 "no ip igmp query-max-response-time (10-250)",
4496 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4497 "Time for response in deci-seconds\n")
4499 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4500 struct pim_interface
*pim_ifp
;
4502 pim_ifp
= ifp
->info
;
4507 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4512 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4513 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4515 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
4516 interface_ip_igmp_query_max_response_time_dsec_cmd
,
4517 "ip igmp query-max-response-time-dsec (10-250)",
4520 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4521 "Query response value in deciseconds\n")
4523 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4524 struct pim_interface
*pim_ifp
;
4525 int query_max_response_time_dsec
;
4526 int default_query_interval_dsec
;
4529 pim_ifp
= ifp
->info
;
4532 ret
= pim_cmd_igmp_start(vty
, ifp
);
4533 if (ret
!= CMD_SUCCESS
)
4535 pim_ifp
= ifp
->info
;
4538 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
4540 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
4542 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
4544 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
4545 query_max_response_time_dsec
, default_query_interval_dsec
,
4550 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
4555 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4556 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4557 "no ip igmp query-max-response-time-dsec",
4561 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
4563 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4564 struct pim_interface
*pim_ifp
;
4566 pim_ifp
= ifp
->info
;
4571 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4576 DEFUN (interface_ip_pim_drprio
,
4577 interface_ip_pim_drprio_cmd
,
4578 "ip pim drpriority (1-4294967295)",
4581 "Set the Designated Router Election Priority\n"
4582 "Value of the new DR Priority\n")
4584 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4586 struct pim_interface
*pim_ifp
;
4587 uint32_t old_dr_prio
;
4589 pim_ifp
= ifp
->info
;
4592 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
4596 old_dr_prio
= pim_ifp
->pim_dr_priority
;
4598 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
4600 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
4601 if (pim_if_dr_election(ifp
))
4602 pim_hello_restart_now(ifp
);
4608 DEFUN (interface_no_ip_pim_drprio
,
4609 interface_no_ip_pim_drprio_cmd
,
4610 "no ip pim drpriority [(1-4294967295)]",
4614 "Revert the Designated Router Priority to default\n"
4615 "Old Value of the Priority\n")
4617 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4618 struct pim_interface
*pim_ifp
;
4620 pim_ifp
= ifp
->info
;
4623 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4627 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
4628 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
4629 if (pim_if_dr_election(ifp
))
4630 pim_hello_restart_now(ifp
);
4637 pim_cmd_interface_add (struct interface
*ifp
)
4639 struct pim_interface
*pim_ifp
= ifp
->info
;
4642 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
4648 PIM_IF_DO_PIM(pim_ifp
->options
);
4651 pim_if_addr_add_all(ifp
);
4652 pim_if_membership_refresh(ifp
);
4656 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4657 interface_ip_pim_ssm_cmd
,
4663 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4665 if (!pim_cmd_interface_add(ifp
)) {
4666 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4670 vty_out(vty
, "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed%s", VTY_NEWLINE
);
4674 DEFUN (interface_ip_pim_sm
,
4675 interface_ip_pim_sm_cmd
,
4681 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4682 if (!pim_cmd_interface_add(ifp
)) {
4683 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4687 pim_if_create_pimreg();
4693 pim_cmd_interface_delete (struct interface
*ifp
)
4695 struct pim_interface
*pim_ifp
= ifp
->info
;
4700 PIM_IF_DONT_PIM(pim_ifp
->options
);
4702 pim_if_membership_clear(ifp
);
4705 pim_sock_delete() removes all neighbors from
4706 pim_ifp->pim_neighbor_list.
4708 pim_sock_delete(ifp
, "pim unconfigured on interface");
4710 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
4711 pim_if_addr_del_all(ifp
);
4718 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4719 interface_no_ip_pim_ssm_cmd
,
4726 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4727 if (!pim_cmd_interface_delete(ifp
)) {
4728 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4735 DEFUN (interface_no_ip_pim_sm
,
4736 interface_no_ip_pim_sm_cmd
,
4743 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4744 if (!pim_cmd_interface_delete(ifp
)) {
4745 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4752 DEFUN (interface_ip_mroute
,
4753 interface_ip_mroute_cmd
,
4754 "ip mroute INTERFACE A.B.C.D",
4756 "Add multicast route\n"
4757 "Outgoing interface name\n"
4760 VTY_DECLVAR_CONTEXT(interface
, iif
);
4761 int idx_interface
= 2;
4763 struct interface
*oif
;
4764 const char *oifname
;
4765 const char *grp_str
;
4766 struct in_addr grp_addr
;
4767 struct in_addr src_addr
;
4770 oifname
= argv
[idx_interface
]->arg
;
4771 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4773 vty_out(vty
, "No such interface name %s%s",
4774 oifname
, VTY_NEWLINE
);
4778 grp_str
= argv
[idx_ipv4
]->arg
;
4779 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4781 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4782 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4786 src_addr
.s_addr
= INADDR_ANY
;
4788 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4789 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4796 DEFUN (interface_ip_mroute_source
,
4797 interface_ip_mroute_source_cmd
,
4798 "ip mroute INTERFACE A.B.C.D A.B.C.D",
4800 "Add multicast route\n"
4801 "Outgoing interface name\n"
4805 VTY_DECLVAR_CONTEXT(interface
, iif
);
4806 int idx_interface
= 2;
4809 struct interface
*oif
;
4810 const char *oifname
;
4811 const char *grp_str
;
4812 struct in_addr grp_addr
;
4813 const char *src_str
;
4814 struct in_addr src_addr
;
4817 oifname
= argv
[idx_interface
]->arg
;
4818 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4820 vty_out(vty
, "No such interface name %s%s",
4821 oifname
, VTY_NEWLINE
);
4825 grp_str
= argv
[idx_ipv4
]->arg
;
4826 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4828 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4829 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4833 src_str
= argv
[idx_ipv4_2
]->arg
;
4834 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
4836 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4837 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4841 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4842 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4849 DEFUN (interface_no_ip_mroute
,
4850 interface_no_ip_mroute_cmd
,
4851 "no ip mroute INTERFACE A.B.C.D",
4854 "Add multicast route\n"
4855 "Outgoing interface name\n"
4858 VTY_DECLVAR_CONTEXT(interface
, iif
);
4859 int idx_interface
= 3;
4861 struct interface
*oif
;
4862 const char *oifname
;
4863 const char *grp_str
;
4864 struct in_addr grp_addr
;
4865 struct in_addr src_addr
;
4868 oifname
= argv
[idx_interface
]->arg
;
4869 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4871 vty_out(vty
, "No such interface name %s%s",
4872 oifname
, VTY_NEWLINE
);
4876 grp_str
= argv
[idx_ipv4
]->arg
;
4877 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4879 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4880 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4884 src_addr
.s_addr
= INADDR_ANY
;
4886 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
4887 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
4894 DEFUN (interface_no_ip_mroute_source
,
4895 interface_no_ip_mroute_source_cmd
,
4896 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
4899 "Add multicast route\n"
4900 "Outgoing interface name\n"
4904 VTY_DECLVAR_CONTEXT(interface
, iif
);
4905 int idx_interface
= 3;
4908 struct interface
*oif
;
4909 const char *oifname
;
4910 const char *grp_str
;
4911 struct in_addr grp_addr
;
4912 const char *src_str
;
4913 struct in_addr src_addr
;
4916 oifname
= argv
[idx_interface
]->arg
;
4917 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4919 vty_out(vty
, "No such interface name %s%s",
4920 oifname
, VTY_NEWLINE
);
4924 grp_str
= argv
[idx_ipv4
]->arg
;
4925 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4927 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4928 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4932 src_str
= argv
[idx_ipv4_2
]->arg
;
4933 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
4935 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4936 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4940 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
4941 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
4948 DEFUN (interface_ip_pim_hello
,
4949 interface_ip_pim_hello_cmd
,
4950 "ip pim hello (1-180) [(1-180)]",
4954 IFACE_PIM_HELLO_TIME_STR
4955 IFACE_PIM_HELLO_HOLD_STR
)
4957 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4960 struct pim_interface
*pim_ifp
;
4962 pim_ifp
= ifp
->info
;
4965 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4969 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
4971 if (argc
== idx_hold
)
4972 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
4979 DEFUN (interface_no_ip_pim_hello
,
4980 interface_no_ip_pim_hello_cmd
,
4981 "no ip pim hello [(1-180) (1-180)]",
4986 IFACE_PIM_HELLO_TIME_STR
4987 IFACE_PIM_HELLO_HOLD_STR
)
4989 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4990 struct pim_interface
*pim_ifp
;
4992 pim_ifp
= ifp
->info
;
4995 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4999 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
5000 pim_ifp
->pim_default_holdtime
= -1;
5011 PIM_DO_DEBUG_IGMP_EVENTS
;
5012 PIM_DO_DEBUG_IGMP_PACKETS
;
5013 PIM_DO_DEBUG_IGMP_TRACE
;
5017 DEFUN (no_debug_igmp
,
5024 PIM_DONT_DEBUG_IGMP_EVENTS
;
5025 PIM_DONT_DEBUG_IGMP_PACKETS
;
5026 PIM_DONT_DEBUG_IGMP_TRACE
;
5031 DEFUN (debug_igmp_events
,
5032 debug_igmp_events_cmd
,
5033 "debug igmp events",
5036 DEBUG_IGMP_EVENTS_STR
)
5038 PIM_DO_DEBUG_IGMP_EVENTS
;
5042 DEFUN (no_debug_igmp_events
,
5043 no_debug_igmp_events_cmd
,
5044 "no debug igmp events",
5048 DEBUG_IGMP_EVENTS_STR
)
5050 PIM_DONT_DEBUG_IGMP_EVENTS
;
5055 DEFUN (debug_igmp_packets
,
5056 debug_igmp_packets_cmd
,
5057 "debug igmp packets",
5060 DEBUG_IGMP_PACKETS_STR
)
5062 PIM_DO_DEBUG_IGMP_PACKETS
;
5066 DEFUN (no_debug_igmp_packets
,
5067 no_debug_igmp_packets_cmd
,
5068 "no debug igmp packets",
5072 DEBUG_IGMP_PACKETS_STR
)
5074 PIM_DONT_DEBUG_IGMP_PACKETS
;
5079 DEFUN (debug_igmp_trace
,
5080 debug_igmp_trace_cmd
,
5084 DEBUG_IGMP_TRACE_STR
)
5086 PIM_DO_DEBUG_IGMP_TRACE
;
5090 DEFUN (no_debug_igmp_trace
,
5091 no_debug_igmp_trace_cmd
,
5092 "no debug igmp trace",
5096 DEBUG_IGMP_TRACE_STR
)
5098 PIM_DONT_DEBUG_IGMP_TRACE
;
5103 DEFUN (debug_mroute
,
5109 PIM_DO_DEBUG_MROUTE
;
5113 DEFUN (debug_mroute_detail
,
5114 debug_mroute_detail_cmd
,
5115 "debug mroute detail",
5120 PIM_DO_DEBUG_MROUTE_DETAIL
;
5124 DEFUN (no_debug_mroute
,
5125 no_debug_mroute_cmd
,
5131 PIM_DONT_DEBUG_MROUTE
;
5135 DEFUN (no_debug_mroute_detail
,
5136 no_debug_mroute_detail_cmd
,
5137 "no debug mroute detail",
5143 PIM_DONT_DEBUG_MROUTE_DETAIL
;
5147 DEFUN (debug_static
,
5153 PIM_DO_DEBUG_STATIC
;
5157 DEFUN (no_debug_static
,
5158 no_debug_static_cmd
,
5164 PIM_DONT_DEBUG_STATIC
;
5175 PIM_DO_DEBUG_PIM_EVENTS
;
5176 PIM_DO_DEBUG_PIM_PACKETS
;
5177 PIM_DO_DEBUG_PIM_TRACE
;
5178 PIM_DO_DEBUG_MSDP_EVENTS
;
5179 PIM_DO_DEBUG_MSDP_PACKETS
;
5183 DEFUN (no_debug_pim
,
5190 PIM_DONT_DEBUG_PIM_EVENTS
;
5191 PIM_DONT_DEBUG_PIM_PACKETS
;
5192 PIM_DONT_DEBUG_PIM_TRACE
;
5193 PIM_DONT_DEBUG_MSDP_EVENTS
;
5194 PIM_DONT_DEBUG_MSDP_PACKETS
;
5196 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5197 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5203 DEFUN (debug_pim_events
,
5204 debug_pim_events_cmd
,
5208 DEBUG_PIM_EVENTS_STR
)
5210 PIM_DO_DEBUG_PIM_EVENTS
;
5214 DEFUN (no_debug_pim_events
,
5215 no_debug_pim_events_cmd
,
5216 "no debug pim events",
5220 DEBUG_PIM_EVENTS_STR
)
5222 PIM_DONT_DEBUG_PIM_EVENTS
;
5226 DEFUN (debug_pim_packets
,
5227 debug_pim_packets_cmd
,
5228 "debug pim packets [<hello|joins|register>]",
5231 DEBUG_PIM_PACKETS_STR
5232 DEBUG_PIM_HELLO_PACKETS_STR
5233 DEBUG_PIM_J_P_PACKETS_STR
5234 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5237 if (argv_find (argv
, argc
, "hello", &idx
))
5239 PIM_DO_DEBUG_PIM_HELLO
;
5240 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
5242 else if (argv_find (argv
, argc
,"joins", &idx
))
5244 PIM_DO_DEBUG_PIM_J_P
;
5245 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
5247 else if (argv_find (argv
, argc
, "register", &idx
))
5249 PIM_DO_DEBUG_PIM_REG
;
5250 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
5254 PIM_DO_DEBUG_PIM_PACKETS
;
5255 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
5260 DEFUN (no_debug_pim_packets
,
5261 no_debug_pim_packets_cmd
,
5262 "no debug pim packets [<hello|joins|register>]",
5266 DEBUG_PIM_PACKETS_STR
5267 DEBUG_PIM_HELLO_PACKETS_STR
5268 DEBUG_PIM_J_P_PACKETS_STR
5269 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5272 if (argv_find (argv
, argc
,"hello",&idx
))
5274 PIM_DONT_DEBUG_PIM_HELLO
;
5275 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
5277 else if (argv_find (argv
, argc
, "joins", &idx
))
5279 PIM_DONT_DEBUG_PIM_J_P
;
5280 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
5282 else if (argv_find (argv
, argc
, "register", &idx
))
5284 PIM_DONT_DEBUG_PIM_REG
;
5285 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
5288 PIM_DONT_DEBUG_PIM_PACKETS
;
5294 DEFUN (debug_pim_packetdump_send
,
5295 debug_pim_packetdump_send_cmd
,
5296 "debug pim packet-dump send",
5299 DEBUG_PIM_PACKETDUMP_STR
5300 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5302 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
5306 DEFUN (no_debug_pim_packetdump_send
,
5307 no_debug_pim_packetdump_send_cmd
,
5308 "no debug pim packet-dump send",
5312 DEBUG_PIM_PACKETDUMP_STR
5313 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5315 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5320 DEFUN (debug_pim_packetdump_recv
,
5321 debug_pim_packetdump_recv_cmd
,
5322 "debug pim packet-dump receive",
5325 DEBUG_PIM_PACKETDUMP_STR
5326 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5328 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
5332 DEFUN (no_debug_pim_packetdump_recv
,
5333 no_debug_pim_packetdump_recv_cmd
,
5334 "no debug pim packet-dump receive",
5338 DEBUG_PIM_PACKETDUMP_STR
5339 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5341 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5346 DEFUN (debug_pim_trace
,
5347 debug_pim_trace_cmd
,
5351 DEBUG_PIM_TRACE_STR
)
5353 PIM_DO_DEBUG_PIM_TRACE
;
5357 DEFUN (no_debug_pim_trace
,
5358 no_debug_pim_trace_cmd
,
5359 "no debug pim trace",
5363 DEBUG_PIM_TRACE_STR
)
5365 PIM_DONT_DEBUG_PIM_TRACE
;
5370 DEFUN (debug_ssmpingd
,
5377 PIM_DO_DEBUG_SSMPINGD
;
5381 DEFUN (no_debug_ssmpingd
,
5382 no_debug_ssmpingd_cmd
,
5383 "no debug ssmpingd",
5389 PIM_DONT_DEBUG_SSMPINGD
;
5394 DEFUN (debug_pim_zebra
,
5395 debug_pim_zebra_cmd
,
5399 DEBUG_PIM_ZEBRA_STR
)
5405 DEFUN (no_debug_pim_zebra
,
5406 no_debug_pim_zebra_cmd
,
5407 "no debug pim zebra",
5411 DEBUG_PIM_ZEBRA_STR
)
5413 PIM_DONT_DEBUG_ZEBRA
;
5424 PIM_DO_DEBUG_MSDP_EVENTS
;
5425 PIM_DO_DEBUG_MSDP_PACKETS
;
5429 DEFUN (no_debug_msdp
,
5436 PIM_DONT_DEBUG_MSDP_EVENTS
;
5437 PIM_DONT_DEBUG_MSDP_PACKETS
;
5441 ALIAS (no_debug_msdp
,
5447 DEFUN (debug_msdp_events
,
5448 debug_msdp_events_cmd
,
5449 "debug msdp events",
5452 DEBUG_MSDP_EVENTS_STR
)
5454 PIM_DO_DEBUG_MSDP_EVENTS
;
5458 DEFUN (no_debug_msdp_events
,
5459 no_debug_msdp_events_cmd
,
5460 "no debug msdp events",
5464 DEBUG_MSDP_EVENTS_STR
)
5466 PIM_DONT_DEBUG_MSDP_EVENTS
;
5470 ALIAS (no_debug_msdp_events
,
5471 undebug_msdp_events_cmd
,
5472 "undebug msdp events",
5475 DEBUG_MSDP_EVENTS_STR
)
5477 DEFUN (debug_msdp_packets
,
5478 debug_msdp_packets_cmd
,
5479 "debug msdp packets",
5482 DEBUG_MSDP_PACKETS_STR
)
5484 PIM_DO_DEBUG_MSDP_PACKETS
;
5488 DEFUN (no_debug_msdp_packets
,
5489 no_debug_msdp_packets_cmd
,
5490 "no debug msdp packets",
5494 DEBUG_MSDP_PACKETS_STR
)
5496 PIM_DONT_DEBUG_MSDP_PACKETS
;
5500 ALIAS (no_debug_msdp_packets
,
5501 undebug_msdp_packets_cmd
,
5502 "undebug msdp packets",
5505 DEBUG_MSDP_PACKETS_STR
)
5507 DEFUN (show_debugging_pim
,
5508 show_debugging_pim_cmd
,
5509 "show debugging pim",
5514 pim_debug_config_write(vty
);
5519 interface_pim_use_src_cmd_worker(struct vty
*vty
, const char *source
)
5522 struct in_addr source_addr
;
5523 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5525 result
= inet_pton(AF_INET
, source
, &source_addr
);
5527 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5528 source
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5532 result
= pim_update_source_set(ifp
, source_addr
);
5536 case PIM_IFACE_NOT_FOUND
:
5537 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5539 case PIM_UPDATE_SOURCE_DUP
:
5540 vty_out(vty
, "%% Source already set to %s%s", source
, VTY_NEWLINE
);
5543 vty_out(vty
, "%% Source set failed%s", VTY_NEWLINE
);
5546 return result
?CMD_WARNING
:CMD_SUCCESS
;
5549 DEFUN (interface_pim_use_source
,
5550 interface_pim_use_source_cmd
,
5551 "ip pim use-source A.B.C.D",
5553 "pim multicast routing\n"
5554 "Configure primary IP address\n"
5555 "source ip address\n")
5557 return interface_pim_use_src_cmd_worker (vty
, argv
[3]->arg
);
5560 DEFUN (interface_no_pim_use_source
,
5561 interface_no_pim_use_source_cmd
,
5562 "no ip pim use-source",
5565 "pim multicast routing\n"
5566 "Delete source IP address\n")
5568 return interface_pim_use_src_cmd_worker (vty
, "0.0.0.0");
5572 ip_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
, const char *local
)
5574 enum pim_msdp_err result
;
5575 struct in_addr peer_addr
;
5576 struct in_addr local_addr
;
5578 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5580 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5581 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5585 result
= inet_pton(AF_INET
, local
, &local_addr
);
5587 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5588 local
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5592 result
= pim_msdp_peer_add(peer_addr
, local_addr
, "default", NULL
/* mp_p */);
5594 case PIM_MSDP_ERR_NONE
:
5596 case PIM_MSDP_ERR_OOM
:
5597 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5599 case PIM_MSDP_ERR_PEER_EXISTS
:
5600 vty_out(vty
, "%% Peer exists%s", VTY_NEWLINE
);
5602 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5603 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5606 vty_out(vty
, "%% peer add failed%s", VTY_NEWLINE
);
5609 return result
?CMD_WARNING
:CMD_SUCCESS
;
5612 DEFUN_HIDDEN (ip_msdp_peer
,
5614 "ip msdp peer A.B.C.D source A.B.C.D",
5617 "Configure MSDP peer\n"
5619 "Source address for TCP connection\n"
5620 "local ip address\n")
5622 return ip_msdp_peer_cmd_worker (vty
, argv
[3]->arg
, argv
[5]->arg
);
5626 ip_no_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
)
5628 enum pim_msdp_err result
;
5629 struct in_addr peer_addr
;
5631 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5633 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5634 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5638 result
= pim_msdp_peer_del(peer_addr
);
5640 case PIM_MSDP_ERR_NONE
:
5642 case PIM_MSDP_ERR_NO_PEER
:
5643 vty_out(vty
, "%% Peer does not exist%s", VTY_NEWLINE
);
5646 vty_out(vty
, "%% peer del failed%s", VTY_NEWLINE
);
5649 return result
?CMD_WARNING
:CMD_SUCCESS
;
5652 DEFUN_HIDDEN (no_ip_msdp_peer
,
5653 no_ip_msdp_peer_cmd
,
5654 "no ip msdp peer A.B.C.D",
5658 "Delete MSDP peer\n"
5659 "peer ip address\n")
5661 return ip_no_msdp_peer_cmd_worker (vty
, argv
[4]->arg
);
5665 ip_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5667 enum pim_msdp_err result
;
5668 struct in_addr mbr_ip
;
5670 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5672 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5673 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5677 result
= pim_msdp_mg_mbr_add(mg
, mbr_ip
);
5679 case PIM_MSDP_ERR_NONE
:
5681 case PIM_MSDP_ERR_OOM
:
5682 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5684 case PIM_MSDP_ERR_MG_MBR_EXISTS
:
5685 vty_out(vty
, "%% mesh-group member exists%s", VTY_NEWLINE
);
5687 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5688 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5691 vty_out(vty
, "%% member add failed%s", VTY_NEWLINE
);
5694 return result
?CMD_WARNING
:CMD_SUCCESS
;
5697 DEFUN (ip_msdp_mesh_group_member
,
5698 ip_msdp_mesh_group_member_cmd
,
5699 "ip msdp mesh-group WORD member A.B.C.D",
5702 "Configure MSDP mesh-group\n"
5704 "mesh group member\n"
5705 "peer ip address\n")
5707 return ip_msdp_mesh_group_member_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5711 ip_no_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5713 enum pim_msdp_err result
;
5714 struct in_addr mbr_ip
;
5716 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5718 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5719 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5723 result
= pim_msdp_mg_mbr_del(mg
, mbr_ip
);
5725 case PIM_MSDP_ERR_NONE
:
5727 case PIM_MSDP_ERR_NO_MG
:
5728 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5730 case PIM_MSDP_ERR_NO_MG_MBR
:
5731 vty_out(vty
, "%% mesh-group member does not exist%s", VTY_NEWLINE
);
5734 vty_out(vty
, "%% mesh-group member del failed%s", VTY_NEWLINE
);
5737 return result
?CMD_WARNING
:CMD_SUCCESS
;
5739 DEFUN (no_ip_msdp_mesh_group_member
,
5740 no_ip_msdp_mesh_group_member_cmd
,
5741 "no ip msdp mesh-group WORD member A.B.C.D",
5745 "Delete MSDP mesh-group member\n"
5747 "mesh group member\n"
5748 "peer ip address\n")
5750 return ip_no_msdp_mesh_group_member_cmd_worker(vty
, argv
[4]->arg
, argv
[6]->arg
);
5754 ip_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
, const char *src
)
5756 enum pim_msdp_err result
;
5757 struct in_addr src_ip
;
5759 result
= inet_pton(AF_INET
, src
, &src_ip
);
5761 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5762 src
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5766 result
= pim_msdp_mg_src_add(mg
, src_ip
);
5768 case PIM_MSDP_ERR_NONE
:
5770 case PIM_MSDP_ERR_OOM
:
5771 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5773 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5774 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5777 vty_out(vty
, "%% source add failed%s", VTY_NEWLINE
);
5780 return result
?CMD_WARNING
:CMD_SUCCESS
;
5784 DEFUN (ip_msdp_mesh_group_source
,
5785 ip_msdp_mesh_group_source_cmd
,
5786 "ip msdp mesh-group WORD source A.B.C.D",
5789 "Configure MSDP mesh-group\n"
5791 "mesh group local address\n"
5792 "source ip address for the TCP connection\n")
5794 return ip_msdp_mesh_group_source_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5798 ip_no_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
)
5800 enum pim_msdp_err result
;
5802 result
= pim_msdp_mg_src_del(mg
);
5804 case PIM_MSDP_ERR_NONE
:
5806 case PIM_MSDP_ERR_NO_MG
:
5807 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5810 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5813 return result
?CMD_WARNING
:CMD_SUCCESS
;
5817 ip_no_msdp_mesh_group_cmd_worker(struct vty
*vty
, const char *mg
)
5819 enum pim_msdp_err result
;
5821 result
= pim_msdp_mg_del(mg
);
5823 case PIM_MSDP_ERR_NONE
:
5825 case PIM_MSDP_ERR_NO_MG
:
5826 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5829 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5832 return result
? CMD_WARNING
: CMD_SUCCESS
;
5835 DEFUN (no_ip_msdp_mesh_group_source
,
5836 no_ip_msdp_mesh_group_source_cmd
,
5837 "no ip msdp mesh-group WORD source [A.B.C.D]",
5841 "Delete MSDP mesh-group source\n"
5843 "mesh group source\n"
5844 "mesh group local address\n")
5847 return ip_no_msdp_mesh_group_cmd_worker(vty
, argv
[6]->arg
);
5849 return ip_no_msdp_mesh_group_source_cmd_worker(vty
, argv
[4]->arg
);
5853 print_empty_json_obj(struct vty
*vty
)
5856 json
= json_object_new_object();
5857 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5858 json_object_free(json
);
5862 ip_msdp_show_mesh_group(struct vty
*vty
, u_char uj
)
5864 struct listnode
*mbrnode
;
5865 struct pim_msdp_mg_mbr
*mbr
;
5866 struct pim_msdp_mg
*mg
= msdp
->mg
;
5867 char mbr_str
[INET_ADDRSTRLEN
];
5868 char src_str
[INET_ADDRSTRLEN
];
5869 char state_str
[PIM_MSDP_STATE_STRLEN
];
5870 enum pim_msdp_peer_state state
;
5871 json_object
*json
= NULL
;
5872 json_object
*json_mg_row
= NULL
;
5873 json_object
*json_members
= NULL
;
5874 json_object
*json_row
= NULL
;
5878 print_empty_json_obj(vty
);
5882 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5884 json
= json_object_new_object();
5885 /* currently there is only one mesh group but we should still make
5886 * it a dict with mg-name as key */
5887 json_mg_row
= json_object_new_object();
5888 json_object_string_add(json_mg_row
, "name", mg
->mesh_group_name
);
5889 json_object_string_add(json_mg_row
, "source", src_str
);
5891 vty_out(vty
, "Mesh group : %s%s", mg
->mesh_group_name
, VTY_NEWLINE
);
5892 vty_out(vty
, " Source : %s%s", src_str
, VTY_NEWLINE
);
5893 vty_out(vty
, " Member State%s", VTY_NEWLINE
);
5896 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5897 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5899 state
= mbr
->mp
->state
;
5901 state
= PIM_MSDP_DISABLED
;
5903 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5905 json_row
= json_object_new_object();
5906 json_object_string_add(json_row
, "member", mbr_str
);
5907 json_object_string_add(json_row
, "state", state_str
);
5908 if (!json_members
) {
5909 json_members
= json_object_new_object();
5910 json_object_object_add(json_mg_row
, "members", json_members
);
5912 json_object_object_add(json_members
, mbr_str
, json_row
);
5914 vty_out(vty
, " %-15s %11s%s",
5915 mbr_str
, state_str
, VTY_NEWLINE
);
5920 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5921 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5922 json_object_free(json
);
5926 DEFUN (show_ip_msdp_mesh_group
,
5927 show_ip_msdp_mesh_group_cmd
,
5928 "show ip msdp mesh-group [json]",
5932 "MSDP mesh-group information\n"
5933 "JavaScript Object Notation\n")
5935 u_char uj
= use_json(argc
, argv
);
5936 ip_msdp_show_mesh_group(vty
, uj
);
5942 ip_msdp_show_peers(struct vty
*vty
, u_char uj
)
5944 struct listnode
*mpnode
;
5945 struct pim_msdp_peer
*mp
;
5946 char peer_str
[INET_ADDRSTRLEN
];
5947 char local_str
[INET_ADDRSTRLEN
];
5948 char state_str
[PIM_MSDP_STATE_STRLEN
];
5949 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5951 json_object
*json
= NULL
;
5952 json_object
*json_row
= NULL
;
5956 json
= json_object_new_object();
5958 vty_out(vty
, "Peer Local State Uptime SaCnt%s", VTY_NEWLINE
);
5961 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
5962 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5963 now
= pim_time_monotonic_sec();
5964 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
5966 strcpy(timebuf
, "-");
5968 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5969 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
5970 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5972 json_row
= json_object_new_object();
5973 json_object_string_add(json_row
, "peer", peer_str
);
5974 json_object_string_add(json_row
, "local", local_str
);
5975 json_object_string_add(json_row
, "state", state_str
);
5976 json_object_string_add(json_row
, "upTime", timebuf
);
5977 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5978 json_object_object_add(json
, peer_str
, json_row
);
5980 vty_out(vty
, "%-15s %15s %11s %8s %6d%s",
5981 peer_str
, local_str
, state_str
,
5982 timebuf
, mp
->sa_cnt
, VTY_NEWLINE
);
5987 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5988 json_object_free(json
);
5993 ip_msdp_show_peers_detail(struct vty
*vty
, const char *peer
, u_char uj
)
5995 struct listnode
*mpnode
;
5996 struct pim_msdp_peer
*mp
;
5997 char peer_str
[INET_ADDRSTRLEN
];
5998 char local_str
[INET_ADDRSTRLEN
];
5999 char state_str
[PIM_MSDP_STATE_STRLEN
];
6000 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6001 char katimer
[PIM_MSDP_TIMER_STRLEN
];
6002 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
6003 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
6005 json_object
*json
= NULL
;
6006 json_object
*json_row
= NULL
;
6009 json
= json_object_new_object();
6012 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6013 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6014 if (strcmp(peer
, "detail") &&
6015 strcmp(peer
, peer_str
))
6018 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6019 now
= pim_time_monotonic_sec();
6020 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6022 strcpy(timebuf
, "-");
6024 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6025 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6026 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
), mp
->ka_timer
);
6027 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
), mp
->cr_timer
);
6028 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
), mp
->hold_timer
);
6031 json_row
= json_object_new_object();
6032 json_object_string_add(json_row
, "peer", peer_str
);
6033 json_object_string_add(json_row
, "local", local_str
);
6034 json_object_string_add(json_row
, "meshGroupName", mp
->mesh_group_name
);
6035 json_object_string_add(json_row
, "state", state_str
);
6036 json_object_string_add(json_row
, "upTime", timebuf
);
6037 json_object_string_add(json_row
, "keepAliveTimer", katimer
);
6038 json_object_string_add(json_row
, "connRetryTimer", crtimer
);
6039 json_object_string_add(json_row
, "holdTimer", holdtimer
);
6040 json_object_string_add(json_row
, "lastReset", mp
->last_reset
);
6041 json_object_int_add(json_row
, "connAttempts", mp
->conn_attempts
);
6042 json_object_int_add(json_row
, "establishedChanges", mp
->est_flaps
);
6043 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6044 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
6045 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
6046 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
6047 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
6048 json_object_object_add(json
, peer_str
, json_row
);
6050 vty_out(vty
, "Peer : %s%s", peer_str
, VTY_NEWLINE
);
6051 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6052 vty_out(vty
, " Mesh Group : %s%s", mp
->mesh_group_name
, VTY_NEWLINE
);
6053 vty_out(vty
, " State : %s%s", state_str
, VTY_NEWLINE
);
6054 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6056 vty_out(vty
, " Keepalive Timer : %s%s", katimer
, VTY_NEWLINE
);
6057 vty_out(vty
, " Conn Retry Timer : %s%s", crtimer
, VTY_NEWLINE
);
6058 vty_out(vty
, " Hold Timer : %s%s", holdtimer
, VTY_NEWLINE
);
6059 vty_out(vty
, " Last Reset : %s%s", mp
->last_reset
, VTY_NEWLINE
);
6060 vty_out(vty
, " Conn Attempts : %d%s", mp
->conn_attempts
, VTY_NEWLINE
);
6061 vty_out(vty
, " Established Changes : %d%s", mp
->est_flaps
, VTY_NEWLINE
);
6062 vty_out(vty
, " SA Count : %d%s", mp
->sa_cnt
, VTY_NEWLINE
);
6063 vty_out(vty
, " Statistics :%s", VTY_NEWLINE
);
6064 vty_out(vty
, " Sent Rcvd%s", VTY_NEWLINE
);
6065 vty_out(vty
, " Keepalives : %10d %10d%s",
6066 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
, VTY_NEWLINE
);
6067 vty_out(vty
, " SAs : %10d %10d%s",
6068 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
, VTY_NEWLINE
);
6069 vty_out(vty
, "%s", VTY_NEWLINE
);
6074 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6075 json_object_free(json
);
6079 DEFUN (show_ip_msdp_peer_detail
,
6080 show_ip_msdp_peer_detail_cmd
,
6081 "show ip msdp peer [detail|A.B.C.D] [json]",
6085 "MSDP peer information\n"
6088 "JavaScript Object Notation\n")
6090 u_char uj
= use_json(argc
, argv
);
6095 ip_msdp_show_peers_detail(vty
, argv
[4]->arg
, uj
);
6097 ip_msdp_show_peers(vty
, uj
);
6103 ip_msdp_show_sa(struct vty
*vty
, u_char uj
)
6105 struct listnode
*sanode
;
6106 struct pim_msdp_sa
*sa
;
6107 char src_str
[INET_ADDRSTRLEN
];
6108 char grp_str
[INET_ADDRSTRLEN
];
6109 char rp_str
[INET_ADDRSTRLEN
];
6110 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6114 json_object
*json
= NULL
;
6115 json_object
*json_group
= NULL
;
6116 json_object
*json_row
= NULL
;
6119 json
= json_object_new_object();
6121 vty_out(vty
, "Source Group RP Local SPT Uptime%s", VTY_NEWLINE
);
6124 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6125 now
= pim_time_monotonic_sec();
6126 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6127 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6128 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6129 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6130 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6132 strcpy(spt_str
, "yes");
6134 strcpy(spt_str
, "no");
6137 strcpy(rp_str
, "-");
6138 strcpy(spt_str
, "-");
6140 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6141 strcpy(local_str
, "yes");
6143 strcpy(local_str
, "no");
6146 json_object_object_get_ex(json
, grp_str
, &json_group
);
6149 json_group
= json_object_new_object();
6150 json_object_object_add(json
, grp_str
, json_group
);
6153 json_row
= json_object_new_object();
6154 json_object_string_add(json_row
, "source", src_str
);
6155 json_object_string_add(json_row
, "group", grp_str
);
6156 json_object_string_add(json_row
, "rp", rp_str
);
6157 json_object_string_add(json_row
, "local", local_str
);
6158 json_object_string_add(json_row
, "sptSetup", spt_str
);
6159 json_object_string_add(json_row
, "upTime", timebuf
);
6160 json_object_object_add(json_group
, src_str
, json_row
);
6162 vty_out(vty
, "%-15s %15s %15s %5c %3c %8s%s",
6163 src_str
, grp_str
, rp_str
, local_str
[0], spt_str
[0], timebuf
, VTY_NEWLINE
);
6169 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6170 json_object_free(json
);
6175 ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
, const char *src_str
,
6176 const char *grp_str
, struct vty
*vty
,
6177 u_char uj
, json_object
*json
)
6179 char rp_str
[INET_ADDRSTRLEN
];
6180 char peer_str
[INET_ADDRSTRLEN
];
6181 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6184 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
6186 json_object
*json_group
= NULL
;
6187 json_object
*json_row
= NULL
;
6189 now
= pim_time_monotonic_sec();
6190 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6191 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6192 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6193 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
6195 strcpy(spt_str
, "yes");
6197 strcpy(spt_str
, "no");
6200 strcpy(rp_str
, "-");
6201 strcpy(peer_str
, "-");
6202 strcpy(spt_str
, "-");
6204 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6205 strcpy(local_str
, "yes");
6207 strcpy(local_str
, "no");
6209 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
), sa
->sa_state_timer
);
6211 json_object_object_get_ex(json
, grp_str
, &json_group
);
6214 json_group
= json_object_new_object();
6215 json_object_object_add(json
, grp_str
, json_group
);
6218 json_row
= json_object_new_object();
6219 json_object_string_add(json_row
, "source", src_str
);
6220 json_object_string_add(json_row
, "group", grp_str
);
6221 json_object_string_add(json_row
, "rp", rp_str
);
6222 json_object_string_add(json_row
, "local", local_str
);
6223 json_object_string_add(json_row
, "sptSetup", spt_str
);
6224 json_object_string_add(json_row
, "upTime", timebuf
);
6225 json_object_string_add(json_row
, "stateTimer", statetimer
);
6226 json_object_object_add(json_group
, src_str
, json_row
);
6228 vty_out(vty
, "SA : %s%s", sa
->sg_str
, VTY_NEWLINE
);
6229 vty_out(vty
, " RP : %s%s", rp_str
, VTY_NEWLINE
);
6230 vty_out(vty
, " Peer : %s%s", peer_str
, VTY_NEWLINE
);
6231 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6232 vty_out(vty
, " SPT Setup : %s%s", spt_str
, VTY_NEWLINE
);
6233 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6234 vty_out(vty
, " State Timer : %s%s", statetimer
, VTY_NEWLINE
);
6235 vty_out(vty
, "%s", VTY_NEWLINE
);
6240 ip_msdp_show_sa_detail(struct vty
*vty
, u_char uj
)
6242 struct listnode
*sanode
;
6243 struct pim_msdp_sa
*sa
;
6244 char src_str
[INET_ADDRSTRLEN
];
6245 char grp_str
[INET_ADDRSTRLEN
];
6246 json_object
*json
= NULL
;
6249 json
= json_object_new_object();
6252 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6253 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6254 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6255 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6259 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6260 json_object_free(json
);
6264 DEFUN (show_ip_msdp_sa_detail
,
6265 show_ip_msdp_sa_detail_cmd
,
6266 "show ip msdp sa detail [json]",
6270 "MSDP active-source information\n"
6272 "JavaScript Object Notation\n")
6274 u_char uj
= use_json(argc
, argv
);
6275 ip_msdp_show_sa_detail(vty
, uj
);
6281 ip_msdp_show_sa_addr(struct vty
*vty
, const char *addr
, u_char uj
)
6283 struct listnode
*sanode
;
6284 struct pim_msdp_sa
*sa
;
6285 char src_str
[INET_ADDRSTRLEN
];
6286 char grp_str
[INET_ADDRSTRLEN
];
6287 json_object
*json
= NULL
;
6290 json
= json_object_new_object();
6293 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6294 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6295 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6296 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6297 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6302 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6303 json_object_free(json
);
6308 ip_msdp_show_sa_sg(struct vty
*vty
, const char *src
, const char *grp
, u_char uj
)
6310 struct listnode
*sanode
;
6311 struct pim_msdp_sa
*sa
;
6312 char src_str
[INET_ADDRSTRLEN
];
6313 char grp_str
[INET_ADDRSTRLEN
];
6314 json_object
*json
= NULL
;
6317 json
= json_object_new_object();
6320 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6321 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6322 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6323 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6324 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6329 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6330 json_object_free(json
);
6334 DEFUN (show_ip_msdp_sa_sg
,
6335 show_ip_msdp_sa_sg_cmd
,
6336 "show ip msdp sa [A.B.C.D [A.B.C.D]] [json]",
6340 "MSDP active-source information\n"
6341 "source or group ip\n"
6343 "JavaScript Object Notation\n")
6345 u_char uj
= use_json(argc
, argv
);
6350 ip_msdp_show_sa_sg(vty
, argv
[4]->arg
, argv
[5]->arg
, uj
);
6352 ip_msdp_show_sa_addr(vty
, argv
[4]->arg
, uj
);
6354 ip_msdp_show_sa(vty
, uj
);
6361 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
6362 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
6365 install_node (&debug_node
, pim_debug_config_write
);
6367 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
6368 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
6369 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
6370 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6371 install_element (CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6372 install_element (CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6373 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6374 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6375 install_element (CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6376 install_element (CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6377 install_element (CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6378 install_element (CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6379 install_element (CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6380 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6381 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6382 install_element (CONFIG_NODE
, &ip_pim_packets_cmd
);
6383 install_element (CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6384 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
6385 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6386 install_element (CONFIG_NODE
, &ip_msdp_peer_cmd
);
6387 install_element (CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6388 install_element (CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6389 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6390 install_element (CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6391 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6393 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6394 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6395 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6396 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6397 install_element (INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6398 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6399 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6400 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
6401 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
6402 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
6403 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6404 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6405 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6406 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6407 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6408 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6409 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6410 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6411 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6412 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6414 // Static mroutes NEB
6415 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6416 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
6417 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6418 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
6420 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6421 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
6422 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6423 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6424 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6425 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6426 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
6427 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6428 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6429 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6430 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
6431 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
6432 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6433 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6434 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6435 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6436 install_element (VIEW_NODE
, &show_ip_pim_state_cmd
);
6437 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6438 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6439 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6440 install_element (VIEW_NODE
, &show_ip_pim_rp_cmd
);
6441 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
6442 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
6443 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
6444 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
6445 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6446 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
6447 install_element (VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6448 install_element (VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6450 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6451 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6452 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
6453 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6454 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6456 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
6457 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
6458 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
6459 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6460 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
6461 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6462 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
6463 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6464 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
6465 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
6466 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
6467 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6468 install_element (ENABLE_NODE
, &debug_static_cmd
);
6469 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
6470 install_element (ENABLE_NODE
, &debug_pim_cmd
);
6471 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
6472 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
6473 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
6474 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
6475 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
6476 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6477 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
6478 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6479 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
6480 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
6481 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
6482 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
6483 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6484 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
6485 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
6486 install_element (ENABLE_NODE
, &debug_msdp_cmd
);
6487 install_element (ENABLE_NODE
, &no_debug_msdp_cmd
);
6488 install_element (ENABLE_NODE
, &undebug_msdp_cmd
);
6489 install_element (ENABLE_NODE
, &debug_msdp_events_cmd
);
6490 install_element (ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6491 install_element (ENABLE_NODE
, &undebug_msdp_events_cmd
);
6492 install_element (ENABLE_NODE
, &debug_msdp_packets_cmd
);
6493 install_element (ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6494 install_element (ENABLE_NODE
, &undebug_msdp_packets_cmd
);
6496 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
6497 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
6498 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
6499 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6500 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
6501 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6502 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
6503 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6504 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
6505 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
6506 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
6507 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6508 install_element (CONFIG_NODE
, &debug_static_cmd
);
6509 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
6510 install_element (CONFIG_NODE
, &debug_pim_cmd
);
6511 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
6512 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
6513 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
6514 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
6515 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
6516 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
6517 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
6518 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
6519 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6520 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
6521 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);
6522 install_element (CONFIG_NODE
, &debug_msdp_cmd
);
6523 install_element (CONFIG_NODE
, &no_debug_msdp_cmd
);
6524 install_element (CONFIG_NODE
, &undebug_msdp_cmd
);
6525 install_element (CONFIG_NODE
, &debug_msdp_events_cmd
);
6526 install_element (CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6527 install_element (CONFIG_NODE
, &undebug_msdp_events_cmd
);
6528 install_element (CONFIG_NODE
, &debug_msdp_packets_cmd
);
6529 install_element (CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6530 install_element (CONFIG_NODE
, &undebug_msdp_packets_cmd
);
6531 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6532 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6533 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6534 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6535 install_element (VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6536 install_element (VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6537 install_element (VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6538 install_element (VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6539 install_element (VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6540 install_element (VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6541 install_element (INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6542 install_element (INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);