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 char pbuf
[PREFIX2STR_BUFFER
];
824 json_row
= json_object_new_object();
825 json_object_pim_ifp_add(json_row
, ifp
);
827 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
828 json_object_string_add(json_row
, "useSource", inet_ntoa(pim_ifp
->update_source
));
830 if (pim_ifp
->sec_addr_list
) {
831 json_object
*sec_list
= NULL
;
833 sec_list
= json_object_new_array();
834 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
835 json_object_array_add(sec_list
,
836 json_object_new_string(prefix2str(&sec_addr
->addr
,
840 json_object_object_add(json_row
, "secondaryAddressList", sec_list
);
844 if (pim_ifp
->pim_neighbor_list
->count
) {
845 json_pim_neighbors
= json_object_new_object();
847 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
848 json_pim_neighbor
= json_object_new_object();
849 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
850 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
851 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
853 json_object_string_add(json_pim_neighbor
, "address", neigh_src_str
);
854 json_object_string_add(json_pim_neighbor
, "upTime", uptime
);
855 json_object_string_add(json_pim_neighbor
, "holdtime", expire
);
857 json_object_object_add(json_pim_neighbors
, neigh_src_str
, json_pim_neighbor
);
860 json_object_object_add(json_row
, "neighbors", json_pim_neighbors
);
863 json_object_string_add(json_row
, "drAddress", dr_str
);
864 json_object_int_add(json_row
, "drPriority", pim_ifp
->pim_dr_priority
);
865 json_object_string_add(json_row
, "drUptime", dr_uptime
);
866 json_object_int_add(json_row
, "drElections", pim_ifp
->pim_dr_election_count
);
867 json_object_int_add(json_row
, "drChanges", pim_ifp
->pim_dr_election_changes
);
870 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
871 if (ifp
== up
->rpf
.source_nexthop
.interface
) {
872 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
873 if (!json_fhr_sources
) {
874 json_fhr_sources
= json_object_new_object();
877 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
878 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
879 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
881 /* Does this group live in json_fhr_sources? If not create it. */
882 json_object_object_get_ex(json_fhr_sources
, grp_str
, &json_group
);
885 json_group
= json_object_new_object();
886 json_object_object_add(json_fhr_sources
, grp_str
, json_group
);
889 json_group_source
= json_object_new_object();
890 json_object_string_add(json_group_source
, "source", src_str
);
891 json_object_string_add(json_group_source
, "group", grp_str
);
892 json_object_string_add(json_group_source
, "upTime", uptime
);
893 json_object_object_add(json_group
, src_str
, json_group_source
);
898 if (json_fhr_sources
) {
899 json_object_object_add(json_row
, "firstHopRouter", json_fhr_sources
);
902 json_object_int_add(json_row
, "helloPeriod", pim_ifp
->pim_hello_period
);
903 json_object_string_add(json_row
, "helloTimer", hello_timer
);
904 json_object_string_add(json_row
, "helloStatStart", stat_uptime
);
905 json_object_int_add(json_row
, "helloReceived", pim_ifp
->pim_ifstat_hello_recv
);
906 json_object_int_add(json_row
, "helloReceivedFailed", pim_ifp
->pim_ifstat_hello_recvfail
);
907 json_object_int_add(json_row
, "helloSend", pim_ifp
->pim_ifstat_hello_sent
);
908 json_object_int_add(json_row
, "hellosendFailed", pim_ifp
->pim_ifstat_hello_sendfail
);
909 json_object_int_add(json_row
, "helloGenerationId", pim_ifp
->pim_generation_id
);
910 json_object_int_add(json_row
, "flagMulticastLoop", mloop
);
912 json_object_int_add(json_row
, "effectivePropagationDelay", pim_if_effective_propagation_delay_msec(ifp
));
913 json_object_int_add(json_row
, "effectiveOverrideInterval", pim_if_effective_override_interval_msec(ifp
));
914 json_object_int_add(json_row
, "joinPruneOverrideInterval", pim_if_jp_override_interval_msec(ifp
));
916 json_object_int_add(json_row
, "propagationDelay", pim_ifp
->pim_propagation_delay_msec
);
917 json_object_int_add(json_row
, "propagationDelayHighest", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
);
918 json_object_int_add(json_row
, "overrideInterval", pim_ifp
->pim_override_interval_msec
);
919 json_object_int_add(json_row
, "overrideIntervalHighest", pim_ifp
->pim_neighbors_highest_override_interval_msec
);
920 json_object_object_add(json
, ifp
->name
, json_row
);
923 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
924 vty_out(vty
, "State : %s%s", if_is_up(ifp
) ? "up" : "down", VTY_NEWLINE
);
925 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
926 vty_out(vty
, "Use Source : %s%s", inet_ntoa(pim_ifp
->update_source
), VTY_NEWLINE
);
928 if (pim_ifp
->sec_addr_list
) {
929 char pbuf
[PREFIX2STR_BUFFER
];
930 vty_out(vty
, "Address : %s (primary)%s",
931 inet_ntoa(ifaddr
), VTY_NEWLINE
);
932 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
933 vty_out(vty
, " %s%s",
934 prefix2str(&sec_addr
->addr
,
936 sizeof(pbuf
)), VTY_NEWLINE
);
939 vty_out(vty
, "Address : %s%s", inet_ntoa(ifaddr
), VTY_NEWLINE
);
941 vty_out(vty
, "%s", VTY_NEWLINE
);
946 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
949 vty_out(vty
, "PIM Neighbors%s", VTY_NEWLINE
);
950 vty_out(vty
, "-------------%s", VTY_NEWLINE
);
954 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
955 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
956 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
957 vty_out(vty
, "%-15s : up for %s, holdtime expires in %s%s", neigh_src_str
, uptime
, expire
, VTY_NEWLINE
);
961 vty_out(vty
, "%s", VTY_NEWLINE
);
962 vty_out(vty
, "%s", VTY_NEWLINE
);
965 vty_out(vty
, "Designated Router%s", VTY_NEWLINE
);
966 vty_out(vty
, "-----------------%s", VTY_NEWLINE
);
967 vty_out(vty
, "Address : %s%s", dr_str
, VTY_NEWLINE
);
968 vty_out(vty
, "Priority : %d%s", pim_ifp
->pim_dr_priority
, VTY_NEWLINE
);
969 vty_out(vty
, "Uptime : %s%s", dr_uptime
, VTY_NEWLINE
);
970 vty_out(vty
, "Elections : %d%s", pim_ifp
->pim_dr_election_count
, VTY_NEWLINE
);
971 vty_out(vty
, "Changes : %d%s", pim_ifp
->pim_dr_election_changes
, VTY_NEWLINE
);
972 vty_out(vty
, "%s", VTY_NEWLINE
);
973 vty_out(vty
, "%s", VTY_NEWLINE
);
977 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
978 if (strcmp(ifp
->name
, up
->rpf
.source_nexthop
.interface
->name
) == 0) {
979 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
982 vty_out(vty
, "FHR - First Hop Router%s", VTY_NEWLINE
);
983 vty_out(vty
, "----------------------%s", VTY_NEWLINE
);
987 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
988 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
989 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
990 vty_out(vty
, "%s : %s is a source, uptime is %s%s", grp_str
, src_str
, uptime
, VTY_NEWLINE
);
996 vty_out(vty
, "%s", VTY_NEWLINE
);
997 vty_out(vty
, "%s", VTY_NEWLINE
);
1000 vty_out(vty
, "Hellos%s", VTY_NEWLINE
);
1001 vty_out(vty
, "------%s", VTY_NEWLINE
);
1002 vty_out(vty
, "Period : %d%s", pim_ifp
->pim_hello_period
, VTY_NEWLINE
);
1003 vty_out(vty
, "Timer : %s%s", hello_timer
, VTY_NEWLINE
);
1004 vty_out(vty
, "StatStart : %s%s", stat_uptime
, VTY_NEWLINE
);
1005 vty_out(vty
, "Receive : %d%s", pim_ifp
->pim_ifstat_hello_recv
, VTY_NEWLINE
);
1006 vty_out(vty
, "Receive Failed : %d%s", pim_ifp
->pim_ifstat_hello_recvfail
, VTY_NEWLINE
);
1007 vty_out(vty
, "Send : %d%s", pim_ifp
->pim_ifstat_hello_sent
, VTY_NEWLINE
);
1008 vty_out(vty
, "Send Failed : %d%s", pim_ifp
->pim_ifstat_hello_sendfail
, VTY_NEWLINE
);
1009 vty_out(vty
, "Generation ID : %08x%s", pim_ifp
->pim_generation_id
, VTY_NEWLINE
);
1010 vty_out(vty
, "%s", VTY_NEWLINE
);
1011 vty_out(vty
, "%s", VTY_NEWLINE
);
1013 pim_print_ifp_flags(vty
, ifp
, mloop
);
1015 vty_out(vty
, "Join Prune Interval%s", VTY_NEWLINE
);
1016 vty_out(vty
, "-------------------%s", VTY_NEWLINE
);
1017 vty_out(vty
, "LAN Delay : %s%s", pim_if_lan_delay_enabled(ifp
) ? "yes" : "no", VTY_NEWLINE
);
1018 vty_out(vty
, "Effective Propagation Delay : %d msec%s", pim_if_effective_propagation_delay_msec(ifp
), VTY_NEWLINE
);
1019 vty_out(vty
, "Effective Override Interval : %d msec%s", pim_if_effective_override_interval_msec(ifp
), VTY_NEWLINE
);
1020 vty_out(vty
, "Join Prune Override Interval : %d msec%s", pim_if_jp_override_interval_msec(ifp
), VTY_NEWLINE
);
1021 vty_out(vty
, "%s", VTY_NEWLINE
);
1022 vty_out(vty
, "%s", VTY_NEWLINE
);
1024 vty_out(vty
, "LAN Prune Delay%s", VTY_NEWLINE
);
1025 vty_out(vty
, "---------------%s", VTY_NEWLINE
);
1026 vty_out(vty
, "Propagation Delay : %d msec%s", pim_ifp
->pim_propagation_delay_msec
, VTY_NEWLINE
);
1027 vty_out(vty
, "Propagation Delay (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
, VTY_NEWLINE
);
1028 vty_out(vty
, "Override Interval : %d msec%s", pim_ifp
->pim_override_interval_msec
, VTY_NEWLINE
);
1029 vty_out(vty
, "Override Interval (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_override_interval_msec
, VTY_NEWLINE
);
1030 vty_out(vty
, "%s", VTY_NEWLINE
);
1031 vty_out(vty
, "%s", VTY_NEWLINE
);
1036 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1037 json_object_free(json
);
1040 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
1044 static void pim_show_interfaces(struct vty
*vty
, u_char uj
)
1046 struct interface
*ifp
;
1047 struct listnode
*node
;
1048 struct listnode
*upnode
;
1049 struct pim_interface
*pim_ifp
;
1050 struct pim_upstream
*up
;
1053 int pim_ifchannels
= 0;
1054 json_object
*json
= NULL
;
1055 json_object
*json_row
= NULL
;
1056 json_object
*json_tmp
;
1058 json
= json_object_new_object();
1060 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1061 pim_ifp
= ifp
->info
;
1066 if (pim_ifp
->pim_sock_fd
< 0)
1069 pim_nbrs
= pim_ifp
->pim_neighbor_list
->count
;
1070 pim_ifchannels
= pim_ifp
->pim_ifchannel_list
->count
;
1073 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
))
1074 if (ifp
== up
->rpf
.source_nexthop
.interface
)
1075 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1078 json_row
= json_object_new_object();
1079 json_object_pim_ifp_add(json_row
, ifp
);
1080 json_object_int_add(json_row
, "pimNeighbors", pim_nbrs
);
1081 json_object_int_add(json_row
, "pimIfChannels", pim_ifchannels
);
1082 json_object_int_add(json_row
, "firstHopRouter", fhr
);
1083 json_object_string_add(json_row
, "pimDesignatedRouter", inet_ntoa(pim_ifp
->pim_dr_addr
));
1085 if (pim_ifp
->pim_dr_addr
.s_addr
== pim_ifp
->primary_address
.s_addr
)
1086 json_object_boolean_true_add(json_row
, "pimDesignatedRouterLocal");
1088 json_object_object_add(json
, ifp
->name
, json_row
);
1092 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1094 vty_out(vty
, "Interface State Address PIM Nbrs PIM DR FHR IfChannels%s", VTY_NEWLINE
);
1096 json_object_object_foreach(json
, key
, val
) {
1097 vty_out(vty
, "%-9s ", key
);
1099 json_object_object_get_ex(val
, "state", &json_tmp
);
1100 vty_out(vty
, "%5s ", json_object_get_string(json_tmp
));
1102 json_object_object_get_ex(val
, "address", &json_tmp
);
1103 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1105 json_object_object_get_ex(val
, "pimNeighbors", &json_tmp
);
1106 vty_out(vty
, "%8d ", json_object_get_int(json_tmp
));
1108 if (json_object_object_get_ex(val
, "pimDesignatedRouterLocal", &json_tmp
)) {
1109 vty_out(vty
, "%15s ", "local");
1111 json_object_object_get_ex(val
, "pimDesignatedRouter", &json_tmp
);
1112 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1115 json_object_object_get_ex(val
, "firstHopRouter", &json_tmp
);
1116 vty_out(vty
, "%3d ", json_object_get_int(json_tmp
));
1118 json_object_object_get_ex(val
, "pimIfChannels", &json_tmp
);
1119 vty_out(vty
, "%9d%s", json_object_get_int(json_tmp
), VTY_NEWLINE
);
1123 json_object_free(json
);
1126 static void pim_show_join(struct vty
*vty
, u_char uj
)
1128 struct pim_interface
*pim_ifp
;
1129 struct in_addr ifaddr
;
1130 struct listnode
*ch_node
;
1131 struct pim_ifchannel
*ch
;
1133 json_object
*json
= NULL
;
1134 json_object
*json_iface
= NULL
;
1135 json_object
*json_row
= NULL
;
1136 json_object
*json_grp
= NULL
;
1138 now
= pim_time_monotonic_sec();
1141 json
= json_object_new_object();
1144 "Interface Address Source Group State Uptime Expire Prune%s",
1147 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
1149 pim_ifp
= ch
->interface
->info
;
1154 ifaddr
= pim_ifp
->primary_address
;
1156 char ch_src_str
[INET_ADDRSTRLEN
];
1157 char ch_grp_str
[INET_ADDRSTRLEN
];
1162 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
1163 ch_src_str
, sizeof(ch_src_str
));
1164 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
1165 ch_grp_str
, sizeof(ch_grp_str
));
1167 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
1168 pim_time_timer_to_mmss(expire
, sizeof(expire
),
1169 ch
->t_ifjoin_expiry_timer
);
1170 pim_time_timer_to_mmss(prune
, sizeof(prune
),
1171 ch
->t_ifjoin_prune_pending_timer
);
1174 json_object_object_get_ex(json
, ch
->interface
->name
, &json_iface
);
1177 json_iface
= json_object_new_object();
1178 json_object_pim_ifp_add(json_iface
, ch
->interface
);
1179 json_object_object_add(json
, ch
->interface
->name
, json_iface
);
1182 json_row
= json_object_new_object();
1183 json_object_string_add(json_row
, "source", ch_src_str
);
1184 json_object_string_add(json_row
, "group", ch_grp_str
);
1185 json_object_string_add(json_row
, "upTime", uptime
);
1186 json_object_string_add(json_row
, "expire", expire
);
1187 json_object_string_add(json_row
, "prune", prune
);
1188 json_object_string_add(json_row
, "channelJoinName",
1189 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
));
1190 if (PIM_IF_FLAG_TEST_S_G_RPT(ch
->flags
))
1191 json_object_int_add(json_row
, "SGRpt", 1);
1193 json_object_object_get_ex(json_iface
, ch_grp_str
, &json_grp
);
1196 json_grp
= json_object_new_object();
1197 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1198 json_object_object_add(json_iface
, ch_grp_str
, json_grp
);
1201 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1203 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
1204 ch
->interface
->name
,
1208 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
),
1214 } /* scan interface channels */
1217 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1218 json_object_free(json
);
1222 static void pim_show_neighbors_single(struct vty
*vty
, const char *neighbor
, u_char uj
)
1224 struct listnode
*node
;
1225 struct listnode
*neighnode
;
1226 struct interface
*ifp
;
1227 struct pim_interface
*pim_ifp
;
1228 struct pim_neighbor
*neigh
;
1230 int found_neighbor
= 0;
1231 int option_address_list
;
1232 int option_dr_priority
;
1233 int option_generation_id
;
1234 int option_holdtime
;
1235 int option_lan_prune_delay
;
1239 char neigh_src_str
[INET_ADDRSTRLEN
];
1241 json_object
*json
= NULL
;
1242 json_object
*json_ifp
= NULL
;
1243 json_object
*json_row
= NULL
;
1245 now
= pim_time_monotonic_sec();
1248 json
= json_object_new_object();
1250 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1251 pim_ifp
= ifp
->info
;
1256 if (pim_ifp
->pim_sock_fd
< 0)
1259 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1260 pim_inet4_dump("<src?>", neigh
->source_addr
,
1261 neigh_src_str
, sizeof(neigh_src_str
));
1264 * The user can specify either the interface name or the PIM neighbor IP.
1265 * If this pim_ifp matches neither then skip.
1267 if (strcmp(neighbor
, "detail") &&
1268 strcmp(neighbor
, ifp
->name
) &&
1269 strcmp(neighbor
, neigh_src_str
))
1273 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1274 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1276 option_address_list
= 0;
1277 option_dr_priority
= 0;
1278 option_generation_id
= 0;
1279 option_holdtime
= 0;
1280 option_lan_prune_delay
= 0;
1283 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
))
1284 option_address_list
= 1;
1286 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
))
1287 option_dr_priority
= 1;
1289 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
))
1290 option_generation_id
= 1;
1292 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
))
1293 option_holdtime
= 1;
1295 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
))
1296 option_lan_prune_delay
= 1;
1298 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
))
1303 /* Does this ifp live in json? If not create it. */
1304 json_object_object_get_ex(json
, ifp
->name
, &json_ifp
);
1307 json_ifp
= json_object_new_object();
1308 json_object_pim_ifp_add(json_ifp
, ifp
);
1309 json_object_object_add(json
, ifp
->name
, json_ifp
);
1312 json_row
= json_object_new_object();
1313 json_object_string_add(json_row
, "interface", ifp
->name
);
1314 json_object_string_add(json_row
, "address", neigh_src_str
);
1315 json_object_string_add(json_row
, "upTime", uptime
);
1316 json_object_string_add(json_row
, "holdtime", expire
);
1317 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1318 json_object_int_add(json_row
, "generationId", neigh
->generation_id
);
1320 if (option_address_list
)
1321 json_object_boolean_true_add(json_row
, "helloOptionAddressList");
1323 if (option_dr_priority
)
1324 json_object_boolean_true_add(json_row
, "helloOptionDrPriority");
1326 if (option_generation_id
)
1327 json_object_boolean_true_add(json_row
, "helloOptionGenerationId");
1329 if (option_holdtime
)
1330 json_object_boolean_true_add(json_row
, "helloOptionHoldtime");
1332 if (option_lan_prune_delay
)
1333 json_object_boolean_true_add(json_row
, "helloOptionLanPruneDelay");
1336 json_object_boolean_true_add(json_row
, "helloOptionTBit");
1338 json_object_object_add(json_ifp
, neigh_src_str
, json_row
);
1341 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
1342 vty_out(vty
, "Neighbor : %s%s", neigh_src_str
, VTY_NEWLINE
);
1343 vty_out(vty
, " Uptime : %s%s", uptime
, VTY_NEWLINE
);
1344 vty_out(vty
, " Holdtime : %s%s", expire
, VTY_NEWLINE
);
1345 vty_out(vty
, " DR Priority : %d%s", neigh
->dr_priority
, VTY_NEWLINE
);
1346 vty_out(vty
, " Generation ID : %08x%s", neigh
->generation_id
, VTY_NEWLINE
);
1347 vty_out(vty
, " Override Interval (msec) : %d%s", neigh
->override_interval_msec
, VTY_NEWLINE
);
1348 vty_out(vty
, " Propagation Delay (msec) : %d%s", neigh
->propagation_delay_msec
, VTY_NEWLINE
);
1349 vty_out(vty
, " Hello Option - Address List : %s%s", option_address_list
? "yes" : "no", VTY_NEWLINE
);
1350 vty_out(vty
, " Hello Option - DR Priority : %s%s", option_dr_priority
? "yes" : "no", VTY_NEWLINE
);
1351 vty_out(vty
, " Hello Option - Generation ID : %s%s", option_generation_id
? "yes" : "no", VTY_NEWLINE
);
1352 vty_out(vty
, " Hello Option - Holdtime : %s%s", option_holdtime
? "yes" : "no", VTY_NEWLINE
);
1353 vty_out(vty
, " Hello Option - LAN Prune Delay : %s%s", option_lan_prune_delay
? "yes" : "no", VTY_NEWLINE
);
1354 vty_out(vty
, " Hello Option - T-bit : %s%s", option_t_bit
? "yes" : "no", VTY_NEWLINE
);
1355 vty_out(vty
, "%s", VTY_NEWLINE
);
1361 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1362 json_object_free(json
);
1365 if (!found_neighbor
)
1366 vty_out (vty
, "%% No such interface or neighbor%s", VTY_NEWLINE
);
1372 pim_show_state(struct vty
*vty
, const char *src_or_group
, const char *group
, u_char uj
)
1374 struct channel_oil
*c_oil
;
1375 struct listnode
*node
;
1376 json_object
*json
= NULL
;
1377 json_object
*json_group
= NULL
;
1378 json_object
*json_ifp_in
= NULL
;
1379 json_object
*json_ifp_out
= NULL
;
1380 json_object
*json_source
= NULL
;
1383 now
= pim_time_monotonic_sec();
1386 json
= json_object_new_object();
1388 vty_out(vty
, "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G)");
1389 vty_out(vty
, "%sInstalled Source Group IIF OIL%s", VTY_NEWLINE
, VTY_NEWLINE
);
1392 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
1393 char grp_str
[INET_ADDRSTRLEN
];
1394 char src_str
[INET_ADDRSTRLEN
];
1395 char in_ifname
[INTERFACE_NAMSIZ
+1];
1396 char out_ifname
[INTERFACE_NAMSIZ
+1];
1398 struct interface
*ifp_in
;
1401 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
1402 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
1403 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
1406 strcpy(in_ifname
, ifp_in
->name
);
1408 strcpy(in_ifname
, "<iif?>");
1412 if (strcmp(src_or_group
, src_str
) && strcmp(src_or_group
, grp_str
))
1415 if (group
&& strcmp(group
, grp_str
))
1421 /* Find the group, create it if it doesn't exist */
1422 json_object_object_get_ex(json
, grp_str
, &json_group
);
1425 json_group
= json_object_new_object();
1426 json_object_object_add(json
, grp_str
, json_group
);
1429 /* Find the source nested under the group, create it if it doesn't exist */
1430 json_object_object_get_ex(json_group
, src_str
, &json_source
);
1433 json_source
= json_object_new_object();
1434 json_object_object_add(json_group
, src_str
, json_source
);
1437 /* Find the inbound interface nested under the source, create it if it doesn't exist */
1438 json_object_object_get_ex(json_source
, in_ifname
, &json_ifp_in
);
1441 json_ifp_in
= json_object_new_object();
1442 json_object_object_add(json_source
, in_ifname
, json_ifp_in
);
1443 json_object_int_add (json_source
, "Installed", c_oil
->installed
);
1444 json_object_int_add (json_source
, "RefCount", c_oil
->oil_ref_count
);
1445 json_object_int_add (json_source
, "OilListSize", c_oil
->oil_size
);
1446 json_object_int_add (json_source
, "OilRescan", c_oil
->oil_inherited_rescan
);
1447 json_object_int_add (json_source
, "LastUsed", c_oil
->cc
.lastused
);
1448 json_object_int_add (json_source
, "PacketCount", c_oil
->cc
.pktcnt
);
1449 json_object_int_add (json_source
, "ByteCount", c_oil
->cc
.bytecnt
);
1450 json_object_int_add (json_source
, "WrongInterface", c_oil
->cc
.wrong_if
);
1453 vty_out(vty
, "%-9d %-15s %-15s %-7s ",
1460 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
1461 struct interface
*ifp_out
;
1462 char oif_uptime
[10];
1465 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
1469 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
1470 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
1473 strcpy(out_ifname
, ifp_out
->name
);
1475 strcpy(out_ifname
, "<oif?>");
1478 json_ifp_out
= json_object_new_object();
1479 json_object_string_add(json_ifp_out
, "source", src_str
);
1480 json_object_string_add(json_ifp_out
, "group", grp_str
);
1481 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
1482 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
1483 json_object_int_add(json_ifp_out
, "installed", c_oil
->installed
);
1485 json_object_object_add(json_ifp_in
, out_ifname
, json_ifp_out
);
1490 vty_out(vty
, "%s(%c%c%c%c)", out_ifname
,
1491 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1492 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1493 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1494 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ');
1497 vty_out(vty
, ", %s(%c%c%c%c)", out_ifname
,
1498 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1499 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1500 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1501 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ' );
1506 vty_out(vty
, "%s", VTY_NEWLINE
);
1511 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1512 json_object_free(json
);
1514 vty_out(vty
, "%s", VTY_NEWLINE
);
1518 static void pim_show_neighbors(struct vty
*vty
, u_char uj
)
1520 struct listnode
*node
;
1521 struct listnode
*neighnode
;
1522 struct interface
*ifp
;
1523 struct pim_interface
*pim_ifp
;
1524 struct pim_neighbor
*neigh
;
1528 char neigh_src_str
[INET_ADDRSTRLEN
];
1529 json_object
*json
= NULL
;
1530 json_object
*json_ifp_rows
= NULL
;
1531 json_object
*json_row
= NULL
;
1533 now
= pim_time_monotonic_sec();
1536 json
= json_object_new_object();
1538 vty_out(vty
, "Interface Neighbor Uptime Holdtime DR Pri%s", VTY_NEWLINE
);
1541 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1542 pim_ifp
= ifp
->info
;
1547 if (pim_ifp
->pim_sock_fd
< 0)
1551 json_ifp_rows
= json_object_new_object();
1553 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1554 pim_inet4_dump("<src?>", neigh
->source_addr
,
1555 neigh_src_str
, sizeof(neigh_src_str
));
1556 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1557 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1560 json_row
= json_object_new_object();
1561 json_object_string_add(json_row
, "interface", ifp
->name
);
1562 json_object_string_add(json_row
, "neighbor", neigh_src_str
);
1563 json_object_string_add(json_row
, "upTime", uptime
);
1564 json_object_string_add(json_row
, "holdTime", expire
);
1565 json_object_int_add(json_row
, "holdTimeMax", neigh
->holdtime
);
1566 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1567 json_object_object_add(json_ifp_rows
, neigh_src_str
, json_row
);
1570 vty_out(vty
, "%-9s %15s %8s %8s %6d%s",
1581 json_object_object_add(json
, ifp
->name
, json_ifp_rows
);
1582 json_ifp_rows
= NULL
;
1587 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1588 json_object_free(json
);
1592 static void pim_show_neighbors_secondary(struct vty
*vty
)
1594 struct listnode
*node
;
1595 struct interface
*ifp
;
1597 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
1599 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1600 struct pim_interface
*pim_ifp
;
1601 struct in_addr ifaddr
;
1602 struct listnode
*neighnode
;
1603 struct pim_neighbor
*neigh
;
1605 pim_ifp
= ifp
->info
;
1610 if (pim_ifp
->pim_sock_fd
< 0)
1613 ifaddr
= pim_ifp
->primary_address
;
1615 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1616 char neigh_src_str
[INET_ADDRSTRLEN
];
1617 struct listnode
*prefix_node
;
1620 if (!neigh
->prefix_list
)
1623 pim_inet4_dump("<src?>", neigh
->source_addr
,
1624 neigh_src_str
, sizeof(neigh_src_str
));
1626 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
1627 char neigh_sec_str
[PREFIX2STR_BUFFER
];
1629 prefix2str(p
, neigh_sec_str
, sizeof(neigh_sec_str
));
1631 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
1643 json_object_pim_upstream_add (json_object
*json
, struct pim_upstream
*up
)
1645 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED
)
1646 json_object_boolean_true_add(json
, "drJoinDesired");
1648 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED
)
1649 json_object_boolean_true_add(json
, "drJoinDesiredUpdated");
1651 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1652 json_object_boolean_true_add(json
, "firstHopRouter");
1654 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_IGMP
)
1655 json_object_boolean_true_add(json
, "sourceIgmp");
1657 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_PIM
)
1658 json_object_boolean_true_add(json
, "sourcePim");
1660 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_STREAM
)
1661 json_object_boolean_true_add(json
, "sourceStream");
1663 /* XXX: need to print ths flag in the plain text display as well */
1664 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_MSDP
)
1665 json_object_boolean_true_add(json
, "sourceMsdp");
1669 pim_upstream_state2brief_str (enum pim_upstream_state join_state
, char *state_str
)
1673 case PIM_UPSTREAM_NOTJOINED
:
1674 strcpy (state_str
, "NotJ");
1676 case PIM_UPSTREAM_JOINED
:
1677 strcpy (state_str
, "J");
1680 strcpy (state_str
, "Unk");
1686 pim_reg_state2brief_str (enum pim_reg_state reg_state
, char *state_str
)
1690 case PIM_REG_NOINFO
:
1691 strcpy (state_str
, "RegNI");
1694 strcpy (state_str
, "RegJ");
1696 case PIM_REG_JOIN_PENDING
:
1698 strcpy (state_str
, "RegP");
1701 strcpy (state_str
, "Unk");
1706 static void pim_show_upstream(struct vty
*vty
, u_char uj
)
1708 struct listnode
*upnode
;
1709 struct pim_upstream
*up
;
1711 json_object
*json
= NULL
;
1712 json_object
*json_group
= NULL
;
1713 json_object
*json_row
= NULL
;
1715 now
= pim_time_monotonic_sec();
1718 json
= json_object_new_object();
1720 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt%s", VTY_NEWLINE
);
1722 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
1723 char src_str
[INET_ADDRSTRLEN
];
1724 char grp_str
[INET_ADDRSTRLEN
];
1726 char join_timer
[10];
1729 char msdp_reg_timer
[10];
1730 char state_str
[PIM_REG_STATE_STR_LEN
];
1732 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1733 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1734 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
1735 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), up
->t_join_timer
);
1738 * If we have a J/P timer for the neighbor display that
1740 if (!up
->t_join_timer
)
1742 struct pim_neighbor
*nbr
;
1744 nbr
= pim_neighbor_find (up
->rpf
.source_nexthop
.interface
,
1745 up
->rpf
.rpf_addr
.u
.prefix4
);
1747 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), nbr
->jp_timer
);
1750 pim_time_timer_to_hhmmss (rs_timer
, sizeof (rs_timer
), up
->t_rs_timer
);
1751 pim_time_timer_to_hhmmss (ka_timer
, sizeof (ka_timer
), up
->t_ka_timer
);
1752 pim_time_timer_to_hhmmss (msdp_reg_timer
, sizeof (msdp_reg_timer
), up
->t_msdp_reg_timer
);
1754 pim_upstream_state2brief_str (up
->join_state
, state_str
);
1755 if (up
->reg_state
!= PIM_REG_NOINFO
) {
1756 char tmp_str
[PIM_REG_STATE_STR_LEN
];
1758 sprintf (state_str
+ strlen (state_str
), ",%s",
1759 pim_reg_state2brief_str (up
->reg_state
, tmp_str
));
1763 json_object_object_get_ex(json
, grp_str
, &json_group
);
1766 json_group
= json_object_new_object();
1767 json_object_object_add(json
, grp_str
, json_group
);
1770 json_row
= json_object_new_object();
1771 json_object_pim_upstream_add(json_row
, up
);
1772 json_object_string_add(json_row
, "inboundInterface", up
->rpf
.source_nexthop
.interface
->name
);
1773 json_object_string_add(json_row
, "source", src_str
);
1774 json_object_string_add(json_row
, "group", grp_str
);
1775 json_object_string_add(json_row
, "state", state_str
);
1776 json_object_string_add(json_row
, "joinState", pim_upstream_state2str (up
->join_state
));
1777 json_object_string_add(json_row
, "regState", pim_reg_state2str (up
->reg_state
, state_str
));
1778 json_object_string_add(json_row
, "upTime", uptime
);
1779 json_object_string_add(json_row
, "joinTimer", join_timer
);
1780 json_object_string_add(json_row
, "resetTimer", rs_timer
);
1781 json_object_string_add(json_row
, "keepaliveTimer", ka_timer
);
1782 json_object_string_add(json_row
, "msdpRegTimer", msdp_reg_timer
);
1783 json_object_int_add(json_row
, "refCount", up
->ref_count
);
1784 json_object_int_add(json_row
, "sptBit", up
->sptbit
);
1785 json_object_object_add(json_group
, src_str
, json_row
);
1787 vty_out(vty
, "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d%s",
1788 up
->rpf
.source_nexthop
.interface
->name
,
1802 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1803 json_object_free(json
);
1807 static void pim_show_join_desired(struct vty
*vty
, u_char uj
)
1809 struct listnode
*chnode
;
1810 struct pim_interface
*pim_ifp
;
1811 struct pim_ifchannel
*ch
;
1812 char src_str
[INET_ADDRSTRLEN
];
1813 char grp_str
[INET_ADDRSTRLEN
];
1814 json_object
*json
= NULL
;
1815 json_object
*json_group
= NULL
;
1816 json_object
*json_row
= NULL
;
1819 json
= json_object_new_object();
1822 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1825 /* scan per-interface (S,G) state */
1826 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, chnode
, ch
)) {
1827 /* scan all interfaces */
1828 pim_ifp
= ch
->interface
->info
;
1832 struct pim_upstream
*up
= ch
->upstream
;
1834 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1835 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1838 json_object_object_get_ex(json
, grp_str
, &json_group
);
1841 json_group
= json_object_new_object();
1842 json_object_object_add(json
, grp_str
, json_group
);
1845 json_row
= json_object_new_object();
1846 json_object_pim_upstream_add(json_row
, up
);
1847 json_object_string_add(json_row
, "interface", ch
->interface
->name
);
1848 json_object_string_add(json_row
, "source", src_str
);
1849 json_object_string_add(json_row
, "group", grp_str
);
1851 if (pim_macro_ch_lost_assert(ch
))
1852 json_object_boolean_true_add(json_row
, "lostAssert");
1854 if (pim_macro_chisin_joins(ch
))
1855 json_object_boolean_true_add(json_row
, "joins");
1857 if (pim_macro_chisin_pim_include(ch
))
1858 json_object_boolean_true_add(json_row
, "pimInclude");
1860 if (pim_upstream_evaluate_join_desired(up
))
1861 json_object_boolean_true_add(json_row
, "evaluateJoinDesired");
1863 json_object_object_add(json_group
, src_str
, json_row
);
1866 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
1867 ch
->interface
->name
,
1870 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
1871 pim_macro_chisin_joins(ch
) ? "yes" : "no",
1872 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
1873 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
1874 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
1880 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1881 json_object_free(json
);
1885 static void pim_show_upstream_rpf(struct vty
*vty
, u_char uj
)
1887 struct listnode
*upnode
;
1888 struct pim_upstream
*up
;
1889 json_object
*json
= NULL
;
1890 json_object
*json_group
= NULL
;
1891 json_object
*json_row
= NULL
;
1894 json
= json_object_new_object();
1897 "Source Group RpfIface RibNextHop RpfAddress %s",
1900 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
1901 char src_str
[INET_ADDRSTRLEN
];
1902 char grp_str
[INET_ADDRSTRLEN
];
1903 char rpf_nexthop_str
[PREFIX_STRLEN
];
1904 char rpf_addr_str
[PREFIX_STRLEN
];
1905 struct pim_rpf
*rpf
;
1906 const char *rpf_ifname
;
1910 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1911 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1912 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
1913 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
1915 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
1918 json_object_object_get_ex(json
, grp_str
, &json_group
);
1921 json_group
= json_object_new_object();
1922 json_object_object_add(json
, grp_str
, json_group
);
1925 json_row
= json_object_new_object();
1926 json_object_pim_upstream_add(json_row
, up
);
1927 json_object_string_add(json_row
, "source", src_str
);
1928 json_object_string_add(json_row
, "group", grp_str
);
1929 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
1930 json_object_string_add(json_row
, "ribNexthop", rpf_nexthop_str
);
1931 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
1932 json_object_object_add(json_group
, src_str
, json_row
);
1934 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
1945 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1946 json_object_free(json
);
1950 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
, json_object
*json
)
1952 char refresh_uptime
[10];
1954 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
1957 json_object_int_add(json
, "rpfCacheRefreshDelayMsecs", qpim_rpf_cache_refresh_delay_msec
);
1958 json_object_int_add(json
, "rpfCacheRefreshTimer", pim_time_timer_remain_msec(qpim_rpf_cache_refresher
));
1959 json_object_int_add(json
, "rpfCacheRefreshRequests", qpim_rpf_cache_refresh_requests
);
1960 json_object_int_add(json
, "rpfCacheRefreshEvents", qpim_rpf_cache_refresh_events
);
1961 json_object_string_add(json
, "rpfCacheRefreshLast", refresh_uptime
);
1962 json_object_int_add(json
, "nexthopLookups", qpim_nexthop_lookups
);
1963 json_object_int_add(json
, "nexthopLookupsAvoided", nexthop_lookups_avoided
);
1966 "RPF Cache Refresh Delay: %ld msecs%s"
1967 "RPF Cache Refresh Timer: %ld msecs%s"
1968 "RPF Cache Refresh Requests: %lld%s"
1969 "RPF Cache Refresh Events: %lld%s"
1970 "RPF Cache Refresh Last: %s%s"
1971 "Nexthop Lookups: %lld%s"
1972 "Nexthop Lookups Avoided: %lld%s",
1973 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
1974 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
1975 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
1976 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
1977 refresh_uptime
, VTY_NEWLINE
,
1978 (long long) qpim_nexthop_lookups
, VTY_NEWLINE
,
1979 (long long)nexthop_lookups_avoided
, VTY_NEWLINE
);
1983 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
1985 char uptime_scan_oil
[10];
1986 char uptime_mroute_add
[10];
1987 char uptime_mroute_del
[10];
1989 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
1990 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
1991 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
1994 "Scan OIL - Last: %s Events: %lld%s"
1995 "MFC Add - Last: %s Events: %lld%s"
1996 "MFC Del - Last: %s Events: %lld%s",
1997 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
1998 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
1999 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
2002 static void pim_show_rpf(struct vty
*vty
, u_char uj
)
2004 struct listnode
*up_node
;
2005 struct pim_upstream
*up
;
2006 time_t now
= pim_time_monotonic_sec();
2007 json_object
*json
= NULL
;
2008 json_object
*json_group
= NULL
;
2009 json_object
*json_row
= NULL
;
2012 json
= json_object_new_object();
2013 show_rpf_refresh_stats(vty
, now
, json
);
2015 show_rpf_refresh_stats(vty
, now
, json
);
2016 vty_out(vty
, "%s", VTY_NEWLINE
);
2018 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
2022 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, up_node
, up
)) {
2023 char src_str
[INET_ADDRSTRLEN
];
2024 char grp_str
[INET_ADDRSTRLEN
];
2025 char rpf_addr_str
[PREFIX_STRLEN
];
2026 char rib_nexthop_str
[PREFIX_STRLEN
];
2027 const char *rpf_ifname
;
2028 struct pim_rpf
*rpf
= &up
->rpf
;
2030 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
2031 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
2032 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
2033 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
2035 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
2038 json_object_object_get_ex(json
, grp_str
, &json_group
);
2041 json_group
= json_object_new_object();
2042 json_object_object_add(json
, grp_str
, json_group
);
2045 json_row
= json_object_new_object();
2046 json_object_string_add(json_row
, "source", src_str
);
2047 json_object_string_add(json_row
, "group", grp_str
);
2048 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
2049 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
2050 json_object_string_add(json_row
, "ribNexthop", rib_nexthop_str
);
2051 json_object_int_add(json_row
, "routeMetric", rpf
->source_nexthop
.mrib_route_metric
);
2052 json_object_int_add(json_row
, "routePreference", rpf
->source_nexthop
.mrib_metric_preference
);
2053 json_object_object_add(json_group
, src_str
, json_row
);
2056 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
2062 rpf
->source_nexthop
.mrib_route_metric
,
2063 rpf
->source_nexthop
.mrib_metric_preference
,
2069 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2070 json_object_free(json
);
2075 pim_print_pnc_cache_walkcb (struct hash_backet
*backet
, void *arg
)
2077 struct pim_nexthop_cache
*pnc
= backet
->data
;
2078 struct vty
*vty
= arg
;
2079 struct nexthop
*nh_node
= NULL
;
2080 ifindex_t first_ifindex
;
2081 struct interface
*ifp
= NULL
;
2086 for (nh_node
= pnc
->nexthop
; nh_node
; nh_node
= nh_node
->next
)
2088 first_ifindex
= nh_node
->ifindex
;
2089 ifp
= if_lookup_by_index (first_ifindex
, VRF_DEFAULT
);
2091 vty_out (vty
, "%-15s ", inet_ntoa (pnc
->rpf
.rpf_addr
.u
.prefix4
));
2092 vty_out (vty
, "%-14s ", ifp
? ifp
->name
: "NULL");
2093 vty_out (vty
, "%s ", inet_ntoa (nh_node
->gate
.ipv4
));
2094 vty_out (vty
, "%s", VTY_NEWLINE
);
2100 pim_show_nexthop (struct vty
*vty
)
2103 if (pimg
&& !pimg
->rpf_hash
)
2105 vty_out (vty
, "no nexthop cache %s", VTY_NEWLINE
);
2109 vty_out (vty
, "Number of registered addresses: %lu %s",
2110 pimg
->rpf_hash
->count
, VTY_NEWLINE
);
2111 vty_out (vty
, "Address Interface Nexthop%s", VTY_NEWLINE
);
2112 vty_out (vty
, "-------------------------------------------%s", VTY_NEWLINE
);
2114 hash_walk (pimg
->rpf_hash
, pim_print_pnc_cache_walkcb
, vty
);
2118 static void igmp_show_groups(struct vty
*vty
, u_char uj
)
2120 struct listnode
*ifnode
;
2121 struct interface
*ifp
;
2123 json_object
*json
= NULL
;
2124 json_object
*json_iface
= NULL
;
2125 json_object
*json_row
= NULL
;
2127 now
= pim_time_monotonic_sec();
2130 json
= json_object_new_object();
2132 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
2134 /* scan interfaces */
2135 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2136 struct pim_interface
*pim_ifp
= ifp
->info
;
2137 struct listnode
*sock_node
;
2138 struct igmp_sock
*igmp
;
2143 /* scan igmp sockets */
2144 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2145 char ifaddr_str
[INET_ADDRSTRLEN
];
2146 struct listnode
*grpnode
;
2147 struct igmp_group
*grp
;
2149 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2151 /* scan igmp groups */
2152 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2153 char group_str
[INET_ADDRSTRLEN
];
2157 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2158 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
2159 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
2162 json_object_object_get_ex(json
, ifp
->name
, &json_iface
);
2165 json_iface
= json_object_new_object();
2166 json_object_pim_ifp_add(json_iface
, ifp
);
2167 json_object_object_add(json
, ifp
->name
, json_iface
);
2170 json_row
= json_object_new_object();
2171 json_object_string_add(json_row
, "source", ifaddr_str
);
2172 json_object_string_add(json_row
, "group", group_str
);
2174 if (grp
->igmp_version
== 3)
2175 json_object_string_add(json_row
, "mode", grp
->group_filtermode_isexcl
? "EXCLUDE" : "INCLUDE");
2177 json_object_string_add(json_row
, "timer", hhmmss
);
2178 json_object_int_add(json_row
, "sourcesCount", grp
->group_source_list
? listcount(grp
->group_source_list
) : 0);
2179 json_object_int_add(json_row
, "version", grp
->igmp_version
);
2180 json_object_string_add(json_row
, "uptime", uptime
);
2181 json_object_object_add(json_iface
, group_str
, json_row
);
2184 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
2188 grp
->igmp_version
== 3 ? (grp
->group_filtermode_isexcl
? "EXCL" : "INCL") : "----",
2190 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
2195 } /* scan igmp groups */
2196 } /* scan igmp sockets */
2197 } /* scan interfaces */
2200 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2201 json_object_free(json
);
2205 static void igmp_show_group_retransmission(struct vty
*vty
)
2207 struct listnode
*ifnode
;
2208 struct interface
*ifp
;
2210 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
2212 /* scan interfaces */
2213 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2214 struct pim_interface
*pim_ifp
= ifp
->info
;
2215 struct listnode
*sock_node
;
2216 struct igmp_sock
*igmp
;
2221 /* scan igmp sockets */
2222 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2223 char ifaddr_str
[INET_ADDRSTRLEN
];
2224 struct listnode
*grpnode
;
2225 struct igmp_group
*grp
;
2227 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2229 /* scan igmp groups */
2230 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2231 char group_str
[INET_ADDRSTRLEN
];
2232 char grp_retr_mmss
[10];
2233 struct listnode
*src_node
;
2234 struct igmp_source
*src
;
2235 int grp_retr_sources
= 0;
2237 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2238 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
2241 /* count group sources with retransmission state */
2242 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2243 if (src
->source_query_retransmit_count
> 0) {
2248 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
2253 grp
->group_specific_query_retransmit_count
,
2257 } /* scan igmp groups */
2258 } /* scan igmp sockets */
2259 } /* scan interfaces */
2262 static void igmp_show_sources(struct vty
*vty
)
2264 struct listnode
*ifnode
;
2265 struct interface
*ifp
;
2268 now
= pim_time_monotonic_sec();
2270 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
2272 /* scan interfaces */
2273 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2274 struct pim_interface
*pim_ifp
= ifp
->info
;
2275 struct listnode
*sock_node
;
2276 struct igmp_sock
*igmp
;
2281 /* scan igmp sockets */
2282 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2283 char ifaddr_str
[INET_ADDRSTRLEN
];
2284 struct listnode
*grpnode
;
2285 struct igmp_group
*grp
;
2287 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2289 /* scan igmp groups */
2290 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2291 char group_str
[INET_ADDRSTRLEN
];
2292 struct listnode
*srcnode
;
2293 struct igmp_source
*src
;
2295 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2297 /* scan group sources */
2298 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2299 char source_str
[INET_ADDRSTRLEN
];
2303 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2305 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
2307 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
2309 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
2315 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
2319 } /* scan group sources */
2320 } /* scan igmp groups */
2321 } /* scan igmp sockets */
2322 } /* scan interfaces */
2325 static void igmp_show_source_retransmission(struct vty
*vty
)
2327 struct listnode
*ifnode
;
2328 struct interface
*ifp
;
2330 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
2332 /* scan interfaces */
2333 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2334 struct pim_interface
*pim_ifp
= ifp
->info
;
2335 struct listnode
*sock_node
;
2336 struct igmp_sock
*igmp
;
2341 /* scan igmp sockets */
2342 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2343 char ifaddr_str
[INET_ADDRSTRLEN
];
2344 struct listnode
*grpnode
;
2345 struct igmp_group
*grp
;
2347 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2349 /* scan igmp groups */
2350 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2351 char group_str
[INET_ADDRSTRLEN
];
2352 struct listnode
*srcnode
;
2353 struct igmp_source
*src
;
2355 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2357 /* scan group sources */
2358 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2359 char source_str
[INET_ADDRSTRLEN
];
2361 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2363 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
2368 src
->source_query_retransmit_count
,
2371 } /* scan group sources */
2372 } /* scan igmp groups */
2373 } /* scan igmp sockets */
2374 } /* scan interfaces */
2377 static void clear_igmp_interfaces()
2379 struct listnode
*ifnode
;
2380 struct listnode
*ifnextnode
;
2381 struct interface
*ifp
;
2383 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2384 pim_if_addr_del_all_igmp(ifp
);
2387 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2388 pim_if_addr_add_all(ifp
);
2392 static void clear_pim_interfaces()
2394 struct listnode
*ifnode
;
2395 struct listnode
*ifnextnode
;
2396 struct interface
*ifp
;
2398 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2400 pim_neighbor_delete_all(ifp
, "interface cleared");
2405 static void clear_interfaces()
2407 clear_igmp_interfaces();
2408 clear_pim_interfaces();
2411 DEFUN (clear_ip_interfaces
,
2412 clear_ip_interfaces_cmd
,
2413 "clear ip interfaces",
2416 "Reset interfaces\n")
2423 DEFUN (clear_ip_igmp_interfaces
,
2424 clear_ip_igmp_interfaces_cmd
,
2425 "clear ip igmp interfaces",
2429 "Reset IGMP interfaces\n")
2431 clear_igmp_interfaces();
2436 static void mroute_add_all()
2438 struct listnode
*node
;
2439 struct channel_oil
*c_oil
;
2441 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2442 if (pim_mroute_add(c_oil
, __PRETTY_FUNCTION__
)) {
2443 /* just log warning */
2444 char source_str
[INET_ADDRSTRLEN
];
2445 char group_str
[INET_ADDRSTRLEN
];
2446 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2447 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2448 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
2449 __FILE__
, __PRETTY_FUNCTION__
,
2450 source_str
, group_str
);
2455 static void mroute_del_all()
2457 struct listnode
*node
;
2458 struct channel_oil
*c_oil
;
2460 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2461 if (pim_mroute_del(c_oil
, __PRETTY_FUNCTION__
)) {
2462 /* just log warning */
2463 char source_str
[INET_ADDRSTRLEN
];
2464 char group_str
[INET_ADDRSTRLEN
];
2465 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2466 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2467 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
2468 __FILE__
, __PRETTY_FUNCTION__
,
2469 source_str
, group_str
);
2474 DEFUN (clear_ip_mroute
,
2475 clear_ip_mroute_cmd
,
2479 "Reset multicast routes\n")
2487 DEFUN (clear_ip_pim_interfaces
,
2488 clear_ip_pim_interfaces_cmd
,
2489 "clear ip pim interfaces",
2493 "Reset PIM interfaces\n")
2495 clear_pim_interfaces();
2500 DEFUN (clear_ip_pim_oil
,
2501 clear_ip_pim_oil_cmd
,
2506 "Rescan PIM OIL (output interface list)\n")
2513 DEFUN (show_ip_igmp_interface
,
2514 show_ip_igmp_interface_cmd
,
2515 "show ip igmp interface [detail|WORD] [json]",
2519 "IGMP interface information\n"
2522 "JavaScript Object Notation\n")
2524 u_char uj
= use_json(argc
, argv
);
2527 if (argv_find(argv
, argc
, "detail", &idx
) ||
2528 argv_find(argv
, argc
, "WORD", &idx
))
2529 igmp_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2531 igmp_show_interfaces(vty
, uj
);
2536 DEFUN (show_ip_igmp_join
,
2537 show_ip_igmp_join_cmd
,
2538 "show ip igmp join",
2542 "IGMP static join information\n")
2544 igmp_show_interface_join(vty
);
2549 DEFUN (show_ip_igmp_groups
,
2550 show_ip_igmp_groups_cmd
,
2551 "show ip igmp groups [json]",
2556 "JavaScript Object Notation\n")
2558 u_char uj
= use_json(argc
, argv
);
2559 igmp_show_groups(vty
, uj
);
2564 DEFUN (show_ip_igmp_groups_retransmissions
,
2565 show_ip_igmp_groups_retransmissions_cmd
,
2566 "show ip igmp groups retransmissions",
2571 "IGMP group retransmissions\n")
2573 igmp_show_group_retransmission(vty
);
2578 DEFUN (show_ip_igmp_sources
,
2579 show_ip_igmp_sources_cmd
,
2580 "show ip igmp sources",
2586 igmp_show_sources(vty
);
2591 DEFUN (show_ip_igmp_sources_retransmissions
,
2592 show_ip_igmp_sources_retransmissions_cmd
,
2593 "show ip igmp sources retransmissions",
2598 "IGMP source retransmissions\n")
2600 igmp_show_source_retransmission(vty
);
2605 DEFUN (show_ip_pim_assert
,
2606 show_ip_pim_assert_cmd
,
2607 "show ip pim assert",
2611 "PIM interface assert\n")
2613 pim_show_assert(vty
);
2618 DEFUN (show_ip_pim_assert_internal
,
2619 show_ip_pim_assert_internal_cmd
,
2620 "show ip pim assert-internal",
2624 "PIM interface internal assert state\n")
2626 pim_show_assert_internal(vty
);
2631 DEFUN (show_ip_pim_assert_metric
,
2632 show_ip_pim_assert_metric_cmd
,
2633 "show ip pim assert-metric",
2637 "PIM interface assert metric\n")
2639 pim_show_assert_metric(vty
);
2644 DEFUN (show_ip_pim_assert_winner_metric
,
2645 show_ip_pim_assert_winner_metric_cmd
,
2646 "show ip pim assert-winner-metric",
2650 "PIM interface assert winner metric\n")
2652 pim_show_assert_winner_metric(vty
);
2657 DEFUN (show_ip_pim_interface
,
2658 show_ip_pim_interface_cmd
,
2659 "show ip pim interface [detail|WORD] [json]",
2663 "PIM interface information\n"
2666 "JavaScript Object Notation\n")
2668 u_char uj
= use_json(argc
, argv
);
2671 if (argv_find(argv
, argc
, "WORD", &idx
) ||
2672 argv_find(argv
, argc
, "detail", &idx
))
2673 pim_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2676 pim_show_interfaces(vty
, uj
);
2681 DEFUN (show_ip_pim_join
,
2682 show_ip_pim_join_cmd
,
2683 "show ip pim join [json]",
2687 "PIM interface join information\n"
2690 u_char uj
= use_json(argc
, argv
);
2691 pim_show_join(vty
, uj
);
2696 DEFUN (show_ip_pim_local_membership
,
2697 show_ip_pim_local_membership_cmd
,
2698 "show ip pim local-membership [json]",
2702 "PIM interface local-membership\n"
2705 u_char uj
= use_json(argc
, argv
);
2706 pim_show_membership(vty
, uj
);
2711 DEFUN (show_ip_pim_neighbor
,
2712 show_ip_pim_neighbor_cmd
,
2713 "show ip pim neighbor [detail|WORD] [json]",
2717 "PIM neighbor information\n"
2719 "Name of interface or neighbor\n"
2720 "JavaScript Object Notation\n")
2722 u_char uj
= use_json(argc
, argv
);
2725 if (argv_find(argv
, argc
, "detail", &idx
) ||
2726 argv_find(argv
, argc
, "WORD", &idx
))
2727 pim_show_neighbors_single(vty
, argv
[idx
]->arg
, uj
);
2729 pim_show_neighbors(vty
, uj
);
2734 DEFUN (show_ip_pim_secondary
,
2735 show_ip_pim_secondary_cmd
,
2736 "show ip pim secondary",
2740 "PIM neighbor addresses\n")
2742 pim_show_neighbors_secondary(vty
);
2747 DEFUN (show_ip_pim_state
,
2748 show_ip_pim_state_cmd
,
2749 "show ip pim state [A.B.C.D [A.B.C.D]] [json]",
2753 "PIM state information\n"
2754 "Unicast or Multicast address\n"
2755 "Multicast address\n"
2756 "JavaScript Object Notation\n")
2758 const char *src_or_group
= NULL
;
2759 const char *group
= NULL
;
2760 u_char uj
= use_json(argc
, argv
);
2766 src_or_group
= argv
[4]->arg
;
2767 group
= argv
[5]->arg
;
2770 src_or_group
= argv
[4]->arg
;
2772 pim_show_state(vty
, src_or_group
, group
, uj
);
2777 DEFUN (show_ip_pim_upstream
,
2778 show_ip_pim_upstream_cmd
,
2779 "show ip pim upstream [json]",
2783 "PIM upstream information\n"
2784 "JavaScript Object Notation\n")
2786 u_char uj
= use_json(argc
, argv
);
2787 pim_show_upstream(vty
, uj
);
2792 DEFUN (show_ip_pim_upstream_join_desired
,
2793 show_ip_pim_upstream_join_desired_cmd
,
2794 "show ip pim upstream-join-desired [json]",
2798 "PIM upstream join-desired\n"
2799 "JavaScript Object Notation\n")
2801 u_char uj
= use_json(argc
, argv
);
2802 pim_show_join_desired(vty
, uj
);
2807 DEFUN (show_ip_pim_upstream_rpf
,
2808 show_ip_pim_upstream_rpf_cmd
,
2809 "show ip pim upstream-rpf [json]",
2813 "PIM upstream source rpf\n"
2814 "JavaScript Object Notation\n")
2816 u_char uj
= use_json(argc
, argv
);
2817 pim_show_upstream_rpf(vty
, uj
);
2822 DEFUN (show_ip_pim_rp
,
2824 "show ip pim rp-info [json]",
2828 "PIM RP information\n"
2829 "JavaScript Object Notation\n")
2831 u_char uj
= use_json(argc
, argv
);
2832 pim_rp_show_information (vty
, uj
);
2837 DEFUN (show_ip_pim_rpf
,
2838 show_ip_pim_rpf_cmd
,
2839 "show ip pim rpf [json]",
2843 "PIM cached source rpf information\n"
2844 "JavaScript Object Notation\n")
2846 u_char uj
= use_json(argc
, argv
);
2847 pim_show_rpf(vty
, uj
);
2852 DEFUN (show_ip_pim_nexthop
,
2853 show_ip_pim_nexthop_cmd
,
2854 "show ip pim nexthop",
2858 "PIM cached nexthop rpf information\n")
2860 pim_show_nexthop (vty
);
2865 DEFUN (show_ip_pim_nexthop_lookup
,
2866 show_ip_pim_nexthop_lookup_cmd
,
2867 "show ip pim nexthop-lookup A.B.C.D A.B.C.D",
2871 "PIM cached nexthop rpf lookup\n"
2872 "Source/RP address\n"
2873 "Multicast Group address\n")
2875 struct pim_nexthop_cache pnc
;
2876 struct prefix nht_p
;
2878 struct in_addr src_addr
, grp_addr
;
2879 struct in_addr vif_source
;
2880 const char *addr_str
, *addr_str1
;
2882 struct pim_nexthop nexthop
;
2883 char nexthop_addr_str
[PREFIX_STRLEN
];
2884 char grp_str
[PREFIX_STRLEN
];
2886 addr_str
= (const char *)argv
[0];
2887 result
= inet_pton (AF_INET
, addr_str
, &src_addr
);
2890 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
2891 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
2895 if (pim_is_group_224_4 (src_addr
))
2897 vty_out (vty
, "Invalid argument. Expected Valid Source Address.%s", VTY_NEWLINE
);
2901 addr_str1
= (const char *)argv
[1];
2902 result
= inet_pton (AF_INET
, addr_str1
, &grp_addr
);
2905 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
2906 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
2910 if (!pim_is_group_224_4 (grp_addr
))
2912 vty_out (vty
, "Invalid argument. Expected Valid Multicast Group Address.%s", VTY_NEWLINE
);
2916 if (!pim_rp_set_upstream_addr (&vif_source
, src_addr
, grp_addr
))
2919 memset (&pnc
, 0, sizeof (struct pim_nexthop_cache
));
2920 nht_p
.family
= AF_INET
;
2921 nht_p
.prefixlen
= IPV4_MAX_BITLEN
;
2922 nht_p
.u
.prefix4
= vif_source
;
2923 grp
.family
= AF_INET
;
2924 grp
.prefixlen
= IPV4_MAX_BITLEN
;
2925 grp
.u
.prefix4
= grp_addr
;
2926 memset (&nexthop
, 0, sizeof (nexthop
));
2928 if ((pim_find_or_track_nexthop (&nht_p
, NULL
, NULL
, &pnc
)) == 1)
2930 //Compute PIM RPF using Cached nexthop
2931 pim_ecmp_nexthop_search (&pnc
, &nexthop
, &nht_p
, &grp
, 0);
2934 pim_ecmp_nexthop_lookup (&nexthop
, vif_source
, &nht_p
, &grp
, 0);
2936 pim_addr_dump ("<grp?>", &grp
, grp_str
, sizeof (grp_str
));
2937 pim_addr_dump ("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
2938 nexthop_addr_str
, sizeof (nexthop_addr_str
));
2939 vty_out (vty
, "Group %s --- Nexthop %s Interface %s %s", grp_str
,
2940 nexthop_addr_str
, nexthop
.interface
->name
, VTY_NEWLINE
);
2945 static void show_multicast_interfaces(struct vty
*vty
)
2947 struct listnode
*node
;
2948 struct interface
*ifp
;
2950 vty_out(vty
, "%s", VTY_NEWLINE
);
2952 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
2955 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
2956 struct pim_interface
*pim_ifp
;
2957 struct in_addr ifaddr
;
2958 struct sioc_vif_req vreq
;
2960 pim_ifp
= ifp
->info
;
2965 memset(&vreq
, 0, sizeof(vreq
));
2966 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
2968 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
2969 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
2970 (unsigned long)SIOCGETVIFCNT
,
2972 pim_ifp
->mroute_vif_index
,
2974 safe_strerror(errno
),
2978 ifaddr
= pim_ifp
->primary_address
;
2980 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
2984 pim_ifp
->mroute_vif_index
,
2985 (unsigned long) vreq
.icount
,
2986 (unsigned long) vreq
.ocount
,
2987 (unsigned long) vreq
.ibytes
,
2988 (unsigned long) vreq
.obytes
,
2993 DEFUN (show_ip_multicast
,
2994 show_ip_multicast_cmd
,
2995 "show ip multicast",
2998 "Multicast global information\n")
3000 time_t now
= pim_time_monotonic_sec();
3004 vty_out(vty
, "Mroute socket descriptor: %d%s",
3005 qpim_mroute_socket_fd
,
3008 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
3009 vty_out(vty
, "Mroute socket uptime: %s%s",
3013 vty_out(vty
, "%s", VTY_NEWLINE
);
3015 pim_zebra_zclient_update (vty
);
3016 pim_zlookup_show_ip_multicast (vty
);
3018 vty_out(vty
, "%s", VTY_NEWLINE
);
3019 vty_out(vty
, "Maximum highest VifIndex: %d%s",
3020 PIM_MAX_USABLE_VIFS
,
3023 vty_out (vty
, "%s", VTY_NEWLINE
);
3024 vty_out (vty
, "Upstream Join Timer: %d secs%s",
3025 qpim_t_periodic
, VTY_NEWLINE
);
3026 vty_out (vty
, "Join/Prune Holdtime: %d secs%s",
3027 PIM_JP_HOLDTIME
, VTY_NEWLINE
);
3028 vty_out (vty
, "PIM ECMP: %s%s",
3029 qpim_ecmp_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3030 vty_out (vty
, "PIM ECMP Rebalance: %s%s",
3031 qpim_ecmp_rebalance_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3033 vty_out (vty
, "%s", VTY_NEWLINE
);
3035 show_rpf_refresh_stats(vty
, now
, NULL
);
3037 vty_out(vty
, "%s", VTY_NEWLINE
);
3039 show_scan_oil_stats(vty
, now
);
3041 show_multicast_interfaces(vty
);
3046 static void show_mroute(struct vty
*vty
, u_char uj
)
3048 struct listnode
*node
;
3049 struct channel_oil
*c_oil
;
3050 struct static_route
*s_route
;
3052 json_object
*json
= NULL
;
3053 json_object
*json_group
= NULL
;
3054 json_object
*json_source
= NULL
;
3055 json_object
*json_oil
= NULL
;
3056 json_object
*json_ifp_out
= NULL
;
3059 char grp_str
[INET_ADDRSTRLEN
];
3060 char src_str
[INET_ADDRSTRLEN
];
3061 char in_ifname
[INTERFACE_NAMSIZ
+1];
3062 char out_ifname
[INTERFACE_NAMSIZ
+1];
3064 struct interface
*ifp_in
;
3068 json
= json_object_new_object();
3070 vty_out(vty
, "Source Group Proto Input Output TTL Uptime%s",
3074 now
= pim_time_monotonic_sec();
3076 /* print list of PIM and IGMP routes */
3077 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3080 if (!c_oil
->installed
&& !uj
)
3083 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
3084 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
3085 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
3088 strcpy(in_ifname
, ifp_in
->name
);
3090 strcpy(in_ifname
, "<iif?>");
3094 /* Find the group, create it if it doesn't exist */
3095 json_object_object_get_ex(json
, grp_str
, &json_group
);
3098 json_group
= json_object_new_object();
3099 json_object_object_add(json
, grp_str
, json_group
);
3102 /* Find the source nested under the group, create it if it doesn't exist */
3103 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3106 json_source
= json_object_new_object();
3107 json_object_object_add(json_group
, src_str
, json_source
);
3110 /* Find the inbound interface nested under the source, create it if it doesn't exist */
3111 json_object_int_add(json_source
, "installed", c_oil
->installed
);
3112 json_object_int_add(json_source
, "refCount", c_oil
->oil_ref_count
);
3113 json_object_int_add(json_source
, "oilSize", c_oil
->oil_size
);
3114 json_object_int_add(json_source
, "OilInheritedRescan", c_oil
->oil_inherited_rescan
);
3115 json_object_string_add(json_source
, "iif", in_ifname
);
3119 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3120 struct interface
*ifp_out
;
3121 char oif_uptime
[10];
3124 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
3128 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3129 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
3133 strcpy(out_ifname
, ifp_out
->name
);
3135 strcpy(out_ifname
, "<oif?>");
3138 json_ifp_out
= json_object_new_object();
3139 json_object_string_add(json_ifp_out
, "source", src_str
);
3140 json_object_string_add(json_ifp_out
, "group", grp_str
);
3142 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
)
3143 json_object_boolean_true_add(json_ifp_out
, "protocolPim");
3145 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
)
3146 json_object_boolean_true_add(json_ifp_out
, "protocolIgmp");
3148 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
)
3149 json_object_boolean_true_add(json_ifp_out
, "protocolSource");
3151 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
)
3152 json_object_boolean_true_add(json_ifp_out
, "protocolInherited");
3154 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3155 json_object_int_add(json_ifp_out
, "iVifI", c_oil
->oil
.mfcc_parent
);
3156 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3157 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3158 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3159 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3161 json_oil
= json_object_new_object();
3162 json_object_object_add(json_source
, "oil", json_oil
);
3164 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3166 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
3167 strcpy(proto
, "PIM");
3170 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
3171 strcpy(proto
, "IGMP");
3174 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
3175 strcpy(proto
, "SRC");
3178 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) {
3179 strcpy(proto
, "STAR");
3182 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3196 in_ifname
[0] = '\0';
3202 if (!uj
&& !found_oif
) {
3203 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3215 /* Print list of static routes */
3216 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3219 if (!s_route
->c_oil
.installed
)
3222 pim_inet4_dump("<group?>", s_route
->group
, grp_str
, sizeof(grp_str
));
3223 pim_inet4_dump("<source?>", s_route
->source
, src_str
, sizeof(src_str
));
3224 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
3228 strcpy(in_ifname
, ifp_in
->name
);
3230 strcpy(in_ifname
, "<iif?>");
3234 /* Find the group, create it if it doesn't exist */
3235 json_object_object_get_ex(json
, grp_str
, &json_group
);
3238 json_group
= json_object_new_object();
3239 json_object_object_add(json
, grp_str
, json_group
);
3242 /* Find the source nested under the group, create it if it doesn't exist */
3243 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3246 json_source
= json_object_new_object();
3247 json_object_object_add(json_group
, src_str
, json_source
);
3250 json_object_string_add(json_source
, "iif", in_ifname
);
3253 strcpy(proto
, "STATIC");
3256 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3257 struct interface
*ifp_out
;
3258 char oif_uptime
[10];
3261 ttl
= s_route
->oif_ttls
[oif_vif_index
];
3265 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3266 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
3270 strcpy(out_ifname
, ifp_out
->name
);
3272 strcpy(out_ifname
, "<oif?>");
3275 json_ifp_out
= json_object_new_object();
3276 json_object_string_add(json_ifp_out
, "source", src_str
);
3277 json_object_string_add(json_ifp_out
, "group", grp_str
);
3278 json_object_boolean_true_add(json_ifp_out
, "protocolStatic");
3279 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3280 json_object_int_add(json_ifp_out
, "iVifI", c_oil
->oil
.mfcc_parent
);
3281 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3282 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3283 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3284 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3286 json_oil
= json_object_new_object();
3287 json_object_object_add(json_source
, "oil", json_oil
);
3289 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3291 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3304 in_ifname
[0] = '\0';
3310 if (!uj
&& !found_oif
) {
3311 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3324 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3325 json_object_free(json
);
3329 DEFUN (show_ip_mroute
,
3331 "show ip mroute [json]",
3337 u_char uj
= use_json(argc
, argv
);
3338 show_mroute(vty
, uj
);
3342 static void show_mroute_count(struct vty
*vty
)
3344 struct listnode
*node
;
3345 struct channel_oil
*c_oil
;
3346 struct static_route
*s_route
;
3348 vty_out(vty
, "%s", VTY_NEWLINE
);
3350 vty_out(vty
, "Source Group LastUsed Packets Bytes WrongIf %s",
3353 /* Print PIM and IGMP route counts */
3354 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3355 char group_str
[INET_ADDRSTRLEN
];
3356 char source_str
[INET_ADDRSTRLEN
];
3358 if (!c_oil
->installed
)
3361 pim_mroute_update_counters (c_oil
);
3363 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3364 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3366 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3369 c_oil
->cc
.lastused
/100,
3376 /* Print static route counts */
3377 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3378 char group_str
[INET_ADDRSTRLEN
];
3379 char source_str
[INET_ADDRSTRLEN
];
3381 if (!s_route
->c_oil
.installed
)
3384 pim_mroute_update_counters (&s_route
->c_oil
);
3386 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3387 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3389 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3392 s_route
->c_oil
.cc
.lastused
,
3393 s_route
->c_oil
.cc
.pktcnt
,
3394 s_route
->c_oil
.cc
.bytecnt
,
3395 s_route
->c_oil
.cc
.wrong_if
,
3400 DEFUN (show_ip_mroute_count
,
3401 show_ip_mroute_count_cmd
,
3402 "show ip mroute count",
3406 "Route and packet count data\n")
3408 show_mroute_count(vty
);
3414 "show ip rib A.B.C.D",
3418 "Unicast address\n")
3421 struct in_addr addr
;
3422 const char *addr_str
;
3423 struct pim_nexthop nexthop
;
3424 char nexthop_addr_str
[PREFIX_STRLEN
];
3427 memset (&nexthop
, 0, sizeof (nexthop
));
3428 addr_str
= argv
[idx_ipv4
]->arg
;
3429 result
= inet_pton(AF_INET
, addr_str
, &addr
);
3431 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
3432 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3436 if (pim_nexthop_lookup(&nexthop
, addr
, 0)) {
3437 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
3438 addr_str
, VTY_NEWLINE
);
3442 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
3445 pim_addr_dump("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
3446 nexthop_addr_str
, sizeof(nexthop_addr_str
));
3448 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
3451 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
3452 nexthop
.mrib_route_metric
,
3453 nexthop
.mrib_metric_preference
,
3459 static void show_ssmpingd(struct vty
*vty
)
3461 struct listnode
*node
;
3462 struct ssmpingd_sock
*ss
;
3465 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
3468 if (!qpim_ssmpingd_list
)
3471 now
= pim_time_monotonic_sec();
3473 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
3474 char source_str
[INET_ADDRSTRLEN
];
3476 struct sockaddr_in bind_addr
;
3477 socklen_t len
= sizeof(bind_addr
);
3478 char bind_addr_str
[INET_ADDRSTRLEN
];
3480 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
3482 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
3483 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
3484 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
3487 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
3488 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
3490 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
3494 ntohs(bind_addr
.sin_port
),
3496 (long long)ss
->requests
,
3501 DEFUN (show_ip_ssmpingd
,
3502 show_ip_ssmpingd_cmd
,
3513 pim_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
, const char *plist
)
3517 result
= pim_rp_new (rp
, group
, plist
);
3519 if (result
== PIM_MALLOC_FAIL
)
3521 vty_out (vty
, "%% Out of memory%s", VTY_NEWLINE
);
3525 if (result
== PIM_GROUP_BAD_ADDRESS
)
3527 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3531 if (result
== PIM_RP_BAD_ADDRESS
)
3533 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3537 if (result
== PIM_RP_NO_PATH
)
3539 vty_out (vty
, "%% No Path to RP address specified: %s%s", rp
, VTY_NEWLINE
);
3543 if (result
== PIM_GROUP_OVERLAP
)
3545 vty_out (vty
, "%% Group range specified cannot overlap%s", VTY_NEWLINE
);
3549 if (result
== PIM_GROUP_PFXLIST_OVERLAP
)
3551 vty_out (vty
, "%% This group is already covered by a RP prefix-list%s", VTY_NEWLINE
);
3555 if (result
== PIM_RP_PFXLIST_IN_USE
)
3557 vty_out (vty
, "%% The same prefix-list cannot be applied to multiple RPs%s", VTY_NEWLINE
);
3564 DEFUN (ip_pim_spt_switchover_infinity
,
3565 ip_pim_spt_switchover_infinity_cmd
,
3566 "ip pim spt-switchover infinity-and-beyond",
3570 "Never switch to SPT Tree\n")
3572 pimg
->spt_switchover
= PIM_SPT_INFINITY
;
3574 pim_upstream_remove_lhr_star_pimreg();
3578 DEFUN (no_ip_pim_spt_switchover_infinity
,
3579 no_ip_pim_spt_switchover_infinity_cmd
,
3580 "no ip pim spt-switchover infinity-and-beyond",
3585 "Never switch to SPT Tree\n")
3587 pimg
->spt_switchover
= PIM_SPT_IMMEDIATE
;
3589 pim_upstream_add_lhr_star_pimreg();
3593 DEFUN (ip_pim_joinprune_time
,
3594 ip_pim_joinprune_time_cmd
,
3595 "ip pim join-prune-interval <60-600>",
3597 "pim multicast routing\n"
3598 "Join Prune Send Interval\n"
3601 qpim_t_periodic
= atoi(argv
[3]->arg
);
3605 DEFUN (no_ip_pim_joinprune_time
,
3606 no_ip_pim_joinprune_time_cmd
,
3607 "no ip pim join-prune-interval <60-600>",
3610 "pim multicast routing\n"
3611 "Join Prune Send Interval\n"
3614 qpim_t_periodic
= PIM_DEFAULT_T_PERIODIC
;
3618 DEFUN (ip_pim_register_suppress
,
3619 ip_pim_register_suppress_cmd
,
3620 "ip pim register-suppress-time <5-60000>",
3622 "pim multicast routing\n"
3623 "Register Suppress Timer\n"
3626 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
3630 DEFUN (no_ip_pim_register_suppress
,
3631 no_ip_pim_register_suppress_cmd
,
3632 "no ip pim register-suppress-time <5-60000>",
3635 "pim multicast routing\n"
3636 "Register Suppress Timer\n"
3639 qpim_register_suppress_time
= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
;
3643 DEFUN (ip_pim_keep_alive
,
3644 ip_pim_keep_alive_cmd
,
3645 "ip pim keep-alive-timer <31-60000>",
3647 "pim multicast routing\n"
3648 "Keep alive Timer\n"
3651 qpim_rp_keep_alive_time
= atoi (argv
[4]->arg
);
3655 DEFUN (no_ip_pim_keep_alive
,
3656 no_ip_pim_keep_alive_cmd
,
3657 "no ip pim keep-alive-timer <31-60000>",
3660 "pim multicast routing\n"
3661 "Keep alive Timer\n"
3664 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
3668 DEFUN (ip_pim_packets
,
3670 "ip pim packets <1-100>",
3672 "pim multicast routing\n"
3673 "packets to process at one time per fd\n"
3674 "Number of packets\n")
3676 qpim_packet_process
= atoi (argv
[3]->arg
);
3680 DEFUN (no_ip_pim_packets
,
3681 no_ip_pim_packets_cmd
,
3682 "no ip pim packets <1-100>",
3685 "pim multicast routing\n"
3686 "packets to process at one time per fd\n"
3687 "Number of packets\n")
3689 qpim_packet_process
= PIM_DEFAULT_PACKET_PROCESS
;
3693 DEFUN (ip_pim_v6_secondary
,
3694 ip_pim_v6_secondary_cmd
,
3695 "ip pim send-v6-secondary",
3697 "pim multicast routing\n"
3698 "Send v6 secondary addresses\n")
3700 pimg
->send_v6_secondary
= 1;
3705 DEFUN (no_ip_pim_v6_secondary
,
3706 no_ip_pim_v6_secondary_cmd
,
3707 "no ip pim send-v6-secondary",
3710 "pim multicast routing\n"
3711 "Send v6 secondary addresses\n")
3713 pimg
->send_v6_secondary
= 0;
3720 "ip pim rp A.B.C.D [A.B.C.D/M]",
3722 "pim multicast routing\n"
3724 "ip address of RP\n"
3725 "Group Address range to cover\n")
3729 if (argc
== (idx_ipv4
+ 1))
3730 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
, NULL
);
3732 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3735 DEFUN (ip_pim_rp_prefix_list
,
3736 ip_pim_rp_prefix_list_cmd
,
3737 "ip pim rp A.B.C.D prefix-list WORD",
3739 "pim multicast routing\n"
3741 "ip address of RP\n"
3742 "group prefix-list filter\n"
3743 "Name of a prefix-list\n")
3745 return pim_rp_cmd_worker (vty
, argv
[3]->arg
, NULL
, argv
[5]->arg
);
3749 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
,
3752 int result
= pim_rp_del (rp
, group
, plist
);
3754 if (result
== PIM_GROUP_BAD_ADDRESS
)
3756 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3760 if (result
== PIM_RP_BAD_ADDRESS
)
3762 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3766 if (result
== PIM_RP_NOT_FOUND
)
3768 vty_out (vty
, "%% Unable to find specified RP%s", VTY_NEWLINE
);
3775 DEFUN (no_ip_pim_rp
,
3777 "no ip pim rp A.B.C.D [A.B.C.D/M]",
3780 "pim multicast routing\n"
3782 "ip address of RP\n"
3783 "Group Address range to cover\n")
3785 int idx_ipv4
= 4, idx_group
= 0;
3787 if (argv_find (argv
, argc
, "A.B.C.D/M", &idx_group
))
3788 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_group
]->arg
, NULL
);
3790 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3793 DEFUN (no_ip_pim_rp_prefix_list
,
3794 no_ip_pim_rp_prefix_list_cmd
,
3795 "no ip pim rp A.B.C.D prefix-list WORD",
3798 "pim multicast routing\n"
3800 "ip address of RP\n"
3801 "group prefix-list filter\n"
3802 "Name of a prefix-list\n")
3804 return pim_no_rp_cmd_worker (vty
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
3808 pim_ssm_cmd_worker (struct vty
*vty
, const char *plist
)
3810 int result
= pim_ssm_range_set (VRF_DEFAULT
, plist
);
3812 if (result
== PIM_SSM_ERR_NONE
)
3817 case PIM_SSM_ERR_NO_VRF
:
3818 vty_out (vty
, "%% VRF doesn't exist%s", VTY_NEWLINE
);
3820 case PIM_SSM_ERR_DUP
:
3821 vty_out (vty
, "%% duplicate config%s", VTY_NEWLINE
);
3824 vty_out (vty
, "%% ssm range config failed%s", VTY_NEWLINE
);
3830 DEFUN (ip_pim_ssm_prefix_list
,
3831 ip_pim_ssm_prefix_list_cmd
,
3832 "ip pim ssm prefix-list WORD",
3834 "pim multicast routing\n"
3835 "Source Specific Multicast\n"
3836 "group range prefix-list filter\n"
3837 "Name of a prefix-list\n")
3839 return pim_ssm_cmd_worker (vty
, argv
[0]->arg
);
3842 DEFUN (no_ip_pim_ssm_prefix_list
,
3843 no_ip_pim_ssm_prefix_list_cmd
,
3844 "no ip pim ssm prefix-list",
3847 "pim multicast routing\n"
3848 "Source Specific Multicast\n"
3849 "group range prefix-list filter\n")
3851 return pim_ssm_cmd_worker (vty
, NULL
);
3854 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3855 no_ip_pim_ssm_prefix_list_name_cmd
,
3856 "no ip pim ssm prefix-list WORD",
3859 "pim multicast routing\n"
3860 "Source Specific Multicast\n"
3861 "group range prefix-list filter\n"
3862 "Name of a prefix-list\n")
3864 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3866 if (ssm
->plist_name
&& !strcmp(ssm
->plist_name
, argv
[0]->arg
))
3867 return pim_ssm_cmd_worker (vty
, NULL
);
3869 vty_out (vty
, "%% pim ssm prefix-list %s doesn't exist%s",
3870 argv
[0]->arg
, VTY_NEWLINE
);
3876 ip_pim_ssm_show_group_range(struct vty
*vty
, u_char uj
)
3878 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3879 const char *range_str
= ssm
->plist_name
?ssm
->plist_name
:PIM_SSM_STANDARD_RANGE
;
3884 json
= json_object_new_object();
3885 json_object_string_add(json
, "ssmGroups", range_str
);
3886 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3887 json_object_free(json
);
3890 vty_out(vty
, "SSM group range : %s%s", range_str
, VTY_NEWLINE
);
3893 DEFUN (show_ip_pim_ssm_range
,
3894 show_ip_pim_ssm_range_cmd
,
3895 "show ip pim group-type [json]",
3900 "JavaScript Object Notation\n")
3902 u_char uj
= use_json(argc
, argv
);
3903 ip_pim_ssm_show_group_range(vty
, uj
);
3909 ip_pim_ssm_show_group_type(struct vty
*vty
, u_char uj
, const char *group
)
3911 struct in_addr group_addr
;
3912 const char *type_str
;
3915 result
= inet_pton(AF_INET
, group
, &group_addr
);
3917 type_str
= "invalid";
3920 if (pim_is_group_224_4 (group_addr
))
3921 type_str
= pim_is_grp_ssm (group_addr
)?"SSM":"ASM";
3923 type_str
= "not-multicast";
3929 json
= json_object_new_object();
3930 json_object_string_add(json
, "groupType", type_str
);
3931 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3932 json_object_free(json
);
3935 vty_out(vty
, "Group type : %s%s", type_str
, VTY_NEWLINE
);
3938 DEFUN (show_ip_pim_group_type
,
3939 show_ip_pim_group_type_cmd
,
3940 "show ip pim group-type A.B.C.D [json]",
3944 "multicast group type\n"
3946 "JavaScript Object Notation\n")
3948 u_char uj
= use_json(argc
, argv
);
3949 ip_pim_ssm_show_group_type(vty
, uj
, argv
[0]->arg
);
3954 DEFUN_HIDDEN (ip_multicast_routing
,
3955 ip_multicast_routing_cmd
,
3956 "ip multicast-routing",
3958 "Enable IP multicast forwarding\n")
3963 DEFUN_HIDDEN (no_ip_multicast_routing
,
3964 no_ip_multicast_routing_cmd
,
3965 "no ip multicast-routing",
3968 "Global IP configuration subcommands\n"
3969 "Enable IP multicast forwarding\n")
3971 vty_out (vty
, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE
);
3977 "ip ssmpingd [A.B.C.D]",
3984 struct in_addr source_addr
;
3985 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3987 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
3989 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
3990 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3994 result
= pim_ssmpingd_start(source_addr
);
3996 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
3997 source_str
, result
, VTY_NEWLINE
);
4004 DEFUN (no_ip_ssmpingd
,
4006 "no ip ssmpingd [A.B.C.D]",
4014 struct in_addr source_addr
;
4015 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
4017 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4019 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
4020 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4024 result
= pim_ssmpingd_stop(source_addr
);
4026 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
4027 source_str
, result
, VTY_NEWLINE
);
4038 "pim multicast routing\n"
4039 "Enable PIM ECMP \n")
4041 qpim_ecmp_enable
= 1;
4046 DEFUN (no_ip_pim_ecmp
,
4051 "pim multicast routing\n"
4052 "Disable PIM ECMP \n")
4054 qpim_ecmp_enable
= 0;
4059 DEFUN (ip_pim_ecmp_rebalance
,
4060 ip_pim_ecmp_rebalance_cmd
,
4061 "ip pim ecmp rebalance",
4063 "pim multicast routing\n"
4064 "Enable PIM ECMP \n"
4065 "Enable PIM ECMP Rebalance\n")
4067 qpim_ecmp_rebalance_enable
= 1;
4072 DEFUN (no_ip_pim_ecmp_rebalance
,
4073 no_ip_pim_ecmp_rebalance_cmd
,
4074 "no ip pim ecmp rebalance",
4077 "pim multicast routing\n"
4078 "Disable PIM ECMP \n"
4079 "Disable PIM ECMP Rebalance\n")
4081 qpim_ecmp_rebalance_enable
= 0;
4087 pim_cmd_igmp_start (struct vty
*vty
, struct interface
*ifp
)
4089 struct pim_interface
*pim_ifp
;
4091 pim_ifp
= ifp
->info
;
4094 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
4096 vty_out(vty
, "Could not enable IGMP on interface %s%s",
4097 ifp
->name
, VTY_NEWLINE
);
4102 PIM_IF_DO_IGMP(pim_ifp
->options
);
4105 pim_if_addr_add_all(ifp
);
4106 pim_if_membership_refresh(ifp
);
4111 DEFUN (interface_ip_igmp
,
4112 interface_ip_igmp_cmd
,
4117 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4119 return pim_cmd_igmp_start(vty
, ifp
);
4122 DEFUN (interface_no_ip_igmp
,
4123 interface_no_ip_igmp_cmd
,
4129 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4130 struct pim_interface
*pim_ifp
;
4132 pim_ifp
= ifp
->info
;
4136 PIM_IF_DONT_IGMP(pim_ifp
->options
);
4138 pim_if_membership_clear(ifp
);
4140 pim_if_addr_del_all_igmp(ifp
);
4142 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
4149 DEFUN (interface_ip_igmp_join
,
4150 interface_ip_igmp_join_cmd
,
4151 "ip igmp join A.B.C.D A.B.C.D",
4154 "IGMP join multicast group\n"
4155 "Multicast group address\n"
4158 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4161 const char *group_str
;
4162 const char *source_str
;
4163 struct in_addr group_addr
;
4164 struct in_addr source_addr
;
4168 group_str
= argv
[idx_ipv4
]->arg
;
4169 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4171 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4172 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4176 /* Source address */
4177 source_str
= argv
[idx_ipv4_2
]->arg
;
4178 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4180 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4181 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4185 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
4187 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
4188 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4195 DEFUN (interface_no_ip_igmp_join
,
4196 interface_no_ip_igmp_join_cmd
,
4197 "no ip igmp join A.B.C.D A.B.C.D",
4201 "IGMP join multicast group\n"
4202 "Multicast group address\n"
4205 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4208 const char *group_str
;
4209 const char *source_str
;
4210 struct in_addr group_addr
;
4211 struct in_addr source_addr
;
4215 group_str
= argv
[idx_ipv4
]->arg
;
4216 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4218 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4219 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4223 /* Source address */
4224 source_str
= argv
[idx_ipv4_2
]->arg
;
4225 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4227 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4228 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4232 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
4234 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
4235 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4243 CLI reconfiguration affects the interface level (struct pim_interface).
4244 This function propagates the reconfiguration to every active socket
4247 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
4249 struct interface
*ifp
;
4250 struct pim_interface
*pim_ifp
;
4254 /* other querier present? */
4256 if (igmp
->t_other_querier_timer
)
4259 /* this is the querier */
4261 zassert(igmp
->interface
);
4262 zassert(igmp
->interface
->info
);
4264 ifp
= igmp
->interface
;
4265 pim_ifp
= ifp
->info
;
4267 if (PIM_DEBUG_IGMP_TRACE
) {
4268 char ifaddr_str
[INET_ADDRSTRLEN
];
4269 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
4270 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
4271 __PRETTY_FUNCTION__
,
4274 pim_ifp
->igmp_default_query_interval
);
4278 igmp_startup_mode_on() will reset QQI:
4280 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
4282 igmp_startup_mode_on(igmp
);
4285 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
4287 if (igmp
->t_igmp_query_timer
) {
4288 /* other querier present */
4289 zassert(igmp
->t_igmp_query_timer
);
4290 zassert(!igmp
->t_other_querier_timer
);
4292 pim_igmp_general_query_off(igmp
);
4293 pim_igmp_general_query_on(igmp
);
4295 zassert(igmp
->t_igmp_query_timer
);
4296 zassert(!igmp
->t_other_querier_timer
);
4299 /* this is the querier */
4301 zassert(!igmp
->t_igmp_query_timer
);
4302 zassert(igmp
->t_other_querier_timer
);
4304 pim_igmp_other_querier_timer_off(igmp
);
4305 pim_igmp_other_querier_timer_on(igmp
);
4307 zassert(!igmp
->t_igmp_query_timer
);
4308 zassert(igmp
->t_other_querier_timer
);
4312 static void change_query_interval(struct pim_interface
*pim_ifp
,
4315 struct listnode
*sock_node
;
4316 struct igmp_sock
*igmp
;
4318 pim_ifp
->igmp_default_query_interval
= query_interval
;
4320 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4321 igmp_sock_query_interval_reconfig(igmp
);
4322 igmp_sock_query_reschedule(igmp
);
4326 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
4327 int query_max_response_time_dsec
)
4329 struct listnode
*sock_node
;
4330 struct igmp_sock
*igmp
;
4332 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
4335 Below we modify socket/group/source timers in order to quickly
4336 reflect the change. Otherwise, those timers would eventually catch
4340 /* scan all sockets */
4341 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4342 struct listnode
*grp_node
;
4343 struct igmp_group
*grp
;
4345 /* reschedule socket general query */
4346 igmp_sock_query_reschedule(igmp
);
4348 /* scan socket groups */
4349 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
4350 struct listnode
*src_node
;
4351 struct igmp_source
*src
;
4353 /* reset group timers for groups in EXCLUDE mode */
4354 if (grp
->group_filtermode_isexcl
) {
4355 igmp_group_reset_gmi(grp
);
4358 /* scan group sources */
4359 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
4361 /* reset source timers for sources with running timers */
4362 if (src
->t_source_timer
) {
4363 igmp_source_reset_gmi(igmp
, grp
, src
);
4370 #define IGMP_QUERY_INTERVAL_MIN (1)
4371 #define IGMP_QUERY_INTERVAL_MAX (1800)
4373 DEFUN (interface_ip_igmp_query_interval
,
4374 interface_ip_igmp_query_interval_cmd
,
4375 "ip igmp query-interval (1-1800)",
4378 IFACE_IGMP_QUERY_INTERVAL_STR
4379 "Query interval in seconds\n")
4381 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4382 struct pim_interface
*pim_ifp
;
4384 int query_interval_dsec
;
4387 pim_ifp
= ifp
->info
;
4390 ret
= pim_cmd_igmp_start(vty
, ifp
);
4391 if (ret
!= CMD_SUCCESS
)
4393 pim_ifp
= ifp
->info
;
4396 query_interval
= atoi(argv
[3]->arg
);
4397 query_interval_dsec
= 10 * query_interval
;
4400 It seems we don't need to check bounds since command.c does it
4401 already, but we verify them anyway for extra safety.
4403 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
4404 vty_out(vty
, "General query interval %d lower than minimum %d%s",
4406 IGMP_QUERY_INTERVAL_MIN
,
4410 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
4411 vty_out(vty
, "General query interval %d higher than maximum %d%s",
4413 IGMP_QUERY_INTERVAL_MAX
,
4418 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4420 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
4421 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4426 change_query_interval(pim_ifp
, query_interval
);
4431 DEFUN (interface_no_ip_igmp_query_interval
,
4432 interface_no_ip_igmp_query_interval_cmd
,
4433 "no ip igmp query-interval",
4437 IFACE_IGMP_QUERY_INTERVAL_STR
)
4439 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4440 struct pim_interface
*pim_ifp
;
4441 int default_query_interval_dsec
;
4443 pim_ifp
= ifp
->info
;
4448 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
4450 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4452 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
4453 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4458 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
4463 DEFUN (interface_ip_igmp_version
,
4464 interface_ip_igmp_version_cmd
,
4465 "ip igmp version (2-3)",
4469 "IGMP version number\n")
4471 VTY_DECLVAR_CONTEXT(interface
,ifp
);
4472 struct pim_interface
*pim_ifp
;
4476 pim_ifp
= ifp
->info
;
4479 ret
= pim_cmd_igmp_start(vty
, ifp
);
4480 if (ret
!= CMD_SUCCESS
)
4482 pim_ifp
= ifp
->info
;
4485 igmp_version
= atoi(argv
[3]->arg
);
4486 pim_ifp
->igmp_version
= igmp_version
;
4491 DEFUN (interface_no_ip_igmp_version
,
4492 interface_no_ip_igmp_version_cmd
,
4493 "no ip igmp version (2-3)",
4498 "IGMP version number\n")
4500 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4501 struct pim_interface
*pim_ifp
;
4503 pim_ifp
= ifp
->info
;
4508 pim_ifp
->igmp_version
= IGMP_DEFAULT_VERSION
;
4513 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4514 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4516 DEFUN (interface_ip_igmp_query_max_response_time
,
4517 interface_ip_igmp_query_max_response_time_cmd
,
4518 "ip igmp query-max-response-time (10-250)",
4521 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4522 "Query response value in deci-seconds\n")
4524 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4525 struct pim_interface
*pim_ifp
;
4526 int query_max_response_time
;
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
= atoi(argv
[3]->arg
);
4540 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
* 10) {
4542 "Can't set query max response time %d sec >= general query interval %d sec%s",
4543 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
4548 change_query_max_response_time(pim_ifp
, query_max_response_time
);
4553 DEFUN (interface_no_ip_igmp_query_max_response_time
,
4554 interface_no_ip_igmp_query_max_response_time_cmd
,
4555 "no ip igmp query-max-response-time (10-250)",
4559 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4560 "Time for response in deci-seconds\n")
4562 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4563 struct pim_interface
*pim_ifp
;
4565 pim_ifp
= ifp
->info
;
4570 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4575 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4576 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4578 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
4579 interface_ip_igmp_query_max_response_time_dsec_cmd
,
4580 "ip igmp query-max-response-time-dsec (10-250)",
4583 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4584 "Query response value in deciseconds\n")
4586 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4587 struct pim_interface
*pim_ifp
;
4588 int query_max_response_time_dsec
;
4589 int default_query_interval_dsec
;
4592 pim_ifp
= ifp
->info
;
4595 ret
= pim_cmd_igmp_start(vty
, ifp
);
4596 if (ret
!= CMD_SUCCESS
)
4598 pim_ifp
= ifp
->info
;
4601 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
4603 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
4605 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
4607 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
4608 query_max_response_time_dsec
, default_query_interval_dsec
,
4613 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
4618 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4619 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4620 "no ip igmp query-max-response-time-dsec",
4624 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
4626 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4627 struct pim_interface
*pim_ifp
;
4629 pim_ifp
= ifp
->info
;
4634 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4639 DEFUN (interface_ip_pim_drprio
,
4640 interface_ip_pim_drprio_cmd
,
4641 "ip pim drpriority (1-4294967295)",
4644 "Set the Designated Router Election Priority\n"
4645 "Value of the new DR Priority\n")
4647 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4649 struct pim_interface
*pim_ifp
;
4650 uint32_t old_dr_prio
;
4652 pim_ifp
= ifp
->info
;
4655 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
4659 old_dr_prio
= pim_ifp
->pim_dr_priority
;
4661 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
4663 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
4664 if (pim_if_dr_election(ifp
))
4665 pim_hello_restart_now(ifp
);
4671 DEFUN (interface_no_ip_pim_drprio
,
4672 interface_no_ip_pim_drprio_cmd
,
4673 "no ip pim drpriority [(1-4294967295)]",
4677 "Revert the Designated Router Priority to default\n"
4678 "Old Value of the Priority\n")
4680 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4681 struct pim_interface
*pim_ifp
;
4683 pim_ifp
= ifp
->info
;
4686 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4690 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
4691 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
4692 if (pim_if_dr_election(ifp
))
4693 pim_hello_restart_now(ifp
);
4700 pim_cmd_interface_add (struct interface
*ifp
)
4702 struct pim_interface
*pim_ifp
= ifp
->info
;
4705 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
4711 PIM_IF_DO_PIM(pim_ifp
->options
);
4714 pim_if_addr_add_all(ifp
);
4715 pim_if_membership_refresh(ifp
);
4719 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4720 interface_ip_pim_ssm_cmd
,
4726 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4728 if (!pim_cmd_interface_add(ifp
)) {
4729 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4733 vty_out(vty
, "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed%s", VTY_NEWLINE
);
4737 DEFUN (interface_ip_pim_sm
,
4738 interface_ip_pim_sm_cmd
,
4744 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4745 if (!pim_cmd_interface_add(ifp
)) {
4746 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4750 pim_if_create_pimreg();
4756 pim_cmd_interface_delete (struct interface
*ifp
)
4758 struct pim_interface
*pim_ifp
= ifp
->info
;
4763 PIM_IF_DONT_PIM(pim_ifp
->options
);
4765 pim_if_membership_clear(ifp
);
4768 pim_sock_delete() removes all neighbors from
4769 pim_ifp->pim_neighbor_list.
4771 pim_sock_delete(ifp
, "pim unconfigured on interface");
4773 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
4774 pim_if_addr_del_all(ifp
);
4781 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4782 interface_no_ip_pim_ssm_cmd
,
4789 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4790 if (!pim_cmd_interface_delete(ifp
)) {
4791 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4798 DEFUN (interface_no_ip_pim_sm
,
4799 interface_no_ip_pim_sm_cmd
,
4806 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4807 if (!pim_cmd_interface_delete(ifp
)) {
4808 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4815 DEFUN (interface_ip_mroute
,
4816 interface_ip_mroute_cmd
,
4817 "ip mroute INTERFACE A.B.C.D",
4819 "Add multicast route\n"
4820 "Outgoing interface name\n"
4823 VTY_DECLVAR_CONTEXT(interface
, iif
);
4824 int idx_interface
= 2;
4826 struct interface
*oif
;
4827 const char *oifname
;
4828 const char *grp_str
;
4829 struct in_addr grp_addr
;
4830 struct in_addr src_addr
;
4833 oifname
= argv
[idx_interface
]->arg
;
4834 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4836 vty_out(vty
, "No such interface name %s%s",
4837 oifname
, VTY_NEWLINE
);
4841 grp_str
= argv
[idx_ipv4
]->arg
;
4842 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4844 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4845 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4849 src_addr
.s_addr
= INADDR_ANY
;
4851 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4852 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4859 DEFUN (interface_ip_mroute_source
,
4860 interface_ip_mroute_source_cmd
,
4861 "ip mroute INTERFACE A.B.C.D A.B.C.D",
4863 "Add multicast route\n"
4864 "Outgoing interface name\n"
4868 VTY_DECLVAR_CONTEXT(interface
, iif
);
4869 int idx_interface
= 2;
4872 struct interface
*oif
;
4873 const char *oifname
;
4874 const char *grp_str
;
4875 struct in_addr grp_addr
;
4876 const char *src_str
;
4877 struct in_addr src_addr
;
4880 oifname
= argv
[idx_interface
]->arg
;
4881 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4883 vty_out(vty
, "No such interface name %s%s",
4884 oifname
, VTY_NEWLINE
);
4888 grp_str
= argv
[idx_ipv4
]->arg
;
4889 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4891 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4892 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4896 src_str
= argv
[idx_ipv4_2
]->arg
;
4897 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
4899 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4900 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4904 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4905 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4912 DEFUN (interface_no_ip_mroute
,
4913 interface_no_ip_mroute_cmd
,
4914 "no ip mroute INTERFACE A.B.C.D",
4917 "Add multicast route\n"
4918 "Outgoing interface name\n"
4921 VTY_DECLVAR_CONTEXT(interface
, iif
);
4922 int idx_interface
= 3;
4924 struct interface
*oif
;
4925 const char *oifname
;
4926 const char *grp_str
;
4927 struct in_addr grp_addr
;
4928 struct in_addr src_addr
;
4931 oifname
= argv
[idx_interface
]->arg
;
4932 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4934 vty_out(vty
, "No such interface name %s%s",
4935 oifname
, VTY_NEWLINE
);
4939 grp_str
= argv
[idx_ipv4
]->arg
;
4940 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4942 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4943 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4947 src_addr
.s_addr
= INADDR_ANY
;
4949 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
4950 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
4957 DEFUN (interface_no_ip_mroute_source
,
4958 interface_no_ip_mroute_source_cmd
,
4959 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
4962 "Add multicast route\n"
4963 "Outgoing interface name\n"
4967 VTY_DECLVAR_CONTEXT(interface
, iif
);
4968 int idx_interface
= 3;
4971 struct interface
*oif
;
4972 const char *oifname
;
4973 const char *grp_str
;
4974 struct in_addr grp_addr
;
4975 const char *src_str
;
4976 struct in_addr src_addr
;
4979 oifname
= argv
[idx_interface
]->arg
;
4980 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4982 vty_out(vty
, "No such interface name %s%s",
4983 oifname
, VTY_NEWLINE
);
4987 grp_str
= argv
[idx_ipv4
]->arg
;
4988 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4990 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4991 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4995 src_str
= argv
[idx_ipv4_2
]->arg
;
4996 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
4998 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4999 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5003 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
5004 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
5011 DEFUN (interface_ip_pim_hello
,
5012 interface_ip_pim_hello_cmd
,
5013 "ip pim hello (1-180) [(1-180)]",
5017 IFACE_PIM_HELLO_TIME_STR
5018 IFACE_PIM_HELLO_HOLD_STR
)
5020 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5023 struct pim_interface
*pim_ifp
;
5025 pim_ifp
= ifp
->info
;
5028 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5032 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
5034 if (argc
== idx_hold
)
5035 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
5042 DEFUN (interface_no_ip_pim_hello
,
5043 interface_no_ip_pim_hello_cmd
,
5044 "no ip pim hello [(1-180) (1-180)]",
5049 IFACE_PIM_HELLO_TIME_STR
5050 IFACE_PIM_HELLO_HOLD_STR
)
5052 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5053 struct pim_interface
*pim_ifp
;
5055 pim_ifp
= ifp
->info
;
5058 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5062 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
5063 pim_ifp
->pim_default_holdtime
= -1;
5074 PIM_DO_DEBUG_IGMP_EVENTS
;
5075 PIM_DO_DEBUG_IGMP_PACKETS
;
5076 PIM_DO_DEBUG_IGMP_TRACE
;
5080 DEFUN (no_debug_igmp
,
5087 PIM_DONT_DEBUG_IGMP_EVENTS
;
5088 PIM_DONT_DEBUG_IGMP_PACKETS
;
5089 PIM_DONT_DEBUG_IGMP_TRACE
;
5094 DEFUN (debug_igmp_events
,
5095 debug_igmp_events_cmd
,
5096 "debug igmp events",
5099 DEBUG_IGMP_EVENTS_STR
)
5101 PIM_DO_DEBUG_IGMP_EVENTS
;
5105 DEFUN (no_debug_igmp_events
,
5106 no_debug_igmp_events_cmd
,
5107 "no debug igmp events",
5111 DEBUG_IGMP_EVENTS_STR
)
5113 PIM_DONT_DEBUG_IGMP_EVENTS
;
5118 DEFUN (debug_igmp_packets
,
5119 debug_igmp_packets_cmd
,
5120 "debug igmp packets",
5123 DEBUG_IGMP_PACKETS_STR
)
5125 PIM_DO_DEBUG_IGMP_PACKETS
;
5129 DEFUN (no_debug_igmp_packets
,
5130 no_debug_igmp_packets_cmd
,
5131 "no debug igmp packets",
5135 DEBUG_IGMP_PACKETS_STR
)
5137 PIM_DONT_DEBUG_IGMP_PACKETS
;
5142 DEFUN (debug_igmp_trace
,
5143 debug_igmp_trace_cmd
,
5147 DEBUG_IGMP_TRACE_STR
)
5149 PIM_DO_DEBUG_IGMP_TRACE
;
5153 DEFUN (no_debug_igmp_trace
,
5154 no_debug_igmp_trace_cmd
,
5155 "no debug igmp trace",
5159 DEBUG_IGMP_TRACE_STR
)
5161 PIM_DONT_DEBUG_IGMP_TRACE
;
5166 DEFUN (debug_mroute
,
5172 PIM_DO_DEBUG_MROUTE
;
5176 DEFUN (debug_mroute_detail
,
5177 debug_mroute_detail_cmd
,
5178 "debug mroute detail",
5183 PIM_DO_DEBUG_MROUTE_DETAIL
;
5187 DEFUN (no_debug_mroute
,
5188 no_debug_mroute_cmd
,
5194 PIM_DONT_DEBUG_MROUTE
;
5198 DEFUN (no_debug_mroute_detail
,
5199 no_debug_mroute_detail_cmd
,
5200 "no debug mroute detail",
5206 PIM_DONT_DEBUG_MROUTE_DETAIL
;
5210 DEFUN (debug_static
,
5216 PIM_DO_DEBUG_STATIC
;
5220 DEFUN (no_debug_static
,
5221 no_debug_static_cmd
,
5227 PIM_DONT_DEBUG_STATIC
;
5238 PIM_DO_DEBUG_PIM_EVENTS
;
5239 PIM_DO_DEBUG_PIM_PACKETS
;
5240 PIM_DO_DEBUG_PIM_TRACE
;
5241 PIM_DO_DEBUG_MSDP_EVENTS
;
5242 PIM_DO_DEBUG_MSDP_PACKETS
;
5246 DEFUN (no_debug_pim
,
5253 PIM_DONT_DEBUG_PIM_EVENTS
;
5254 PIM_DONT_DEBUG_PIM_PACKETS
;
5255 PIM_DONT_DEBUG_PIM_TRACE
;
5256 PIM_DONT_DEBUG_MSDP_EVENTS
;
5257 PIM_DONT_DEBUG_MSDP_PACKETS
;
5259 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5260 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5266 DEFUN (debug_pim_events
,
5267 debug_pim_events_cmd
,
5271 DEBUG_PIM_EVENTS_STR
)
5273 PIM_DO_DEBUG_PIM_EVENTS
;
5277 DEFUN (no_debug_pim_events
,
5278 no_debug_pim_events_cmd
,
5279 "no debug pim events",
5283 DEBUG_PIM_EVENTS_STR
)
5285 PIM_DONT_DEBUG_PIM_EVENTS
;
5289 DEFUN (debug_pim_packets
,
5290 debug_pim_packets_cmd
,
5291 "debug pim packets [<hello|joins|register>]",
5294 DEBUG_PIM_PACKETS_STR
5295 DEBUG_PIM_HELLO_PACKETS_STR
5296 DEBUG_PIM_J_P_PACKETS_STR
5297 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5300 if (argv_find (argv
, argc
, "hello", &idx
))
5302 PIM_DO_DEBUG_PIM_HELLO
;
5303 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
5305 else if (argv_find (argv
, argc
,"joins", &idx
))
5307 PIM_DO_DEBUG_PIM_J_P
;
5308 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
5310 else if (argv_find (argv
, argc
, "register", &idx
))
5312 PIM_DO_DEBUG_PIM_REG
;
5313 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
5317 PIM_DO_DEBUG_PIM_PACKETS
;
5318 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
5323 DEFUN (no_debug_pim_packets
,
5324 no_debug_pim_packets_cmd
,
5325 "no debug pim packets [<hello|joins|register>]",
5329 DEBUG_PIM_PACKETS_STR
5330 DEBUG_PIM_HELLO_PACKETS_STR
5331 DEBUG_PIM_J_P_PACKETS_STR
5332 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5335 if (argv_find (argv
, argc
,"hello",&idx
))
5337 PIM_DONT_DEBUG_PIM_HELLO
;
5338 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
5340 else if (argv_find (argv
, argc
, "joins", &idx
))
5342 PIM_DONT_DEBUG_PIM_J_P
;
5343 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
5345 else if (argv_find (argv
, argc
, "register", &idx
))
5347 PIM_DONT_DEBUG_PIM_REG
;
5348 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
5351 PIM_DONT_DEBUG_PIM_PACKETS
;
5357 DEFUN (debug_pim_packetdump_send
,
5358 debug_pim_packetdump_send_cmd
,
5359 "debug pim packet-dump send",
5362 DEBUG_PIM_PACKETDUMP_STR
5363 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5365 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
5369 DEFUN (no_debug_pim_packetdump_send
,
5370 no_debug_pim_packetdump_send_cmd
,
5371 "no debug pim packet-dump send",
5375 DEBUG_PIM_PACKETDUMP_STR
5376 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5378 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5383 DEFUN (debug_pim_packetdump_recv
,
5384 debug_pim_packetdump_recv_cmd
,
5385 "debug pim packet-dump receive",
5388 DEBUG_PIM_PACKETDUMP_STR
5389 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5391 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
5395 DEFUN (no_debug_pim_packetdump_recv
,
5396 no_debug_pim_packetdump_recv_cmd
,
5397 "no debug pim packet-dump receive",
5401 DEBUG_PIM_PACKETDUMP_STR
5402 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5404 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5409 DEFUN (debug_pim_trace
,
5410 debug_pim_trace_cmd
,
5414 DEBUG_PIM_TRACE_STR
)
5416 PIM_DO_DEBUG_PIM_TRACE
;
5420 DEFUN (no_debug_pim_trace
,
5421 no_debug_pim_trace_cmd
,
5422 "no debug pim trace",
5426 DEBUG_PIM_TRACE_STR
)
5428 PIM_DONT_DEBUG_PIM_TRACE
;
5433 DEFUN (debug_ssmpingd
,
5440 PIM_DO_DEBUG_SSMPINGD
;
5444 DEFUN (no_debug_ssmpingd
,
5445 no_debug_ssmpingd_cmd
,
5446 "no debug ssmpingd",
5452 PIM_DONT_DEBUG_SSMPINGD
;
5457 DEFUN (debug_pim_zebra
,
5458 debug_pim_zebra_cmd
,
5462 DEBUG_PIM_ZEBRA_STR
)
5468 DEFUN (no_debug_pim_zebra
,
5469 no_debug_pim_zebra_cmd
,
5470 "no debug pim zebra",
5474 DEBUG_PIM_ZEBRA_STR
)
5476 PIM_DONT_DEBUG_ZEBRA
;
5487 PIM_DO_DEBUG_MSDP_EVENTS
;
5488 PIM_DO_DEBUG_MSDP_PACKETS
;
5492 DEFUN (no_debug_msdp
,
5499 PIM_DONT_DEBUG_MSDP_EVENTS
;
5500 PIM_DONT_DEBUG_MSDP_PACKETS
;
5504 ALIAS (no_debug_msdp
,
5510 DEFUN (debug_msdp_events
,
5511 debug_msdp_events_cmd
,
5512 "debug msdp events",
5515 DEBUG_MSDP_EVENTS_STR
)
5517 PIM_DO_DEBUG_MSDP_EVENTS
;
5521 DEFUN (no_debug_msdp_events
,
5522 no_debug_msdp_events_cmd
,
5523 "no debug msdp events",
5527 DEBUG_MSDP_EVENTS_STR
)
5529 PIM_DONT_DEBUG_MSDP_EVENTS
;
5533 ALIAS (no_debug_msdp_events
,
5534 undebug_msdp_events_cmd
,
5535 "undebug msdp events",
5538 DEBUG_MSDP_EVENTS_STR
)
5540 DEFUN (debug_msdp_packets
,
5541 debug_msdp_packets_cmd
,
5542 "debug msdp packets",
5545 DEBUG_MSDP_PACKETS_STR
)
5547 PIM_DO_DEBUG_MSDP_PACKETS
;
5551 DEFUN (no_debug_msdp_packets
,
5552 no_debug_msdp_packets_cmd
,
5553 "no debug msdp packets",
5557 DEBUG_MSDP_PACKETS_STR
)
5559 PIM_DONT_DEBUG_MSDP_PACKETS
;
5563 ALIAS (no_debug_msdp_packets
,
5564 undebug_msdp_packets_cmd
,
5565 "undebug msdp packets",
5568 DEBUG_MSDP_PACKETS_STR
)
5570 DEFUN (show_debugging_pim
,
5571 show_debugging_pim_cmd
,
5572 "show debugging pim",
5577 pim_debug_config_write(vty
);
5582 interface_pim_use_src_cmd_worker(struct vty
*vty
, const char *source
)
5585 struct in_addr source_addr
;
5586 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5588 result
= inet_pton(AF_INET
, source
, &source_addr
);
5590 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5591 source
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5595 result
= pim_update_source_set(ifp
, source_addr
);
5599 case PIM_IFACE_NOT_FOUND
:
5600 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5602 case PIM_UPDATE_SOURCE_DUP
:
5603 vty_out(vty
, "%% Source already set to %s%s", source
, VTY_NEWLINE
);
5606 vty_out(vty
, "%% Source set failed%s", VTY_NEWLINE
);
5609 return result
?CMD_WARNING
:CMD_SUCCESS
;
5612 DEFUN (interface_pim_use_source
,
5613 interface_pim_use_source_cmd
,
5614 "ip pim use-source A.B.C.D",
5616 "pim multicast routing\n"
5617 "Configure primary IP address\n"
5618 "source ip address\n")
5620 return interface_pim_use_src_cmd_worker (vty
, argv
[3]->arg
);
5623 DEFUN (interface_no_pim_use_source
,
5624 interface_no_pim_use_source_cmd
,
5625 "no ip pim use-source",
5628 "pim multicast routing\n"
5629 "Delete source IP address\n")
5631 return interface_pim_use_src_cmd_worker (vty
, "0.0.0.0");
5635 ip_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
, const char *local
)
5637 enum pim_msdp_err result
;
5638 struct in_addr peer_addr
;
5639 struct in_addr local_addr
;
5641 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5643 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5644 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5648 result
= inet_pton(AF_INET
, local
, &local_addr
);
5650 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5651 local
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5655 result
= pim_msdp_peer_add(peer_addr
, local_addr
, "default", NULL
/* mp_p */);
5657 case PIM_MSDP_ERR_NONE
:
5659 case PIM_MSDP_ERR_OOM
:
5660 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5662 case PIM_MSDP_ERR_PEER_EXISTS
:
5663 vty_out(vty
, "%% Peer exists%s", VTY_NEWLINE
);
5665 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5666 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5669 vty_out(vty
, "%% peer add failed%s", VTY_NEWLINE
);
5672 return result
?CMD_WARNING
:CMD_SUCCESS
;
5675 DEFUN_HIDDEN (ip_msdp_peer
,
5677 "ip msdp peer A.B.C.D source A.B.C.D",
5680 "Configure MSDP peer\n"
5682 "Source address for TCP connection\n"
5683 "local ip address\n")
5685 return ip_msdp_peer_cmd_worker (vty
, argv
[3]->arg
, argv
[5]->arg
);
5689 ip_no_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
)
5691 enum pim_msdp_err result
;
5692 struct in_addr peer_addr
;
5694 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5696 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5697 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5701 result
= pim_msdp_peer_del(peer_addr
);
5703 case PIM_MSDP_ERR_NONE
:
5705 case PIM_MSDP_ERR_NO_PEER
:
5706 vty_out(vty
, "%% Peer does not exist%s", VTY_NEWLINE
);
5709 vty_out(vty
, "%% peer del failed%s", VTY_NEWLINE
);
5712 return result
?CMD_WARNING
:CMD_SUCCESS
;
5715 DEFUN_HIDDEN (no_ip_msdp_peer
,
5716 no_ip_msdp_peer_cmd
,
5717 "no ip msdp peer A.B.C.D",
5721 "Delete MSDP peer\n"
5722 "peer ip address\n")
5724 return ip_no_msdp_peer_cmd_worker (vty
, argv
[4]->arg
);
5728 ip_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5730 enum pim_msdp_err result
;
5731 struct in_addr mbr_ip
;
5733 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5735 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5736 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5740 result
= pim_msdp_mg_mbr_add(mg
, mbr_ip
);
5742 case PIM_MSDP_ERR_NONE
:
5744 case PIM_MSDP_ERR_OOM
:
5745 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5747 case PIM_MSDP_ERR_MG_MBR_EXISTS
:
5748 vty_out(vty
, "%% mesh-group member exists%s", VTY_NEWLINE
);
5750 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5751 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5754 vty_out(vty
, "%% member add failed%s", VTY_NEWLINE
);
5757 return result
?CMD_WARNING
:CMD_SUCCESS
;
5760 DEFUN (ip_msdp_mesh_group_member
,
5761 ip_msdp_mesh_group_member_cmd
,
5762 "ip msdp mesh-group WORD member A.B.C.D",
5765 "Configure MSDP mesh-group\n"
5767 "mesh group member\n"
5768 "peer ip address\n")
5770 return ip_msdp_mesh_group_member_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5774 ip_no_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5776 enum pim_msdp_err result
;
5777 struct in_addr mbr_ip
;
5779 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5781 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5782 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5786 result
= pim_msdp_mg_mbr_del(mg
, mbr_ip
);
5788 case PIM_MSDP_ERR_NONE
:
5790 case PIM_MSDP_ERR_NO_MG
:
5791 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5793 case PIM_MSDP_ERR_NO_MG_MBR
:
5794 vty_out(vty
, "%% mesh-group member does not exist%s", VTY_NEWLINE
);
5797 vty_out(vty
, "%% mesh-group member del failed%s", VTY_NEWLINE
);
5800 return result
?CMD_WARNING
:CMD_SUCCESS
;
5802 DEFUN (no_ip_msdp_mesh_group_member
,
5803 no_ip_msdp_mesh_group_member_cmd
,
5804 "no ip msdp mesh-group WORD member A.B.C.D",
5808 "Delete MSDP mesh-group member\n"
5810 "mesh group member\n"
5811 "peer ip address\n")
5813 return ip_no_msdp_mesh_group_member_cmd_worker(vty
, argv
[4]->arg
, argv
[6]->arg
);
5817 ip_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
, const char *src
)
5819 enum pim_msdp_err result
;
5820 struct in_addr src_ip
;
5822 result
= inet_pton(AF_INET
, src
, &src_ip
);
5824 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5825 src
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5829 result
= pim_msdp_mg_src_add(mg
, src_ip
);
5831 case PIM_MSDP_ERR_NONE
:
5833 case PIM_MSDP_ERR_OOM
:
5834 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5836 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5837 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5840 vty_out(vty
, "%% source add failed%s", VTY_NEWLINE
);
5843 return result
?CMD_WARNING
:CMD_SUCCESS
;
5847 DEFUN (ip_msdp_mesh_group_source
,
5848 ip_msdp_mesh_group_source_cmd
,
5849 "ip msdp mesh-group WORD source A.B.C.D",
5852 "Configure MSDP mesh-group\n"
5854 "mesh group local address\n"
5855 "source ip address for the TCP connection\n")
5857 return ip_msdp_mesh_group_source_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5861 ip_no_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
)
5863 enum pim_msdp_err result
;
5865 result
= pim_msdp_mg_src_del(mg
);
5867 case PIM_MSDP_ERR_NONE
:
5869 case PIM_MSDP_ERR_NO_MG
:
5870 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5873 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5876 return result
?CMD_WARNING
:CMD_SUCCESS
;
5880 ip_no_msdp_mesh_group_cmd_worker(struct vty
*vty
, const char *mg
)
5882 enum pim_msdp_err result
;
5884 result
= pim_msdp_mg_del(mg
);
5886 case PIM_MSDP_ERR_NONE
:
5888 case PIM_MSDP_ERR_NO_MG
:
5889 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5892 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5895 return result
? CMD_WARNING
: CMD_SUCCESS
;
5898 DEFUN (no_ip_msdp_mesh_group_source
,
5899 no_ip_msdp_mesh_group_source_cmd
,
5900 "no ip msdp mesh-group WORD source [A.B.C.D]",
5904 "Delete MSDP mesh-group source\n"
5906 "mesh group source\n"
5907 "mesh group local address\n")
5910 return ip_no_msdp_mesh_group_cmd_worker(vty
, argv
[6]->arg
);
5912 return ip_no_msdp_mesh_group_source_cmd_worker(vty
, argv
[4]->arg
);
5916 print_empty_json_obj(struct vty
*vty
)
5919 json
= json_object_new_object();
5920 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5921 json_object_free(json
);
5925 ip_msdp_show_mesh_group(struct vty
*vty
, u_char uj
)
5927 struct listnode
*mbrnode
;
5928 struct pim_msdp_mg_mbr
*mbr
;
5929 struct pim_msdp_mg
*mg
= msdp
->mg
;
5930 char mbr_str
[INET_ADDRSTRLEN
];
5931 char src_str
[INET_ADDRSTRLEN
];
5932 char state_str
[PIM_MSDP_STATE_STRLEN
];
5933 enum pim_msdp_peer_state state
;
5934 json_object
*json
= NULL
;
5935 json_object
*json_mg_row
= NULL
;
5936 json_object
*json_members
= NULL
;
5937 json_object
*json_row
= NULL
;
5941 print_empty_json_obj(vty
);
5945 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5947 json
= json_object_new_object();
5948 /* currently there is only one mesh group but we should still make
5949 * it a dict with mg-name as key */
5950 json_mg_row
= json_object_new_object();
5951 json_object_string_add(json_mg_row
, "name", mg
->mesh_group_name
);
5952 json_object_string_add(json_mg_row
, "source", src_str
);
5954 vty_out(vty
, "Mesh group : %s%s", mg
->mesh_group_name
, VTY_NEWLINE
);
5955 vty_out(vty
, " Source : %s%s", src_str
, VTY_NEWLINE
);
5956 vty_out(vty
, " Member State%s", VTY_NEWLINE
);
5959 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5960 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5962 state
= mbr
->mp
->state
;
5964 state
= PIM_MSDP_DISABLED
;
5966 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5968 json_row
= json_object_new_object();
5969 json_object_string_add(json_row
, "member", mbr_str
);
5970 json_object_string_add(json_row
, "state", state_str
);
5971 if (!json_members
) {
5972 json_members
= json_object_new_object();
5973 json_object_object_add(json_mg_row
, "members", json_members
);
5975 json_object_object_add(json_members
, mbr_str
, json_row
);
5977 vty_out(vty
, " %-15s %11s%s",
5978 mbr_str
, state_str
, VTY_NEWLINE
);
5983 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5984 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5985 json_object_free(json
);
5989 DEFUN (show_ip_msdp_mesh_group
,
5990 show_ip_msdp_mesh_group_cmd
,
5991 "show ip msdp mesh-group [json]",
5995 "MSDP mesh-group information\n"
5996 "JavaScript Object Notation\n")
5998 u_char uj
= use_json(argc
, argv
);
5999 ip_msdp_show_mesh_group(vty
, uj
);
6005 ip_msdp_show_peers(struct vty
*vty
, u_char uj
)
6007 struct listnode
*mpnode
;
6008 struct pim_msdp_peer
*mp
;
6009 char peer_str
[INET_ADDRSTRLEN
];
6010 char local_str
[INET_ADDRSTRLEN
];
6011 char state_str
[PIM_MSDP_STATE_STRLEN
];
6012 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6014 json_object
*json
= NULL
;
6015 json_object
*json_row
= NULL
;
6019 json
= json_object_new_object();
6021 vty_out(vty
, "Peer Local State Uptime SaCnt%s", VTY_NEWLINE
);
6024 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6025 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6026 now
= pim_time_monotonic_sec();
6027 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6029 strcpy(timebuf
, "-");
6031 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6032 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6033 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6035 json_row
= json_object_new_object();
6036 json_object_string_add(json_row
, "peer", peer_str
);
6037 json_object_string_add(json_row
, "local", local_str
);
6038 json_object_string_add(json_row
, "state", state_str
);
6039 json_object_string_add(json_row
, "upTime", timebuf
);
6040 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6041 json_object_object_add(json
, peer_str
, json_row
);
6043 vty_out(vty
, "%-15s %15s %11s %8s %6d%s",
6044 peer_str
, local_str
, state_str
,
6045 timebuf
, mp
->sa_cnt
, VTY_NEWLINE
);
6050 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6051 json_object_free(json
);
6056 ip_msdp_show_peers_detail(struct vty
*vty
, const char *peer
, u_char uj
)
6058 struct listnode
*mpnode
;
6059 struct pim_msdp_peer
*mp
;
6060 char peer_str
[INET_ADDRSTRLEN
];
6061 char local_str
[INET_ADDRSTRLEN
];
6062 char state_str
[PIM_MSDP_STATE_STRLEN
];
6063 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6064 char katimer
[PIM_MSDP_TIMER_STRLEN
];
6065 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
6066 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
6068 json_object
*json
= NULL
;
6069 json_object
*json_row
= NULL
;
6072 json
= json_object_new_object();
6075 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6076 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6077 if (strcmp(peer
, "detail") &&
6078 strcmp(peer
, peer_str
))
6081 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6082 now
= pim_time_monotonic_sec();
6083 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6085 strcpy(timebuf
, "-");
6087 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6088 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6089 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
), mp
->ka_timer
);
6090 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
), mp
->cr_timer
);
6091 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
), mp
->hold_timer
);
6094 json_row
= json_object_new_object();
6095 json_object_string_add(json_row
, "peer", peer_str
);
6096 json_object_string_add(json_row
, "local", local_str
);
6097 json_object_string_add(json_row
, "meshGroupName", mp
->mesh_group_name
);
6098 json_object_string_add(json_row
, "state", state_str
);
6099 json_object_string_add(json_row
, "upTime", timebuf
);
6100 json_object_string_add(json_row
, "keepAliveTimer", katimer
);
6101 json_object_string_add(json_row
, "connRetryTimer", crtimer
);
6102 json_object_string_add(json_row
, "holdTimer", holdtimer
);
6103 json_object_string_add(json_row
, "lastReset", mp
->last_reset
);
6104 json_object_int_add(json_row
, "connAttempts", mp
->conn_attempts
);
6105 json_object_int_add(json_row
, "establishedChanges", mp
->est_flaps
);
6106 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6107 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
6108 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
6109 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
6110 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
6111 json_object_object_add(json
, peer_str
, json_row
);
6113 vty_out(vty
, "Peer : %s%s", peer_str
, VTY_NEWLINE
);
6114 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6115 vty_out(vty
, " Mesh Group : %s%s", mp
->mesh_group_name
, VTY_NEWLINE
);
6116 vty_out(vty
, " State : %s%s", state_str
, VTY_NEWLINE
);
6117 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6119 vty_out(vty
, " Keepalive Timer : %s%s", katimer
, VTY_NEWLINE
);
6120 vty_out(vty
, " Conn Retry Timer : %s%s", crtimer
, VTY_NEWLINE
);
6121 vty_out(vty
, " Hold Timer : %s%s", holdtimer
, VTY_NEWLINE
);
6122 vty_out(vty
, " Last Reset : %s%s", mp
->last_reset
, VTY_NEWLINE
);
6123 vty_out(vty
, " Conn Attempts : %d%s", mp
->conn_attempts
, VTY_NEWLINE
);
6124 vty_out(vty
, " Established Changes : %d%s", mp
->est_flaps
, VTY_NEWLINE
);
6125 vty_out(vty
, " SA Count : %d%s", mp
->sa_cnt
, VTY_NEWLINE
);
6126 vty_out(vty
, " Statistics :%s", VTY_NEWLINE
);
6127 vty_out(vty
, " Sent Rcvd%s", VTY_NEWLINE
);
6128 vty_out(vty
, " Keepalives : %10d %10d%s",
6129 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
, VTY_NEWLINE
);
6130 vty_out(vty
, " SAs : %10d %10d%s",
6131 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
, VTY_NEWLINE
);
6132 vty_out(vty
, "%s", VTY_NEWLINE
);
6137 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6138 json_object_free(json
);
6142 DEFUN (show_ip_msdp_peer_detail
,
6143 show_ip_msdp_peer_detail_cmd
,
6144 "show ip msdp peer [detail|A.B.C.D] [json]",
6148 "MSDP peer information\n"
6151 "JavaScript Object Notation\n")
6153 u_char uj
= use_json(argc
, argv
);
6158 ip_msdp_show_peers_detail(vty
, argv
[4]->arg
, uj
);
6160 ip_msdp_show_peers(vty
, uj
);
6166 ip_msdp_show_sa(struct vty
*vty
, u_char uj
)
6168 struct listnode
*sanode
;
6169 struct pim_msdp_sa
*sa
;
6170 char src_str
[INET_ADDRSTRLEN
];
6171 char grp_str
[INET_ADDRSTRLEN
];
6172 char rp_str
[INET_ADDRSTRLEN
];
6173 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6177 json_object
*json
= NULL
;
6178 json_object
*json_group
= NULL
;
6179 json_object
*json_row
= NULL
;
6182 json
= json_object_new_object();
6184 vty_out(vty
, "Source Group RP Local SPT Uptime%s", VTY_NEWLINE
);
6187 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6188 now
= pim_time_monotonic_sec();
6189 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6190 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6191 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6192 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6193 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6195 strcpy(spt_str
, "yes");
6197 strcpy(spt_str
, "no");
6200 strcpy(rp_str
, "-");
6201 strcpy(spt_str
, "-");
6203 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6204 strcpy(local_str
, "yes");
6206 strcpy(local_str
, "no");
6209 json_object_object_get_ex(json
, grp_str
, &json_group
);
6212 json_group
= json_object_new_object();
6213 json_object_object_add(json
, grp_str
, json_group
);
6216 json_row
= json_object_new_object();
6217 json_object_string_add(json_row
, "source", src_str
);
6218 json_object_string_add(json_row
, "group", grp_str
);
6219 json_object_string_add(json_row
, "rp", rp_str
);
6220 json_object_string_add(json_row
, "local", local_str
);
6221 json_object_string_add(json_row
, "sptSetup", spt_str
);
6222 json_object_string_add(json_row
, "upTime", timebuf
);
6223 json_object_object_add(json_group
, src_str
, json_row
);
6225 vty_out(vty
, "%-15s %15s %15s %5c %3c %8s%s",
6226 src_str
, grp_str
, rp_str
, local_str
[0], spt_str
[0], timebuf
, VTY_NEWLINE
);
6232 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6233 json_object_free(json
);
6238 ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
, const char *src_str
,
6239 const char *grp_str
, struct vty
*vty
,
6240 u_char uj
, json_object
*json
)
6242 char rp_str
[INET_ADDRSTRLEN
];
6243 char peer_str
[INET_ADDRSTRLEN
];
6244 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6247 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
6249 json_object
*json_group
= NULL
;
6250 json_object
*json_row
= NULL
;
6252 now
= pim_time_monotonic_sec();
6253 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6254 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6255 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6256 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
6258 strcpy(spt_str
, "yes");
6260 strcpy(spt_str
, "no");
6263 strcpy(rp_str
, "-");
6264 strcpy(peer_str
, "-");
6265 strcpy(spt_str
, "-");
6267 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6268 strcpy(local_str
, "yes");
6270 strcpy(local_str
, "no");
6272 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
), sa
->sa_state_timer
);
6274 json_object_object_get_ex(json
, grp_str
, &json_group
);
6277 json_group
= json_object_new_object();
6278 json_object_object_add(json
, grp_str
, json_group
);
6281 json_row
= json_object_new_object();
6282 json_object_string_add(json_row
, "source", src_str
);
6283 json_object_string_add(json_row
, "group", grp_str
);
6284 json_object_string_add(json_row
, "rp", rp_str
);
6285 json_object_string_add(json_row
, "local", local_str
);
6286 json_object_string_add(json_row
, "sptSetup", spt_str
);
6287 json_object_string_add(json_row
, "upTime", timebuf
);
6288 json_object_string_add(json_row
, "stateTimer", statetimer
);
6289 json_object_object_add(json_group
, src_str
, json_row
);
6291 vty_out(vty
, "SA : %s%s", sa
->sg_str
, VTY_NEWLINE
);
6292 vty_out(vty
, " RP : %s%s", rp_str
, VTY_NEWLINE
);
6293 vty_out(vty
, " Peer : %s%s", peer_str
, VTY_NEWLINE
);
6294 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6295 vty_out(vty
, " SPT Setup : %s%s", spt_str
, VTY_NEWLINE
);
6296 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6297 vty_out(vty
, " State Timer : %s%s", statetimer
, VTY_NEWLINE
);
6298 vty_out(vty
, "%s", VTY_NEWLINE
);
6303 ip_msdp_show_sa_detail(struct vty
*vty
, u_char uj
)
6305 struct listnode
*sanode
;
6306 struct pim_msdp_sa
*sa
;
6307 char src_str
[INET_ADDRSTRLEN
];
6308 char grp_str
[INET_ADDRSTRLEN
];
6309 json_object
*json
= NULL
;
6312 json
= json_object_new_object();
6315 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6316 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6317 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6318 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6322 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6323 json_object_free(json
);
6327 DEFUN (show_ip_msdp_sa_detail
,
6328 show_ip_msdp_sa_detail_cmd
,
6329 "show ip msdp sa detail [json]",
6333 "MSDP active-source information\n"
6335 "JavaScript Object Notation\n")
6337 u_char uj
= use_json(argc
, argv
);
6338 ip_msdp_show_sa_detail(vty
, uj
);
6344 ip_msdp_show_sa_addr(struct vty
*vty
, const char *addr
, u_char uj
)
6346 struct listnode
*sanode
;
6347 struct pim_msdp_sa
*sa
;
6348 char src_str
[INET_ADDRSTRLEN
];
6349 char grp_str
[INET_ADDRSTRLEN
];
6350 json_object
*json
= NULL
;
6353 json
= json_object_new_object();
6356 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6357 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6358 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6359 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6360 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6365 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6366 json_object_free(json
);
6371 ip_msdp_show_sa_sg(struct vty
*vty
, const char *src
, const char *grp
, u_char uj
)
6373 struct listnode
*sanode
;
6374 struct pim_msdp_sa
*sa
;
6375 char src_str
[INET_ADDRSTRLEN
];
6376 char grp_str
[INET_ADDRSTRLEN
];
6377 json_object
*json
= NULL
;
6380 json
= json_object_new_object();
6383 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6384 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6385 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6386 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6387 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6392 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6393 json_object_free(json
);
6397 DEFUN (show_ip_msdp_sa_sg
,
6398 show_ip_msdp_sa_sg_cmd
,
6399 "show ip msdp sa [A.B.C.D [A.B.C.D]] [json]",
6403 "MSDP active-source information\n"
6404 "source or group ip\n"
6406 "JavaScript Object Notation\n")
6408 u_char uj
= use_json(argc
, argv
);
6411 char *src_ip
= argv_find (argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
: NULL
;
6412 char *grp_ip
= idx
< argc
&& argv_find (argv
, argc
, "A.B.C.D", &idx
) ?
6413 argv
[idx
]->arg
: NULL
;
6415 if (src_ip
&& grp_ip
)
6416 ip_msdp_show_sa_sg(vty
, src_ip
, grp_ip
, uj
);
6418 ip_msdp_show_sa_addr(vty
, src_ip
, uj
);
6420 ip_msdp_show_sa(vty
, uj
);
6427 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
6428 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
6431 install_node (&debug_node
, pim_debug_config_write
);
6433 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
6434 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
6435 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
6436 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6437 install_element (CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6438 install_element (CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6439 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6440 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6441 install_element (CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6442 install_element (CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6443 install_element (CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6444 install_element (CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6445 install_element (CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6446 install_element (CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6447 install_element (CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6448 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6449 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6450 install_element (CONFIG_NODE
, &ip_pim_packets_cmd
);
6451 install_element (CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6452 install_element (CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6453 install_element (CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6454 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
6455 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6456 install_element (CONFIG_NODE
, &ip_msdp_peer_cmd
);
6457 install_element (CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6458 install_element (CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6459 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6460 install_element (CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6461 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6463 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6464 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6465 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6466 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6467 install_element (INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6468 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6469 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6470 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
6471 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
6472 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
6473 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6474 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6475 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6476 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6477 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6478 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6479 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6480 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6481 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6482 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6484 // Static mroutes NEB
6485 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6486 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
6487 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6488 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
6490 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6491 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
6492 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6493 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6494 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6495 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6496 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
6497 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6498 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6499 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6500 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
6501 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
6502 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6503 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6504 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6505 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6506 install_element (VIEW_NODE
, &show_ip_pim_state_cmd
);
6507 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6508 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6509 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6510 install_element (VIEW_NODE
, &show_ip_pim_rp_cmd
);
6511 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
6512 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
6513 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
6514 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
6515 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6516 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
6517 install_element (VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6518 install_element (VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6520 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6521 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6522 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
6523 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6524 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6526 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
6527 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
6528 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
6529 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6530 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
6531 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6532 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
6533 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6534 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
6535 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
6536 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
6537 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6538 install_element (ENABLE_NODE
, &debug_static_cmd
);
6539 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
6540 install_element (ENABLE_NODE
, &debug_pim_cmd
);
6541 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
6542 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
6543 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
6544 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
6545 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
6546 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6547 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
6548 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6549 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
6550 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
6551 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
6552 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
6553 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6554 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
6555 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
6556 install_element (ENABLE_NODE
, &debug_msdp_cmd
);
6557 install_element (ENABLE_NODE
, &no_debug_msdp_cmd
);
6558 install_element (ENABLE_NODE
, &undebug_msdp_cmd
);
6559 install_element (ENABLE_NODE
, &debug_msdp_events_cmd
);
6560 install_element (ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6561 install_element (ENABLE_NODE
, &undebug_msdp_events_cmd
);
6562 install_element (ENABLE_NODE
, &debug_msdp_packets_cmd
);
6563 install_element (ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6564 install_element (ENABLE_NODE
, &undebug_msdp_packets_cmd
);
6566 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
6567 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
6568 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
6569 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6570 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
6571 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6572 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
6573 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6574 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
6575 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
6576 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
6577 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6578 install_element (CONFIG_NODE
, &debug_static_cmd
);
6579 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
6580 install_element (CONFIG_NODE
, &debug_pim_cmd
);
6581 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
6582 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
6583 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
6584 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
6585 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
6586 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
6587 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
6588 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
6589 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6590 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
6591 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);
6592 install_element (CONFIG_NODE
, &debug_msdp_cmd
);
6593 install_element (CONFIG_NODE
, &no_debug_msdp_cmd
);
6594 install_element (CONFIG_NODE
, &undebug_msdp_cmd
);
6595 install_element (CONFIG_NODE
, &debug_msdp_events_cmd
);
6596 install_element (CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6597 install_element (CONFIG_NODE
, &undebug_msdp_events_cmd
);
6598 install_element (CONFIG_NODE
, &debug_msdp_packets_cmd
);
6599 install_element (CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6600 install_element (CONFIG_NODE
, &undebug_msdp_packets_cmd
);
6601 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6602 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6603 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6604 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6605 install_element (VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6606 install_element (VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6607 install_element (VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6608 install_element (VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6609 install_element (VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6610 install_element (VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6611 install_element (INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6612 install_element (INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);