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
);
3565 pim_cmd_spt_switchover (enum pim_spt_switchover spt
, const char *plist
)
3567 pimg
->spt
.switchover
= spt
;
3569 switch (pimg
->spt
.switchover
)
3571 case PIM_SPT_IMMEDIATE
:
3572 if (pimg
->spt
.plist
)
3573 XFREE (MTYPE_PIM_SPT_PLIST_NAME
, pimg
->spt
.plist
);
3575 pim_upstream_add_lhr_star_pimreg ();
3577 case PIM_SPT_INFINITY
:
3578 pim_upstream_remove_lhr_star_pimreg (plist
);
3580 if (pimg
->spt
.plist
)
3581 XFREE (MTYPE_PIM_SPT_PLIST_NAME
, pimg
->spt
.plist
);
3584 pimg
->spt
.plist
= XSTRDUP (MTYPE_PIM_SPT_PLIST_NAME
, plist
);
3591 DEFUN (ip_pim_spt_switchover_infinity
,
3592 ip_pim_spt_switchover_infinity_cmd
,
3593 "ip pim spt-switchover infinity-and-beyond",
3597 "Never switch to SPT Tree\n")
3599 return pim_cmd_spt_switchover (PIM_SPT_INFINITY
, NULL
);
3602 DEFUN (ip_pim_spt_switchover_infinity_plist
,
3603 ip_pim_spt_switchover_infinity_plist_cmd
,
3604 "ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3608 "Never switch to SPT Tree\n"
3609 "Prefix-List to control which groups to switch\n"
3610 "Prefix-List name\n")
3612 return pim_cmd_spt_switchover (PIM_SPT_INFINITY
, argv
[5]->arg
);
3615 DEFUN (no_ip_pim_spt_switchover_infinity
,
3616 no_ip_pim_spt_switchover_infinity_cmd
,
3617 "no ip pim spt-switchover infinity-and-beyond",
3622 "Never switch to SPT Tree\n")
3624 return pim_cmd_spt_switchover (PIM_SPT_IMMEDIATE
, NULL
);
3627 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
3628 no_ip_pim_spt_switchover_infinity_plist_cmd
,
3629 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3634 "Never switch to SPT Tree\n"
3635 "Prefix-List to control which groups to switch\n"
3636 "Prefix-List name\n")
3638 return pim_cmd_spt_switchover (PIM_SPT_IMMEDIATE
, NULL
);
3641 DEFUN (ip_pim_joinprune_time
,
3642 ip_pim_joinprune_time_cmd
,
3643 "ip pim join-prune-interval (60-600)",
3645 "pim multicast routing\n"
3646 "Join Prune Send Interval\n"
3649 qpim_t_periodic
= atoi(argv
[3]->arg
);
3653 DEFUN (no_ip_pim_joinprune_time
,
3654 no_ip_pim_joinprune_time_cmd
,
3655 "no ip pim join-prune-interval (60-600)",
3658 "pim multicast routing\n"
3659 "Join Prune Send Interval\n"
3662 qpim_t_periodic
= PIM_DEFAULT_T_PERIODIC
;
3666 DEFUN (ip_pim_register_suppress
,
3667 ip_pim_register_suppress_cmd
,
3668 "ip pim register-suppress-time (5-60000)",
3670 "pim multicast routing\n"
3671 "Register Suppress Timer\n"
3674 qpim_register_suppress_time
= atoi (argv
[3]->arg
);
3678 DEFUN (no_ip_pim_register_suppress
,
3679 no_ip_pim_register_suppress_cmd
,
3680 "no ip pim register-suppress-time (5-60000)",
3683 "pim multicast routing\n"
3684 "Register Suppress Timer\n"
3687 qpim_register_suppress_time
= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
;
3691 DEFUN (ip_pim_keep_alive
,
3692 ip_pim_keep_alive_cmd
,
3693 "ip pim keep-alive-timer (31-60000)",
3695 "pim multicast routing\n"
3696 "Keep alive Timer\n"
3699 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
3703 DEFUN (no_ip_pim_keep_alive
,
3704 no_ip_pim_keep_alive_cmd
,
3705 "no ip pim keep-alive-timer (31-60000)",
3708 "pim multicast routing\n"
3709 "Keep alive Timer\n"
3712 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
3716 DEFUN (ip_pim_packets
,
3718 "ip pim packets (1-100)",
3720 "pim multicast routing\n"
3721 "packets to process at one time per fd\n"
3722 "Number of packets\n")
3724 qpim_packet_process
= atoi (argv
[3]->arg
);
3728 DEFUN (no_ip_pim_packets
,
3729 no_ip_pim_packets_cmd
,
3730 "no ip pim packets (1-100)",
3733 "pim multicast routing\n"
3734 "packets to process at one time per fd\n"
3735 "Number of packets\n")
3737 qpim_packet_process
= PIM_DEFAULT_PACKET_PROCESS
;
3741 DEFUN (ip_pim_v6_secondary
,
3742 ip_pim_v6_secondary_cmd
,
3743 "ip pim send-v6-secondary",
3745 "pim multicast routing\n"
3746 "Send v6 secondary addresses\n")
3748 pimg
->send_v6_secondary
= 1;
3753 DEFUN (no_ip_pim_v6_secondary
,
3754 no_ip_pim_v6_secondary_cmd
,
3755 "no ip pim send-v6-secondary",
3758 "pim multicast routing\n"
3759 "Send v6 secondary addresses\n")
3761 pimg
->send_v6_secondary
= 0;
3768 "ip pim rp A.B.C.D [A.B.C.D/M]",
3770 "pim multicast routing\n"
3772 "ip address of RP\n"
3773 "Group Address range to cover\n")
3777 if (argc
== (idx_ipv4
+ 1))
3778 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3780 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
, NULL
);
3784 DEFUN (ip_pim_rp_prefix_list
,
3785 ip_pim_rp_prefix_list_cmd
,
3786 "ip pim rp A.B.C.D prefix-list WORD",
3788 "pim multicast routing\n"
3790 "ip address of RP\n"
3791 "group prefix-list filter\n"
3792 "Name of a prefix-list\n")
3794 return pim_rp_cmd_worker (vty
, argv
[3]->arg
, NULL
, argv
[5]->arg
);
3798 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
,
3801 int result
= pim_rp_del (rp
, group
, plist
);
3803 if (result
== PIM_GROUP_BAD_ADDRESS
)
3805 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3809 if (result
== PIM_RP_BAD_ADDRESS
)
3811 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3815 if (result
== PIM_RP_NOT_FOUND
)
3817 vty_out (vty
, "%% Unable to find specified RP%s", VTY_NEWLINE
);
3824 DEFUN (no_ip_pim_rp
,
3826 "no ip pim rp A.B.C.D [A.B.C.D/M]",
3829 "pim multicast routing\n"
3831 "ip address of RP\n"
3832 "Group Address range to cover\n")
3834 int idx_ipv4
= 4, idx_group
= 0;
3836 if (argv_find (argv
, argc
, "A.B.C.D/M", &idx_group
))
3837 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_group
]->arg
, NULL
);
3839 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
3842 DEFUN (no_ip_pim_rp_prefix_list
,
3843 no_ip_pim_rp_prefix_list_cmd
,
3844 "no ip pim rp A.B.C.D prefix-list WORD",
3847 "pim multicast routing\n"
3849 "ip address of RP\n"
3850 "group prefix-list filter\n"
3851 "Name of a prefix-list\n")
3853 return pim_no_rp_cmd_worker (vty
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
3857 pim_ssm_cmd_worker (struct vty
*vty
, const char *plist
)
3859 int result
= pim_ssm_range_set (VRF_DEFAULT
, plist
);
3861 if (result
== PIM_SSM_ERR_NONE
)
3866 case PIM_SSM_ERR_NO_VRF
:
3867 vty_out (vty
, "%% VRF doesn't exist%s", VTY_NEWLINE
);
3869 case PIM_SSM_ERR_DUP
:
3870 vty_out (vty
, "%% duplicate config%s", VTY_NEWLINE
);
3873 vty_out (vty
, "%% ssm range config failed%s", VTY_NEWLINE
);
3879 DEFUN (ip_pim_ssm_prefix_list
,
3880 ip_pim_ssm_prefix_list_cmd
,
3881 "ip pim ssm prefix-list WORD",
3883 "pim multicast routing\n"
3884 "Source Specific Multicast\n"
3885 "group range prefix-list filter\n"
3886 "Name of a prefix-list\n")
3888 return pim_ssm_cmd_worker (vty
, argv
[0]->arg
);
3891 DEFUN (no_ip_pim_ssm_prefix_list
,
3892 no_ip_pim_ssm_prefix_list_cmd
,
3893 "no ip pim ssm prefix-list",
3896 "pim multicast routing\n"
3897 "Source Specific Multicast\n"
3898 "group range prefix-list filter\n")
3900 return pim_ssm_cmd_worker (vty
, NULL
);
3903 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3904 no_ip_pim_ssm_prefix_list_name_cmd
,
3905 "no ip pim ssm prefix-list WORD",
3908 "pim multicast routing\n"
3909 "Source Specific Multicast\n"
3910 "group range prefix-list filter\n"
3911 "Name of a prefix-list\n")
3913 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3915 if (ssm
->plist_name
&& !strcmp(ssm
->plist_name
, argv
[0]->arg
))
3916 return pim_ssm_cmd_worker (vty
, NULL
);
3918 vty_out (vty
, "%% pim ssm prefix-list %s doesn't exist%s",
3919 argv
[0]->arg
, VTY_NEWLINE
);
3925 ip_pim_ssm_show_group_range(struct vty
*vty
, u_char uj
)
3927 struct pim_ssm
*ssm
= pimg
->ssm_info
;
3928 const char *range_str
= ssm
->plist_name
?ssm
->plist_name
:PIM_SSM_STANDARD_RANGE
;
3933 json
= json_object_new_object();
3934 json_object_string_add(json
, "ssmGroups", range_str
);
3935 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3936 json_object_free(json
);
3939 vty_out(vty
, "SSM group range : %s%s", range_str
, VTY_NEWLINE
);
3942 DEFUN (show_ip_pim_ssm_range
,
3943 show_ip_pim_ssm_range_cmd
,
3944 "show ip pim group-type [json]",
3949 "JavaScript Object Notation\n")
3951 u_char uj
= use_json(argc
, argv
);
3952 ip_pim_ssm_show_group_range(vty
, uj
);
3958 ip_pim_ssm_show_group_type(struct vty
*vty
, u_char uj
, const char *group
)
3960 struct in_addr group_addr
;
3961 const char *type_str
;
3964 result
= inet_pton(AF_INET
, group
, &group_addr
);
3966 type_str
= "invalid";
3969 if (pim_is_group_224_4 (group_addr
))
3970 type_str
= pim_is_grp_ssm (group_addr
)?"SSM":"ASM";
3972 type_str
= "not-multicast";
3978 json
= json_object_new_object();
3979 json_object_string_add(json
, "groupType", type_str
);
3980 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3981 json_object_free(json
);
3984 vty_out(vty
, "Group type : %s%s", type_str
, VTY_NEWLINE
);
3987 DEFUN (show_ip_pim_group_type
,
3988 show_ip_pim_group_type_cmd
,
3989 "show ip pim group-type A.B.C.D [json]",
3993 "multicast group type\n"
3995 "JavaScript Object Notation\n")
3997 u_char uj
= use_json(argc
, argv
);
3998 ip_pim_ssm_show_group_type(vty
, uj
, argv
[0]->arg
);
4003 DEFUN_HIDDEN (ip_multicast_routing
,
4004 ip_multicast_routing_cmd
,
4005 "ip multicast-routing",
4007 "Enable IP multicast forwarding\n")
4012 DEFUN_HIDDEN (no_ip_multicast_routing
,
4013 no_ip_multicast_routing_cmd
,
4014 "no ip multicast-routing",
4017 "Global IP configuration subcommands\n"
4018 "Enable IP multicast forwarding\n")
4020 vty_out (vty
, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE
);
4026 "ip ssmpingd [A.B.C.D]",
4033 struct in_addr source_addr
;
4034 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
4036 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4038 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
4039 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4043 result
= pim_ssmpingd_start(source_addr
);
4045 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
4046 source_str
, result
, VTY_NEWLINE
);
4053 DEFUN (no_ip_ssmpingd
,
4055 "no ip ssmpingd [A.B.C.D]",
4063 struct in_addr source_addr
;
4064 const char *source_str
= (argc
== idx_ipv4
) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
4066 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4068 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
4069 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4073 result
= pim_ssmpingd_stop(source_addr
);
4075 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
4076 source_str
, result
, VTY_NEWLINE
);
4087 "pim multicast routing\n"
4088 "Enable PIM ECMP \n")
4090 qpim_ecmp_enable
= 1;
4095 DEFUN (no_ip_pim_ecmp
,
4100 "pim multicast routing\n"
4101 "Disable PIM ECMP \n")
4103 qpim_ecmp_enable
= 0;
4108 DEFUN (ip_pim_ecmp_rebalance
,
4109 ip_pim_ecmp_rebalance_cmd
,
4110 "ip pim ecmp rebalance",
4112 "pim multicast routing\n"
4113 "Enable PIM ECMP \n"
4114 "Enable PIM ECMP Rebalance\n")
4116 qpim_ecmp_rebalance_enable
= 1;
4121 DEFUN (no_ip_pim_ecmp_rebalance
,
4122 no_ip_pim_ecmp_rebalance_cmd
,
4123 "no ip pim ecmp rebalance",
4126 "pim multicast routing\n"
4127 "Disable PIM ECMP \n"
4128 "Disable PIM ECMP Rebalance\n")
4130 qpim_ecmp_rebalance_enable
= 0;
4136 pim_cmd_igmp_start (struct vty
*vty
, struct interface
*ifp
)
4138 struct pim_interface
*pim_ifp
;
4139 uint8_t need_startup
= 0;
4141 pim_ifp
= ifp
->info
;
4145 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
4148 vty_out(vty
, "Could not enable IGMP on interface %s%s",
4149 ifp
->name
, VTY_NEWLINE
);
4156 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
4158 PIM_IF_DO_IGMP(pim_ifp
->options
);
4163 /* 'ip igmp' executed multiple times, with need_startup
4164 avoid multiple if add all and membership refresh */
4167 pim_if_addr_add_all(ifp
);
4168 pim_if_membership_refresh(ifp
);
4174 DEFUN (interface_ip_igmp
,
4175 interface_ip_igmp_cmd
,
4180 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4182 return pim_cmd_igmp_start(vty
, ifp
);
4185 DEFUN (interface_no_ip_igmp
,
4186 interface_no_ip_igmp_cmd
,
4192 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4193 struct pim_interface
*pim_ifp
;
4195 pim_ifp
= ifp
->info
;
4199 PIM_IF_DONT_IGMP(pim_ifp
->options
);
4201 pim_if_membership_clear(ifp
);
4203 pim_if_addr_del_all_igmp(ifp
);
4205 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
4212 DEFUN (interface_ip_igmp_join
,
4213 interface_ip_igmp_join_cmd
,
4214 "ip igmp join A.B.C.D A.B.C.D",
4217 "IGMP join multicast group\n"
4218 "Multicast group address\n"
4221 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4224 const char *group_str
;
4225 const char *source_str
;
4226 struct in_addr group_addr
;
4227 struct in_addr source_addr
;
4231 group_str
= argv
[idx_ipv4
]->arg
;
4232 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4234 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4235 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4239 /* Source address */
4240 source_str
= argv
[idx_ipv4_2
]->arg
;
4241 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4243 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4244 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4248 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
4250 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
4251 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4258 DEFUN (interface_no_ip_igmp_join
,
4259 interface_no_ip_igmp_join_cmd
,
4260 "no ip igmp join A.B.C.D A.B.C.D",
4264 "IGMP join multicast group\n"
4265 "Multicast group address\n"
4268 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4271 const char *group_str
;
4272 const char *source_str
;
4273 struct in_addr group_addr
;
4274 struct in_addr source_addr
;
4278 group_str
= argv
[idx_ipv4
]->arg
;
4279 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4281 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4282 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4286 /* Source address */
4287 source_str
= argv
[idx_ipv4_2
]->arg
;
4288 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4290 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4291 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4295 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
4297 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
4298 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4306 CLI reconfiguration affects the interface level (struct pim_interface).
4307 This function propagates the reconfiguration to every active socket
4310 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
4312 struct interface
*ifp
;
4313 struct pim_interface
*pim_ifp
;
4317 /* other querier present? */
4319 if (igmp
->t_other_querier_timer
)
4322 /* this is the querier */
4324 zassert(igmp
->interface
);
4325 zassert(igmp
->interface
->info
);
4327 ifp
= igmp
->interface
;
4328 pim_ifp
= ifp
->info
;
4330 if (PIM_DEBUG_IGMP_TRACE
) {
4331 char ifaddr_str
[INET_ADDRSTRLEN
];
4332 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
4333 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
4334 __PRETTY_FUNCTION__
,
4337 pim_ifp
->igmp_default_query_interval
);
4341 igmp_startup_mode_on() will reset QQI:
4343 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
4345 igmp_startup_mode_on(igmp
);
4348 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
4350 if (igmp
->t_igmp_query_timer
) {
4351 /* other querier present */
4352 zassert(igmp
->t_igmp_query_timer
);
4353 zassert(!igmp
->t_other_querier_timer
);
4355 pim_igmp_general_query_off(igmp
);
4356 pim_igmp_general_query_on(igmp
);
4358 zassert(igmp
->t_igmp_query_timer
);
4359 zassert(!igmp
->t_other_querier_timer
);
4362 /* this is the querier */
4364 zassert(!igmp
->t_igmp_query_timer
);
4365 zassert(igmp
->t_other_querier_timer
);
4367 pim_igmp_other_querier_timer_off(igmp
);
4368 pim_igmp_other_querier_timer_on(igmp
);
4370 zassert(!igmp
->t_igmp_query_timer
);
4371 zassert(igmp
->t_other_querier_timer
);
4375 static void change_query_interval(struct pim_interface
*pim_ifp
,
4378 struct listnode
*sock_node
;
4379 struct igmp_sock
*igmp
;
4381 pim_ifp
->igmp_default_query_interval
= query_interval
;
4383 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4384 igmp_sock_query_interval_reconfig(igmp
);
4385 igmp_sock_query_reschedule(igmp
);
4389 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
4390 int query_max_response_time_dsec
)
4392 struct listnode
*sock_node
;
4393 struct igmp_sock
*igmp
;
4395 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
4398 Below we modify socket/group/source timers in order to quickly
4399 reflect the change. Otherwise, those timers would eventually catch
4403 /* scan all sockets */
4404 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4405 struct listnode
*grp_node
;
4406 struct igmp_group
*grp
;
4408 /* reschedule socket general query */
4409 igmp_sock_query_reschedule(igmp
);
4411 /* scan socket groups */
4412 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
4413 struct listnode
*src_node
;
4414 struct igmp_source
*src
;
4416 /* reset group timers for groups in EXCLUDE mode */
4417 if (grp
->group_filtermode_isexcl
) {
4418 igmp_group_reset_gmi(grp
);
4421 /* scan group sources */
4422 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
4424 /* reset source timers for sources with running timers */
4425 if (src
->t_source_timer
) {
4426 igmp_source_reset_gmi(igmp
, grp
, src
);
4433 #define IGMP_QUERY_INTERVAL_MIN (1)
4434 #define IGMP_QUERY_INTERVAL_MAX (1800)
4436 DEFUN (interface_ip_igmp_query_interval
,
4437 interface_ip_igmp_query_interval_cmd
,
4438 "ip igmp query-interval (1-1800)",
4441 IFACE_IGMP_QUERY_INTERVAL_STR
4442 "Query interval in seconds\n")
4444 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4445 struct pim_interface
*pim_ifp
;
4447 int query_interval_dsec
;
4450 pim_ifp
= ifp
->info
;
4453 ret
= pim_cmd_igmp_start(vty
, ifp
);
4454 if (ret
!= CMD_SUCCESS
)
4456 pim_ifp
= ifp
->info
;
4459 query_interval
= atoi(argv
[3]->arg
);
4460 query_interval_dsec
= 10 * query_interval
;
4463 It seems we don't need to check bounds since command.c does it
4464 already, but we verify them anyway for extra safety.
4466 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
4467 vty_out(vty
, "General query interval %d lower than minimum %d%s",
4469 IGMP_QUERY_INTERVAL_MIN
,
4473 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
4474 vty_out(vty
, "General query interval %d higher than maximum %d%s",
4476 IGMP_QUERY_INTERVAL_MAX
,
4481 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4483 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
4484 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4489 change_query_interval(pim_ifp
, query_interval
);
4494 DEFUN (interface_no_ip_igmp_query_interval
,
4495 interface_no_ip_igmp_query_interval_cmd
,
4496 "no ip igmp query-interval",
4500 IFACE_IGMP_QUERY_INTERVAL_STR
)
4502 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4503 struct pim_interface
*pim_ifp
;
4504 int default_query_interval_dsec
;
4506 pim_ifp
= ifp
->info
;
4511 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
4513 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4515 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
4516 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4521 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
4526 DEFUN (interface_ip_igmp_version
,
4527 interface_ip_igmp_version_cmd
,
4528 "ip igmp version (2-3)",
4532 "IGMP version number\n")
4534 VTY_DECLVAR_CONTEXT(interface
,ifp
);
4535 struct pim_interface
*pim_ifp
= NULL
;
4536 int igmp_version
, old_version
= 0;
4539 pim_ifp
= ifp
->info
;
4543 ret
= pim_cmd_igmp_start(vty
, ifp
);
4544 if (ret
!= CMD_SUCCESS
)
4546 pim_ifp
= ifp
->info
;
4549 igmp_version
= atoi(argv
[3]->arg
);
4550 old_version
= pim_ifp
->igmp_version
;
4551 pim_ifp
->igmp_version
= igmp_version
;
4553 //Check if IGMP is Enabled otherwise, enable on interface
4554 if (!PIM_IF_TEST_IGMP (pim_ifp
->options
))
4556 PIM_IF_DO_IGMP(pim_ifp
->options
);
4557 pim_if_addr_add_all(ifp
);
4558 pim_if_membership_refresh(ifp
);
4559 old_version
= igmp_version
; //avoid refreshing membership again.
4561 /* Current and new version is different refresh existing
4562 membership. Going from 3 -> 2 or 2 -> 3. */
4563 if (old_version
!= igmp_version
)
4564 pim_if_membership_refresh(ifp
);
4569 DEFUN (interface_no_ip_igmp_version
,
4570 interface_no_ip_igmp_version_cmd
,
4571 "no ip igmp version (2-3)",
4576 "IGMP version number\n")
4578 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4579 struct pim_interface
*pim_ifp
;
4581 pim_ifp
= ifp
->info
;
4586 pim_ifp
->igmp_version
= IGMP_DEFAULT_VERSION
;
4591 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4592 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4594 DEFUN (interface_ip_igmp_query_max_response_time
,
4595 interface_ip_igmp_query_max_response_time_cmd
,
4596 "ip igmp query-max-response-time (10-250)",
4599 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4600 "Query response value in deci-seconds\n")
4602 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4603 struct pim_interface
*pim_ifp
;
4604 int query_max_response_time
;
4607 pim_ifp
= ifp
->info
;
4610 ret
= pim_cmd_igmp_start(vty
, ifp
);
4611 if (ret
!= CMD_SUCCESS
)
4613 pim_ifp
= ifp
->info
;
4616 query_max_response_time
= atoi(argv
[3]->arg
);
4618 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
* 10) {
4620 "Can't set query max response time %d sec >= general query interval %d sec%s",
4621 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
4626 change_query_max_response_time(pim_ifp
, query_max_response_time
);
4631 DEFUN (interface_no_ip_igmp_query_max_response_time
,
4632 interface_no_ip_igmp_query_max_response_time_cmd
,
4633 "no ip igmp query-max-response-time (10-250)",
4637 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4638 "Time for response in deci-seconds\n")
4640 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4641 struct pim_interface
*pim_ifp
;
4643 pim_ifp
= ifp
->info
;
4648 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4653 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4654 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4656 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
4657 interface_ip_igmp_query_max_response_time_dsec_cmd
,
4658 "ip igmp query-max-response-time-dsec (10-250)",
4661 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4662 "Query response value in deciseconds\n")
4664 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4665 struct pim_interface
*pim_ifp
;
4666 int query_max_response_time_dsec
;
4667 int default_query_interval_dsec
;
4670 pim_ifp
= ifp
->info
;
4673 ret
= pim_cmd_igmp_start(vty
, ifp
);
4674 if (ret
!= CMD_SUCCESS
)
4676 pim_ifp
= ifp
->info
;
4679 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
4681 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
4683 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
4685 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
4686 query_max_response_time_dsec
, default_query_interval_dsec
,
4691 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
4696 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4697 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4698 "no ip igmp query-max-response-time-dsec",
4702 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
4704 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4705 struct pim_interface
*pim_ifp
;
4707 pim_ifp
= ifp
->info
;
4712 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4717 DEFUN (interface_ip_pim_drprio
,
4718 interface_ip_pim_drprio_cmd
,
4719 "ip pim drpriority (1-4294967295)",
4722 "Set the Designated Router Election Priority\n"
4723 "Value of the new DR Priority\n")
4725 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4727 struct pim_interface
*pim_ifp
;
4728 uint32_t old_dr_prio
;
4730 pim_ifp
= ifp
->info
;
4733 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
4737 old_dr_prio
= pim_ifp
->pim_dr_priority
;
4739 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
4741 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
4742 if (pim_if_dr_election(ifp
))
4743 pim_hello_restart_now(ifp
);
4749 DEFUN (interface_no_ip_pim_drprio
,
4750 interface_no_ip_pim_drprio_cmd
,
4751 "no ip pim drpriority [(1-4294967295)]",
4755 "Revert the Designated Router Priority to default\n"
4756 "Old Value of the Priority\n")
4758 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4759 struct pim_interface
*pim_ifp
;
4761 pim_ifp
= ifp
->info
;
4764 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4768 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
4769 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
4770 if (pim_if_dr_election(ifp
))
4771 pim_hello_restart_now(ifp
);
4778 pim_cmd_interface_add (struct interface
*ifp
)
4780 struct pim_interface
*pim_ifp
= ifp
->info
;
4783 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
4789 PIM_IF_DO_PIM(pim_ifp
->options
);
4792 pim_if_addr_add_all(ifp
);
4793 pim_if_membership_refresh(ifp
);
4797 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4798 interface_ip_pim_ssm_cmd
,
4804 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4806 if (!pim_cmd_interface_add(ifp
)) {
4807 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4811 vty_out(vty
, "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed%s", VTY_NEWLINE
);
4815 DEFUN (interface_ip_pim_sm
,
4816 interface_ip_pim_sm_cmd
,
4822 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4823 if (!pim_cmd_interface_add(ifp
)) {
4824 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
4828 pim_if_create_pimreg();
4834 pim_cmd_interface_delete (struct interface
*ifp
)
4836 struct pim_interface
*pim_ifp
= ifp
->info
;
4841 PIM_IF_DONT_PIM(pim_ifp
->options
);
4843 pim_if_membership_clear(ifp
);
4846 pim_sock_delete() removes all neighbors from
4847 pim_ifp->pim_neighbor_list.
4849 pim_sock_delete(ifp
, "pim unconfigured on interface");
4851 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
4852 pim_if_addr_del_all(ifp
);
4859 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4860 interface_no_ip_pim_ssm_cmd
,
4867 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4868 if (!pim_cmd_interface_delete(ifp
)) {
4869 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4876 DEFUN (interface_no_ip_pim_sm
,
4877 interface_no_ip_pim_sm_cmd
,
4884 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4885 if (!pim_cmd_interface_delete(ifp
)) {
4886 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
4893 DEFUN (interface_ip_mroute
,
4894 interface_ip_mroute_cmd
,
4895 "ip mroute INTERFACE A.B.C.D",
4897 "Add multicast route\n"
4898 "Outgoing interface name\n"
4901 VTY_DECLVAR_CONTEXT(interface
, iif
);
4902 int idx_interface
= 2;
4904 struct interface
*oif
;
4905 const char *oifname
;
4906 const char *grp_str
;
4907 struct in_addr grp_addr
;
4908 struct in_addr src_addr
;
4911 oifname
= argv
[idx_interface
]->arg
;
4912 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4914 vty_out(vty
, "No such interface name %s%s",
4915 oifname
, VTY_NEWLINE
);
4919 grp_str
= argv
[idx_ipv4
]->arg
;
4920 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4922 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4923 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4927 src_addr
.s_addr
= INADDR_ANY
;
4929 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4930 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4937 DEFUN (interface_ip_mroute_source
,
4938 interface_ip_mroute_source_cmd
,
4939 "ip mroute INTERFACE A.B.C.D A.B.C.D",
4941 "Add multicast route\n"
4942 "Outgoing interface name\n"
4946 VTY_DECLVAR_CONTEXT(interface
, iif
);
4947 int idx_interface
= 2;
4950 struct interface
*oif
;
4951 const char *oifname
;
4952 const char *grp_str
;
4953 struct in_addr grp_addr
;
4954 const char *src_str
;
4955 struct in_addr src_addr
;
4958 oifname
= argv
[idx_interface
]->arg
;
4959 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
4961 vty_out(vty
, "No such interface name %s%s",
4962 oifname
, VTY_NEWLINE
);
4966 grp_str
= argv
[idx_ipv4
]->arg
;
4967 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
4969 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4970 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4974 src_str
= argv
[idx_ipv4_2
]->arg
;
4975 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
4977 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4978 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4982 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
4983 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
4990 DEFUN (interface_no_ip_mroute
,
4991 interface_no_ip_mroute_cmd
,
4992 "no ip mroute INTERFACE A.B.C.D",
4995 "Add multicast route\n"
4996 "Outgoing interface name\n"
4999 VTY_DECLVAR_CONTEXT(interface
, iif
);
5000 int idx_interface
= 3;
5002 struct interface
*oif
;
5003 const char *oifname
;
5004 const char *grp_str
;
5005 struct in_addr grp_addr
;
5006 struct in_addr src_addr
;
5009 oifname
= argv
[idx_interface
]->arg
;
5010 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5012 vty_out(vty
, "No such interface name %s%s",
5013 oifname
, VTY_NEWLINE
);
5017 grp_str
= argv
[idx_ipv4
]->arg
;
5018 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5020 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5021 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5025 src_addr
.s_addr
= INADDR_ANY
;
5027 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
5028 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
5035 DEFUN (interface_no_ip_mroute_source
,
5036 interface_no_ip_mroute_source_cmd
,
5037 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
5040 "Add multicast route\n"
5041 "Outgoing interface name\n"
5045 VTY_DECLVAR_CONTEXT(interface
, iif
);
5046 int idx_interface
= 3;
5049 struct interface
*oif
;
5050 const char *oifname
;
5051 const char *grp_str
;
5052 struct in_addr grp_addr
;
5053 const char *src_str
;
5054 struct in_addr src_addr
;
5057 oifname
= argv
[idx_interface
]->arg
;
5058 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5060 vty_out(vty
, "No such interface name %s%s",
5061 oifname
, VTY_NEWLINE
);
5065 grp_str
= argv
[idx_ipv4
]->arg
;
5066 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5068 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5069 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5073 src_str
= argv
[idx_ipv4_2
]->arg
;
5074 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
5076 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
5077 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5081 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
5082 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
5089 DEFUN (interface_ip_pim_hello
,
5090 interface_ip_pim_hello_cmd
,
5091 "ip pim hello (1-180) [(1-180)]",
5095 IFACE_PIM_HELLO_TIME_STR
5096 IFACE_PIM_HELLO_HOLD_STR
)
5098 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5101 struct pim_interface
*pim_ifp
;
5103 pim_ifp
= ifp
->info
;
5106 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5110 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
5112 if (argc
== idx_hold
+ 1)
5113 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
5120 DEFUN (interface_no_ip_pim_hello
,
5121 interface_no_ip_pim_hello_cmd
,
5122 "no ip pim hello [(1-180) (1-180)]",
5127 IFACE_PIM_HELLO_TIME_STR
5128 IFACE_PIM_HELLO_HOLD_STR
)
5130 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5131 struct pim_interface
*pim_ifp
;
5133 pim_ifp
= ifp
->info
;
5136 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5140 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
5141 pim_ifp
->pim_default_holdtime
= -1;
5152 PIM_DO_DEBUG_IGMP_EVENTS
;
5153 PIM_DO_DEBUG_IGMP_PACKETS
;
5154 PIM_DO_DEBUG_IGMP_TRACE
;
5158 DEFUN (no_debug_igmp
,
5165 PIM_DONT_DEBUG_IGMP_EVENTS
;
5166 PIM_DONT_DEBUG_IGMP_PACKETS
;
5167 PIM_DONT_DEBUG_IGMP_TRACE
;
5172 DEFUN (debug_igmp_events
,
5173 debug_igmp_events_cmd
,
5174 "debug igmp events",
5177 DEBUG_IGMP_EVENTS_STR
)
5179 PIM_DO_DEBUG_IGMP_EVENTS
;
5183 DEFUN (no_debug_igmp_events
,
5184 no_debug_igmp_events_cmd
,
5185 "no debug igmp events",
5189 DEBUG_IGMP_EVENTS_STR
)
5191 PIM_DONT_DEBUG_IGMP_EVENTS
;
5196 DEFUN (debug_igmp_packets
,
5197 debug_igmp_packets_cmd
,
5198 "debug igmp packets",
5201 DEBUG_IGMP_PACKETS_STR
)
5203 PIM_DO_DEBUG_IGMP_PACKETS
;
5207 DEFUN (no_debug_igmp_packets
,
5208 no_debug_igmp_packets_cmd
,
5209 "no debug igmp packets",
5213 DEBUG_IGMP_PACKETS_STR
)
5215 PIM_DONT_DEBUG_IGMP_PACKETS
;
5220 DEFUN (debug_igmp_trace
,
5221 debug_igmp_trace_cmd
,
5225 DEBUG_IGMP_TRACE_STR
)
5227 PIM_DO_DEBUG_IGMP_TRACE
;
5231 DEFUN (no_debug_igmp_trace
,
5232 no_debug_igmp_trace_cmd
,
5233 "no debug igmp trace",
5237 DEBUG_IGMP_TRACE_STR
)
5239 PIM_DONT_DEBUG_IGMP_TRACE
;
5244 DEFUN (debug_mroute
,
5250 PIM_DO_DEBUG_MROUTE
;
5254 DEFUN (debug_mroute_detail
,
5255 debug_mroute_detail_cmd
,
5256 "debug mroute detail",
5261 PIM_DO_DEBUG_MROUTE_DETAIL
;
5265 DEFUN (no_debug_mroute
,
5266 no_debug_mroute_cmd
,
5272 PIM_DONT_DEBUG_MROUTE
;
5276 DEFUN (no_debug_mroute_detail
,
5277 no_debug_mroute_detail_cmd
,
5278 "no debug mroute detail",
5284 PIM_DONT_DEBUG_MROUTE_DETAIL
;
5288 DEFUN (debug_static
,
5294 PIM_DO_DEBUG_STATIC
;
5298 DEFUN (no_debug_static
,
5299 no_debug_static_cmd
,
5305 PIM_DONT_DEBUG_STATIC
;
5316 PIM_DO_DEBUG_PIM_EVENTS
;
5317 PIM_DO_DEBUG_PIM_PACKETS
;
5318 PIM_DO_DEBUG_PIM_TRACE
;
5319 PIM_DO_DEBUG_MSDP_EVENTS
;
5320 PIM_DO_DEBUG_MSDP_PACKETS
;
5324 DEFUN (no_debug_pim
,
5331 PIM_DONT_DEBUG_PIM_EVENTS
;
5332 PIM_DONT_DEBUG_PIM_PACKETS
;
5333 PIM_DONT_DEBUG_PIM_TRACE
;
5334 PIM_DONT_DEBUG_MSDP_EVENTS
;
5335 PIM_DONT_DEBUG_MSDP_PACKETS
;
5337 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5338 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5344 DEFUN (debug_pim_events
,
5345 debug_pim_events_cmd
,
5349 DEBUG_PIM_EVENTS_STR
)
5351 PIM_DO_DEBUG_PIM_EVENTS
;
5355 DEFUN (no_debug_pim_events
,
5356 no_debug_pim_events_cmd
,
5357 "no debug pim events",
5361 DEBUG_PIM_EVENTS_STR
)
5363 PIM_DONT_DEBUG_PIM_EVENTS
;
5367 DEFUN (debug_pim_packets
,
5368 debug_pim_packets_cmd
,
5369 "debug pim packets [<hello|joins|register>]",
5372 DEBUG_PIM_PACKETS_STR
5373 DEBUG_PIM_HELLO_PACKETS_STR
5374 DEBUG_PIM_J_P_PACKETS_STR
5375 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5378 if (argv_find (argv
, argc
, "hello", &idx
))
5380 PIM_DO_DEBUG_PIM_HELLO
;
5381 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
5383 else if (argv_find (argv
, argc
,"joins", &idx
))
5385 PIM_DO_DEBUG_PIM_J_P
;
5386 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
5388 else if (argv_find (argv
, argc
, "register", &idx
))
5390 PIM_DO_DEBUG_PIM_REG
;
5391 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
5395 PIM_DO_DEBUG_PIM_PACKETS
;
5396 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
5401 DEFUN (no_debug_pim_packets
,
5402 no_debug_pim_packets_cmd
,
5403 "no debug pim packets [<hello|joins|register>]",
5407 DEBUG_PIM_PACKETS_STR
5408 DEBUG_PIM_HELLO_PACKETS_STR
5409 DEBUG_PIM_J_P_PACKETS_STR
5410 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5413 if (argv_find (argv
, argc
,"hello",&idx
))
5415 PIM_DONT_DEBUG_PIM_HELLO
;
5416 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
5418 else if (argv_find (argv
, argc
, "joins", &idx
))
5420 PIM_DONT_DEBUG_PIM_J_P
;
5421 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
5423 else if (argv_find (argv
, argc
, "register", &idx
))
5425 PIM_DONT_DEBUG_PIM_REG
;
5426 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
5429 PIM_DONT_DEBUG_PIM_PACKETS
;
5435 DEFUN (debug_pim_packetdump_send
,
5436 debug_pim_packetdump_send_cmd
,
5437 "debug pim packet-dump send",
5440 DEBUG_PIM_PACKETDUMP_STR
5441 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5443 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
5447 DEFUN (no_debug_pim_packetdump_send
,
5448 no_debug_pim_packetdump_send_cmd
,
5449 "no debug pim packet-dump send",
5453 DEBUG_PIM_PACKETDUMP_STR
5454 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5456 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5461 DEFUN (debug_pim_packetdump_recv
,
5462 debug_pim_packetdump_recv_cmd
,
5463 "debug pim packet-dump receive",
5466 DEBUG_PIM_PACKETDUMP_STR
5467 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5469 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
5473 DEFUN (no_debug_pim_packetdump_recv
,
5474 no_debug_pim_packetdump_recv_cmd
,
5475 "no debug pim packet-dump receive",
5479 DEBUG_PIM_PACKETDUMP_STR
5480 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5482 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5487 DEFUN (debug_pim_trace
,
5488 debug_pim_trace_cmd
,
5492 DEBUG_PIM_TRACE_STR
)
5494 PIM_DO_DEBUG_PIM_TRACE
;
5498 DEFUN (no_debug_pim_trace
,
5499 no_debug_pim_trace_cmd
,
5500 "no debug pim trace",
5504 DEBUG_PIM_TRACE_STR
)
5506 PIM_DONT_DEBUG_PIM_TRACE
;
5511 DEFUN (debug_ssmpingd
,
5518 PIM_DO_DEBUG_SSMPINGD
;
5522 DEFUN (no_debug_ssmpingd
,
5523 no_debug_ssmpingd_cmd
,
5524 "no debug ssmpingd",
5530 PIM_DONT_DEBUG_SSMPINGD
;
5535 DEFUN (debug_pim_zebra
,
5536 debug_pim_zebra_cmd
,
5540 DEBUG_PIM_ZEBRA_STR
)
5546 DEFUN (no_debug_pim_zebra
,
5547 no_debug_pim_zebra_cmd
,
5548 "no debug pim zebra",
5552 DEBUG_PIM_ZEBRA_STR
)
5554 PIM_DONT_DEBUG_ZEBRA
;
5565 PIM_DO_DEBUG_MSDP_EVENTS
;
5566 PIM_DO_DEBUG_MSDP_PACKETS
;
5570 DEFUN (no_debug_msdp
,
5577 PIM_DONT_DEBUG_MSDP_EVENTS
;
5578 PIM_DONT_DEBUG_MSDP_PACKETS
;
5582 ALIAS (no_debug_msdp
,
5588 DEFUN (debug_msdp_events
,
5589 debug_msdp_events_cmd
,
5590 "debug msdp events",
5593 DEBUG_MSDP_EVENTS_STR
)
5595 PIM_DO_DEBUG_MSDP_EVENTS
;
5599 DEFUN (no_debug_msdp_events
,
5600 no_debug_msdp_events_cmd
,
5601 "no debug msdp events",
5605 DEBUG_MSDP_EVENTS_STR
)
5607 PIM_DONT_DEBUG_MSDP_EVENTS
;
5611 ALIAS (no_debug_msdp_events
,
5612 undebug_msdp_events_cmd
,
5613 "undebug msdp events",
5616 DEBUG_MSDP_EVENTS_STR
)
5618 DEFUN (debug_msdp_packets
,
5619 debug_msdp_packets_cmd
,
5620 "debug msdp packets",
5623 DEBUG_MSDP_PACKETS_STR
)
5625 PIM_DO_DEBUG_MSDP_PACKETS
;
5629 DEFUN (no_debug_msdp_packets
,
5630 no_debug_msdp_packets_cmd
,
5631 "no debug msdp packets",
5635 DEBUG_MSDP_PACKETS_STR
)
5637 PIM_DONT_DEBUG_MSDP_PACKETS
;
5641 ALIAS (no_debug_msdp_packets
,
5642 undebug_msdp_packets_cmd
,
5643 "undebug msdp packets",
5646 DEBUG_MSDP_PACKETS_STR
)
5648 DEFUN (show_debugging_pim
,
5649 show_debugging_pim_cmd
,
5650 "show debugging pim",
5655 pim_debug_config_write(vty
);
5660 interface_pim_use_src_cmd_worker(struct vty
*vty
, const char *source
)
5663 struct in_addr source_addr
;
5664 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5666 result
= inet_pton(AF_INET
, source
, &source_addr
);
5668 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5669 source
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5673 result
= pim_update_source_set(ifp
, source_addr
);
5677 case PIM_IFACE_NOT_FOUND
:
5678 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5680 case PIM_UPDATE_SOURCE_DUP
:
5681 vty_out(vty
, "%% Source already set to %s%s", source
, VTY_NEWLINE
);
5684 vty_out(vty
, "%% Source set failed%s", VTY_NEWLINE
);
5687 return result
?CMD_WARNING
:CMD_SUCCESS
;
5690 DEFUN (interface_pim_use_source
,
5691 interface_pim_use_source_cmd
,
5692 "ip pim use-source A.B.C.D",
5694 "pim multicast routing\n"
5695 "Configure primary IP address\n"
5696 "source ip address\n")
5698 return interface_pim_use_src_cmd_worker (vty
, argv
[3]->arg
);
5701 DEFUN (interface_no_pim_use_source
,
5702 interface_no_pim_use_source_cmd
,
5703 "no ip pim use-source",
5706 "pim multicast routing\n"
5707 "Delete source IP address\n")
5709 return interface_pim_use_src_cmd_worker (vty
, "0.0.0.0");
5713 ip_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
, const char *local
)
5715 enum pim_msdp_err result
;
5716 struct in_addr peer_addr
;
5717 struct in_addr local_addr
;
5719 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5721 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5722 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5726 result
= inet_pton(AF_INET
, local
, &local_addr
);
5728 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5729 local
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5733 result
= pim_msdp_peer_add(peer_addr
, local_addr
, "default", NULL
/* mp_p */);
5735 case PIM_MSDP_ERR_NONE
:
5737 case PIM_MSDP_ERR_OOM
:
5738 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5740 case PIM_MSDP_ERR_PEER_EXISTS
:
5741 vty_out(vty
, "%% Peer exists%s", VTY_NEWLINE
);
5743 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5744 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5747 vty_out(vty
, "%% peer add failed%s", VTY_NEWLINE
);
5750 return result
?CMD_WARNING
:CMD_SUCCESS
;
5753 DEFUN_HIDDEN (ip_msdp_peer
,
5755 "ip msdp peer A.B.C.D source A.B.C.D",
5758 "Configure MSDP peer\n"
5760 "Source address for TCP connection\n"
5761 "local ip address\n")
5763 return ip_msdp_peer_cmd_worker (vty
, argv
[3]->arg
, argv
[5]->arg
);
5767 ip_no_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
)
5769 enum pim_msdp_err result
;
5770 struct in_addr peer_addr
;
5772 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
5774 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
5775 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5779 result
= pim_msdp_peer_del(peer_addr
);
5781 case PIM_MSDP_ERR_NONE
:
5783 case PIM_MSDP_ERR_NO_PEER
:
5784 vty_out(vty
, "%% Peer does not exist%s", VTY_NEWLINE
);
5787 vty_out(vty
, "%% peer del failed%s", VTY_NEWLINE
);
5790 return result
?CMD_WARNING
:CMD_SUCCESS
;
5793 DEFUN_HIDDEN (no_ip_msdp_peer
,
5794 no_ip_msdp_peer_cmd
,
5795 "no ip msdp peer A.B.C.D",
5799 "Delete MSDP peer\n"
5800 "peer ip address\n")
5802 return ip_no_msdp_peer_cmd_worker (vty
, argv
[4]->arg
);
5806 ip_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5808 enum pim_msdp_err result
;
5809 struct in_addr mbr_ip
;
5811 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5813 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5814 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5818 result
= pim_msdp_mg_mbr_add(mg
, mbr_ip
);
5820 case PIM_MSDP_ERR_NONE
:
5822 case PIM_MSDP_ERR_OOM
:
5823 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5825 case PIM_MSDP_ERR_MG_MBR_EXISTS
:
5826 vty_out(vty
, "%% mesh-group member exists%s", VTY_NEWLINE
);
5828 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5829 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5832 vty_out(vty
, "%% member add failed%s", VTY_NEWLINE
);
5835 return result
?CMD_WARNING
:CMD_SUCCESS
;
5838 DEFUN (ip_msdp_mesh_group_member
,
5839 ip_msdp_mesh_group_member_cmd
,
5840 "ip msdp mesh-group WORD member A.B.C.D",
5843 "Configure MSDP mesh-group\n"
5845 "mesh group member\n"
5846 "peer ip address\n")
5848 return ip_msdp_mesh_group_member_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5852 ip_no_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
5854 enum pim_msdp_err result
;
5855 struct in_addr mbr_ip
;
5857 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
5859 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
5860 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5864 result
= pim_msdp_mg_mbr_del(mg
, mbr_ip
);
5866 case PIM_MSDP_ERR_NONE
:
5868 case PIM_MSDP_ERR_NO_MG
:
5869 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5871 case PIM_MSDP_ERR_NO_MG_MBR
:
5872 vty_out(vty
, "%% mesh-group member does not exist%s", VTY_NEWLINE
);
5875 vty_out(vty
, "%% mesh-group member del failed%s", VTY_NEWLINE
);
5878 return result
?CMD_WARNING
:CMD_SUCCESS
;
5880 DEFUN (no_ip_msdp_mesh_group_member
,
5881 no_ip_msdp_mesh_group_member_cmd
,
5882 "no ip msdp mesh-group WORD member A.B.C.D",
5886 "Delete MSDP mesh-group member\n"
5888 "mesh group member\n"
5889 "peer ip address\n")
5891 return ip_no_msdp_mesh_group_member_cmd_worker(vty
, argv
[4]->arg
, argv
[6]->arg
);
5895 ip_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
, const char *src
)
5897 enum pim_msdp_err result
;
5898 struct in_addr src_ip
;
5900 result
= inet_pton(AF_INET
, src
, &src_ip
);
5902 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5903 src
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5907 result
= pim_msdp_mg_src_add(mg
, src_ip
);
5909 case PIM_MSDP_ERR_NONE
:
5911 case PIM_MSDP_ERR_OOM
:
5912 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
5914 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
5915 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
5918 vty_out(vty
, "%% source add failed%s", VTY_NEWLINE
);
5921 return result
?CMD_WARNING
:CMD_SUCCESS
;
5925 DEFUN (ip_msdp_mesh_group_source
,
5926 ip_msdp_mesh_group_source_cmd
,
5927 "ip msdp mesh-group WORD source A.B.C.D",
5930 "Configure MSDP mesh-group\n"
5932 "mesh group local address\n"
5933 "source ip address for the TCP connection\n")
5935 return ip_msdp_mesh_group_source_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
5939 ip_no_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
)
5941 enum pim_msdp_err result
;
5943 result
= pim_msdp_mg_src_del(mg
);
5945 case PIM_MSDP_ERR_NONE
:
5947 case PIM_MSDP_ERR_NO_MG
:
5948 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5951 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5954 return result
?CMD_WARNING
:CMD_SUCCESS
;
5958 ip_no_msdp_mesh_group_cmd_worker(struct vty
*vty
, const char *mg
)
5960 enum pim_msdp_err result
;
5962 result
= pim_msdp_mg_del(mg
);
5964 case PIM_MSDP_ERR_NONE
:
5966 case PIM_MSDP_ERR_NO_MG
:
5967 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
5970 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
5973 return result
? CMD_WARNING
: CMD_SUCCESS
;
5976 DEFUN (no_ip_msdp_mesh_group_source
,
5977 no_ip_msdp_mesh_group_source_cmd
,
5978 "no ip msdp mesh-group WORD source [A.B.C.D]",
5982 "Delete MSDP mesh-group source\n"
5984 "mesh group source\n"
5985 "mesh group local address\n")
5988 return ip_no_msdp_mesh_group_cmd_worker(vty
, argv
[6]->arg
);
5990 return ip_no_msdp_mesh_group_source_cmd_worker(vty
, argv
[4]->arg
);
5994 print_empty_json_obj(struct vty
*vty
)
5997 json
= json_object_new_object();
5998 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
5999 json_object_free(json
);
6003 ip_msdp_show_mesh_group(struct vty
*vty
, u_char uj
)
6005 struct listnode
*mbrnode
;
6006 struct pim_msdp_mg_mbr
*mbr
;
6007 struct pim_msdp_mg
*mg
= msdp
->mg
;
6008 char mbr_str
[INET_ADDRSTRLEN
];
6009 char src_str
[INET_ADDRSTRLEN
];
6010 char state_str
[PIM_MSDP_STATE_STRLEN
];
6011 enum pim_msdp_peer_state state
;
6012 json_object
*json
= NULL
;
6013 json_object
*json_mg_row
= NULL
;
6014 json_object
*json_members
= NULL
;
6015 json_object
*json_row
= NULL
;
6019 print_empty_json_obj(vty
);
6023 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
6025 json
= json_object_new_object();
6026 /* currently there is only one mesh group but we should still make
6027 * it a dict with mg-name as key */
6028 json_mg_row
= json_object_new_object();
6029 json_object_string_add(json_mg_row
, "name", mg
->mesh_group_name
);
6030 json_object_string_add(json_mg_row
, "source", src_str
);
6032 vty_out(vty
, "Mesh group : %s%s", mg
->mesh_group_name
, VTY_NEWLINE
);
6033 vty_out(vty
, " Source : %s%s", src_str
, VTY_NEWLINE
);
6034 vty_out(vty
, " Member State%s", VTY_NEWLINE
);
6037 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
6038 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
6040 state
= mbr
->mp
->state
;
6042 state
= PIM_MSDP_DISABLED
;
6044 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
6046 json_row
= json_object_new_object();
6047 json_object_string_add(json_row
, "member", mbr_str
);
6048 json_object_string_add(json_row
, "state", state_str
);
6049 if (!json_members
) {
6050 json_members
= json_object_new_object();
6051 json_object_object_add(json_mg_row
, "members", json_members
);
6053 json_object_object_add(json_members
, mbr_str
, json_row
);
6055 vty_out(vty
, " %-15s %11s%s",
6056 mbr_str
, state_str
, VTY_NEWLINE
);
6061 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
6062 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6063 json_object_free(json
);
6067 DEFUN (show_ip_msdp_mesh_group
,
6068 show_ip_msdp_mesh_group_cmd
,
6069 "show ip msdp mesh-group [json]",
6073 "MSDP mesh-group information\n"
6074 "JavaScript Object Notation\n")
6076 u_char uj
= use_json(argc
, argv
);
6077 ip_msdp_show_mesh_group(vty
, uj
);
6083 ip_msdp_show_peers(struct vty
*vty
, u_char uj
)
6085 struct listnode
*mpnode
;
6086 struct pim_msdp_peer
*mp
;
6087 char peer_str
[INET_ADDRSTRLEN
];
6088 char local_str
[INET_ADDRSTRLEN
];
6089 char state_str
[PIM_MSDP_STATE_STRLEN
];
6090 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6092 json_object
*json
= NULL
;
6093 json_object
*json_row
= NULL
;
6097 json
= json_object_new_object();
6099 vty_out(vty
, "Peer Local State Uptime SaCnt%s", VTY_NEWLINE
);
6102 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6103 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6104 now
= pim_time_monotonic_sec();
6105 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6107 strcpy(timebuf
, "-");
6109 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6110 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6111 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6113 json_row
= json_object_new_object();
6114 json_object_string_add(json_row
, "peer", peer_str
);
6115 json_object_string_add(json_row
, "local", local_str
);
6116 json_object_string_add(json_row
, "state", state_str
);
6117 json_object_string_add(json_row
, "upTime", timebuf
);
6118 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6119 json_object_object_add(json
, peer_str
, json_row
);
6121 vty_out(vty
, "%-15s %15s %11s %8s %6d%s",
6122 peer_str
, local_str
, state_str
,
6123 timebuf
, mp
->sa_cnt
, VTY_NEWLINE
);
6128 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6129 json_object_free(json
);
6134 ip_msdp_show_peers_detail(struct vty
*vty
, const char *peer
, u_char uj
)
6136 struct listnode
*mpnode
;
6137 struct pim_msdp_peer
*mp
;
6138 char peer_str
[INET_ADDRSTRLEN
];
6139 char local_str
[INET_ADDRSTRLEN
];
6140 char state_str
[PIM_MSDP_STATE_STRLEN
];
6141 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6142 char katimer
[PIM_MSDP_TIMER_STRLEN
];
6143 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
6144 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
6146 json_object
*json
= NULL
;
6147 json_object
*json_row
= NULL
;
6150 json
= json_object_new_object();
6153 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6154 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6155 if (strcmp(peer
, "detail") &&
6156 strcmp(peer
, peer_str
))
6159 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6160 now
= pim_time_monotonic_sec();
6161 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6163 strcpy(timebuf
, "-");
6165 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6166 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6167 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
), mp
->ka_timer
);
6168 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
), mp
->cr_timer
);
6169 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
), mp
->hold_timer
);
6172 json_row
= json_object_new_object();
6173 json_object_string_add(json_row
, "peer", peer_str
);
6174 json_object_string_add(json_row
, "local", local_str
);
6175 json_object_string_add(json_row
, "meshGroupName", mp
->mesh_group_name
);
6176 json_object_string_add(json_row
, "state", state_str
);
6177 json_object_string_add(json_row
, "upTime", timebuf
);
6178 json_object_string_add(json_row
, "keepAliveTimer", katimer
);
6179 json_object_string_add(json_row
, "connRetryTimer", crtimer
);
6180 json_object_string_add(json_row
, "holdTimer", holdtimer
);
6181 json_object_string_add(json_row
, "lastReset", mp
->last_reset
);
6182 json_object_int_add(json_row
, "connAttempts", mp
->conn_attempts
);
6183 json_object_int_add(json_row
, "establishedChanges", mp
->est_flaps
);
6184 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6185 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
6186 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
6187 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
6188 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
6189 json_object_object_add(json
, peer_str
, json_row
);
6191 vty_out(vty
, "Peer : %s%s", peer_str
, VTY_NEWLINE
);
6192 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6193 vty_out(vty
, " Mesh Group : %s%s", mp
->mesh_group_name
, VTY_NEWLINE
);
6194 vty_out(vty
, " State : %s%s", state_str
, VTY_NEWLINE
);
6195 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6197 vty_out(vty
, " Keepalive Timer : %s%s", katimer
, VTY_NEWLINE
);
6198 vty_out(vty
, " Conn Retry Timer : %s%s", crtimer
, VTY_NEWLINE
);
6199 vty_out(vty
, " Hold Timer : %s%s", holdtimer
, VTY_NEWLINE
);
6200 vty_out(vty
, " Last Reset : %s%s", mp
->last_reset
, VTY_NEWLINE
);
6201 vty_out(vty
, " Conn Attempts : %d%s", mp
->conn_attempts
, VTY_NEWLINE
);
6202 vty_out(vty
, " Established Changes : %d%s", mp
->est_flaps
, VTY_NEWLINE
);
6203 vty_out(vty
, " SA Count : %d%s", mp
->sa_cnt
, VTY_NEWLINE
);
6204 vty_out(vty
, " Statistics :%s", VTY_NEWLINE
);
6205 vty_out(vty
, " Sent Rcvd%s", VTY_NEWLINE
);
6206 vty_out(vty
, " Keepalives : %10d %10d%s",
6207 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
, VTY_NEWLINE
);
6208 vty_out(vty
, " SAs : %10d %10d%s",
6209 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
, VTY_NEWLINE
);
6210 vty_out(vty
, "%s", VTY_NEWLINE
);
6215 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6216 json_object_free(json
);
6220 DEFUN (show_ip_msdp_peer_detail
,
6221 show_ip_msdp_peer_detail_cmd
,
6222 "show ip msdp peer [detail|A.B.C.D] [json]",
6226 "MSDP peer information\n"
6229 "JavaScript Object Notation\n")
6231 u_char uj
= use_json(argc
, argv
);
6236 ip_msdp_show_peers_detail(vty
, argv
[4]->arg
, uj
);
6238 ip_msdp_show_peers(vty
, uj
);
6244 ip_msdp_show_sa(struct vty
*vty
, u_char uj
)
6246 struct listnode
*sanode
;
6247 struct pim_msdp_sa
*sa
;
6248 char src_str
[INET_ADDRSTRLEN
];
6249 char grp_str
[INET_ADDRSTRLEN
];
6250 char rp_str
[INET_ADDRSTRLEN
];
6251 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6255 json_object
*json
= NULL
;
6256 json_object
*json_group
= NULL
;
6257 json_object
*json_row
= NULL
;
6260 json
= json_object_new_object();
6262 vty_out(vty
, "Source Group RP Local SPT Uptime%s", VTY_NEWLINE
);
6265 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6266 now
= pim_time_monotonic_sec();
6267 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6268 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6269 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6270 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6271 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6273 strcpy(spt_str
, "yes");
6275 strcpy(spt_str
, "no");
6278 strcpy(rp_str
, "-");
6279 strcpy(spt_str
, "-");
6281 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6282 strcpy(local_str
, "yes");
6284 strcpy(local_str
, "no");
6287 json_object_object_get_ex(json
, grp_str
, &json_group
);
6290 json_group
= json_object_new_object();
6291 json_object_object_add(json
, grp_str
, json_group
);
6294 json_row
= json_object_new_object();
6295 json_object_string_add(json_row
, "source", src_str
);
6296 json_object_string_add(json_row
, "group", grp_str
);
6297 json_object_string_add(json_row
, "rp", rp_str
);
6298 json_object_string_add(json_row
, "local", local_str
);
6299 json_object_string_add(json_row
, "sptSetup", spt_str
);
6300 json_object_string_add(json_row
, "upTime", timebuf
);
6301 json_object_object_add(json_group
, src_str
, json_row
);
6303 vty_out(vty
, "%-15s %15s %15s %5c %3c %8s%s",
6304 src_str
, grp_str
, rp_str
, local_str
[0], spt_str
[0], timebuf
, VTY_NEWLINE
);
6310 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6311 json_object_free(json
);
6316 ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
, const char *src_str
,
6317 const char *grp_str
, struct vty
*vty
,
6318 u_char uj
, json_object
*json
)
6320 char rp_str
[INET_ADDRSTRLEN
];
6321 char peer_str
[INET_ADDRSTRLEN
];
6322 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6325 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
6327 json_object
*json_group
= NULL
;
6328 json_object
*json_row
= NULL
;
6330 now
= pim_time_monotonic_sec();
6331 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6332 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6333 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6334 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
6336 strcpy(spt_str
, "yes");
6338 strcpy(spt_str
, "no");
6341 strcpy(rp_str
, "-");
6342 strcpy(peer_str
, "-");
6343 strcpy(spt_str
, "-");
6345 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6346 strcpy(local_str
, "yes");
6348 strcpy(local_str
, "no");
6350 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
), sa
->sa_state_timer
);
6352 json_object_object_get_ex(json
, grp_str
, &json_group
);
6355 json_group
= json_object_new_object();
6356 json_object_object_add(json
, grp_str
, json_group
);
6359 json_row
= json_object_new_object();
6360 json_object_string_add(json_row
, "source", src_str
);
6361 json_object_string_add(json_row
, "group", grp_str
);
6362 json_object_string_add(json_row
, "rp", rp_str
);
6363 json_object_string_add(json_row
, "local", local_str
);
6364 json_object_string_add(json_row
, "sptSetup", spt_str
);
6365 json_object_string_add(json_row
, "upTime", timebuf
);
6366 json_object_string_add(json_row
, "stateTimer", statetimer
);
6367 json_object_object_add(json_group
, src_str
, json_row
);
6369 vty_out(vty
, "SA : %s%s", sa
->sg_str
, VTY_NEWLINE
);
6370 vty_out(vty
, " RP : %s%s", rp_str
, VTY_NEWLINE
);
6371 vty_out(vty
, " Peer : %s%s", peer_str
, VTY_NEWLINE
);
6372 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6373 vty_out(vty
, " SPT Setup : %s%s", spt_str
, VTY_NEWLINE
);
6374 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6375 vty_out(vty
, " State Timer : %s%s", statetimer
, VTY_NEWLINE
);
6376 vty_out(vty
, "%s", VTY_NEWLINE
);
6381 ip_msdp_show_sa_detail(struct vty
*vty
, u_char uj
)
6383 struct listnode
*sanode
;
6384 struct pim_msdp_sa
*sa
;
6385 char src_str
[INET_ADDRSTRLEN
];
6386 char grp_str
[INET_ADDRSTRLEN
];
6387 json_object
*json
= NULL
;
6390 json
= json_object_new_object();
6393 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6394 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6395 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6396 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6400 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6401 json_object_free(json
);
6405 DEFUN (show_ip_msdp_sa_detail
,
6406 show_ip_msdp_sa_detail_cmd
,
6407 "show ip msdp sa detail [json]",
6411 "MSDP active-source information\n"
6413 "JavaScript Object Notation\n")
6415 u_char uj
= use_json(argc
, argv
);
6416 ip_msdp_show_sa_detail(vty
, uj
);
6422 ip_msdp_show_sa_addr(struct vty
*vty
, const char *addr
, u_char uj
)
6424 struct listnode
*sanode
;
6425 struct pim_msdp_sa
*sa
;
6426 char src_str
[INET_ADDRSTRLEN
];
6427 char grp_str
[INET_ADDRSTRLEN
];
6428 json_object
*json
= NULL
;
6431 json
= json_object_new_object();
6434 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6435 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6436 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6437 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6438 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6443 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6444 json_object_free(json
);
6449 ip_msdp_show_sa_sg(struct vty
*vty
, const char *src
, const char *grp
, u_char uj
)
6451 struct listnode
*sanode
;
6452 struct pim_msdp_sa
*sa
;
6453 char src_str
[INET_ADDRSTRLEN
];
6454 char grp_str
[INET_ADDRSTRLEN
];
6455 json_object
*json
= NULL
;
6458 json
= json_object_new_object();
6461 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6462 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6463 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6464 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6465 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6470 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6471 json_object_free(json
);
6475 DEFUN (show_ip_msdp_sa_sg
,
6476 show_ip_msdp_sa_sg_cmd
,
6477 "show ip msdp sa [A.B.C.D [A.B.C.D]] [json]",
6481 "MSDP active-source information\n"
6482 "source or group ip\n"
6484 "JavaScript Object Notation\n")
6486 u_char uj
= use_json(argc
, argv
);
6489 char *src_ip
= argv_find (argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
: NULL
;
6490 char *grp_ip
= idx
< argc
&& argv_find (argv
, argc
, "A.B.C.D", &idx
) ?
6491 argv
[idx
]->arg
: NULL
;
6493 if (src_ip
&& grp_ip
)
6494 ip_msdp_show_sa_sg(vty
, src_ip
, grp_ip
, uj
);
6496 ip_msdp_show_sa_addr(vty
, src_ip
, uj
);
6498 ip_msdp_show_sa(vty
, uj
);
6505 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
6506 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
6509 install_node (&debug_node
, pim_debug_config_write
);
6511 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
6512 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
6513 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
6514 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6515 install_element (CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6516 install_element (CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6517 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6518 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6519 install_element (CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6520 install_element (CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6521 install_element (CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6522 install_element (CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6523 install_element (CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6524 install_element (CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6525 install_element (CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6526 install_element (CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6527 install_element (CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6528 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6529 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6530 install_element (CONFIG_NODE
, &ip_pim_packets_cmd
);
6531 install_element (CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6532 install_element (CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6533 install_element (CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6534 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
6535 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6536 install_element (CONFIG_NODE
, &ip_msdp_peer_cmd
);
6537 install_element (CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6538 install_element (CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6539 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6540 install_element (CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6541 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6543 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6544 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6545 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6546 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6547 install_element (INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6548 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6549 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6550 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
6551 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
6552 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
6553 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6554 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6555 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6556 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6557 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6558 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6559 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6560 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6561 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6562 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6564 // Static mroutes NEB
6565 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6566 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
6567 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6568 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
6570 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6571 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
6572 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6573 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6574 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6575 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6576 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
6577 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6578 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6579 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6580 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
6581 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
6582 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6583 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6584 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6585 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6586 install_element (VIEW_NODE
, &show_ip_pim_state_cmd
);
6587 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6588 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6589 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6590 install_element (VIEW_NODE
, &show_ip_pim_rp_cmd
);
6591 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
6592 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
6593 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
6594 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
6595 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6596 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
6597 install_element (VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6598 install_element (VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6600 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6601 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6602 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
6603 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6604 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6606 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
6607 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
6608 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
6609 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6610 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
6611 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6612 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
6613 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6614 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
6615 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
6616 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
6617 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6618 install_element (ENABLE_NODE
, &debug_static_cmd
);
6619 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
6620 install_element (ENABLE_NODE
, &debug_pim_cmd
);
6621 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
6622 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
6623 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
6624 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
6625 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
6626 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6627 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
6628 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6629 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
6630 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
6631 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
6632 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
6633 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6634 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
6635 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
6636 install_element (ENABLE_NODE
, &debug_msdp_cmd
);
6637 install_element (ENABLE_NODE
, &no_debug_msdp_cmd
);
6638 install_element (ENABLE_NODE
, &undebug_msdp_cmd
);
6639 install_element (ENABLE_NODE
, &debug_msdp_events_cmd
);
6640 install_element (ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6641 install_element (ENABLE_NODE
, &undebug_msdp_events_cmd
);
6642 install_element (ENABLE_NODE
, &debug_msdp_packets_cmd
);
6643 install_element (ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6644 install_element (ENABLE_NODE
, &undebug_msdp_packets_cmd
);
6646 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
6647 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
6648 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
6649 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6650 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
6651 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6652 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
6653 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6654 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
6655 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
6656 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
6657 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6658 install_element (CONFIG_NODE
, &debug_static_cmd
);
6659 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
6660 install_element (CONFIG_NODE
, &debug_pim_cmd
);
6661 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
6662 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
6663 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
6664 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
6665 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
6666 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
6667 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
6668 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
6669 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6670 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
6671 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);
6672 install_element (CONFIG_NODE
, &debug_msdp_cmd
);
6673 install_element (CONFIG_NODE
, &no_debug_msdp_cmd
);
6674 install_element (CONFIG_NODE
, &undebug_msdp_cmd
);
6675 install_element (CONFIG_NODE
, &debug_msdp_events_cmd
);
6676 install_element (CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6677 install_element (CONFIG_NODE
, &undebug_msdp_events_cmd
);
6678 install_element (CONFIG_NODE
, &debug_msdp_packets_cmd
);
6679 install_element (CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6680 install_element (CONFIG_NODE
, &undebug_msdp_packets_cmd
);
6681 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6682 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6683 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6684 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6685 install_element (VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6686 install_element (VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6687 install_element (VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6688 install_element (VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6689 install_element (VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6690 install_element (VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6691 install_element (INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6692 install_element (INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);