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 along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 #include "pim_mroute.h"
34 #include "pim_iface.h"
36 #include "pim_mroute.h"
39 #include "pim_igmpv3.h"
44 #include "pim_neighbor.h"
46 #include "pim_ifchannel.h"
47 #include "pim_hello.h"
49 #include "pim_upstream.h"
51 #include "pim_macro.h"
52 #include "pim_ssmpingd.h"
53 #include "pim_zebra.h"
54 #include "pim_static.h"
56 #include "pim_zlookup.h"
63 static struct cmd_node pim_global_node
= {
69 static struct cmd_node interface_node
= {
75 static struct cmd_node debug_node
=
82 static void pim_if_membership_clear(struct interface
*ifp
)
84 struct pim_interface
*pim_ifp
;
89 if (PIM_IF_TEST_PIM(pim_ifp
->options
) &&
90 PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
94 pim_ifchannel_membership_clear(ifp
);
98 When PIM is disabled on interface, IGMPv3 local membership
99 information is not injected into PIM interface state.
101 The function pim_if_membership_refresh() fetches all IGMPv3 local
102 membership information into PIM. It is intented to be called
103 whenever PIM is enabled on the interface in order to collect missed
104 local membership information.
106 static void pim_if_membership_refresh(struct interface
*ifp
)
108 struct pim_interface
*pim_ifp
;
109 struct listnode
*sock_node
;
110 struct igmp_sock
*igmp
;
115 if (!PIM_IF_TEST_PIM(pim_ifp
->options
))
117 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
121 First clear off membership from all PIM (S,G) entries on the
125 pim_ifchannel_membership_clear(ifp
);
128 Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on
132 /* scan igmp sockets */
133 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
134 struct listnode
*grpnode
;
135 struct igmp_group
*grp
;
137 /* scan igmp groups */
138 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
139 struct listnode
*srcnode
;
140 struct igmp_source
*src
;
142 /* scan group sources */
143 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
145 if (IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
)) {
148 memset (&sg
, 0, sizeof (struct prefix_sg
));
149 sg
.src
= src
->source_addr
;
150 sg
.grp
= grp
->group_addr
;
151 pim_ifchannel_local_membership_add(ifp
, &sg
);
154 } /* scan group sources */
155 } /* scan igmp groups */
156 } /* scan igmp sockets */
159 Finally delete every PIM (S,G) entry lacking all state info
162 pim_ifchannel_delete_on_noinfo(ifp
);
166 static void pim_show_assert(struct vty
*vty
)
168 struct pim_interface
*pim_ifp
;
169 struct pim_ifchannel
*ch
;
170 struct listnode
*ch_node
;
171 struct in_addr ifaddr
;
174 now
= pim_time_monotonic_sec();
177 "Interface Address Source Group State Winner Uptime Timer%s",
180 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
181 char ch_src_str
[INET_ADDRSTRLEN
];
182 char ch_grp_str
[INET_ADDRSTRLEN
];
183 char winner_str
[INET_ADDRSTRLEN
];
187 pim_ifp
= ch
->interface
->info
;
192 ifaddr
= pim_ifp
->primary_address
;
194 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
195 ch_src_str
, sizeof(ch_src_str
));
196 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
197 ch_grp_str
, sizeof(ch_grp_str
));
198 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
,
199 winner_str
, sizeof(winner_str
));
201 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
202 pim_time_timer_to_mmss(timer
, sizeof(timer
),
203 ch
->t_ifassert_timer
);
205 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
210 pim_ifchannel_ifassert_name(ch
->ifassert_state
),
215 } /* scan interface channels */
218 static void pim_show_assert_internal(struct vty
*vty
)
220 struct pim_interface
*pim_ifp
;
221 struct listnode
*ch_node
;
222 struct pim_ifchannel
*ch
;
223 struct in_addr ifaddr
;
227 "ECA: Evaluate CouldAssert%s"
228 "ATD: AssertTrackingDesired%s"
229 "eATD: Evaluate AssertTrackingDesired%s%s",
230 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
233 "Interface Address Source Group CA eCA ATD eATD%s",
236 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
237 pim_ifp
= ch
->interface
->info
;
242 ifaddr
= pim_ifp
->primary_address
;
244 char ch_src_str
[INET_ADDRSTRLEN
];
245 char ch_grp_str
[INET_ADDRSTRLEN
];
247 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
248 ch_src_str
, sizeof(ch_src_str
));
249 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
250 ch_grp_str
, sizeof(ch_grp_str
));
251 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
256 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
257 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
258 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes" : "no",
259 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no",
261 } /* scan interface channels */
264 static void pim_show_assert_metric(struct vty
*vty
)
266 struct pim_interface
*pim_ifp
;
267 struct listnode
*ch_node
;
268 struct pim_ifchannel
*ch
;
269 struct in_addr ifaddr
;
272 "Interface Address Source Group RPT Pref Metric Address %s",
275 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
276 pim_ifp
= ch
->interface
->info
;
281 ifaddr
= pim_ifp
->primary_address
;
283 char ch_src_str
[INET_ADDRSTRLEN
];
284 char ch_grp_str
[INET_ADDRSTRLEN
];
285 char addr_str
[INET_ADDRSTRLEN
];
286 struct pim_assert_metric am
;
288 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
, pim_ifp
->primary_address
);
290 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
291 ch_src_str
, sizeof(ch_src_str
));
292 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
293 ch_grp_str
, sizeof(ch_grp_str
));
294 pim_inet4_dump("<addr?>", am
.ip_address
,
295 addr_str
, sizeof(addr_str
));
297 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s%s",
302 am
.rpt_bit_flag
? "yes" : "no",
303 am
.metric_preference
,
307 } /* scan interface channels */
310 static void pim_show_assert_winner_metric(struct vty
*vty
)
312 struct pim_interface
*pim_ifp
;
313 struct listnode
*ch_node
;
314 struct pim_ifchannel
*ch
;
315 struct in_addr ifaddr
;
318 "Interface Address Source Group RPT Pref Metric Address %s",
321 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
322 pim_ifp
= ch
->interface
->info
;
327 ifaddr
= pim_ifp
->primary_address
;
329 char ch_src_str
[INET_ADDRSTRLEN
];
330 char ch_grp_str
[INET_ADDRSTRLEN
];
331 char addr_str
[INET_ADDRSTRLEN
];
332 struct pim_assert_metric
*am
;
336 am
= &ch
->ifassert_winner_metric
;
338 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
339 ch_src_str
, sizeof(ch_src_str
));
340 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
341 ch_grp_str
, sizeof(ch_grp_str
));
342 pim_inet4_dump("<addr?>", am
->ip_address
,
343 addr_str
, sizeof(addr_str
));
345 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
346 snprintf(pref_str
, sizeof(pref_str
), "INFI");
348 snprintf(pref_str
, sizeof(pref_str
), "%4u", am
->metric_preference
);
350 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
351 snprintf(metr_str
, sizeof(metr_str
), "INFI");
353 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
355 vty_out(vty
, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
360 am
->rpt_bit_flag
? "yes" : "no",
365 } /* scan interface channels */
368 static void json_object_pim_ifp_add(struct json_object
*json
, struct interface
*ifp
)
370 struct pim_interface
*pim_ifp
;
373 json_object_string_add(json
, "name", ifp
->name
);
374 json_object_string_add(json
, "state", if_is_up(ifp
) ? "up" : "down");
375 json_object_string_add(json
, "address", inet_ntoa(pim_ifp
->primary_address
));
376 json_object_int_add(json
, "index", ifp
->ifindex
);
378 if (if_is_multicast(ifp
))
379 json_object_boolean_true_add(json
, "flagMulticast");
381 if (if_is_broadcast(ifp
))
382 json_object_boolean_true_add(json
, "flagBroadcast");
384 if (ifp
->flags
& IFF_ALLMULTI
)
385 json_object_boolean_true_add(json
, "flagAllMulticast");
387 if (ifp
->flags
& IFF_PROMISC
)
388 json_object_boolean_true_add(json
, "flagPromiscuous");
390 if (PIM_IF_IS_DELETED(ifp
))
391 json_object_boolean_true_add(json
, "flagDeleted");
393 if (pim_if_lan_delay_enabled(ifp
))
394 json_object_boolean_true_add(json
, "lanDelayEnabled");
397 static void pim_show_membership(struct vty
*vty
, u_char uj
)
399 struct pim_interface
*pim_ifp
;
400 struct listnode
*ch_node
;
401 struct pim_ifchannel
*ch
;
403 json_object
*json
= NULL
;
404 json_object
*json_iface
= NULL
;
405 json_object
*json_row
= NULL
;
406 json_object
*json_tmp
= NULL
;
408 json
= json_object_new_object();
410 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
412 pim_ifp
= ch
->interface
->info
;
417 char ch_src_str
[INET_ADDRSTRLEN
];
418 char ch_grp_str
[INET_ADDRSTRLEN
];
420 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
421 ch_src_str
, sizeof(ch_src_str
));
422 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
423 ch_grp_str
, sizeof(ch_grp_str
));
425 json_object_object_get_ex(json
, ch
->interface
->name
, &json_iface
);
428 json_iface
= json_object_new_object();
429 json_object_pim_ifp_add(json_iface
, ch
->interface
);
430 json_object_object_add(json
, ch
->interface
->name
, json_iface
);
433 json_row
= json_object_new_object();
434 json_object_string_add(json_row
, "source", ch_src_str
);
435 json_object_string_add(json_row
, "group", ch_grp_str
);
436 json_object_string_add(json_row
, "localMembership",
437 ch
->local_ifmembership
== PIM_IFMEMBERSHIP_NOINFO
? "NOINFO" : "INCLUDE");
438 json_object_object_add(json_iface
, ch_grp_str
, json_row
);
439 } /* scan interface channels */
442 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
445 "Interface Address Source Group Membership%s",
449 * Example of the json data we are traversing
455 * "address":"10.1.20.1",
457 * "flagMulticast":true,
458 * "flagBroadcast":true,
459 * "lanDelayEnabled":true,
462 * "group":"226.10.10.10",
463 * "localMembership":"INCLUDE"
469 /* foreach interface */
470 json_object_object_foreach(json
, key
, val
) {
472 /* Find all of the keys where the val is an object. In the example
473 * above the only one is 226.10.10.10
475 json_object_object_foreach(val
, if_field_key
, if_field_val
) {
476 type
= json_object_get_type(if_field_val
);
478 if (type
== json_type_object
) {
479 vty_out(vty
, "%-9s ", key
);
481 json_object_object_get_ex(val
, "address", &json_tmp
);
482 vty_out(vty
, "%-15s ", json_object_get_string(json_tmp
));
484 json_object_object_get_ex(if_field_val
, "source", &json_tmp
);
485 vty_out(vty
, "%-15s ", json_object_get_string(json_tmp
));
488 vty_out(vty
, "%-15s ", if_field_key
);
490 json_object_object_get_ex(if_field_val
, "localMembership", &json_tmp
);
491 vty_out(vty
, "%-10s%s", json_object_get_string(json_tmp
), VTY_NEWLINE
);
497 json_object_free(json
);
500 static void pim_print_ifp_flags(struct vty
*vty
, struct interface
*ifp
, int mloop
)
502 vty_out(vty
, "Flags%s", VTY_NEWLINE
);
503 vty_out(vty
, "-----%s", VTY_NEWLINE
);
504 vty_out(vty
, "All Multicast : %s%s", (ifp
->flags
& IFF_ALLMULTI
) ? "yes" : "no", VTY_NEWLINE
);
505 vty_out(vty
, "Broadcast : %s%s", if_is_broadcast(ifp
)? "yes" : "no", VTY_NEWLINE
);
506 vty_out(vty
, "Deleted : %s%s", PIM_IF_IS_DELETED(ifp
) ? "yes" : "no", VTY_NEWLINE
);
507 vty_out(vty
, "Interface Index : %d%s", ifp
->ifindex
, VTY_NEWLINE
);
508 vty_out(vty
, "Multicast : %s%s", if_is_multicast(ifp
) ? "yes" : "no", VTY_NEWLINE
);
509 vty_out(vty
, "Multicast Loop : %d%s", mloop
, VTY_NEWLINE
);
510 vty_out(vty
, "Promiscuous : %s%s", (ifp
->flags
& IFF_PROMISC
) ? "yes" : "no", VTY_NEWLINE
);
511 vty_out(vty
, "%s", VTY_NEWLINE
);
512 vty_out(vty
, "%s", VTY_NEWLINE
);
515 static void igmp_show_interfaces(struct vty
*vty
, u_char uj
)
517 struct listnode
*node
;
518 struct interface
*ifp
;
520 json_object
*json
= NULL
;
521 json_object
*json_row
= NULL
;
523 now
= pim_time_monotonic_sec();
526 json
= json_object_new_object();
529 "Interface State Address V Querier Query Timer Uptime%s",
532 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
533 struct pim_interface
*pim_ifp
;
534 struct listnode
*sock_node
;
535 struct igmp_sock
*igmp
;
542 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
544 char query_hhmmss
[10];
546 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
547 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
550 json_row
= json_object_new_object();
551 json_object_pim_ifp_add(json_row
, ifp
);
552 json_object_string_add(json_row
, "upTime", uptime
);
553 json_object_int_add(json_row
, "version", pim_ifp
->igmp_version
);
555 if (igmp
->t_igmp_query_timer
) {
556 json_object_boolean_true_add(json_row
, "querier");
557 json_object_string_add(json_row
, "queryTimer", query_hhmmss
);
560 json_object_object_add(json
, ifp
->name
, json_row
);
563 vty_out(vty
, "%-9s %5s %15s %d %7s %11s %8s%s",
565 if_is_up(ifp
) ? "up" : "down",
566 inet_ntoa(igmp
->ifaddr
),
567 pim_ifp
->igmp_version
,
568 igmp
->t_igmp_query_timer
? "local" : "other",
577 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
578 json_object_free(json
);
582 static void igmp_show_interfaces_single(struct vty
*vty
, const char *ifname
, u_char uj
)
584 struct igmp_sock
*igmp
;
585 struct interface
*ifp
;
586 struct listnode
*node
;
587 struct listnode
*sock_node
;
588 struct pim_interface
*pim_ifp
;
590 char query_hhmmss
[10];
591 char other_hhmmss
[10];
592 int found_ifname
= 0;
595 long gmi_msec
; /* Group Membership Interval */
598 long oqpi_msec
; /* Other Querier Present Interval */
602 json_object
*json
= NULL
;
603 json_object
*json_row
= NULL
;
606 json
= json_object_new_object();
608 now
= pim_time_monotonic_sec();
610 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
616 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
619 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
621 pim_time_uptime(uptime
, sizeof(uptime
), now
- igmp
->sock_creation
);
622 pim_time_timer_to_hhmmss(query_hhmmss
, sizeof(query_hhmmss
), igmp
->t_igmp_query_timer
);
623 pim_time_timer_to_hhmmss(other_hhmmss
, sizeof(other_hhmmss
), igmp
->t_other_querier_timer
);
625 gmi_msec
= PIM_IGMP_GMI_MSEC(igmp
->querier_robustness_variable
,
626 igmp
->querier_query_interval
,
627 pim_ifp
->igmp_query_max_response_time_dsec
);
629 sqi
= PIM_IGMP_SQI(pim_ifp
->igmp_default_query_interval
);
631 oqpi_msec
= PIM_IGMP_OQPI_MSEC(igmp
->querier_robustness_variable
,
632 igmp
->querier_query_interval
,
633 pim_ifp
->igmp_query_max_response_time_dsec
);
635 lmqt_msec
= PIM_IGMP_LMQT_MSEC(pim_ifp
->igmp_query_max_response_time_dsec
,
636 igmp
->querier_robustness_variable
);
638 ohpi_msec
= PIM_IGMP_OHPI_DSEC(igmp
->querier_robustness_variable
,
639 igmp
->querier_query_interval
,
640 pim_ifp
->igmp_query_max_response_time_dsec
) * 100;
642 qri_msec
= pim_ifp
->igmp_query_max_response_time_dsec
* 100;
643 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
646 json_row
= json_object_new_object();
647 json_object_pim_ifp_add(json_row
, ifp
);
648 json_object_string_add(json_row
, "upTime", uptime
);
649 json_object_string_add(json_row
, "querier", igmp
->t_igmp_query_timer
? "local" : "other");
650 json_object_int_add(json_row
, "queryStartCount", igmp
->startup_query_count
);
651 json_object_string_add(json_row
, "queryQueryTimer", query_hhmmss
);
652 json_object_string_add(json_row
, "queryOtherTimer", other_hhmmss
);
653 json_object_int_add(json_row
, "version", pim_ifp
->igmp_version
);
654 json_object_int_add(json_row
, "timerGroupMembershipIntervalMsec", gmi_msec
);
655 json_object_int_add(json_row
, "timerLastMemberQueryMsec", lmqt_msec
);
656 json_object_int_add(json_row
, "timerOlderHostPresentIntervalMsec", ohpi_msec
);
657 json_object_int_add(json_row
, "timerOtherQuerierPresentIntervalMsec", oqpi_msec
);
658 json_object_int_add(json_row
, "timerQueryInterval", igmp
->querier_query_interval
);
659 json_object_int_add(json_row
, "timerQueryResponseIntervalMsec", qri_msec
);
660 json_object_int_add(json_row
, "timerRobustnessVariable", igmp
->querier_robustness_variable
);
661 json_object_int_add(json_row
, "timerStartupQueryInterval", sqi
);
663 json_object_object_add(json
, ifp
->name
, json_row
);
666 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
667 vty_out(vty
, "State : %s%s", if_is_up(ifp
) ? "up" : "down", VTY_NEWLINE
);
668 vty_out(vty
, "Address : %s%s", inet_ntoa(pim_ifp
->primary_address
), VTY_NEWLINE
);
669 vty_out(vty
, "Uptime : %s%s", uptime
, VTY_NEWLINE
);
670 vty_out(vty
, "Version : %d%s", pim_ifp
->igmp_version
, VTY_NEWLINE
);
671 vty_out(vty
, "%s", VTY_NEWLINE
);
672 vty_out(vty
, "%s", VTY_NEWLINE
);
674 vty_out(vty
, "Querier%s", VTY_NEWLINE
);
675 vty_out(vty
, "-------%s", VTY_NEWLINE
);
676 vty_out(vty
, "Querier : %s%s", igmp
->t_igmp_query_timer
? "local" : "other", VTY_NEWLINE
);
677 vty_out(vty
, "Start Count : %d%s", igmp
->startup_query_count
, VTY_NEWLINE
);
678 vty_out(vty
, "Query Timer : %s%s", query_hhmmss
, VTY_NEWLINE
);
679 vty_out(vty
, "Other Timer : %s%s", other_hhmmss
, VTY_NEWLINE
);
680 vty_out(vty
, "%s", VTY_NEWLINE
);
681 vty_out(vty
, "%s", VTY_NEWLINE
);
683 vty_out(vty
, "Timers%s", VTY_NEWLINE
);
684 vty_out(vty
, "------%s", VTY_NEWLINE
);
685 vty_out(vty
, "Group Membership Interval : %lis%s", gmi_msec
/1000, VTY_NEWLINE
);
686 vty_out(vty
, "Last Member Query Time : %lis%s", lmqt_msec
/1000, VTY_NEWLINE
);
687 vty_out(vty
, "Older Host Present Interval : %lis%s", ohpi_msec
/1000, VTY_NEWLINE
);
688 vty_out(vty
, "Other Querier Present Interval : %lis%s", oqpi_msec
/1000, VTY_NEWLINE
);
689 vty_out(vty
, "Query Interval : %ds%s", igmp
->querier_query_interval
, VTY_NEWLINE
);
690 vty_out(vty
, "Query Response Interval : %lis%s", qri_msec
/1000, VTY_NEWLINE
);
691 vty_out(vty
, "Robustness Variable : %d%s", igmp
->querier_robustness_variable
, VTY_NEWLINE
);
692 vty_out(vty
, "Startup Query Interval : %ds%s", sqi
, VTY_NEWLINE
);
693 vty_out(vty
, "%s", VTY_NEWLINE
);
694 vty_out(vty
, "%s", VTY_NEWLINE
);
696 pim_print_ifp_flags(vty
, ifp
, mloop
);
702 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
703 json_object_free(json
);
706 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
710 static void igmp_show_interface_join(struct vty
*vty
)
712 struct listnode
*node
;
713 struct interface
*ifp
;
716 now
= pim_time_monotonic_sec();
719 "Interface Address Source Group Socket Uptime %s",
722 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
723 struct pim_interface
*pim_ifp
;
724 struct listnode
*join_node
;
725 struct igmp_join
*ij
;
726 struct in_addr pri_addr
;
727 char pri_addr_str
[INET_ADDRSTRLEN
];
734 if (!pim_ifp
->igmp_join_list
)
737 pri_addr
= pim_find_primary_addr(ifp
);
738 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
, sizeof(pri_addr_str
));
740 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, join_node
, ij
)) {
741 char group_str
[INET_ADDRSTRLEN
];
742 char source_str
[INET_ADDRSTRLEN
];
745 pim_time_uptime(uptime
, sizeof(uptime
), now
- ij
->sock_creation
);
746 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
747 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
749 vty_out(vty
, "%-9s %-15s %-15s %-15s %6d %8s%s",
757 } /* for (pim_ifp->igmp_join_list) */
763 static void pim_show_interfaces_single(struct vty
*vty
, const char *ifname
, u_char uj
)
765 struct in_addr ifaddr
;
766 struct interface
*ifp
;
767 struct listnode
*neighnode
;
768 struct listnode
*node
;
769 struct listnode
*upnode
;
770 struct pim_interface
*pim_ifp
;
771 struct pim_neighbor
*neigh
;
772 struct pim_upstream
*up
;
774 char dr_str
[INET_ADDRSTRLEN
];
777 char grp_str
[INET_ADDRSTRLEN
];
778 char hello_period
[10];
779 char hello_timer
[10];
780 char neigh_src_str
[INET_ADDRSTRLEN
];
781 char src_str
[INET_ADDRSTRLEN
];
782 char stat_uptime
[10];
785 int found_ifname
= 0;
787 json_object
*json
= NULL
;
788 json_object
*json_row
= NULL
;
789 json_object
*json_pim_neighbor
= NULL
;
790 json_object
*json_pim_neighbors
= NULL
;
791 json_object
*json_group
= NULL
;
792 json_object
*json_group_source
= NULL
;
793 json_object
*json_fhr_sources
= NULL
;
794 struct pim_secondary_addr
*sec_addr
;
795 struct listnode
*sec_node
;
797 now
= pim_time_monotonic_sec();
800 json
= json_object_new_object();
802 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
808 if (pim_ifp
->pim_sock_fd
< 0)
811 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
815 ifaddr
= pim_ifp
->primary_address
;
816 pim_inet4_dump("<dr?>", pim_ifp
->pim_dr_addr
, dr_str
, sizeof(dr_str
));
817 pim_time_uptime_begin(dr_uptime
, sizeof(dr_uptime
), now
, pim_ifp
->pim_dr_election_last
);
818 pim_time_timer_to_hhmmss(hello_timer
, sizeof(hello_timer
), pim_ifp
->t_pim_hello_timer
);
819 pim_time_mmss(hello_period
, sizeof(hello_period
), pim_ifp
->pim_hello_period
);
820 pim_time_uptime(stat_uptime
, sizeof(stat_uptime
), now
- pim_ifp
->pim_ifstat_start
);
821 mloop
= pim_socket_mcastloop_get(pim_ifp
->pim_sock_fd
);
824 char pbuf
[PREFIX2STR_BUFFER
];
825 json_row
= json_object_new_object();
826 json_object_pim_ifp_add(json_row
, ifp
);
828 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
829 json_object_string_add(json_row
, "useSource", inet_ntoa(pim_ifp
->update_source
));
831 if (pim_ifp
->sec_addr_list
) {
832 json_object
*sec_list
= NULL
;
834 sec_list
= json_object_new_array();
835 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
836 json_object_array_add(sec_list
,
837 json_object_new_string(prefix2str(&sec_addr
->addr
,
841 json_object_object_add(json_row
, "secondaryAddressList", sec_list
);
845 if (pim_ifp
->pim_neighbor_list
->count
) {
846 json_pim_neighbors
= json_object_new_object();
848 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
849 json_pim_neighbor
= json_object_new_object();
850 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
851 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
852 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
854 json_object_string_add(json_pim_neighbor
, "address", neigh_src_str
);
855 json_object_string_add(json_pim_neighbor
, "upTime", uptime
);
856 json_object_string_add(json_pim_neighbor
, "holdtime", expire
);
858 json_object_object_add(json_pim_neighbors
, neigh_src_str
, json_pim_neighbor
);
861 json_object_object_add(json_row
, "neighbors", json_pim_neighbors
);
864 json_object_string_add(json_row
, "drAddress", dr_str
);
865 json_object_int_add(json_row
, "drPriority", pim_ifp
->pim_dr_priority
);
866 json_object_string_add(json_row
, "drUptime", dr_uptime
);
867 json_object_int_add(json_row
, "drElections", pim_ifp
->pim_dr_election_count
);
868 json_object_int_add(json_row
, "drChanges", pim_ifp
->pim_dr_election_changes
);
871 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
872 if (ifp
== up
->rpf
.source_nexthop
.interface
) {
873 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
874 if (!json_fhr_sources
) {
875 json_fhr_sources
= json_object_new_object();
878 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
879 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
880 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
882 /* Does this group live in json_fhr_sources? If not create it. */
883 json_object_object_get_ex(json_fhr_sources
, grp_str
, &json_group
);
886 json_group
= json_object_new_object();
887 json_object_object_add(json_fhr_sources
, grp_str
, json_group
);
890 json_group_source
= json_object_new_object();
891 json_object_string_add(json_group_source
, "source", src_str
);
892 json_object_string_add(json_group_source
, "group", grp_str
);
893 json_object_string_add(json_group_source
, "upTime", uptime
);
894 json_object_object_add(json_group
, src_str
, json_group_source
);
899 if (json_fhr_sources
) {
900 json_object_object_add(json_row
, "firstHopRouter", json_fhr_sources
);
903 json_object_int_add(json_row
, "helloPeriod", pim_ifp
->pim_hello_period
);
904 json_object_string_add(json_row
, "helloTimer", hello_timer
);
905 json_object_string_add(json_row
, "helloStatStart", stat_uptime
);
906 json_object_int_add(json_row
, "helloReceived", pim_ifp
->pim_ifstat_hello_recv
);
907 json_object_int_add(json_row
, "helloReceivedFailed", pim_ifp
->pim_ifstat_hello_recvfail
);
908 json_object_int_add(json_row
, "helloSend", pim_ifp
->pim_ifstat_hello_sent
);
909 json_object_int_add(json_row
, "hellosendFailed", pim_ifp
->pim_ifstat_hello_sendfail
);
910 json_object_int_add(json_row
, "helloGenerationId", pim_ifp
->pim_generation_id
);
911 json_object_int_add(json_row
, "flagMulticastLoop", mloop
);
913 json_object_int_add(json_row
, "effectivePropagationDelay", pim_if_effective_propagation_delay_msec(ifp
));
914 json_object_int_add(json_row
, "effectiveOverrideInterval", pim_if_effective_override_interval_msec(ifp
));
915 json_object_int_add(json_row
, "joinPruneOverrideInterval", pim_if_jp_override_interval_msec(ifp
));
917 json_object_int_add(json_row
, "propagationDelay", pim_ifp
->pim_propagation_delay_msec
);
918 json_object_int_add(json_row
, "propagationDelayHighest", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
);
919 json_object_int_add(json_row
, "overrideInterval", pim_ifp
->pim_override_interval_msec
);
920 json_object_int_add(json_row
, "overrideIntervalHighest", pim_ifp
->pim_neighbors_highest_override_interval_msec
);
921 json_object_object_add(json
, ifp
->name
, json_row
);
924 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
925 vty_out(vty
, "State : %s%s", if_is_up(ifp
) ? "up" : "down", VTY_NEWLINE
);
926 if (pim_ifp
->update_source
.s_addr
!= INADDR_ANY
) {
927 vty_out(vty
, "Use Source : %s%s", inet_ntoa(pim_ifp
->update_source
), VTY_NEWLINE
);
929 if (pim_ifp
->sec_addr_list
) {
930 char pbuf
[PREFIX2STR_BUFFER
];
931 vty_out(vty
, "Address : %s (primary)%s",
932 inet_ntoa(ifaddr
), VTY_NEWLINE
);
933 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->sec_addr_list
, sec_node
, sec_addr
)) {
934 vty_out(vty
, " %s%s",
935 prefix2str(&sec_addr
->addr
,
937 sizeof(pbuf
)), VTY_NEWLINE
);
940 vty_out(vty
, "Address : %s%s", inet_ntoa(ifaddr
), VTY_NEWLINE
);
942 vty_out(vty
, "%s", VTY_NEWLINE
);
947 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
950 vty_out(vty
, "PIM Neighbors%s", VTY_NEWLINE
);
951 vty_out(vty
, "-------------%s", VTY_NEWLINE
);
955 pim_inet4_dump("<src?>", neigh
->source_addr
, neigh_src_str
, sizeof(neigh_src_str
));
956 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
957 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
958 vty_out(vty
, "%-15s : up for %s, holdtime expires in %s%s", neigh_src_str
, uptime
, expire
, VTY_NEWLINE
);
962 vty_out(vty
, "%s", VTY_NEWLINE
);
963 vty_out(vty
, "%s", VTY_NEWLINE
);
966 vty_out(vty
, "Designated Router%s", VTY_NEWLINE
);
967 vty_out(vty
, "-----------------%s", VTY_NEWLINE
);
968 vty_out(vty
, "Address : %s%s", dr_str
, VTY_NEWLINE
);
969 vty_out(vty
, "Priority : %d%s", pim_ifp
->pim_dr_priority
, VTY_NEWLINE
);
970 vty_out(vty
, "Uptime : %s%s", dr_uptime
, VTY_NEWLINE
);
971 vty_out(vty
, "Elections : %d%s", pim_ifp
->pim_dr_election_count
, VTY_NEWLINE
);
972 vty_out(vty
, "Changes : %d%s", pim_ifp
->pim_dr_election_changes
, VTY_NEWLINE
);
973 vty_out(vty
, "%s", VTY_NEWLINE
);
974 vty_out(vty
, "%s", VTY_NEWLINE
);
978 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
979 if (strcmp(ifp
->name
, up
->rpf
.source_nexthop
.interface
->name
) == 0) {
980 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
) {
983 vty_out(vty
, "FHR - First Hop Router%s", VTY_NEWLINE
);
984 vty_out(vty
, "----------------------%s", VTY_NEWLINE
);
988 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
989 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
990 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
991 vty_out(vty
, "%s : %s is a source, uptime is %s%s", grp_str
, src_str
, uptime
, VTY_NEWLINE
);
997 vty_out(vty
, "%s", VTY_NEWLINE
);
998 vty_out(vty
, "%s", VTY_NEWLINE
);
1001 vty_out(vty
, "Hellos%s", VTY_NEWLINE
);
1002 vty_out(vty
, "------%s", VTY_NEWLINE
);
1003 vty_out(vty
, "Period : %d%s", pim_ifp
->pim_hello_period
, VTY_NEWLINE
);
1004 vty_out(vty
, "Timer : %s%s", hello_timer
, VTY_NEWLINE
);
1005 vty_out(vty
, "StatStart : %s%s", stat_uptime
, VTY_NEWLINE
);
1006 vty_out(vty
, "Receive : %d%s", pim_ifp
->pim_ifstat_hello_recv
, VTY_NEWLINE
);
1007 vty_out(vty
, "Receive Failed : %d%s", pim_ifp
->pim_ifstat_hello_recvfail
, VTY_NEWLINE
);
1008 vty_out(vty
, "Send : %d%s", pim_ifp
->pim_ifstat_hello_sent
, VTY_NEWLINE
);
1009 vty_out(vty
, "Send Failed : %d%s", pim_ifp
->pim_ifstat_hello_sendfail
, VTY_NEWLINE
);
1010 vty_out(vty
, "Generation ID : %08x%s", pim_ifp
->pim_generation_id
, VTY_NEWLINE
);
1011 vty_out(vty
, "%s", VTY_NEWLINE
);
1012 vty_out(vty
, "%s", VTY_NEWLINE
);
1014 pim_print_ifp_flags(vty
, ifp
, mloop
);
1016 vty_out(vty
, "Join Prune Interval%s", VTY_NEWLINE
);
1017 vty_out(vty
, "-------------------%s", VTY_NEWLINE
);
1018 vty_out(vty
, "LAN Delay : %s%s", pim_if_lan_delay_enabled(ifp
) ? "yes" : "no", VTY_NEWLINE
);
1019 vty_out(vty
, "Effective Propagation Delay : %d msec%s", pim_if_effective_propagation_delay_msec(ifp
), VTY_NEWLINE
);
1020 vty_out(vty
, "Effective Override Interval : %d msec%s", pim_if_effective_override_interval_msec(ifp
), VTY_NEWLINE
);
1021 vty_out(vty
, "Join Prune Override Interval : %d msec%s", pim_if_jp_override_interval_msec(ifp
), VTY_NEWLINE
);
1022 vty_out(vty
, "%s", VTY_NEWLINE
);
1023 vty_out(vty
, "%s", VTY_NEWLINE
);
1025 vty_out(vty
, "LAN Prune Delay%s", VTY_NEWLINE
);
1026 vty_out(vty
, "---------------%s", VTY_NEWLINE
);
1027 vty_out(vty
, "Propagation Delay : %d msec%s", pim_ifp
->pim_propagation_delay_msec
, VTY_NEWLINE
);
1028 vty_out(vty
, "Propagation Delay (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_propagation_delay_msec
, VTY_NEWLINE
);
1029 vty_out(vty
, "Override Interval : %d msec%s", pim_ifp
->pim_override_interval_msec
, VTY_NEWLINE
);
1030 vty_out(vty
, "Override Interval (Highest) : %d msec%s", pim_ifp
->pim_neighbors_highest_override_interval_msec
, VTY_NEWLINE
);
1031 vty_out(vty
, "%s", VTY_NEWLINE
);
1032 vty_out(vty
, "%s", VTY_NEWLINE
);
1037 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1038 json_object_free(json
);
1041 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
1045 static void pim_show_interfaces(struct vty
*vty
, u_char uj
)
1047 struct interface
*ifp
;
1048 struct listnode
*node
;
1049 struct listnode
*upnode
;
1050 struct pim_interface
*pim_ifp
;
1051 struct pim_upstream
*up
;
1054 int pim_ifchannels
= 0;
1055 json_object
*json
= NULL
;
1056 json_object
*json_row
= NULL
;
1057 json_object
*json_tmp
;
1059 json
= json_object_new_object();
1061 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1062 pim_ifp
= ifp
->info
;
1067 if (pim_ifp
->pim_sock_fd
< 0)
1070 pim_nbrs
= pim_ifp
->pim_neighbor_list
->count
;
1071 pim_ifchannels
= pim_ifp
->pim_ifchannel_list
->count
;
1074 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
))
1075 if (ifp
== up
->rpf
.source_nexthop
.interface
)
1076 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1079 json_row
= json_object_new_object();
1080 json_object_pim_ifp_add(json_row
, ifp
);
1081 json_object_int_add(json_row
, "pimNeighbors", pim_nbrs
);
1082 json_object_int_add(json_row
, "pimIfChannels", pim_ifchannels
);
1083 json_object_int_add(json_row
, "firstHopRouter", fhr
);
1084 json_object_string_add(json_row
, "pimDesignatedRouter", inet_ntoa(pim_ifp
->pim_dr_addr
));
1086 if (pim_ifp
->pim_dr_addr
.s_addr
== pim_ifp
->primary_address
.s_addr
)
1087 json_object_boolean_true_add(json_row
, "pimDesignatedRouterLocal");
1089 json_object_object_add(json
, ifp
->name
, json_row
);
1093 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1095 vty_out(vty
, "Interface State Address PIM Nbrs PIM DR FHR IfChannels%s", VTY_NEWLINE
);
1097 json_object_object_foreach(json
, key
, val
) {
1098 vty_out(vty
, "%-9s ", key
);
1100 json_object_object_get_ex(val
, "state", &json_tmp
);
1101 vty_out(vty
, "%5s ", json_object_get_string(json_tmp
));
1103 json_object_object_get_ex(val
, "address", &json_tmp
);
1104 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1106 json_object_object_get_ex(val
, "pimNeighbors", &json_tmp
);
1107 vty_out(vty
, "%8d ", json_object_get_int(json_tmp
));
1109 if (json_object_object_get_ex(val
, "pimDesignatedRouterLocal", &json_tmp
)) {
1110 vty_out(vty
, "%15s ", "local");
1112 json_object_object_get_ex(val
, "pimDesignatedRouter", &json_tmp
);
1113 vty_out(vty
, "%15s ", json_object_get_string(json_tmp
));
1116 json_object_object_get_ex(val
, "firstHopRouter", &json_tmp
);
1117 vty_out(vty
, "%3d ", json_object_get_int(json_tmp
));
1119 json_object_object_get_ex(val
, "pimIfChannels", &json_tmp
);
1120 vty_out(vty
, "%9d%s", json_object_get_int(json_tmp
), VTY_NEWLINE
);
1124 json_object_free(json
);
1127 static void pim_show_interface_traffic (struct vty
*vty
, u_char uj
)
1129 struct interface
*ifp
= NULL
;
1130 struct pim_interface
*pim_ifp
= NULL
;
1131 struct listnode
*node
= NULL
;
1132 json_object
*json
= NULL
;
1133 json_object
*json_row
= NULL
;
1136 json
= json_object_new_object ();
1139 vty_out (vty
, "%s", VTY_NEWLINE
);
1140 vty_out (vty
, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s%s", "Interface",
1141 " HELLO", " JOIN", " PRUNE", " REGISTER",
1142 " REGISTER-STOP", " ASSERT", VTY_NEWLINE
);
1144 "%-10s%-18s%-17s%-17s%-17s%-17s%-17s%s",
1145 "", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx",
1146 " Rx/Tx", " Rx/Tx", VTY_NEWLINE
);
1148 "---------------------------------------------------------------------------------------------------------------%s",
1152 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
1154 pim_ifp
= ifp
->info
;
1159 if (pim_ifp
->pim_sock_fd
< 0)
1163 json_row
= json_object_new_object ();
1164 json_object_pim_ifp_add (json_row
, ifp
);
1165 json_object_int_add (json_row
, "helloRx", pim_ifp
->pim_ifstat_hello_recv
);
1166 json_object_int_add (json_row
, "helloTx", pim_ifp
->pim_ifstat_hello_sent
);
1167 json_object_int_add (json_row
, "joinRx", pim_ifp
->pim_ifstat_join_recv
);
1168 json_object_int_add (json_row
, "joinTx", pim_ifp
->pim_ifstat_join_send
);
1169 json_object_int_add (json_row
, "registerRx", pim_ifp
->pim_ifstat_reg_recv
);
1170 json_object_int_add (json_row
, "registerTx", pim_ifp
->pim_ifstat_reg_recv
);
1171 json_object_int_add (json_row
, "registerStopRx", pim_ifp
->pim_ifstat_reg_stop_recv
);
1172 json_object_int_add (json_row
, "registerStopTx", pim_ifp
->pim_ifstat_reg_stop_send
);
1173 json_object_int_add (json_row
, "assertRx", pim_ifp
->pim_ifstat_assert_recv
);
1174 json_object_int_add (json_row
, "assertTx", pim_ifp
->pim_ifstat_assert_send
);
1176 json_object_object_add (json
, ifp
->name
, json_row
);
1181 "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %s",
1182 ifp
->name
, pim_ifp
->pim_ifstat_hello_recv
,
1183 pim_ifp
->pim_ifstat_hello_sent
, pim_ifp
->pim_ifstat_join_recv
,
1184 pim_ifp
->pim_ifstat_join_send
, pim_ifp
->pim_ifstat_prune_recv
,
1185 pim_ifp
->pim_ifstat_prune_send
, pim_ifp
->pim_ifstat_reg_recv
,
1186 pim_ifp
->pim_ifstat_reg_send
,
1187 pim_ifp
->pim_ifstat_reg_stop_recv
,
1188 pim_ifp
->pim_ifstat_reg_stop_send
,
1189 pim_ifp
->pim_ifstat_assert_recv
,
1190 pim_ifp
->pim_ifstat_assert_send
, VTY_NEWLINE
);
1195 vty_out (vty
, "%s%s", json_object_to_json_string_ext (json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1196 json_object_free (json
);
1200 static void pim_show_interface_traffic_single (struct vty
*vty
, const char *ifname
, u_char uj
)
1202 struct interface
*ifp
= NULL
;
1203 struct pim_interface
*pim_ifp
= NULL
;
1204 struct listnode
*node
= NULL
;
1205 json_object
*json
= NULL
;
1206 json_object
*json_row
= NULL
;
1207 uint8_t found_ifname
= 0;
1210 json
= json_object_new_object ();
1213 vty_out (vty
, "%s", VTY_NEWLINE
);
1214 vty_out (vty
, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s%s", "Interface",
1215 " HELLO", " JOIN", " PRUNE", " REGISTER",
1216 " REGISTER-STOP", " ASSERT", VTY_NEWLINE
);
1218 "%-10s%-18s%-17s%-17s%-17s%-17s%-17s%s",
1219 "", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx",
1220 " Rx/Tx", " Rx/Tx", VTY_NEWLINE
);
1222 "---------------------------------------------------------------------------------------------------------------%s",
1226 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
1228 if (strcmp (ifname
, ifp
->name
))
1231 pim_ifp
= ifp
->info
;
1236 if (pim_ifp
->pim_sock_fd
< 0)
1242 json_row
= json_object_new_object ();
1243 json_object_pim_ifp_add (json_row
, ifp
);
1244 json_object_int_add (json_row
, "helloRx", pim_ifp
->pim_ifstat_hello_recv
);
1245 json_object_int_add (json_row
, "helloTx", pim_ifp
->pim_ifstat_hello_sent
);
1246 json_object_int_add (json_row
, "joinRx", pim_ifp
->pim_ifstat_join_recv
);
1247 json_object_int_add (json_row
, "joinTx", pim_ifp
->pim_ifstat_join_send
);
1248 json_object_int_add (json_row
, "registerRx", pim_ifp
->pim_ifstat_reg_recv
);
1249 json_object_int_add (json_row
, "registerTx", pim_ifp
->pim_ifstat_reg_recv
);
1250 json_object_int_add (json_row
, "registerStopRx", pim_ifp
->pim_ifstat_reg_stop_recv
);
1251 json_object_int_add (json_row
, "registerStopTx", pim_ifp
->pim_ifstat_reg_stop_send
);
1252 json_object_int_add (json_row
, "assertRx", pim_ifp
->pim_ifstat_assert_recv
);
1253 json_object_int_add (json_row
, "assertTx", pim_ifp
->pim_ifstat_assert_send
);
1255 json_object_object_add (json
, ifp
->name
, json_row
);
1260 "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %s",
1261 ifp
->name
, pim_ifp
->pim_ifstat_hello_recv
,
1262 pim_ifp
->pim_ifstat_hello_sent
, pim_ifp
->pim_ifstat_join_recv
,
1263 pim_ifp
->pim_ifstat_join_send
, pim_ifp
->pim_ifstat_prune_recv
,
1264 pim_ifp
->pim_ifstat_prune_send
, pim_ifp
->pim_ifstat_reg_recv
,
1265 pim_ifp
->pim_ifstat_reg_send
,
1266 pim_ifp
->pim_ifstat_reg_stop_recv
,
1267 pim_ifp
->pim_ifstat_reg_stop_send
,
1268 pim_ifp
->pim_ifstat_assert_recv
,
1269 pim_ifp
->pim_ifstat_assert_send
, VTY_NEWLINE
);
1274 vty_out (vty
, "%s%s", json_object_to_json_string_ext (json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1275 json_object_free (json
);
1280 vty_out (vty
, "%% No such interface%s", VTY_NEWLINE
);
1284 static void pim_show_join(struct vty
*vty
, u_char uj
)
1286 struct pim_interface
*pim_ifp
;
1287 struct in_addr ifaddr
;
1288 struct listnode
*ch_node
;
1289 struct pim_ifchannel
*ch
;
1291 json_object
*json
= NULL
;
1292 json_object
*json_iface
= NULL
;
1293 json_object
*json_row
= NULL
;
1294 json_object
*json_grp
= NULL
;
1296 now
= pim_time_monotonic_sec();
1299 json
= json_object_new_object();
1302 "Interface Address Source Group State Uptime Expire Prune%s",
1305 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, ch_node
, ch
)) {
1307 pim_ifp
= ch
->interface
->info
;
1312 ifaddr
= pim_ifp
->primary_address
;
1314 char ch_src_str
[INET_ADDRSTRLEN
];
1315 char ch_grp_str
[INET_ADDRSTRLEN
];
1320 pim_inet4_dump("<ch_src?>", ch
->sg
.src
,
1321 ch_src_str
, sizeof(ch_src_str
));
1322 pim_inet4_dump("<ch_grp?>", ch
->sg
.grp
,
1323 ch_grp_str
, sizeof(ch_grp_str
));
1325 pim_time_uptime_begin(uptime
, sizeof(uptime
), now
, ch
->ifjoin_creation
);
1326 pim_time_timer_to_mmss(expire
, sizeof(expire
),
1327 ch
->t_ifjoin_expiry_timer
);
1328 pim_time_timer_to_mmss(prune
, sizeof(prune
),
1329 ch
->t_ifjoin_prune_pending_timer
);
1332 json_object_object_get_ex(json
, ch
->interface
->name
, &json_iface
);
1335 json_iface
= json_object_new_object();
1336 json_object_pim_ifp_add(json_iface
, ch
->interface
);
1337 json_object_object_add(json
, ch
->interface
->name
, json_iface
);
1340 json_row
= json_object_new_object();
1341 json_object_string_add(json_row
, "source", ch_src_str
);
1342 json_object_string_add(json_row
, "group", ch_grp_str
);
1343 json_object_string_add(json_row
, "upTime", uptime
);
1344 json_object_string_add(json_row
, "expire", expire
);
1345 json_object_string_add(json_row
, "prune", prune
);
1346 json_object_string_add(json_row
, "channelJoinName",
1347 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
));
1348 if (PIM_IF_FLAG_TEST_S_G_RPT(ch
->flags
))
1349 json_object_int_add(json_row
, "SGRpt", 1);
1351 json_object_object_get_ex(json_iface
, ch_grp_str
, &json_grp
);
1354 json_grp
= json_object_new_object();
1355 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1356 json_object_object_add(json_iface
, ch_grp_str
, json_grp
);
1359 json_object_object_add(json_grp
, ch_src_str
, json_row
);
1361 vty_out(vty
, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
1362 ch
->interface
->name
,
1366 pim_ifchannel_ifjoin_name(ch
->ifjoin_state
, ch
->flags
),
1372 } /* scan interface channels */
1375 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1376 json_object_free(json
);
1380 static void pim_show_neighbors_single(struct vty
*vty
, const char *neighbor
, u_char uj
)
1382 struct listnode
*node
;
1383 struct listnode
*neighnode
;
1384 struct interface
*ifp
;
1385 struct pim_interface
*pim_ifp
;
1386 struct pim_neighbor
*neigh
;
1388 int found_neighbor
= 0;
1389 int option_address_list
;
1390 int option_dr_priority
;
1391 int option_generation_id
;
1392 int option_holdtime
;
1393 int option_lan_prune_delay
;
1397 char neigh_src_str
[INET_ADDRSTRLEN
];
1399 json_object
*json
= NULL
;
1400 json_object
*json_ifp
= NULL
;
1401 json_object
*json_row
= NULL
;
1403 now
= pim_time_monotonic_sec();
1406 json
= json_object_new_object();
1408 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1409 pim_ifp
= ifp
->info
;
1414 if (pim_ifp
->pim_sock_fd
< 0)
1417 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1418 pim_inet4_dump("<src?>", neigh
->source_addr
,
1419 neigh_src_str
, sizeof(neigh_src_str
));
1422 * The user can specify either the interface name or the PIM neighbor IP.
1423 * If this pim_ifp matches neither then skip.
1425 if (strcmp(neighbor
, "detail") &&
1426 strcmp(neighbor
, ifp
->name
) &&
1427 strcmp(neighbor
, neigh_src_str
))
1431 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1432 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1434 option_address_list
= 0;
1435 option_dr_priority
= 0;
1436 option_generation_id
= 0;
1437 option_holdtime
= 0;
1438 option_lan_prune_delay
= 0;
1441 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_ADDRESS_LIST
))
1442 option_address_list
= 1;
1444 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_DR_PRIORITY
))
1445 option_dr_priority
= 1;
1447 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_GENERATION_ID
))
1448 option_generation_id
= 1;
1450 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_HOLDTIME
))
1451 option_holdtime
= 1;
1453 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_LAN_PRUNE_DELAY
))
1454 option_lan_prune_delay
= 1;
1456 if (PIM_OPTION_IS_SET(neigh
->hello_options
, PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION
))
1461 /* Does this ifp live in json? If not create it. */
1462 json_object_object_get_ex(json
, ifp
->name
, &json_ifp
);
1465 json_ifp
= json_object_new_object();
1466 json_object_pim_ifp_add(json_ifp
, ifp
);
1467 json_object_object_add(json
, ifp
->name
, json_ifp
);
1470 json_row
= json_object_new_object();
1471 json_object_string_add(json_row
, "interface", ifp
->name
);
1472 json_object_string_add(json_row
, "address", neigh_src_str
);
1473 json_object_string_add(json_row
, "upTime", uptime
);
1474 json_object_string_add(json_row
, "holdtime", expire
);
1475 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1476 json_object_int_add(json_row
, "generationId", neigh
->generation_id
);
1478 if (option_address_list
)
1479 json_object_boolean_true_add(json_row
, "helloOptionAddressList");
1481 if (option_dr_priority
)
1482 json_object_boolean_true_add(json_row
, "helloOptionDrPriority");
1484 if (option_generation_id
)
1485 json_object_boolean_true_add(json_row
, "helloOptionGenerationId");
1487 if (option_holdtime
)
1488 json_object_boolean_true_add(json_row
, "helloOptionHoldtime");
1490 if (option_lan_prune_delay
)
1491 json_object_boolean_true_add(json_row
, "helloOptionLanPruneDelay");
1494 json_object_boolean_true_add(json_row
, "helloOptionTBit");
1496 json_object_object_add(json_ifp
, neigh_src_str
, json_row
);
1499 vty_out(vty
, "Interface : %s%s", ifp
->name
, VTY_NEWLINE
);
1500 vty_out(vty
, "Neighbor : %s%s", neigh_src_str
, VTY_NEWLINE
);
1501 vty_out(vty
, " Uptime : %s%s", uptime
, VTY_NEWLINE
);
1502 vty_out(vty
, " Holdtime : %s%s", expire
, VTY_NEWLINE
);
1503 vty_out(vty
, " DR Priority : %d%s", neigh
->dr_priority
, VTY_NEWLINE
);
1504 vty_out(vty
, " Generation ID : %08x%s", neigh
->generation_id
, VTY_NEWLINE
);
1505 vty_out(vty
, " Override Interval (msec) : %d%s", neigh
->override_interval_msec
, VTY_NEWLINE
);
1506 vty_out(vty
, " Propagation Delay (msec) : %d%s", neigh
->propagation_delay_msec
, VTY_NEWLINE
);
1507 vty_out(vty
, " Hello Option - Address List : %s%s", option_address_list
? "yes" : "no", VTY_NEWLINE
);
1508 vty_out(vty
, " Hello Option - DR Priority : %s%s", option_dr_priority
? "yes" : "no", VTY_NEWLINE
);
1509 vty_out(vty
, " Hello Option - Generation ID : %s%s", option_generation_id
? "yes" : "no", VTY_NEWLINE
);
1510 vty_out(vty
, " Hello Option - Holdtime : %s%s", option_holdtime
? "yes" : "no", VTY_NEWLINE
);
1511 vty_out(vty
, " Hello Option - LAN Prune Delay : %s%s", option_lan_prune_delay
? "yes" : "no", VTY_NEWLINE
);
1512 vty_out(vty
, " Hello Option - T-bit : %s%s", option_t_bit
? "yes" : "no", VTY_NEWLINE
);
1513 pim_bfd_show_info (vty
, neigh
->bfd_info
, json_ifp
, uj
, 0);
1514 vty_out(vty
, "%s", VTY_NEWLINE
);
1520 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1521 json_object_free(json
);
1524 if (!found_neighbor
)
1525 vty_out (vty
, "%% No such interface or neighbor%s", VTY_NEWLINE
);
1531 pim_show_state(struct vty
*vty
, const char *src_or_group
, const char *group
, u_char uj
)
1533 struct channel_oil
*c_oil
;
1534 struct listnode
*node
;
1535 json_object
*json
= NULL
;
1536 json_object
*json_group
= NULL
;
1537 json_object
*json_ifp_in
= NULL
;
1538 json_object
*json_ifp_out
= NULL
;
1539 json_object
*json_source
= NULL
;
1542 now
= pim_time_monotonic_sec();
1545 json
= json_object_new_object();
1547 vty_out(vty
, "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G)");
1548 vty_out(vty
, "%sInstalled Source Group IIF OIL%s", VTY_NEWLINE
, VTY_NEWLINE
);
1551 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
1552 char grp_str
[INET_ADDRSTRLEN
];
1553 char src_str
[INET_ADDRSTRLEN
];
1554 char in_ifname
[INTERFACE_NAMSIZ
+1];
1555 char out_ifname
[INTERFACE_NAMSIZ
+1];
1557 struct interface
*ifp_in
;
1560 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
1561 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
1562 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
1565 strcpy(in_ifname
, ifp_in
->name
);
1567 strcpy(in_ifname
, "<iif?>");
1571 if (strcmp(src_or_group
, src_str
) && strcmp(src_or_group
, grp_str
))
1574 if (group
&& strcmp(group
, grp_str
))
1580 /* Find the group, create it if it doesn't exist */
1581 json_object_object_get_ex(json
, grp_str
, &json_group
);
1584 json_group
= json_object_new_object();
1585 json_object_object_add(json
, grp_str
, json_group
);
1588 /* Find the source nested under the group, create it if it doesn't exist */
1589 json_object_object_get_ex(json_group
, src_str
, &json_source
);
1592 json_source
= json_object_new_object();
1593 json_object_object_add(json_group
, src_str
, json_source
);
1596 /* Find the inbound interface nested under the source, create it if it doesn't exist */
1597 json_object_object_get_ex(json_source
, in_ifname
, &json_ifp_in
);
1600 json_ifp_in
= json_object_new_object();
1601 json_object_object_add(json_source
, in_ifname
, json_ifp_in
);
1602 json_object_int_add (json_source
, "Installed", c_oil
->installed
);
1603 json_object_int_add (json_source
, "RefCount", c_oil
->oil_ref_count
);
1604 json_object_int_add (json_source
, "OilListSize", c_oil
->oil_size
);
1605 json_object_int_add (json_source
, "OilRescan", c_oil
->oil_inherited_rescan
);
1606 json_object_int_add (json_source
, "LastUsed", c_oil
->cc
.lastused
);
1607 json_object_int_add (json_source
, "PacketCount", c_oil
->cc
.pktcnt
);
1608 json_object_int_add (json_source
, "ByteCount", c_oil
->cc
.bytecnt
);
1609 json_object_int_add (json_source
, "WrongInterface", c_oil
->cc
.wrong_if
);
1612 vty_out(vty
, "%-9d %-15s %-15s %-7s ",
1619 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
1620 struct interface
*ifp_out
;
1621 char oif_uptime
[10];
1624 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
1628 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
1629 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
1632 strcpy(out_ifname
, ifp_out
->name
);
1634 strcpy(out_ifname
, "<oif?>");
1637 json_ifp_out
= json_object_new_object();
1638 json_object_string_add(json_ifp_out
, "source", src_str
);
1639 json_object_string_add(json_ifp_out
, "group", grp_str
);
1640 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
1641 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
1642 json_object_int_add(json_ifp_out
, "installed", c_oil
->installed
);
1644 json_object_object_add(json_ifp_in
, out_ifname
, json_ifp_out
);
1649 vty_out(vty
, "%s(%c%c%c%c)", out_ifname
,
1650 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1651 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1652 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1653 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ');
1656 vty_out(vty
, ", %s(%c%c%c%c)", out_ifname
,
1657 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) ? 'I' : ' ',
1658 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) ? 'J' : ' ',
1659 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) ? 'S' : ' ',
1660 (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) ? '*' : ' ' );
1665 vty_out(vty
, "%s", VTY_NEWLINE
);
1670 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1671 json_object_free(json
);
1673 vty_out(vty
, "%s", VTY_NEWLINE
);
1677 static void pim_show_neighbors(struct vty
*vty
, u_char uj
)
1679 struct listnode
*node
;
1680 struct listnode
*neighnode
;
1681 struct interface
*ifp
;
1682 struct pim_interface
*pim_ifp
;
1683 struct pim_neighbor
*neigh
;
1687 char neigh_src_str
[INET_ADDRSTRLEN
];
1688 json_object
*json
= NULL
;
1689 json_object
*json_ifp_rows
= NULL
;
1690 json_object
*json_row
= NULL
;
1692 now
= pim_time_monotonic_sec();
1695 json
= json_object_new_object();
1697 vty_out(vty
, "Interface Neighbor Uptime Holdtime DR Pri%s", VTY_NEWLINE
);
1700 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1701 pim_ifp
= ifp
->info
;
1706 if (pim_ifp
->pim_sock_fd
< 0)
1710 json_ifp_rows
= json_object_new_object();
1712 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1713 pim_inet4_dump("<src?>", neigh
->source_addr
,
1714 neigh_src_str
, sizeof(neigh_src_str
));
1715 pim_time_uptime(uptime
, sizeof(uptime
), now
- neigh
->creation
);
1716 pim_time_timer_to_hhmmss(expire
, sizeof(expire
), neigh
->t_expire_timer
);
1719 json_row
= json_object_new_object();
1720 json_object_string_add(json_row
, "interface", ifp
->name
);
1721 json_object_string_add(json_row
, "neighbor", neigh_src_str
);
1722 json_object_string_add(json_row
, "upTime", uptime
);
1723 json_object_string_add(json_row
, "holdTime", expire
);
1724 json_object_int_add(json_row
, "holdTimeMax", neigh
->holdtime
);
1725 json_object_int_add(json_row
, "drPriority", neigh
->dr_priority
);
1726 json_object_object_add(json_ifp_rows
, neigh_src_str
, json_row
);
1729 vty_out(vty
, "%-9s %15s %8s %8s %6d%s",
1740 json_object_object_add(json
, ifp
->name
, json_ifp_rows
);
1741 json_ifp_rows
= NULL
;
1746 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1747 json_object_free(json
);
1751 static void pim_show_neighbors_secondary(struct vty
*vty
)
1753 struct listnode
*node
;
1754 struct interface
*ifp
;
1756 vty_out(vty
, "Interface Address Neighbor Secondary %s", VTY_NEWLINE
);
1758 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
1759 struct pim_interface
*pim_ifp
;
1760 struct in_addr ifaddr
;
1761 struct listnode
*neighnode
;
1762 struct pim_neighbor
*neigh
;
1764 pim_ifp
= ifp
->info
;
1769 if (pim_ifp
->pim_sock_fd
< 0)
1772 ifaddr
= pim_ifp
->primary_address
;
1774 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->pim_neighbor_list
, neighnode
, neigh
)) {
1775 char neigh_src_str
[INET_ADDRSTRLEN
];
1776 struct listnode
*prefix_node
;
1779 if (!neigh
->prefix_list
)
1782 pim_inet4_dump("<src?>", neigh
->source_addr
,
1783 neigh_src_str
, sizeof(neigh_src_str
));
1785 for (ALL_LIST_ELEMENTS_RO(neigh
->prefix_list
, prefix_node
, p
)) {
1786 char neigh_sec_str
[PREFIX2STR_BUFFER
];
1788 prefix2str(p
, neigh_sec_str
, sizeof(neigh_sec_str
));
1790 vty_out(vty
, "%-9s %-15s %-15s %-15s%s",
1802 json_object_pim_upstream_add (json_object
*json
, struct pim_upstream
*up
)
1804 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED
)
1805 json_object_boolean_true_add(json
, "drJoinDesired");
1807 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED
)
1808 json_object_boolean_true_add(json
, "drJoinDesiredUpdated");
1810 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_FHR
)
1811 json_object_boolean_true_add(json
, "firstHopRouter");
1813 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_IGMP
)
1814 json_object_boolean_true_add(json
, "sourceIgmp");
1816 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_PIM
)
1817 json_object_boolean_true_add(json
, "sourcePim");
1819 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_STREAM
)
1820 json_object_boolean_true_add(json
, "sourceStream");
1822 /* XXX: need to print ths flag in the plain text display as well */
1823 if (up
->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_MSDP
)
1824 json_object_boolean_true_add(json
, "sourceMsdp");
1828 pim_upstream_state2brief_str (enum pim_upstream_state join_state
, char *state_str
)
1832 case PIM_UPSTREAM_NOTJOINED
:
1833 strcpy (state_str
, "NotJ");
1835 case PIM_UPSTREAM_JOINED
:
1836 strcpy (state_str
, "J");
1839 strcpy (state_str
, "Unk");
1845 pim_reg_state2brief_str (enum pim_reg_state reg_state
, char *state_str
)
1849 case PIM_REG_NOINFO
:
1850 strcpy (state_str
, "RegNI");
1853 strcpy (state_str
, "RegJ");
1855 case PIM_REG_JOIN_PENDING
:
1857 strcpy (state_str
, "RegP");
1860 strcpy (state_str
, "Unk");
1865 static void pim_show_upstream(struct vty
*vty
, u_char uj
)
1867 struct listnode
*upnode
;
1868 struct pim_upstream
*up
;
1870 json_object
*json
= NULL
;
1871 json_object
*json_group
= NULL
;
1872 json_object
*json_row
= NULL
;
1874 now
= pim_time_monotonic_sec();
1877 json
= json_object_new_object();
1879 vty_out(vty
, "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt%s", VTY_NEWLINE
);
1881 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
1882 char src_str
[INET_ADDRSTRLEN
];
1883 char grp_str
[INET_ADDRSTRLEN
];
1885 char join_timer
[10];
1888 char msdp_reg_timer
[10];
1889 char state_str
[PIM_REG_STATE_STR_LEN
];
1891 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1892 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1893 pim_time_uptime(uptime
, sizeof(uptime
), now
- up
->state_transition
);
1894 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), up
->t_join_timer
);
1897 * If we have a J/P timer for the neighbor display that
1899 if (!up
->t_join_timer
)
1901 struct pim_neighbor
*nbr
;
1903 nbr
= pim_neighbor_find (up
->rpf
.source_nexthop
.interface
,
1904 up
->rpf
.rpf_addr
.u
.prefix4
);
1906 pim_time_timer_to_hhmmss (join_timer
, sizeof(join_timer
), nbr
->jp_timer
);
1909 pim_time_timer_to_hhmmss (rs_timer
, sizeof (rs_timer
), up
->t_rs_timer
);
1910 pim_time_timer_to_hhmmss (ka_timer
, sizeof (ka_timer
), up
->t_ka_timer
);
1911 pim_time_timer_to_hhmmss (msdp_reg_timer
, sizeof (msdp_reg_timer
), up
->t_msdp_reg_timer
);
1913 pim_upstream_state2brief_str (up
->join_state
, state_str
);
1914 if (up
->reg_state
!= PIM_REG_NOINFO
) {
1915 char tmp_str
[PIM_REG_STATE_STR_LEN
];
1917 sprintf (state_str
+ strlen (state_str
), ",%s",
1918 pim_reg_state2brief_str (up
->reg_state
, tmp_str
));
1922 json_object_object_get_ex(json
, grp_str
, &json_group
);
1925 json_group
= json_object_new_object();
1926 json_object_object_add(json
, grp_str
, json_group
);
1929 json_row
= json_object_new_object();
1930 json_object_pim_upstream_add(json_row
, up
);
1931 json_object_string_add(json_row
, "inboundInterface", up
->rpf
.source_nexthop
.interface
->name
);
1932 json_object_string_add(json_row
, "source", src_str
);
1933 json_object_string_add(json_row
, "group", grp_str
);
1934 json_object_string_add(json_row
, "state", state_str
);
1935 json_object_string_add(json_row
, "joinState", pim_upstream_state2str (up
->join_state
));
1936 json_object_string_add(json_row
, "regState", pim_reg_state2str (up
->reg_state
, state_str
));
1937 json_object_string_add(json_row
, "upTime", uptime
);
1938 json_object_string_add(json_row
, "joinTimer", join_timer
);
1939 json_object_string_add(json_row
, "resetTimer", rs_timer
);
1940 json_object_string_add(json_row
, "keepaliveTimer", ka_timer
);
1941 json_object_string_add(json_row
, "msdpRegTimer", msdp_reg_timer
);
1942 json_object_int_add(json_row
, "refCount", up
->ref_count
);
1943 json_object_int_add(json_row
, "sptBit", up
->sptbit
);
1944 json_object_object_add(json_group
, src_str
, json_row
);
1946 vty_out(vty
, "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d%s",
1947 up
->rpf
.source_nexthop
.interface
->name
,
1961 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
1962 json_object_free(json
);
1966 static void pim_show_join_desired(struct vty
*vty
, u_char uj
)
1968 struct listnode
*chnode
;
1969 struct pim_interface
*pim_ifp
;
1970 struct pim_ifchannel
*ch
;
1971 char src_str
[INET_ADDRSTRLEN
];
1972 char grp_str
[INET_ADDRSTRLEN
];
1973 json_object
*json
= NULL
;
1974 json_object
*json_group
= NULL
;
1975 json_object
*json_row
= NULL
;
1978 json
= json_object_new_object();
1981 "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
1984 /* scan per-interface (S,G) state */
1985 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, chnode
, ch
)) {
1986 /* scan all interfaces */
1987 pim_ifp
= ch
->interface
->info
;
1991 struct pim_upstream
*up
= ch
->upstream
;
1993 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
1994 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
1997 json_object_object_get_ex(json
, grp_str
, &json_group
);
2000 json_group
= json_object_new_object();
2001 json_object_object_add(json
, grp_str
, json_group
);
2004 json_row
= json_object_new_object();
2005 json_object_pim_upstream_add(json_row
, up
);
2006 json_object_string_add(json_row
, "interface", ch
->interface
->name
);
2007 json_object_string_add(json_row
, "source", src_str
);
2008 json_object_string_add(json_row
, "group", grp_str
);
2010 if (pim_macro_ch_lost_assert(ch
))
2011 json_object_boolean_true_add(json_row
, "lostAssert");
2013 if (pim_macro_chisin_joins(ch
))
2014 json_object_boolean_true_add(json_row
, "joins");
2016 if (pim_macro_chisin_pim_include(ch
))
2017 json_object_boolean_true_add(json_row
, "pimInclude");
2019 if (pim_upstream_evaluate_join_desired(up
))
2020 json_object_boolean_true_add(json_row
, "evaluateJoinDesired");
2022 json_object_object_add(json_group
, src_str
, json_row
);
2025 vty_out(vty
, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
2026 ch
->interface
->name
,
2029 pim_macro_ch_lost_assert(ch
) ? "yes" : "no",
2030 pim_macro_chisin_joins(ch
) ? "yes" : "no",
2031 pim_macro_chisin_pim_include(ch
) ? "yes" : "no",
2032 PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
) ? "yes" : "no",
2033 pim_upstream_evaluate_join_desired(up
) ? "yes" : "no",
2039 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2040 json_object_free(json
);
2044 static void pim_show_upstream_rpf(struct vty
*vty
, u_char uj
)
2046 struct listnode
*upnode
;
2047 struct pim_upstream
*up
;
2048 json_object
*json
= NULL
;
2049 json_object
*json_group
= NULL
;
2050 json_object
*json_row
= NULL
;
2053 json
= json_object_new_object();
2056 "Source Group RpfIface RibNextHop RpfAddress %s",
2059 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, upnode
, up
)) {
2060 char src_str
[INET_ADDRSTRLEN
];
2061 char grp_str
[INET_ADDRSTRLEN
];
2062 char rpf_nexthop_str
[PREFIX_STRLEN
];
2063 char rpf_addr_str
[PREFIX_STRLEN
];
2064 struct pim_rpf
*rpf
;
2065 const char *rpf_ifname
;
2069 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
2070 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
2071 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rpf_nexthop_str
, sizeof(rpf_nexthop_str
));
2072 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
2074 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
2077 json_object_object_get_ex(json
, grp_str
, &json_group
);
2080 json_group
= json_object_new_object();
2081 json_object_object_add(json
, grp_str
, json_group
);
2084 json_row
= json_object_new_object();
2085 json_object_pim_upstream_add(json_row
, up
);
2086 json_object_string_add(json_row
, "source", src_str
);
2087 json_object_string_add(json_row
, "group", grp_str
);
2088 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
2089 json_object_string_add(json_row
, "ribNexthop", rpf_nexthop_str
);
2090 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
2091 json_object_object_add(json_group
, src_str
, json_row
);
2093 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s%s",
2104 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2105 json_object_free(json
);
2109 static void show_rpf_refresh_stats(struct vty
*vty
, time_t now
, json_object
*json
)
2111 char refresh_uptime
[10];
2113 pim_time_uptime_begin(refresh_uptime
, sizeof(refresh_uptime
), now
, qpim_rpf_cache_refresh_last
);
2116 json_object_int_add(json
, "rpfCacheRefreshDelayMsecs", qpim_rpf_cache_refresh_delay_msec
);
2117 json_object_int_add(json
, "rpfCacheRefreshTimer", pim_time_timer_remain_msec(qpim_rpf_cache_refresher
));
2118 json_object_int_add(json
, "rpfCacheRefreshRequests", qpim_rpf_cache_refresh_requests
);
2119 json_object_int_add(json
, "rpfCacheRefreshEvents", qpim_rpf_cache_refresh_events
);
2120 json_object_string_add(json
, "rpfCacheRefreshLast", refresh_uptime
);
2121 json_object_int_add(json
, "nexthopLookups", qpim_nexthop_lookups
);
2122 json_object_int_add(json
, "nexthopLookupsAvoided", nexthop_lookups_avoided
);
2125 "RPF Cache Refresh Delay: %ld msecs%s"
2126 "RPF Cache Refresh Timer: %ld msecs%s"
2127 "RPF Cache Refresh Requests: %lld%s"
2128 "RPF Cache Refresh Events: %lld%s"
2129 "RPF Cache Refresh Last: %s%s"
2130 "Nexthop Lookups: %lld%s"
2131 "Nexthop Lookups Avoided: %lld%s",
2132 qpim_rpf_cache_refresh_delay_msec
, VTY_NEWLINE
,
2133 pim_time_timer_remain_msec(qpim_rpf_cache_refresher
), VTY_NEWLINE
,
2134 (long long)qpim_rpf_cache_refresh_requests
, VTY_NEWLINE
,
2135 (long long)qpim_rpf_cache_refresh_events
, VTY_NEWLINE
,
2136 refresh_uptime
, VTY_NEWLINE
,
2137 (long long) qpim_nexthop_lookups
, VTY_NEWLINE
,
2138 (long long)nexthop_lookups_avoided
, VTY_NEWLINE
);
2142 static void show_scan_oil_stats(struct vty
*vty
, time_t now
)
2144 char uptime_scan_oil
[10];
2145 char uptime_mroute_add
[10];
2146 char uptime_mroute_del
[10];
2148 pim_time_uptime_begin(uptime_scan_oil
, sizeof(uptime_scan_oil
), now
, qpim_scan_oil_last
);
2149 pim_time_uptime_begin(uptime_mroute_add
, sizeof(uptime_mroute_add
), now
, qpim_mroute_add_last
);
2150 pim_time_uptime_begin(uptime_mroute_del
, sizeof(uptime_mroute_del
), now
, qpim_mroute_del_last
);
2153 "Scan OIL - Last: %s Events: %lld%s"
2154 "MFC Add - Last: %s Events: %lld%s"
2155 "MFC Del - Last: %s Events: %lld%s",
2156 uptime_scan_oil
, (long long) qpim_scan_oil_events
, VTY_NEWLINE
,
2157 uptime_mroute_add
, (long long) qpim_mroute_add_events
, VTY_NEWLINE
,
2158 uptime_mroute_del
, (long long) qpim_mroute_del_events
, VTY_NEWLINE
);
2161 static void pim_show_rpf(struct vty
*vty
, u_char uj
)
2163 struct listnode
*up_node
;
2164 struct pim_upstream
*up
;
2165 time_t now
= pim_time_monotonic_sec();
2166 json_object
*json
= NULL
;
2167 json_object
*json_group
= NULL
;
2168 json_object
*json_row
= NULL
;
2171 json
= json_object_new_object();
2172 show_rpf_refresh_stats(vty
, now
, json
);
2174 show_rpf_refresh_stats(vty
, now
, json
);
2175 vty_out(vty
, "%s", VTY_NEWLINE
);
2177 "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
2181 for (ALL_LIST_ELEMENTS_RO(pim_upstream_list
, up_node
, up
)) {
2182 char src_str
[INET_ADDRSTRLEN
];
2183 char grp_str
[INET_ADDRSTRLEN
];
2184 char rpf_addr_str
[PREFIX_STRLEN
];
2185 char rib_nexthop_str
[PREFIX_STRLEN
];
2186 const char *rpf_ifname
;
2187 struct pim_rpf
*rpf
= &up
->rpf
;
2189 pim_inet4_dump("<src?>", up
->sg
.src
, src_str
, sizeof(src_str
));
2190 pim_inet4_dump("<grp?>", up
->sg
.grp
, grp_str
, sizeof(grp_str
));
2191 pim_addr_dump("<rpf?>", &rpf
->rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
2192 pim_addr_dump("<nexthop?>", &rpf
->source_nexthop
.mrib_nexthop_addr
, rib_nexthop_str
, sizeof(rib_nexthop_str
));
2194 rpf_ifname
= rpf
->source_nexthop
.interface
? rpf
->source_nexthop
.interface
->name
: "<ifname?>";
2197 json_object_object_get_ex(json
, grp_str
, &json_group
);
2200 json_group
= json_object_new_object();
2201 json_object_object_add(json
, grp_str
, json_group
);
2204 json_row
= json_object_new_object();
2205 json_object_string_add(json_row
, "source", src_str
);
2206 json_object_string_add(json_row
, "group", grp_str
);
2207 json_object_string_add(json_row
, "rpfInterface", rpf_ifname
);
2208 json_object_string_add(json_row
, "rpfAddress", rpf_addr_str
);
2209 json_object_string_add(json_row
, "ribNexthop", rib_nexthop_str
);
2210 json_object_int_add(json_row
, "routeMetric", rpf
->source_nexthop
.mrib_route_metric
);
2211 json_object_int_add(json_row
, "routePreference", rpf
->source_nexthop
.mrib_metric_preference
);
2212 json_object_object_add(json_group
, src_str
, json_row
);
2215 vty_out(vty
, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
2221 rpf
->source_nexthop
.mrib_route_metric
,
2222 rpf
->source_nexthop
.mrib_metric_preference
,
2228 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2229 json_object_free(json
);
2234 pim_print_pnc_cache_walkcb (struct hash_backet
*backet
, void *arg
)
2236 struct pim_nexthop_cache
*pnc
= backet
->data
;
2237 struct vty
*vty
= arg
;
2238 struct nexthop
*nh_node
= NULL
;
2239 ifindex_t first_ifindex
;
2240 struct interface
*ifp
= NULL
;
2245 for (nh_node
= pnc
->nexthop
; nh_node
; nh_node
= nh_node
->next
)
2247 first_ifindex
= nh_node
->ifindex
;
2248 ifp
= if_lookup_by_index (first_ifindex
, VRF_DEFAULT
);
2250 vty_out (vty
, "%-15s ", inet_ntoa (pnc
->rpf
.rpf_addr
.u
.prefix4
));
2251 vty_out (vty
, "%-14s ", ifp
? ifp
->name
: "NULL");
2252 vty_out (vty
, "%s ", inet_ntoa (nh_node
->gate
.ipv4
));
2253 vty_out (vty
, "%s", VTY_NEWLINE
);
2259 pim_show_nexthop (struct vty
*vty
)
2262 if (pimg
&& !pimg
->rpf_hash
)
2264 vty_out (vty
, "no nexthop cache %s", VTY_NEWLINE
);
2268 vty_out (vty
, "Number of registered addresses: %lu %s",
2269 pimg
->rpf_hash
->count
, VTY_NEWLINE
);
2270 vty_out (vty
, "Address Interface Nexthop%s", VTY_NEWLINE
);
2271 vty_out (vty
, "-------------------------------------------%s", VTY_NEWLINE
);
2273 hash_walk (pimg
->rpf_hash
, pim_print_pnc_cache_walkcb
, vty
);
2277 static void igmp_show_groups(struct vty
*vty
, u_char uj
)
2279 struct listnode
*ifnode
;
2280 struct interface
*ifp
;
2282 json_object
*json
= NULL
;
2283 json_object
*json_iface
= NULL
;
2284 json_object
*json_row
= NULL
;
2286 now
= pim_time_monotonic_sec();
2289 json
= json_object_new_object();
2291 vty_out(vty
, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE
);
2293 /* scan interfaces */
2294 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2295 struct pim_interface
*pim_ifp
= ifp
->info
;
2296 struct listnode
*sock_node
;
2297 struct igmp_sock
*igmp
;
2302 /* scan igmp sockets */
2303 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2304 char ifaddr_str
[INET_ADDRSTRLEN
];
2305 struct listnode
*grpnode
;
2306 struct igmp_group
*grp
;
2308 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2310 /* scan igmp groups */
2311 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2312 char group_str
[INET_ADDRSTRLEN
];
2316 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2317 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
2318 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
2321 json_object_object_get_ex(json
, ifp
->name
, &json_iface
);
2324 json_iface
= json_object_new_object();
2325 json_object_pim_ifp_add(json_iface
, ifp
);
2326 json_object_object_add(json
, ifp
->name
, json_iface
);
2329 json_row
= json_object_new_object();
2330 json_object_string_add(json_row
, "source", ifaddr_str
);
2331 json_object_string_add(json_row
, "group", group_str
);
2333 if (grp
->igmp_version
== 3)
2334 json_object_string_add(json_row
, "mode", grp
->group_filtermode_isexcl
? "EXCLUDE" : "INCLUDE");
2336 json_object_string_add(json_row
, "timer", hhmmss
);
2337 json_object_int_add(json_row
, "sourcesCount", grp
->group_source_list
? listcount(grp
->group_source_list
) : 0);
2338 json_object_int_add(json_row
, "version", grp
->igmp_version
);
2339 json_object_string_add(json_row
, "uptime", uptime
);
2340 json_object_object_add(json_iface
, group_str
, json_row
);
2343 vty_out(vty
, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
2347 grp
->igmp_version
== 3 ? (grp
->group_filtermode_isexcl
? "EXCL" : "INCL") : "----",
2349 grp
->group_source_list
? listcount(grp
->group_source_list
) : 0,
2354 } /* scan igmp groups */
2355 } /* scan igmp sockets */
2356 } /* scan interfaces */
2359 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
2360 json_object_free(json
);
2364 static void igmp_show_group_retransmission(struct vty
*vty
)
2366 struct listnode
*ifnode
;
2367 struct interface
*ifp
;
2369 vty_out(vty
, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE
);
2371 /* scan interfaces */
2372 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2373 struct pim_interface
*pim_ifp
= ifp
->info
;
2374 struct listnode
*sock_node
;
2375 struct igmp_sock
*igmp
;
2380 /* scan igmp sockets */
2381 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2382 char ifaddr_str
[INET_ADDRSTRLEN
];
2383 struct listnode
*grpnode
;
2384 struct igmp_group
*grp
;
2386 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2388 /* scan igmp groups */
2389 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2390 char group_str
[INET_ADDRSTRLEN
];
2391 char grp_retr_mmss
[10];
2392 struct listnode
*src_node
;
2393 struct igmp_source
*src
;
2394 int grp_retr_sources
= 0;
2396 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2397 pim_time_timer_to_mmss(grp_retr_mmss
, sizeof(grp_retr_mmss
), grp
->t_group_query_retransmit_timer
);
2400 /* count group sources with retransmission state */
2401 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
2402 if (src
->source_query_retransmit_count
> 0) {
2407 vty_out(vty
, "%-9s %-15s %-15s %-8s %7d %7d%s",
2412 grp
->group_specific_query_retransmit_count
,
2416 } /* scan igmp groups */
2417 } /* scan igmp sockets */
2418 } /* scan interfaces */
2421 static void igmp_show_sources(struct vty
*vty
)
2423 struct listnode
*ifnode
;
2424 struct interface
*ifp
;
2427 now
= pim_time_monotonic_sec();
2429 vty_out(vty
, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE
);
2431 /* scan interfaces */
2432 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2433 struct pim_interface
*pim_ifp
= ifp
->info
;
2434 struct listnode
*sock_node
;
2435 struct igmp_sock
*igmp
;
2440 /* scan igmp sockets */
2441 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2442 char ifaddr_str
[INET_ADDRSTRLEN
];
2443 struct listnode
*grpnode
;
2444 struct igmp_group
*grp
;
2446 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2448 /* scan igmp groups */
2449 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2450 char group_str
[INET_ADDRSTRLEN
];
2451 struct listnode
*srcnode
;
2452 struct igmp_source
*src
;
2454 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2456 /* scan group sources */
2457 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2458 char source_str
[INET_ADDRSTRLEN
];
2462 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2464 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
2466 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
2468 vty_out(vty
, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
2474 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y" : "N",
2478 } /* scan group sources */
2479 } /* scan igmp groups */
2480 } /* scan igmp sockets */
2481 } /* scan interfaces */
2484 static void igmp_show_source_retransmission(struct vty
*vty
)
2486 struct listnode
*ifnode
;
2487 struct interface
*ifp
;
2489 vty_out(vty
, "Interface Address Group Source Counter%s", VTY_NEWLINE
);
2491 /* scan interfaces */
2492 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), ifnode
, ifp
)) {
2493 struct pim_interface
*pim_ifp
= ifp
->info
;
2494 struct listnode
*sock_node
;
2495 struct igmp_sock
*igmp
;
2500 /* scan igmp sockets */
2501 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
2502 char ifaddr_str
[INET_ADDRSTRLEN
];
2503 struct listnode
*grpnode
;
2504 struct igmp_group
*grp
;
2506 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
2508 /* scan igmp groups */
2509 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grpnode
, grp
)) {
2510 char group_str
[INET_ADDRSTRLEN
];
2511 struct listnode
*srcnode
;
2512 struct igmp_source
*src
;
2514 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
, sizeof(group_str
));
2516 /* scan group sources */
2517 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
)) {
2518 char source_str
[INET_ADDRSTRLEN
];
2520 pim_inet4_dump("<source?>", src
->source_addr
, source_str
, sizeof(source_str
));
2522 vty_out(vty
, "%-9s %-15s %-15s %-15s %7d%s",
2527 src
->source_query_retransmit_count
,
2530 } /* scan group sources */
2531 } /* scan igmp groups */
2532 } /* scan igmp sockets */
2533 } /* scan interfaces */
2536 static void clear_igmp_interfaces()
2538 struct listnode
*ifnode
;
2539 struct listnode
*ifnextnode
;
2540 struct interface
*ifp
;
2542 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2543 pim_if_addr_del_all_igmp(ifp
);
2546 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2547 pim_if_addr_add_all(ifp
);
2551 static void clear_pim_interfaces()
2553 struct listnode
*ifnode
;
2554 struct listnode
*ifnextnode
;
2555 struct interface
*ifp
;
2557 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
)) {
2559 pim_neighbor_delete_all(ifp
, "interface cleared");
2564 static void clear_interfaces()
2566 clear_igmp_interfaces();
2567 clear_pim_interfaces();
2570 DEFUN (clear_ip_interfaces
,
2571 clear_ip_interfaces_cmd
,
2572 "clear ip interfaces",
2575 "Reset interfaces\n")
2582 DEFUN (clear_ip_igmp_interfaces
,
2583 clear_ip_igmp_interfaces_cmd
,
2584 "clear ip igmp interfaces",
2588 "Reset IGMP interfaces\n")
2590 clear_igmp_interfaces();
2595 static void mroute_add_all()
2597 struct listnode
*node
;
2598 struct channel_oil
*c_oil
;
2600 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2601 if (pim_mroute_add(c_oil
, __PRETTY_FUNCTION__
)) {
2602 /* just log warning */
2603 char source_str
[INET_ADDRSTRLEN
];
2604 char group_str
[INET_ADDRSTRLEN
];
2605 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2606 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2607 zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
2608 __FILE__
, __PRETTY_FUNCTION__
,
2609 source_str
, group_str
);
2614 static void mroute_del_all()
2616 struct listnode
*node
;
2617 struct channel_oil
*c_oil
;
2619 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
2620 if (pim_mroute_del(c_oil
, __PRETTY_FUNCTION__
)) {
2621 /* just log warning */
2622 char source_str
[INET_ADDRSTRLEN
];
2623 char group_str
[INET_ADDRSTRLEN
];
2624 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
2625 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
2626 zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
2627 __FILE__
, __PRETTY_FUNCTION__
,
2628 source_str
, group_str
);
2633 DEFUN (clear_ip_mroute
,
2634 clear_ip_mroute_cmd
,
2638 "Reset multicast routes\n")
2646 DEFUN (clear_ip_pim_interfaces
,
2647 clear_ip_pim_interfaces_cmd
,
2648 "clear ip pim interfaces",
2652 "Reset PIM interfaces\n")
2654 clear_pim_interfaces();
2659 DEFUN (clear_ip_pim_interface_traffic
,
2660 clear_ip_pim_interface_traffic_cmd
,
2661 "clear ip pim interface traffic",
2664 "PIM clear commands\n"
2665 "Reset PIM interfaces\n"
2666 "Reset Protocol Packet counters\n")
2668 struct listnode
*ifnode
= NULL
;
2669 struct listnode
*ifnextnode
= NULL
;
2670 struct interface
*ifp
= NULL
;
2671 struct pim_interface
*pim_ifp
= NULL
;
2673 for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT
), ifnode
, ifnextnode
, ifp
))
2675 pim_ifp
= ifp
->info
;
2680 pim_ifp
->pim_ifstat_hello_recv
= 0;
2681 pim_ifp
->pim_ifstat_hello_sent
= 0;
2682 pim_ifp
->pim_ifstat_join_recv
= 0;
2683 pim_ifp
->pim_ifstat_join_send
= 0;
2684 pim_ifp
->pim_ifstat_prune_recv
= 0;
2685 pim_ifp
->pim_ifstat_prune_send
= 0;
2686 pim_ifp
->pim_ifstat_reg_recv
= 0;
2687 pim_ifp
->pim_ifstat_reg_send
= 0;
2688 pim_ifp
->pim_ifstat_reg_stop_recv
= 0;
2689 pim_ifp
->pim_ifstat_reg_stop_send
= 0;
2690 pim_ifp
->pim_ifstat_assert_recv
= 0;
2691 pim_ifp
->pim_ifstat_assert_send
= 0;
2698 DEFUN (clear_ip_pim_oil
,
2699 clear_ip_pim_oil_cmd
,
2704 "Rescan PIM OIL (output interface list)\n")
2711 DEFUN (show_ip_igmp_interface
,
2712 show_ip_igmp_interface_cmd
,
2713 "show ip igmp interface [detail|WORD] [json]",
2717 "IGMP interface information\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 igmp_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2729 igmp_show_interfaces(vty
, uj
);
2734 DEFUN (show_ip_igmp_join
,
2735 show_ip_igmp_join_cmd
,
2736 "show ip igmp join",
2740 "IGMP static join information\n")
2742 igmp_show_interface_join(vty
);
2747 DEFUN (show_ip_igmp_groups
,
2748 show_ip_igmp_groups_cmd
,
2749 "show ip igmp groups [json]",
2754 "JavaScript Object Notation\n")
2756 u_char uj
= use_json(argc
, argv
);
2757 igmp_show_groups(vty
, uj
);
2762 DEFUN (show_ip_igmp_groups_retransmissions
,
2763 show_ip_igmp_groups_retransmissions_cmd
,
2764 "show ip igmp groups retransmissions",
2769 "IGMP group retransmissions\n")
2771 igmp_show_group_retransmission(vty
);
2776 DEFUN (show_ip_igmp_sources
,
2777 show_ip_igmp_sources_cmd
,
2778 "show ip igmp sources",
2784 igmp_show_sources(vty
);
2789 DEFUN (show_ip_igmp_sources_retransmissions
,
2790 show_ip_igmp_sources_retransmissions_cmd
,
2791 "show ip igmp sources retransmissions",
2796 "IGMP source retransmissions\n")
2798 igmp_show_source_retransmission(vty
);
2803 DEFUN (show_ip_pim_assert
,
2804 show_ip_pim_assert_cmd
,
2805 "show ip pim assert",
2809 "PIM interface assert\n")
2811 pim_show_assert(vty
);
2816 DEFUN (show_ip_pim_assert_internal
,
2817 show_ip_pim_assert_internal_cmd
,
2818 "show ip pim assert-internal",
2822 "PIM interface internal assert state\n")
2824 pim_show_assert_internal(vty
);
2829 DEFUN (show_ip_pim_assert_metric
,
2830 show_ip_pim_assert_metric_cmd
,
2831 "show ip pim assert-metric",
2835 "PIM interface assert metric\n")
2837 pim_show_assert_metric(vty
);
2842 DEFUN (show_ip_pim_assert_winner_metric
,
2843 show_ip_pim_assert_winner_metric_cmd
,
2844 "show ip pim assert-winner-metric",
2848 "PIM interface assert winner metric\n")
2850 pim_show_assert_winner_metric(vty
);
2855 DEFUN (show_ip_pim_interface
,
2856 show_ip_pim_interface_cmd
,
2857 "show ip pim interface [detail|WORD] [json]",
2861 "PIM interface information\n"
2864 "JavaScript Object Notation\n")
2866 u_char uj
= use_json(argc
, argv
);
2869 if (argv_find(argv
, argc
, "WORD", &idx
) ||
2870 argv_find(argv
, argc
, "detail", &idx
))
2871 pim_show_interfaces_single(vty
, argv
[idx
]->arg
, uj
);
2874 pim_show_interfaces(vty
, uj
);
2879 DEFUN (show_ip_pim_join
,
2880 show_ip_pim_join_cmd
,
2881 "show ip pim join [json]",
2885 "PIM interface join information\n"
2888 u_char uj
= use_json(argc
, argv
);
2889 pim_show_join(vty
, uj
);
2894 DEFUN (show_ip_pim_local_membership
,
2895 show_ip_pim_local_membership_cmd
,
2896 "show ip pim local-membership [json]",
2900 "PIM interface local-membership\n"
2903 u_char uj
= use_json(argc
, argv
);
2904 pim_show_membership(vty
, uj
);
2909 DEFUN (show_ip_pim_neighbor
,
2910 show_ip_pim_neighbor_cmd
,
2911 "show ip pim neighbor [detail|WORD] [json]",
2915 "PIM neighbor information\n"
2917 "Name of interface or neighbor\n"
2918 "JavaScript Object Notation\n")
2920 u_char uj
= use_json(argc
, argv
);
2923 if (argv_find(argv
, argc
, "detail", &idx
) ||
2924 argv_find(argv
, argc
, "WORD", &idx
))
2925 pim_show_neighbors_single(vty
, argv
[idx
]->arg
, uj
);
2927 pim_show_neighbors(vty
, uj
);
2932 DEFUN (show_ip_pim_secondary
,
2933 show_ip_pim_secondary_cmd
,
2934 "show ip pim secondary",
2938 "PIM neighbor addresses\n")
2940 pim_show_neighbors_secondary(vty
);
2945 DEFUN (show_ip_pim_state
,
2946 show_ip_pim_state_cmd
,
2947 "show ip pim state [A.B.C.D [A.B.C.D]] [json]",
2951 "PIM state information\n"
2952 "Unicast or Multicast address\n"
2953 "Multicast address\n"
2954 "JavaScript Object Notation\n")
2956 const char *src_or_group
= NULL
;
2957 const char *group
= NULL
;
2958 u_char uj
= use_json(argc
, argv
);
2964 src_or_group
= argv
[4]->arg
;
2965 group
= argv
[5]->arg
;
2968 src_or_group
= argv
[4]->arg
;
2970 pim_show_state(vty
, src_or_group
, group
, uj
);
2975 DEFUN (show_ip_pim_upstream
,
2976 show_ip_pim_upstream_cmd
,
2977 "show ip pim upstream [json]",
2981 "PIM upstream information\n"
2982 "JavaScript Object Notation\n")
2984 u_char uj
= use_json(argc
, argv
);
2985 pim_show_upstream(vty
, uj
);
2990 DEFUN (show_ip_pim_upstream_join_desired
,
2991 show_ip_pim_upstream_join_desired_cmd
,
2992 "show ip pim upstream-join-desired [json]",
2996 "PIM upstream join-desired\n"
2997 "JavaScript Object Notation\n")
2999 u_char uj
= use_json(argc
, argv
);
3000 pim_show_join_desired(vty
, uj
);
3005 DEFUN (show_ip_pim_upstream_rpf
,
3006 show_ip_pim_upstream_rpf_cmd
,
3007 "show ip pim upstream-rpf [json]",
3011 "PIM upstream source rpf\n"
3012 "JavaScript Object Notation\n")
3014 u_char uj
= use_json(argc
, argv
);
3015 pim_show_upstream_rpf(vty
, uj
);
3020 DEFUN (show_ip_pim_rp
,
3022 "show ip pim rp-info [json]",
3026 "PIM RP information\n"
3027 "JavaScript Object Notation\n")
3029 u_char uj
= use_json(argc
, argv
);
3030 pim_rp_show_information (vty
, uj
);
3035 DEFUN (show_ip_pim_rpf
,
3036 show_ip_pim_rpf_cmd
,
3037 "show ip pim rpf [json]",
3041 "PIM cached source rpf information\n"
3042 "JavaScript Object Notation\n")
3044 u_char uj
= use_json(argc
, argv
);
3045 pim_show_rpf(vty
, uj
);
3050 DEFUN (show_ip_pim_nexthop
,
3051 show_ip_pim_nexthop_cmd
,
3052 "show ip pim nexthop",
3056 "PIM cached nexthop rpf information\n")
3058 pim_show_nexthop (vty
);
3063 DEFUN (show_ip_pim_nexthop_lookup
,
3064 show_ip_pim_nexthop_lookup_cmd
,
3065 "show ip pim nexthop-lookup A.B.C.D A.B.C.D",
3069 "PIM cached nexthop rpf lookup\n"
3070 "Source/RP address\n"
3071 "Multicast Group address\n")
3073 struct pim_nexthop_cache pnc
;
3074 struct prefix nht_p
;
3076 struct in_addr src_addr
, grp_addr
;
3077 struct in_addr vif_source
;
3078 const char *addr_str
, *addr_str1
;
3080 struct pim_nexthop nexthop
;
3081 char nexthop_addr_str
[PREFIX_STRLEN
];
3082 char grp_str
[PREFIX_STRLEN
];
3084 addr_str
= argv
[4]->arg
;
3085 result
= inet_pton (AF_INET
, addr_str
, &src_addr
);
3088 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
3089 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
3093 if (pim_is_group_224_4 (src_addr
))
3095 vty_out (vty
, "Invalid argument. Expected Valid Source Address.%s", VTY_NEWLINE
);
3099 addr_str1
= argv
[5]->arg
;
3100 result
= inet_pton (AF_INET
, addr_str1
, &grp_addr
);
3103 vty_out (vty
, "Bad unicast address %s: errno=%d: %s%s",
3104 addr_str
, errno
, safe_strerror (errno
), VTY_NEWLINE
);
3108 if (!pim_is_group_224_4 (grp_addr
))
3110 vty_out (vty
, "Invalid argument. Expected Valid Multicast Group Address.%s", VTY_NEWLINE
);
3114 if (!pim_rp_set_upstream_addr (&vif_source
, src_addr
, grp_addr
))
3117 memset (&pnc
, 0, sizeof (struct pim_nexthop_cache
));
3118 nht_p
.family
= AF_INET
;
3119 nht_p
.prefixlen
= IPV4_MAX_BITLEN
;
3120 nht_p
.u
.prefix4
= vif_source
;
3121 grp
.family
= AF_INET
;
3122 grp
.prefixlen
= IPV4_MAX_BITLEN
;
3123 grp
.u
.prefix4
= grp_addr
;
3124 memset (&nexthop
, 0, sizeof (nexthop
));
3126 if ((pim_find_or_track_nexthop (&nht_p
, NULL
, NULL
, &pnc
)) == 1)
3128 //Compute PIM RPF using Cached nexthop
3129 pim_ecmp_nexthop_search (&pnc
, &nexthop
, &nht_p
, &grp
, 0);
3132 pim_ecmp_nexthop_lookup (&nexthop
, vif_source
, &nht_p
, &grp
, 0);
3134 pim_addr_dump ("<grp?>", &grp
, grp_str
, sizeof (grp_str
));
3135 pim_addr_dump ("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
3136 nexthop_addr_str
, sizeof (nexthop_addr_str
));
3137 vty_out (vty
, "Group %s --- Nexthop %s Interface %s %s", grp_str
,
3138 nexthop_addr_str
, nexthop
.interface
->name
, VTY_NEWLINE
);
3143 DEFUN (show_ip_pim_interface_traffic
,
3144 show_ip_pim_interface_traffic_cmd
,
3145 "show ip pim interface traffic [WORD] [json]",
3149 "PIM interface information\n"
3150 "Protocol Packet counters\n"
3152 "JavaScript Object Notation\n")
3154 u_char uj
= use_json (argc
, argv
);
3157 if (argv_find(argv
, argc
, "WORD", &idx
))
3158 pim_show_interface_traffic_single (vty
, argv
[idx
]->arg
, uj
);
3160 pim_show_interface_traffic (vty
, uj
);
3165 static void show_multicast_interfaces(struct vty
*vty
)
3167 struct listnode
*node
;
3168 struct interface
*ifp
;
3170 vty_out(vty
, "%s", VTY_NEWLINE
);
3172 vty_out(vty
, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
3175 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
3176 struct pim_interface
*pim_ifp
;
3177 struct in_addr ifaddr
;
3178 struct sioc_vif_req vreq
;
3180 pim_ifp
= ifp
->info
;
3185 memset(&vreq
, 0, sizeof(vreq
));
3186 vreq
.vifi
= pim_ifp
->mroute_vif_index
;
3188 if (ioctl(qpim_mroute_socket_fd
, SIOCGETVIFCNT
, &vreq
)) {
3189 zlog_warn("ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
3190 (unsigned long)SIOCGETVIFCNT
,
3192 pim_ifp
->mroute_vif_index
,
3194 safe_strerror(errno
),
3198 ifaddr
= pim_ifp
->primary_address
;
3200 vty_out(vty
, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
3204 pim_ifp
->mroute_vif_index
,
3205 (unsigned long) vreq
.icount
,
3206 (unsigned long) vreq
.ocount
,
3207 (unsigned long) vreq
.ibytes
,
3208 (unsigned long) vreq
.obytes
,
3213 DEFUN (show_ip_multicast
,
3214 show_ip_multicast_cmd
,
3215 "show ip multicast",
3218 "Multicast global information\n")
3220 time_t now
= pim_time_monotonic_sec();
3224 vty_out(vty
, "Mroute socket descriptor: %d%s",
3225 qpim_mroute_socket_fd
,
3228 pim_time_uptime(uptime
, sizeof(uptime
), now
- qpim_mroute_socket_creation
);
3229 vty_out(vty
, "Mroute socket uptime: %s%s",
3233 vty_out(vty
, "%s", VTY_NEWLINE
);
3235 pim_zebra_zclient_update (vty
);
3236 pim_zlookup_show_ip_multicast (vty
);
3238 vty_out(vty
, "%s", VTY_NEWLINE
);
3239 vty_out(vty
, "Maximum highest VifIndex: %d%s",
3240 PIM_MAX_USABLE_VIFS
,
3243 vty_out (vty
, "%s", VTY_NEWLINE
);
3244 vty_out (vty
, "Upstream Join Timer: %d secs%s",
3245 qpim_t_periodic
, VTY_NEWLINE
);
3246 vty_out (vty
, "Join/Prune Holdtime: %d secs%s",
3247 PIM_JP_HOLDTIME
, VTY_NEWLINE
);
3248 vty_out (vty
, "PIM ECMP: %s%s",
3249 qpim_ecmp_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3250 vty_out (vty
, "PIM ECMP Rebalance: %s%s",
3251 qpim_ecmp_rebalance_enable
? "Enable" : "Disable", VTY_NEWLINE
);
3253 vty_out (vty
, "%s", VTY_NEWLINE
);
3255 show_rpf_refresh_stats(vty
, now
, NULL
);
3257 vty_out(vty
, "%s", VTY_NEWLINE
);
3259 show_scan_oil_stats(vty
, now
);
3261 show_multicast_interfaces(vty
);
3266 static void show_mroute(struct vty
*vty
, u_char uj
)
3268 struct listnode
*node
;
3269 struct channel_oil
*c_oil
;
3270 struct static_route
*s_route
;
3272 json_object
*json
= NULL
;
3273 json_object
*json_group
= NULL
;
3274 json_object
*json_source
= NULL
;
3275 json_object
*json_oil
= NULL
;
3276 json_object
*json_ifp_out
= NULL
;
3279 char grp_str
[INET_ADDRSTRLEN
];
3280 char src_str
[INET_ADDRSTRLEN
];
3281 char in_ifname
[INTERFACE_NAMSIZ
+1];
3282 char out_ifname
[INTERFACE_NAMSIZ
+1];
3284 struct interface
*ifp_in
;
3288 json
= json_object_new_object();
3290 vty_out(vty
, "Source Group Proto Input Output TTL Uptime%s",
3294 now
= pim_time_monotonic_sec();
3296 /* print list of PIM and IGMP routes */
3297 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3300 if (!c_oil
->installed
&& !uj
)
3303 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, grp_str
, sizeof(grp_str
));
3304 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, src_str
, sizeof(src_str
));
3305 ifp_in
= pim_if_find_by_vif_index(c_oil
->oil
.mfcc_parent
);
3308 strcpy(in_ifname
, ifp_in
->name
);
3310 strcpy(in_ifname
, "<iif?>");
3314 /* Find the group, create it if it doesn't exist */
3315 json_object_object_get_ex(json
, grp_str
, &json_group
);
3318 json_group
= json_object_new_object();
3319 json_object_object_add(json
, grp_str
, json_group
);
3322 /* Find the source nested under the group, create it if it doesn't exist */
3323 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3326 json_source
= json_object_new_object();
3327 json_object_object_add(json_group
, src_str
, json_source
);
3330 /* Find the inbound interface nested under the source, create it if it doesn't exist */
3331 json_object_int_add(json_source
, "installed", c_oil
->installed
);
3332 json_object_int_add(json_source
, "refCount", c_oil
->oil_ref_count
);
3333 json_object_int_add(json_source
, "oilSize", c_oil
->oil_size
);
3334 json_object_int_add(json_source
, "OilInheritedRescan", c_oil
->oil_inherited_rescan
);
3335 json_object_string_add(json_source
, "iif", in_ifname
);
3339 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3340 struct interface
*ifp_out
;
3341 char oif_uptime
[10];
3344 ttl
= c_oil
->oil
.mfcc_ttls
[oif_vif_index
];
3348 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3349 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- c_oil
->oif_creation
[oif_vif_index
]);
3353 strcpy(out_ifname
, ifp_out
->name
);
3355 strcpy(out_ifname
, "<oif?>");
3358 json_ifp_out
= json_object_new_object();
3359 json_object_string_add(json_ifp_out
, "source", src_str
);
3360 json_object_string_add(json_ifp_out
, "group", grp_str
);
3362 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
)
3363 json_object_boolean_true_add(json_ifp_out
, "protocolPim");
3365 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
)
3366 json_object_boolean_true_add(json_ifp_out
, "protocolIgmp");
3368 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
)
3369 json_object_boolean_true_add(json_ifp_out
, "protocolSource");
3371 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
)
3372 json_object_boolean_true_add(json_ifp_out
, "protocolInherited");
3374 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3375 json_object_int_add(json_ifp_out
, "iVifI", c_oil
->oil
.mfcc_parent
);
3376 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3377 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3378 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3379 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3381 json_oil
= json_object_new_object();
3382 json_object_object_add(json_source
, "oil", json_oil
);
3384 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3386 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_PIM
) {
3387 strcpy(proto
, "PIM");
3390 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_IGMP
) {
3391 strcpy(proto
, "IGMP");
3394 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_SOURCE
) {
3395 strcpy(proto
, "SRC");
3398 if (c_oil
->oif_flags
[oif_vif_index
] & PIM_OIF_FLAG_PROTO_STAR
) {
3399 strcpy(proto
, "STAR");
3402 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3416 in_ifname
[0] = '\0';
3422 if (!uj
&& !found_oif
) {
3423 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3435 /* Print list of static routes */
3436 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3439 if (!s_route
->c_oil
.installed
)
3442 pim_inet4_dump("<group?>", s_route
->group
, grp_str
, sizeof(grp_str
));
3443 pim_inet4_dump("<source?>", s_route
->source
, src_str
, sizeof(src_str
));
3444 ifp_in
= pim_if_find_by_vif_index(s_route
->iif
);
3448 strcpy(in_ifname
, ifp_in
->name
);
3450 strcpy(in_ifname
, "<iif?>");
3454 /* Find the group, create it if it doesn't exist */
3455 json_object_object_get_ex(json
, grp_str
, &json_group
);
3458 json_group
= json_object_new_object();
3459 json_object_object_add(json
, grp_str
, json_group
);
3462 /* Find the source nested under the group, create it if it doesn't exist */
3463 json_object_object_get_ex(json_group
, src_str
, &json_source
);
3466 json_source
= json_object_new_object();
3467 json_object_object_add(json_group
, src_str
, json_source
);
3470 json_object_string_add(json_source
, "iif", in_ifname
);
3473 strcpy(proto
, "STATIC");
3476 for (oif_vif_index
= 0; oif_vif_index
< MAXVIFS
; ++oif_vif_index
) {
3477 struct interface
*ifp_out
;
3478 char oif_uptime
[10];
3481 ttl
= s_route
->oif_ttls
[oif_vif_index
];
3485 ifp_out
= pim_if_find_by_vif_index(oif_vif_index
);
3486 pim_time_uptime(oif_uptime
, sizeof(oif_uptime
), now
- s_route
->c_oil
.oif_creation
[oif_vif_index
]);
3490 strcpy(out_ifname
, ifp_out
->name
);
3492 strcpy(out_ifname
, "<oif?>");
3495 json_ifp_out
= json_object_new_object();
3496 json_object_string_add(json_ifp_out
, "source", src_str
);
3497 json_object_string_add(json_ifp_out
, "group", grp_str
);
3498 json_object_boolean_true_add(json_ifp_out
, "protocolStatic");
3499 json_object_string_add(json_ifp_out
, "inboundInterface", in_ifname
);
3500 json_object_int_add(json_ifp_out
, "iVifI", s_route
->c_oil
.oil
.mfcc_parent
);
3501 json_object_string_add(json_ifp_out
, "outboundInterface", out_ifname
);
3502 json_object_int_add(json_ifp_out
, "oVifI", oif_vif_index
);
3503 json_object_int_add(json_ifp_out
, "ttl", ttl
);
3504 json_object_string_add(json_ifp_out
, "upTime", oif_uptime
);
3506 json_oil
= json_object_new_object();
3507 json_object_object_add(json_source
, "oil", json_oil
);
3509 json_object_object_add(json_oil
, out_ifname
, json_ifp_out
);
3511 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3524 in_ifname
[0] = '\0';
3530 if (!uj
&& !found_oif
) {
3531 vty_out(vty
, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
3544 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
3545 json_object_free(json
);
3549 DEFUN (show_ip_mroute
,
3551 "show ip mroute [json]",
3557 u_char uj
= use_json(argc
, argv
);
3558 show_mroute(vty
, uj
);
3562 static void show_mroute_count(struct vty
*vty
)
3564 struct listnode
*node
;
3565 struct channel_oil
*c_oil
;
3566 struct static_route
*s_route
;
3568 vty_out(vty
, "%s", VTY_NEWLINE
);
3570 vty_out(vty
, "Source Group LastUsed Packets Bytes WrongIf %s",
3573 /* Print PIM and IGMP route counts */
3574 for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list
, node
, c_oil
)) {
3575 char group_str
[INET_ADDRSTRLEN
];
3576 char source_str
[INET_ADDRSTRLEN
];
3578 if (!c_oil
->installed
)
3581 pim_mroute_update_counters (c_oil
);
3583 pim_inet4_dump("<group?>", c_oil
->oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3584 pim_inet4_dump("<source?>", c_oil
->oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3586 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3589 c_oil
->cc
.lastused
/100,
3596 /* Print static route counts */
3597 for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list
, node
, s_route
)) {
3598 char group_str
[INET_ADDRSTRLEN
];
3599 char source_str
[INET_ADDRSTRLEN
];
3601 if (!s_route
->c_oil
.installed
)
3604 pim_mroute_update_counters (&s_route
->c_oil
);
3606 pim_inet4_dump("<group?>", s_route
->c_oil
.oil
.mfcc_mcastgrp
, group_str
, sizeof(group_str
));
3607 pim_inet4_dump("<source?>", s_route
->c_oil
.oil
.mfcc_origin
, source_str
, sizeof(source_str
));
3609 vty_out(vty
, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
3612 s_route
->c_oil
.cc
.lastused
,
3613 s_route
->c_oil
.cc
.pktcnt
,
3614 s_route
->c_oil
.cc
.bytecnt
,
3615 s_route
->c_oil
.cc
.wrong_if
,
3620 DEFUN (show_ip_mroute_count
,
3621 show_ip_mroute_count_cmd
,
3622 "show ip mroute count",
3626 "Route and packet count data\n")
3628 show_mroute_count(vty
);
3634 "show ip rib A.B.C.D",
3638 "Unicast address\n")
3641 struct in_addr addr
;
3642 const char *addr_str
;
3643 struct pim_nexthop nexthop
;
3644 char nexthop_addr_str
[PREFIX_STRLEN
];
3647 memset (&nexthop
, 0, sizeof (nexthop
));
3648 addr_str
= argv
[idx_ipv4
]->arg
;
3649 result
= inet_pton(AF_INET
, addr_str
, &addr
);
3651 vty_out(vty
, "Bad unicast address %s: errno=%d: %s%s",
3652 addr_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
3656 if (pim_nexthop_lookup(&nexthop
, addr
, 0)) {
3657 vty_out(vty
, "Failure querying RIB nexthop for unicast address %s%s",
3658 addr_str
, VTY_NEWLINE
);
3662 vty_out(vty
, "Address NextHop Interface Metric Preference%s",
3665 pim_addr_dump("<nexthop?>", &nexthop
.mrib_nexthop_addr
,
3666 nexthop_addr_str
, sizeof(nexthop_addr_str
));
3668 vty_out(vty
, "%-15s %-15s %-9s %6d %10d%s",
3671 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
3672 nexthop
.mrib_route_metric
,
3673 nexthop
.mrib_metric_preference
,
3679 static void show_ssmpingd(struct vty
*vty
)
3681 struct listnode
*node
;
3682 struct ssmpingd_sock
*ss
;
3685 vty_out(vty
, "Source Socket Address Port Uptime Requests%s",
3688 if (!qpim_ssmpingd_list
)
3691 now
= pim_time_monotonic_sec();
3693 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
3694 char source_str
[INET_ADDRSTRLEN
];
3696 struct sockaddr_in bind_addr
;
3697 socklen_t len
= sizeof(bind_addr
);
3698 char bind_addr_str
[INET_ADDRSTRLEN
];
3700 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
3702 if (pim_socket_getsockname(ss
->sock_fd
, (struct sockaddr
*) &bind_addr
, &len
)) {
3703 vty_out(vty
, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
3704 source_str
, ss
->sock_fd
, VTY_NEWLINE
);
3707 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
, sizeof(bind_addr_str
));
3708 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
), now
- ss
->creation
);
3710 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld%s",
3714 ntohs(bind_addr
.sin_port
),
3716 (long long)ss
->requests
,
3721 DEFUN (show_ip_ssmpingd
,
3722 show_ip_ssmpingd_cmd
,
3733 pim_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
, const char *plist
)
3737 result
= pim_rp_new (rp
, group
, plist
);
3739 if (result
== PIM_MALLOC_FAIL
)
3741 vty_out (vty
, "%% Out of memory%s", VTY_NEWLINE
);
3745 if (result
== PIM_GROUP_BAD_ADDRESS
)
3747 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
3751 if (result
== PIM_RP_BAD_ADDRESS
)
3753 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
3757 if (result
== PIM_RP_NO_PATH
)
3759 vty_out (vty
, "%% No Path to RP address specified: %s%s", rp
, VTY_NEWLINE
);
3763 if (result
== PIM_GROUP_OVERLAP
)
3765 vty_out (vty
, "%% Group range specified cannot overlap%s", VTY_NEWLINE
);
3769 if (result
== PIM_GROUP_PFXLIST_OVERLAP
)
3771 vty_out (vty
, "%% This group is already covered by a RP prefix-list%s", VTY_NEWLINE
);
3775 if (result
== PIM_RP_PFXLIST_IN_USE
)
3777 vty_out (vty
, "%% The same prefix-list cannot be applied to multiple RPs%s", VTY_NEWLINE
);
3785 pim_cmd_spt_switchover (enum pim_spt_switchover spt
, const char *plist
)
3787 pimg
->spt
.switchover
= spt
;
3789 switch (pimg
->spt
.switchover
)
3791 case PIM_SPT_IMMEDIATE
:
3792 if (pimg
->spt
.plist
)
3793 XFREE (MTYPE_PIM_SPT_PLIST_NAME
, pimg
->spt
.plist
);
3795 pim_upstream_add_lhr_star_pimreg ();
3797 case PIM_SPT_INFINITY
:
3798 pim_upstream_remove_lhr_star_pimreg (plist
);
3800 if (pimg
->spt
.plist
)
3801 XFREE (MTYPE_PIM_SPT_PLIST_NAME
, pimg
->spt
.plist
);
3804 pimg
->spt
.plist
= XSTRDUP (MTYPE_PIM_SPT_PLIST_NAME
, plist
);
3811 DEFUN (ip_pim_spt_switchover_infinity
,
3812 ip_pim_spt_switchover_infinity_cmd
,
3813 "ip pim spt-switchover infinity-and-beyond",
3817 "Never switch to SPT Tree\n")
3819 return pim_cmd_spt_switchover (PIM_SPT_INFINITY
, NULL
);
3822 DEFUN (ip_pim_spt_switchover_infinity_plist
,
3823 ip_pim_spt_switchover_infinity_plist_cmd
,
3824 "ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3828 "Never switch to SPT Tree\n"
3829 "Prefix-List to control which groups to switch\n"
3830 "Prefix-List name\n")
3832 return pim_cmd_spt_switchover (PIM_SPT_INFINITY
, argv
[5]->arg
);
3835 DEFUN (no_ip_pim_spt_switchover_infinity
,
3836 no_ip_pim_spt_switchover_infinity_cmd
,
3837 "no ip pim spt-switchover infinity-and-beyond",
3842 "Never switch to SPT Tree\n")
3844 return pim_cmd_spt_switchover (PIM_SPT_IMMEDIATE
, NULL
);
3847 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
3848 no_ip_pim_spt_switchover_infinity_plist_cmd
,
3849 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3854 "Never switch to SPT Tree\n"
3855 "Prefix-List to control which groups to switch\n"
3856 "Prefix-List name\n")
3858 return pim_cmd_spt_switchover (PIM_SPT_IMMEDIATE
, NULL
);
3861 DEFUN (ip_pim_joinprune_time
,
3862 ip_pim_joinprune_time_cmd
,
3863 "ip pim join-prune-interval (60-600)",
3865 "pim multicast routing\n"
3866 "Join Prune Send Interval\n"
3869 qpim_t_periodic
= atoi(argv
[3]->arg
);
3873 DEFUN (no_ip_pim_joinprune_time
,
3874 no_ip_pim_joinprune_time_cmd
,
3875 "no ip pim join-prune-interval (60-600)",
3878 "pim multicast routing\n"
3879 "Join Prune Send Interval\n"
3882 qpim_t_periodic
= PIM_DEFAULT_T_PERIODIC
;
3886 DEFUN (ip_pim_register_suppress
,
3887 ip_pim_register_suppress_cmd
,
3888 "ip pim register-suppress-time (5-60000)",
3890 "pim multicast routing\n"
3891 "Register Suppress Timer\n"
3894 qpim_register_suppress_time
= atoi (argv
[3]->arg
);
3898 DEFUN (no_ip_pim_register_suppress
,
3899 no_ip_pim_register_suppress_cmd
,
3900 "no ip pim register-suppress-time (5-60000)",
3903 "pim multicast routing\n"
3904 "Register Suppress Timer\n"
3907 qpim_register_suppress_time
= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
;
3911 DEFUN (ip_pim_keep_alive
,
3912 ip_pim_keep_alive_cmd
,
3913 "ip pim keep-alive-timer (31-60000)",
3915 "pim multicast routing\n"
3916 "Keep alive Timer\n"
3919 qpim_keep_alive_time
= atoi (argv
[3]->arg
);
3923 DEFUN (no_ip_pim_keep_alive
,
3924 no_ip_pim_keep_alive_cmd
,
3925 "no ip pim keep-alive-timer (31-60000)",
3928 "pim multicast routing\n"
3929 "Keep alive Timer\n"
3932 qpim_keep_alive_time
= PIM_KEEPALIVE_PERIOD
;
3936 DEFUN (ip_pim_packets
,
3938 "ip pim packets (1-100)",
3940 "pim multicast routing\n"
3941 "packets to process at one time per fd\n"
3942 "Number of packets\n")
3944 qpim_packet_process
= atoi (argv
[3]->arg
);
3948 DEFUN (no_ip_pim_packets
,
3949 no_ip_pim_packets_cmd
,
3950 "no ip pim packets (1-100)",
3953 "pim multicast routing\n"
3954 "packets to process at one time per fd\n"
3955 "Number of packets\n")
3957 qpim_packet_process
= PIM_DEFAULT_PACKET_PROCESS
;
3961 DEFUN (ip_pim_v6_secondary
,
3962 ip_pim_v6_secondary_cmd
,
3963 "ip pim send-v6-secondary",
3965 "pim multicast routing\n"
3966 "Send v6 secondary addresses\n")
3968 pimg
->send_v6_secondary
= 1;
3973 DEFUN (no_ip_pim_v6_secondary
,
3974 no_ip_pim_v6_secondary_cmd
,
3975 "no ip pim send-v6-secondary",
3978 "pim multicast routing\n"
3979 "Send v6 secondary addresses\n")
3981 pimg
->send_v6_secondary
= 0;
3988 "ip pim rp A.B.C.D [A.B.C.D/M]",
3990 "pim multicast routing\n"
3992 "ip address of RP\n"
3993 "Group Address range to cover\n")
3997 if (argc
== (idx_ipv4
+ 1))
3998 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
4000 return pim_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_ipv4
+ 1]->arg
, NULL
);
4004 DEFUN (ip_pim_rp_prefix_list
,
4005 ip_pim_rp_prefix_list_cmd
,
4006 "ip pim rp A.B.C.D prefix-list WORD",
4008 "pim multicast routing\n"
4010 "ip address of RP\n"
4011 "group prefix-list filter\n"
4012 "Name of a prefix-list\n")
4014 return pim_rp_cmd_worker (vty
, argv
[3]->arg
, NULL
, argv
[5]->arg
);
4018 pim_no_rp_cmd_worker (struct vty
*vty
, const char *rp
, const char *group
,
4021 int result
= pim_rp_del (rp
, group
, plist
);
4023 if (result
== PIM_GROUP_BAD_ADDRESS
)
4025 vty_out (vty
, "%% Bad group address specified: %s%s", group
, VTY_NEWLINE
);
4029 if (result
== PIM_RP_BAD_ADDRESS
)
4031 vty_out (vty
, "%% Bad RP address specified: %s%s", rp
, VTY_NEWLINE
);
4035 if (result
== PIM_RP_NOT_FOUND
)
4037 vty_out (vty
, "%% Unable to find specified RP%s", VTY_NEWLINE
);
4044 DEFUN (no_ip_pim_rp
,
4046 "no ip pim rp A.B.C.D [A.B.C.D/M]",
4049 "pim multicast routing\n"
4051 "ip address of RP\n"
4052 "Group Address range to cover\n")
4054 int idx_ipv4
= 4, idx_group
= 0;
4056 if (argv_find (argv
, argc
, "A.B.C.D/M", &idx_group
))
4057 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, argv
[idx_group
]->arg
, NULL
);
4059 return pim_no_rp_cmd_worker (vty
, argv
[idx_ipv4
]->arg
, NULL
, NULL
);
4062 DEFUN (no_ip_pim_rp_prefix_list
,
4063 no_ip_pim_rp_prefix_list_cmd
,
4064 "no ip pim rp A.B.C.D prefix-list WORD",
4067 "pim multicast routing\n"
4069 "ip address of RP\n"
4070 "group prefix-list filter\n"
4071 "Name of a prefix-list\n")
4073 return pim_no_rp_cmd_worker (vty
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
4077 pim_ssm_cmd_worker (struct vty
*vty
, const char *plist
)
4079 int result
= pim_ssm_range_set (VRF_DEFAULT
, plist
);
4081 if (result
== PIM_SSM_ERR_NONE
)
4086 case PIM_SSM_ERR_NO_VRF
:
4087 vty_out (vty
, "%% VRF doesn't exist%s", VTY_NEWLINE
);
4089 case PIM_SSM_ERR_DUP
:
4090 vty_out (vty
, "%% duplicate config%s", VTY_NEWLINE
);
4093 vty_out (vty
, "%% ssm range config failed%s", VTY_NEWLINE
);
4099 DEFUN (ip_pim_ssm_prefix_list
,
4100 ip_pim_ssm_prefix_list_cmd
,
4101 "ip pim ssm prefix-list WORD",
4103 "pim multicast routing\n"
4104 "Source Specific Multicast\n"
4105 "group range prefix-list filter\n"
4106 "Name of a prefix-list\n")
4108 return pim_ssm_cmd_worker (vty
, argv
[0]->arg
);
4111 DEFUN (no_ip_pim_ssm_prefix_list
,
4112 no_ip_pim_ssm_prefix_list_cmd
,
4113 "no ip pim ssm prefix-list",
4116 "pim multicast routing\n"
4117 "Source Specific Multicast\n"
4118 "group range prefix-list filter\n")
4120 return pim_ssm_cmd_worker (vty
, NULL
);
4123 DEFUN (no_ip_pim_ssm_prefix_list_name
,
4124 no_ip_pim_ssm_prefix_list_name_cmd
,
4125 "no ip pim ssm prefix-list WORD",
4128 "pim multicast routing\n"
4129 "Source Specific Multicast\n"
4130 "group range prefix-list filter\n"
4131 "Name of a prefix-list\n")
4133 struct pim_ssm
*ssm
= pimg
->ssm_info
;
4135 if (ssm
->plist_name
&& !strcmp(ssm
->plist_name
, argv
[0]->arg
))
4136 return pim_ssm_cmd_worker (vty
, NULL
);
4138 vty_out (vty
, "%% pim ssm prefix-list %s doesn't exist%s",
4139 argv
[0]->arg
, VTY_NEWLINE
);
4145 ip_pim_ssm_show_group_range(struct vty
*vty
, u_char uj
)
4147 struct pim_ssm
*ssm
= pimg
->ssm_info
;
4148 const char *range_str
= ssm
->plist_name
?ssm
->plist_name
:PIM_SSM_STANDARD_RANGE
;
4153 json
= json_object_new_object();
4154 json_object_string_add(json
, "ssmGroups", range_str
);
4155 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
4156 json_object_free(json
);
4159 vty_out(vty
, "SSM group range : %s%s", range_str
, VTY_NEWLINE
);
4162 DEFUN (show_ip_pim_ssm_range
,
4163 show_ip_pim_ssm_range_cmd
,
4164 "show ip pim group-type [json]",
4169 "JavaScript Object Notation\n")
4171 u_char uj
= use_json(argc
, argv
);
4172 ip_pim_ssm_show_group_range(vty
, uj
);
4178 ip_pim_ssm_show_group_type(struct vty
*vty
, u_char uj
, const char *group
)
4180 struct in_addr group_addr
;
4181 const char *type_str
;
4184 result
= inet_pton(AF_INET
, group
, &group_addr
);
4186 type_str
= "invalid";
4189 if (pim_is_group_224_4 (group_addr
))
4190 type_str
= pim_is_grp_ssm (group_addr
)?"SSM":"ASM";
4192 type_str
= "not-multicast";
4198 json
= json_object_new_object();
4199 json_object_string_add(json
, "groupType", type_str
);
4200 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
4201 json_object_free(json
);
4204 vty_out(vty
, "Group type : %s%s", type_str
, VTY_NEWLINE
);
4207 DEFUN (show_ip_pim_group_type
,
4208 show_ip_pim_group_type_cmd
,
4209 "show ip pim group-type A.B.C.D [json]",
4213 "multicast group type\n"
4215 "JavaScript Object Notation\n")
4217 u_char uj
= use_json(argc
, argv
);
4218 ip_pim_ssm_show_group_type(vty
, uj
, argv
[0]->arg
);
4223 DEFUN_HIDDEN (ip_multicast_routing
,
4224 ip_multicast_routing_cmd
,
4225 "ip multicast-routing",
4227 "Enable IP multicast forwarding\n")
4232 DEFUN_HIDDEN (no_ip_multicast_routing
,
4233 no_ip_multicast_routing_cmd
,
4234 "no ip multicast-routing",
4237 "Global IP configuration subcommands\n"
4238 "Enable IP multicast forwarding\n")
4240 vty_out (vty
, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE
);
4246 "ip ssmpingd [A.B.C.D]",
4253 struct in_addr source_addr
;
4254 const char *source_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
4256 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4258 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
4259 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4263 result
= pim_ssmpingd_start(source_addr
);
4265 vty_out(vty
, "%% Failure starting ssmpingd for source %s: %d%s",
4266 source_str
, result
, VTY_NEWLINE
);
4273 DEFUN (no_ip_ssmpingd
,
4275 "no ip ssmpingd [A.B.C.D]",
4283 struct in_addr source_addr
;
4284 const char *source_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
4286 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4288 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
4289 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4293 result
= pim_ssmpingd_stop(source_addr
);
4295 vty_out(vty
, "%% Failure stopping ssmpingd for source %s: %d%s",
4296 source_str
, result
, VTY_NEWLINE
);
4307 "pim multicast routing\n"
4308 "Enable PIM ECMP \n")
4310 qpim_ecmp_enable
= 1;
4315 DEFUN (no_ip_pim_ecmp
,
4320 "pim multicast routing\n"
4321 "Disable PIM ECMP \n")
4323 qpim_ecmp_enable
= 0;
4328 DEFUN (ip_pim_ecmp_rebalance
,
4329 ip_pim_ecmp_rebalance_cmd
,
4330 "ip pim ecmp rebalance",
4332 "pim multicast routing\n"
4333 "Enable PIM ECMP \n"
4334 "Enable PIM ECMP Rebalance\n")
4336 qpim_ecmp_enable
= 1;
4337 qpim_ecmp_rebalance_enable
= 1;
4342 DEFUN (no_ip_pim_ecmp_rebalance
,
4343 no_ip_pim_ecmp_rebalance_cmd
,
4344 "no ip pim ecmp rebalance",
4347 "pim multicast routing\n"
4348 "Disable PIM ECMP \n"
4349 "Disable PIM ECMP Rebalance\n")
4351 qpim_ecmp_rebalance_enable
= 0;
4357 pim_cmd_igmp_start (struct vty
*vty
, struct interface
*ifp
)
4359 struct pim_interface
*pim_ifp
;
4360 uint8_t need_startup
= 0;
4362 pim_ifp
= ifp
->info
;
4366 pim_ifp
= pim_if_new(ifp
, 1 /* igmp=true */, 0 /* pim=false */);
4369 vty_out(vty
, "Could not enable IGMP on interface %s%s",
4370 ifp
->name
, VTY_NEWLINE
);
4377 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
))
4379 PIM_IF_DO_IGMP(pim_ifp
->options
);
4384 /* 'ip igmp' executed multiple times, with need_startup
4385 avoid multiple if add all and membership refresh */
4388 pim_if_addr_add_all(ifp
);
4389 pim_if_membership_refresh(ifp
);
4395 DEFUN (interface_ip_igmp
,
4396 interface_ip_igmp_cmd
,
4401 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4403 return pim_cmd_igmp_start(vty
, ifp
);
4406 DEFUN (interface_no_ip_igmp
,
4407 interface_no_ip_igmp_cmd
,
4413 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4414 struct pim_interface
*pim_ifp
;
4416 pim_ifp
= ifp
->info
;
4420 PIM_IF_DONT_IGMP(pim_ifp
->options
);
4422 pim_if_membership_clear(ifp
);
4424 pim_if_addr_del_all_igmp(ifp
);
4426 if (!PIM_IF_TEST_PIM(pim_ifp
->options
)) {
4433 DEFUN (interface_ip_igmp_join
,
4434 interface_ip_igmp_join_cmd
,
4435 "ip igmp join A.B.C.D A.B.C.D",
4438 "IGMP join multicast group\n"
4439 "Multicast group address\n"
4442 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4445 const char *group_str
;
4446 const char *source_str
;
4447 struct in_addr group_addr
;
4448 struct in_addr source_addr
;
4452 group_str
= argv
[idx_ipv4
]->arg
;
4453 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4455 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4456 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4460 /* Source address */
4461 source_str
= argv
[idx_ipv4_2
]->arg
;
4462 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4464 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4465 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4469 result
= pim_if_igmp_join_add(ifp
, group_addr
, source_addr
);
4471 vty_out(vty
, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
4472 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4479 DEFUN (interface_no_ip_igmp_join
,
4480 interface_no_ip_igmp_join_cmd
,
4481 "no ip igmp join A.B.C.D A.B.C.D",
4485 "IGMP join multicast group\n"
4486 "Multicast group address\n"
4489 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4492 const char *group_str
;
4493 const char *source_str
;
4494 struct in_addr group_addr
;
4495 struct in_addr source_addr
;
4499 group_str
= argv
[idx_ipv4
]->arg
;
4500 result
= inet_pton(AF_INET
, group_str
, &group_addr
);
4502 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
4503 group_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4507 /* Source address */
4508 source_str
= argv
[idx_ipv4_2
]->arg
;
4509 result
= inet_pton(AF_INET
, source_str
, &source_addr
);
4511 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
4512 source_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
4516 result
= pim_if_igmp_join_del(ifp
, group_addr
, source_addr
);
4518 vty_out(vty
, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
4519 group_str
, source_str
, ifp
->name
, result
, VTY_NEWLINE
);
4527 CLI reconfiguration affects the interface level (struct pim_interface).
4528 This function propagates the reconfiguration to every active socket
4531 static void igmp_sock_query_interval_reconfig(struct igmp_sock
*igmp
)
4533 struct interface
*ifp
;
4534 struct pim_interface
*pim_ifp
;
4538 /* other querier present? */
4540 if (igmp
->t_other_querier_timer
)
4543 /* this is the querier */
4545 zassert(igmp
->interface
);
4546 zassert(igmp
->interface
->info
);
4548 ifp
= igmp
->interface
;
4549 pim_ifp
= ifp
->info
;
4551 if (PIM_DEBUG_IGMP_TRACE
) {
4552 char ifaddr_str
[INET_ADDRSTRLEN
];
4553 pim_inet4_dump("<ifaddr?>", igmp
->ifaddr
, ifaddr_str
, sizeof(ifaddr_str
));
4554 zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
4555 __PRETTY_FUNCTION__
,
4558 pim_ifp
->igmp_default_query_interval
);
4562 igmp_startup_mode_on() will reset QQI:
4564 igmp->querier_query_interval = pim_ifp->igmp_default_query_interval;
4566 igmp_startup_mode_on(igmp
);
4569 static void igmp_sock_query_reschedule(struct igmp_sock
*igmp
)
4571 if (igmp
->t_igmp_query_timer
) {
4572 /* other querier present */
4573 zassert(igmp
->t_igmp_query_timer
);
4574 zassert(!igmp
->t_other_querier_timer
);
4576 pim_igmp_general_query_off(igmp
);
4577 pim_igmp_general_query_on(igmp
);
4579 zassert(igmp
->t_igmp_query_timer
);
4580 zassert(!igmp
->t_other_querier_timer
);
4583 /* this is the querier */
4585 zassert(!igmp
->t_igmp_query_timer
);
4586 zassert(igmp
->t_other_querier_timer
);
4588 pim_igmp_other_querier_timer_off(igmp
);
4589 pim_igmp_other_querier_timer_on(igmp
);
4591 zassert(!igmp
->t_igmp_query_timer
);
4592 zassert(igmp
->t_other_querier_timer
);
4596 static void change_query_interval(struct pim_interface
*pim_ifp
,
4599 struct listnode
*sock_node
;
4600 struct igmp_sock
*igmp
;
4602 pim_ifp
->igmp_default_query_interval
= query_interval
;
4604 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4605 igmp_sock_query_interval_reconfig(igmp
);
4606 igmp_sock_query_reschedule(igmp
);
4610 static void change_query_max_response_time(struct pim_interface
*pim_ifp
,
4611 int query_max_response_time_dsec
)
4613 struct listnode
*sock_node
;
4614 struct igmp_sock
*igmp
;
4616 pim_ifp
->igmp_query_max_response_time_dsec
= query_max_response_time_dsec
;
4619 Below we modify socket/group/source timers in order to quickly
4620 reflect the change. Otherwise, those timers would eventually catch
4624 /* scan all sockets */
4625 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_socket_list
, sock_node
, igmp
)) {
4626 struct listnode
*grp_node
;
4627 struct igmp_group
*grp
;
4629 /* reschedule socket general query */
4630 igmp_sock_query_reschedule(igmp
);
4632 /* scan socket groups */
4633 for (ALL_LIST_ELEMENTS_RO(igmp
->igmp_group_list
, grp_node
, grp
)) {
4634 struct listnode
*src_node
;
4635 struct igmp_source
*src
;
4637 /* reset group timers for groups in EXCLUDE mode */
4638 if (grp
->group_filtermode_isexcl
) {
4639 igmp_group_reset_gmi(grp
);
4642 /* scan group sources */
4643 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, src_node
, src
)) {
4645 /* reset source timers for sources with running timers */
4646 if (src
->t_source_timer
) {
4647 igmp_source_reset_gmi(igmp
, grp
, src
);
4654 #define IGMP_QUERY_INTERVAL_MIN (1)
4655 #define IGMP_QUERY_INTERVAL_MAX (1800)
4657 DEFUN (interface_ip_igmp_query_interval
,
4658 interface_ip_igmp_query_interval_cmd
,
4659 "ip igmp query-interval (1-1800)",
4662 IFACE_IGMP_QUERY_INTERVAL_STR
4663 "Query interval in seconds\n")
4665 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4666 struct pim_interface
*pim_ifp
;
4668 int query_interval_dsec
;
4671 pim_ifp
= ifp
->info
;
4674 ret
= pim_cmd_igmp_start(vty
, ifp
);
4675 if (ret
!= CMD_SUCCESS
)
4677 pim_ifp
= ifp
->info
;
4680 query_interval
= atoi(argv
[3]->arg
);
4681 query_interval_dsec
= 10 * query_interval
;
4684 It seems we don't need to check bounds since command.c does it
4685 already, but we verify them anyway for extra safety.
4687 if (query_interval
< IGMP_QUERY_INTERVAL_MIN
) {
4688 vty_out(vty
, "General query interval %d lower than minimum %d%s",
4690 IGMP_QUERY_INTERVAL_MIN
,
4694 if (query_interval
> IGMP_QUERY_INTERVAL_MAX
) {
4695 vty_out(vty
, "General query interval %d higher than maximum %d%s",
4697 IGMP_QUERY_INTERVAL_MAX
,
4702 if (query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4704 "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
4705 query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4710 change_query_interval(pim_ifp
, query_interval
);
4715 DEFUN (interface_no_ip_igmp_query_interval
,
4716 interface_no_ip_igmp_query_interval_cmd
,
4717 "no ip igmp query-interval",
4721 IFACE_IGMP_QUERY_INTERVAL_STR
)
4723 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4724 struct pim_interface
*pim_ifp
;
4725 int default_query_interval_dsec
;
4727 pim_ifp
= ifp
->info
;
4732 default_query_interval_dsec
= IGMP_GENERAL_QUERY_INTERVAL
* 10;
4734 if (default_query_interval_dsec
<= pim_ifp
->igmp_query_max_response_time_dsec
) {
4736 "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
4737 default_query_interval_dsec
, pim_ifp
->igmp_query_max_response_time_dsec
,
4742 change_query_interval(pim_ifp
, IGMP_GENERAL_QUERY_INTERVAL
);
4747 DEFUN (interface_ip_igmp_version
,
4748 interface_ip_igmp_version_cmd
,
4749 "ip igmp version (2-3)",
4753 "IGMP version number\n")
4755 VTY_DECLVAR_CONTEXT(interface
,ifp
);
4756 struct pim_interface
*pim_ifp
= NULL
;
4757 int igmp_version
, old_version
= 0;
4760 pim_ifp
= ifp
->info
;
4764 ret
= pim_cmd_igmp_start(vty
, ifp
);
4765 if (ret
!= CMD_SUCCESS
)
4767 pim_ifp
= ifp
->info
;
4770 igmp_version
= atoi(argv
[3]->arg
);
4771 old_version
= pim_ifp
->igmp_version
;
4772 pim_ifp
->igmp_version
= igmp_version
;
4774 //Check if IGMP is Enabled otherwise, enable on interface
4775 if (!PIM_IF_TEST_IGMP (pim_ifp
->options
))
4777 PIM_IF_DO_IGMP(pim_ifp
->options
);
4778 pim_if_addr_add_all(ifp
);
4779 pim_if_membership_refresh(ifp
);
4780 old_version
= igmp_version
; //avoid refreshing membership again.
4782 /* Current and new version is different refresh existing
4783 membership. Going from 3 -> 2 or 2 -> 3. */
4784 if (old_version
!= igmp_version
)
4785 pim_if_membership_refresh(ifp
);
4790 DEFUN (interface_no_ip_igmp_version
,
4791 interface_no_ip_igmp_version_cmd
,
4792 "no ip igmp version (2-3)",
4797 "IGMP version number\n")
4799 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4800 struct pim_interface
*pim_ifp
;
4802 pim_ifp
= ifp
->info
;
4807 pim_ifp
->igmp_version
= IGMP_DEFAULT_VERSION
;
4812 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4813 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4815 DEFUN (interface_ip_igmp_query_max_response_time
,
4816 interface_ip_igmp_query_max_response_time_cmd
,
4817 "ip igmp query-max-response-time (10-250)",
4820 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4821 "Query response value in deci-seconds\n")
4823 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4824 struct pim_interface
*pim_ifp
;
4825 int query_max_response_time
;
4828 pim_ifp
= ifp
->info
;
4831 ret
= pim_cmd_igmp_start(vty
, ifp
);
4832 if (ret
!= CMD_SUCCESS
)
4834 pim_ifp
= ifp
->info
;
4837 query_max_response_time
= atoi(argv
[3]->arg
);
4839 if (query_max_response_time
>= pim_ifp
->igmp_default_query_interval
* 10) {
4841 "Can't set query max response time %d sec >= general query interval %d sec%s",
4842 query_max_response_time
, pim_ifp
->igmp_default_query_interval
,
4847 change_query_max_response_time(pim_ifp
, query_max_response_time
);
4852 DEFUN (interface_no_ip_igmp_query_max_response_time
,
4853 interface_no_ip_igmp_query_max_response_time_cmd
,
4854 "no ip igmp query-max-response-time (10-250)",
4858 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4859 "Time for response in deci-seconds\n")
4861 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4862 struct pim_interface
*pim_ifp
;
4864 pim_ifp
= ifp
->info
;
4869 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4874 #define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10)
4875 #define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250)
4877 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
4878 interface_ip_igmp_query_max_response_time_dsec_cmd
,
4879 "ip igmp query-max-response-time-dsec (10-250)",
4882 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4883 "Query response value in deciseconds\n")
4885 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4886 struct pim_interface
*pim_ifp
;
4887 int query_max_response_time_dsec
;
4888 int default_query_interval_dsec
;
4891 pim_ifp
= ifp
->info
;
4894 ret
= pim_cmd_igmp_start(vty
, ifp
);
4895 if (ret
!= CMD_SUCCESS
)
4897 pim_ifp
= ifp
->info
;
4900 query_max_response_time_dsec
= atoi(argv
[4]->arg
);
4902 default_query_interval_dsec
= 10 * pim_ifp
->igmp_default_query_interval
;
4904 if (query_max_response_time_dsec
>= default_query_interval_dsec
) {
4906 "Can't set query max response time %d dsec >= general query interval %d dsec%s",
4907 query_max_response_time_dsec
, default_query_interval_dsec
,
4912 change_query_max_response_time(pim_ifp
, query_max_response_time_dsec
);
4917 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4918 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4919 "no ip igmp query-max-response-time-dsec",
4923 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
)
4925 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4926 struct pim_interface
*pim_ifp
;
4928 pim_ifp
= ifp
->info
;
4933 change_query_max_response_time(pim_ifp
, IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
);
4938 DEFUN (interface_ip_pim_drprio
,
4939 interface_ip_pim_drprio_cmd
,
4940 "ip pim drpriority (1-4294967295)",
4943 "Set the Designated Router Election Priority\n"
4944 "Value of the new DR Priority\n")
4946 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4948 struct pim_interface
*pim_ifp
;
4949 uint32_t old_dr_prio
;
4951 pim_ifp
= ifp
->info
;
4954 vty_out(vty
, "Please enable PIM on interface, first%s", VTY_NEWLINE
);
4958 old_dr_prio
= pim_ifp
->pim_dr_priority
;
4960 pim_ifp
->pim_dr_priority
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
4962 if (old_dr_prio
!= pim_ifp
->pim_dr_priority
) {
4963 if (pim_if_dr_election(ifp
))
4964 pim_hello_restart_now(ifp
);
4970 DEFUN (interface_no_ip_pim_drprio
,
4971 interface_no_ip_pim_drprio_cmd
,
4972 "no ip pim drpriority [(1-4294967295)]",
4976 "Revert the Designated Router Priority to default\n"
4977 "Old Value of the Priority\n")
4979 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4980 struct pim_interface
*pim_ifp
;
4982 pim_ifp
= ifp
->info
;
4985 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
4989 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
4990 pim_ifp
->pim_dr_priority
= PIM_DEFAULT_DR_PRIORITY
;
4991 if (pim_if_dr_election(ifp
))
4992 pim_hello_restart_now(ifp
);
4999 pim_cmd_interface_add (struct interface
*ifp
)
5001 struct pim_interface
*pim_ifp
= ifp
->info
;
5004 pim_ifp
= pim_if_new(ifp
, 0 /* igmp=false */, 1 /* pim=true */);
5010 PIM_IF_DO_PIM(pim_ifp
->options
);
5013 pim_if_addr_add_all(ifp
);
5014 pim_if_membership_refresh(ifp
);
5018 DEFUN_HIDDEN (interface_ip_pim_ssm
,
5019 interface_ip_pim_ssm_cmd
,
5025 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5027 if (!pim_cmd_interface_add(ifp
)) {
5028 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
5032 vty_out(vty
, "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed%s", VTY_NEWLINE
);
5036 DEFUN (interface_ip_pim_sm
,
5037 interface_ip_pim_sm_cmd
,
5043 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5044 if (!pim_cmd_interface_add(ifp
)) {
5045 vty_out(vty
, "Could not enable PIM SM on interface%s", VTY_NEWLINE
);
5049 pim_if_create_pimreg();
5055 pim_cmd_interface_delete (struct interface
*ifp
)
5057 struct pim_interface
*pim_ifp
= ifp
->info
;
5062 PIM_IF_DONT_PIM(pim_ifp
->options
);
5064 pim_if_membership_clear(ifp
);
5067 pim_sock_delete() removes all neighbors from
5068 pim_ifp->pim_neighbor_list.
5070 pim_sock_delete(ifp
, "pim unconfigured on interface");
5072 if (!PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
5073 pim_if_addr_del_all(ifp
);
5080 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
5081 interface_no_ip_pim_ssm_cmd
,
5088 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5089 if (!pim_cmd_interface_delete(ifp
)) {
5090 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
5097 DEFUN (interface_no_ip_pim_sm
,
5098 interface_no_ip_pim_sm_cmd
,
5105 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5106 if (!pim_cmd_interface_delete(ifp
)) {
5107 vty_out(vty
, "Unable to delete interface information%s", VTY_NEWLINE
);
5114 DEFUN (interface_ip_mroute
,
5115 interface_ip_mroute_cmd
,
5116 "ip mroute INTERFACE A.B.C.D",
5118 "Add multicast route\n"
5119 "Outgoing interface name\n"
5122 VTY_DECLVAR_CONTEXT(interface
, iif
);
5123 int idx_interface
= 2;
5125 struct interface
*oif
;
5126 const char *oifname
;
5127 const char *grp_str
;
5128 struct in_addr grp_addr
;
5129 struct in_addr src_addr
;
5132 oifname
= argv
[idx_interface
]->arg
;
5133 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5135 vty_out(vty
, "No such interface name %s%s",
5136 oifname
, VTY_NEWLINE
);
5140 grp_str
= argv
[idx_ipv4
]->arg
;
5141 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5143 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5144 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5148 src_addr
.s_addr
= INADDR_ANY
;
5150 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
5151 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
5158 DEFUN (interface_ip_mroute_source
,
5159 interface_ip_mroute_source_cmd
,
5160 "ip mroute INTERFACE A.B.C.D A.B.C.D",
5162 "Add multicast route\n"
5163 "Outgoing interface name\n"
5167 VTY_DECLVAR_CONTEXT(interface
, iif
);
5168 int idx_interface
= 2;
5171 struct interface
*oif
;
5172 const char *oifname
;
5173 const char *grp_str
;
5174 struct in_addr grp_addr
;
5175 const char *src_str
;
5176 struct in_addr src_addr
;
5179 oifname
= argv
[idx_interface
]->arg
;
5180 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5182 vty_out(vty
, "No such interface name %s%s",
5183 oifname
, VTY_NEWLINE
);
5187 grp_str
= argv
[idx_ipv4
]->arg
;
5188 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5190 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5191 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5195 src_str
= argv
[idx_ipv4_2
]->arg
;
5196 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
5198 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
5199 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5203 if (pim_static_add(iif
, oif
, grp_addr
, src_addr
)) {
5204 vty_out(vty
, "Failed to add route%s", VTY_NEWLINE
);
5211 DEFUN (interface_no_ip_mroute
,
5212 interface_no_ip_mroute_cmd
,
5213 "no ip mroute INTERFACE A.B.C.D",
5216 "Add multicast route\n"
5217 "Outgoing interface name\n"
5220 VTY_DECLVAR_CONTEXT(interface
, iif
);
5221 int idx_interface
= 3;
5223 struct interface
*oif
;
5224 const char *oifname
;
5225 const char *grp_str
;
5226 struct in_addr grp_addr
;
5227 struct in_addr src_addr
;
5230 oifname
= argv
[idx_interface
]->arg
;
5231 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5233 vty_out(vty
, "No such interface name %s%s",
5234 oifname
, VTY_NEWLINE
);
5238 grp_str
= argv
[idx_ipv4
]->arg
;
5239 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5241 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5242 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5246 src_addr
.s_addr
= INADDR_ANY
;
5248 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
5249 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
5256 DEFUN (interface_no_ip_mroute_source
,
5257 interface_no_ip_mroute_source_cmd
,
5258 "no ip mroute INTERFACE A.B.C.D A.B.C.D",
5261 "Add multicast route\n"
5262 "Outgoing interface name\n"
5266 VTY_DECLVAR_CONTEXT(interface
, iif
);
5267 int idx_interface
= 3;
5270 struct interface
*oif
;
5271 const char *oifname
;
5272 const char *grp_str
;
5273 struct in_addr grp_addr
;
5274 const char *src_str
;
5275 struct in_addr src_addr
;
5278 oifname
= argv
[idx_interface
]->arg
;
5279 oif
= if_lookup_by_name(oifname
, VRF_DEFAULT
);
5281 vty_out(vty
, "No such interface name %s%s",
5282 oifname
, VTY_NEWLINE
);
5286 grp_str
= argv
[idx_ipv4
]->arg
;
5287 result
= inet_pton(AF_INET
, grp_str
, &grp_addr
);
5289 vty_out(vty
, "Bad group address %s: errno=%d: %s%s",
5290 grp_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5294 src_str
= argv
[idx_ipv4_2
]->arg
;
5295 result
= inet_pton(AF_INET
, src_str
, &src_addr
);
5297 vty_out(vty
, "Bad source address %s: errno=%d: %s%s",
5298 src_str
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5302 if (pim_static_del(iif
, oif
, grp_addr
, src_addr
)) {
5303 vty_out(vty
, "Failed to remove route%s", VTY_NEWLINE
);
5310 DEFUN (interface_ip_pim_hello
,
5311 interface_ip_pim_hello_cmd
,
5312 "ip pim hello (1-180) [(1-180)]",
5316 IFACE_PIM_HELLO_TIME_STR
5317 IFACE_PIM_HELLO_HOLD_STR
)
5319 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5322 struct pim_interface
*pim_ifp
;
5324 pim_ifp
= ifp
->info
;
5327 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5331 pim_ifp
->pim_hello_period
= strtol(argv
[idx_time
]->arg
, NULL
, 10);
5333 if (argc
== idx_hold
+ 1)
5334 pim_ifp
->pim_default_holdtime
= strtol(argv
[idx_hold
]->arg
, NULL
, 10);
5341 DEFUN (interface_no_ip_pim_hello
,
5342 interface_no_ip_pim_hello_cmd
,
5343 "no ip pim hello [(1-180) (1-180)]",
5348 IFACE_PIM_HELLO_TIME_STR
5349 IFACE_PIM_HELLO_HOLD_STR
)
5351 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5352 struct pim_interface
*pim_ifp
;
5354 pim_ifp
= ifp
->info
;
5357 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5361 pim_ifp
->pim_hello_period
= PIM_DEFAULT_HELLO_PERIOD
;
5362 pim_ifp
->pim_default_holdtime
= -1;
5373 PIM_DO_DEBUG_IGMP_EVENTS
;
5374 PIM_DO_DEBUG_IGMP_PACKETS
;
5375 PIM_DO_DEBUG_IGMP_TRACE
;
5379 DEFUN (no_debug_igmp
,
5386 PIM_DONT_DEBUG_IGMP_EVENTS
;
5387 PIM_DONT_DEBUG_IGMP_PACKETS
;
5388 PIM_DONT_DEBUG_IGMP_TRACE
;
5393 DEFUN (debug_igmp_events
,
5394 debug_igmp_events_cmd
,
5395 "debug igmp events",
5398 DEBUG_IGMP_EVENTS_STR
)
5400 PIM_DO_DEBUG_IGMP_EVENTS
;
5404 DEFUN (no_debug_igmp_events
,
5405 no_debug_igmp_events_cmd
,
5406 "no debug igmp events",
5410 DEBUG_IGMP_EVENTS_STR
)
5412 PIM_DONT_DEBUG_IGMP_EVENTS
;
5417 DEFUN (debug_igmp_packets
,
5418 debug_igmp_packets_cmd
,
5419 "debug igmp packets",
5422 DEBUG_IGMP_PACKETS_STR
)
5424 PIM_DO_DEBUG_IGMP_PACKETS
;
5428 DEFUN (no_debug_igmp_packets
,
5429 no_debug_igmp_packets_cmd
,
5430 "no debug igmp packets",
5434 DEBUG_IGMP_PACKETS_STR
)
5436 PIM_DONT_DEBUG_IGMP_PACKETS
;
5441 DEFUN (debug_igmp_trace
,
5442 debug_igmp_trace_cmd
,
5446 DEBUG_IGMP_TRACE_STR
)
5448 PIM_DO_DEBUG_IGMP_TRACE
;
5452 DEFUN (no_debug_igmp_trace
,
5453 no_debug_igmp_trace_cmd
,
5454 "no debug igmp trace",
5458 DEBUG_IGMP_TRACE_STR
)
5460 PIM_DONT_DEBUG_IGMP_TRACE
;
5465 DEFUN (debug_mroute
,
5471 PIM_DO_DEBUG_MROUTE
;
5475 DEFUN (debug_mroute_detail
,
5476 debug_mroute_detail_cmd
,
5477 "debug mroute detail",
5482 PIM_DO_DEBUG_MROUTE_DETAIL
;
5486 DEFUN (no_debug_mroute
,
5487 no_debug_mroute_cmd
,
5493 PIM_DONT_DEBUG_MROUTE
;
5497 DEFUN (no_debug_mroute_detail
,
5498 no_debug_mroute_detail_cmd
,
5499 "no debug mroute detail",
5505 PIM_DONT_DEBUG_MROUTE_DETAIL
;
5509 DEFUN (debug_static
,
5515 PIM_DO_DEBUG_STATIC
;
5519 DEFUN (no_debug_static
,
5520 no_debug_static_cmd
,
5526 PIM_DONT_DEBUG_STATIC
;
5537 PIM_DO_DEBUG_PIM_EVENTS
;
5538 PIM_DO_DEBUG_PIM_PACKETS
;
5539 PIM_DO_DEBUG_PIM_TRACE
;
5540 PIM_DO_DEBUG_MSDP_EVENTS
;
5541 PIM_DO_DEBUG_MSDP_PACKETS
;
5545 DEFUN (no_debug_pim
,
5552 PIM_DONT_DEBUG_PIM_EVENTS
;
5553 PIM_DONT_DEBUG_PIM_PACKETS
;
5554 PIM_DONT_DEBUG_PIM_TRACE
;
5555 PIM_DONT_DEBUG_MSDP_EVENTS
;
5556 PIM_DONT_DEBUG_MSDP_PACKETS
;
5558 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5559 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5565 DEFUN (debug_pim_events
,
5566 debug_pim_events_cmd
,
5570 DEBUG_PIM_EVENTS_STR
)
5572 PIM_DO_DEBUG_PIM_EVENTS
;
5576 DEFUN (no_debug_pim_events
,
5577 no_debug_pim_events_cmd
,
5578 "no debug pim events",
5582 DEBUG_PIM_EVENTS_STR
)
5584 PIM_DONT_DEBUG_PIM_EVENTS
;
5588 DEFUN (debug_pim_packets
,
5589 debug_pim_packets_cmd
,
5590 "debug pim packets [<hello|joins|register>]",
5593 DEBUG_PIM_PACKETS_STR
5594 DEBUG_PIM_HELLO_PACKETS_STR
5595 DEBUG_PIM_J_P_PACKETS_STR
5596 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5599 if (argv_find (argv
, argc
, "hello", &idx
))
5601 PIM_DO_DEBUG_PIM_HELLO
;
5602 vty_out (vty
, "PIM Hello debugging is on%s", VTY_NEWLINE
);
5604 else if (argv_find (argv
, argc
,"joins", &idx
))
5606 PIM_DO_DEBUG_PIM_J_P
;
5607 vty_out (vty
, "PIM Join/Prune debugging is on%s", VTY_NEWLINE
);
5609 else if (argv_find (argv
, argc
, "register", &idx
))
5611 PIM_DO_DEBUG_PIM_REG
;
5612 vty_out (vty
, "PIM Register debugging is on%s", VTY_NEWLINE
);
5616 PIM_DO_DEBUG_PIM_PACKETS
;
5617 vty_out (vty
, "PIM Packet debugging is on %s", VTY_NEWLINE
);
5622 DEFUN (no_debug_pim_packets
,
5623 no_debug_pim_packets_cmd
,
5624 "no debug pim packets [<hello|joins|register>]",
5628 DEBUG_PIM_PACKETS_STR
5629 DEBUG_PIM_HELLO_PACKETS_STR
5630 DEBUG_PIM_J_P_PACKETS_STR
5631 DEBUG_PIM_PIM_REG_PACKETS_STR
)
5634 if (argv_find (argv
, argc
,"hello",&idx
))
5636 PIM_DONT_DEBUG_PIM_HELLO
;
5637 vty_out (vty
, "PIM Hello debugging is off %s", VTY_NEWLINE
);
5639 else if (argv_find (argv
, argc
, "joins", &idx
))
5641 PIM_DONT_DEBUG_PIM_J_P
;
5642 vty_out (vty
, "PIM Join/Prune debugging is off %s", VTY_NEWLINE
);
5644 else if (argv_find (argv
, argc
, "register", &idx
))
5646 PIM_DONT_DEBUG_PIM_REG
;
5647 vty_out (vty
, "PIM Register debugging is off%s", VTY_NEWLINE
);
5650 PIM_DONT_DEBUG_PIM_PACKETS
;
5656 DEFUN (debug_pim_packetdump_send
,
5657 debug_pim_packetdump_send_cmd
,
5658 "debug pim packet-dump send",
5661 DEBUG_PIM_PACKETDUMP_STR
5662 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5664 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
5668 DEFUN (no_debug_pim_packetdump_send
,
5669 no_debug_pim_packetdump_send_cmd
,
5670 "no debug pim packet-dump send",
5674 DEBUG_PIM_PACKETDUMP_STR
5675 DEBUG_PIM_PACKETDUMP_SEND_STR
)
5677 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
5682 DEFUN (debug_pim_packetdump_recv
,
5683 debug_pim_packetdump_recv_cmd
,
5684 "debug pim packet-dump receive",
5687 DEBUG_PIM_PACKETDUMP_STR
5688 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5690 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
5694 DEFUN (no_debug_pim_packetdump_recv
,
5695 no_debug_pim_packetdump_recv_cmd
,
5696 "no debug pim packet-dump receive",
5700 DEBUG_PIM_PACKETDUMP_STR
5701 DEBUG_PIM_PACKETDUMP_RECV_STR
)
5703 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
5708 DEFUN (debug_pim_trace
,
5709 debug_pim_trace_cmd
,
5713 DEBUG_PIM_TRACE_STR
)
5715 PIM_DO_DEBUG_PIM_TRACE
;
5719 DEFUN (no_debug_pim_trace
,
5720 no_debug_pim_trace_cmd
,
5721 "no debug pim trace",
5725 DEBUG_PIM_TRACE_STR
)
5727 PIM_DONT_DEBUG_PIM_TRACE
;
5732 DEFUN (debug_ssmpingd
,
5739 PIM_DO_DEBUG_SSMPINGD
;
5743 DEFUN (no_debug_ssmpingd
,
5744 no_debug_ssmpingd_cmd
,
5745 "no debug ssmpingd",
5751 PIM_DONT_DEBUG_SSMPINGD
;
5756 DEFUN (debug_pim_zebra
,
5757 debug_pim_zebra_cmd
,
5761 DEBUG_PIM_ZEBRA_STR
)
5767 DEFUN (no_debug_pim_zebra
,
5768 no_debug_pim_zebra_cmd
,
5769 "no debug pim zebra",
5773 DEBUG_PIM_ZEBRA_STR
)
5775 PIM_DONT_DEBUG_ZEBRA
;
5786 PIM_DO_DEBUG_MSDP_EVENTS
;
5787 PIM_DO_DEBUG_MSDP_PACKETS
;
5791 DEFUN (no_debug_msdp
,
5798 PIM_DONT_DEBUG_MSDP_EVENTS
;
5799 PIM_DONT_DEBUG_MSDP_PACKETS
;
5803 ALIAS (no_debug_msdp
,
5809 DEFUN (debug_msdp_events
,
5810 debug_msdp_events_cmd
,
5811 "debug msdp events",
5814 DEBUG_MSDP_EVENTS_STR
)
5816 PIM_DO_DEBUG_MSDP_EVENTS
;
5820 DEFUN (no_debug_msdp_events
,
5821 no_debug_msdp_events_cmd
,
5822 "no debug msdp events",
5826 DEBUG_MSDP_EVENTS_STR
)
5828 PIM_DONT_DEBUG_MSDP_EVENTS
;
5832 ALIAS (no_debug_msdp_events
,
5833 undebug_msdp_events_cmd
,
5834 "undebug msdp events",
5837 DEBUG_MSDP_EVENTS_STR
)
5839 DEFUN (debug_msdp_packets
,
5840 debug_msdp_packets_cmd
,
5841 "debug msdp packets",
5844 DEBUG_MSDP_PACKETS_STR
)
5846 PIM_DO_DEBUG_MSDP_PACKETS
;
5850 DEFUN (no_debug_msdp_packets
,
5851 no_debug_msdp_packets_cmd
,
5852 "no debug msdp packets",
5856 DEBUG_MSDP_PACKETS_STR
)
5858 PIM_DONT_DEBUG_MSDP_PACKETS
;
5862 ALIAS (no_debug_msdp_packets
,
5863 undebug_msdp_packets_cmd
,
5864 "undebug msdp packets",
5867 DEBUG_MSDP_PACKETS_STR
)
5869 DEFUN (show_debugging_pim
,
5870 show_debugging_pim_cmd
,
5871 "show debugging pim",
5876 pim_debug_config_write(vty
);
5881 interface_pim_use_src_cmd_worker(struct vty
*vty
, const char *source
)
5884 struct in_addr source_addr
;
5885 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5887 result
= inet_pton(AF_INET
, source
, &source_addr
);
5889 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
5890 source
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
5894 result
= pim_update_source_set(ifp
, source_addr
);
5898 case PIM_IFACE_NOT_FOUND
:
5899 vty_out(vty
, "Pim not enabled on this interface%s", VTY_NEWLINE
);
5901 case PIM_UPDATE_SOURCE_DUP
:
5902 vty_out(vty
, "%% Source already set to %s%s", source
, VTY_NEWLINE
);
5905 vty_out(vty
, "%% Source set failed%s", VTY_NEWLINE
);
5908 return result
?CMD_WARNING
:CMD_SUCCESS
;
5911 DEFUN (interface_pim_use_source
,
5912 interface_pim_use_source_cmd
,
5913 "ip pim use-source A.B.C.D",
5915 "pim multicast routing\n"
5916 "Configure primary IP address\n"
5917 "source ip address\n")
5919 return interface_pim_use_src_cmd_worker (vty
, argv
[3]->arg
);
5922 DEFUN (interface_no_pim_use_source
,
5923 interface_no_pim_use_source_cmd
,
5924 "no ip pim use-source",
5927 "pim multicast routing\n"
5928 "Delete source IP address\n")
5930 return interface_pim_use_src_cmd_worker (vty
, "0.0.0.0");
5938 "Enables BFD support\n")
5940 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5941 struct pim_interface
*pim_ifp
= NULL
;
5942 struct bfd_info
*bfd_info
= NULL
;
5946 pim_ifp
= ifp
->info
;
5949 bfd_info
= pim_ifp
->bfd_info
;
5951 if (!bfd_info
|| !CHECK_FLAG (bfd_info
->flags
, BFD_FLAG_PARAM_CFG
))
5952 pim_bfd_if_param_set (ifp
, BFD_DEF_MIN_RX
, BFD_DEF_MIN_TX
,
5953 BFD_DEF_DETECT_MULT
, 1);
5958 DEFUN (no_ip_pim_bfd
,
5964 "Disables BFD support\n")
5966 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5967 struct pim_interface
*pim_ifp
= NULL
;
5971 pim_ifp
= ifp
->info
;
5975 if (pim_ifp
->bfd_info
)
5977 pim_bfd_reg_dereg_all_nbr (ifp
, ZEBRA_BFD_DEST_DEREGISTER
);
5978 bfd_info_free (&(pim_ifp
->bfd_info
));
5984 DEFUN (ip_pim_bfd_param
,
5985 ip_pim_bfd_param_cmd
,
5986 "ip pim bfd (2-255) (50-60000) (50-60000)",
5989 "Enables BFD support\n"
5990 "Detect Multiplier\n"
5991 "Required min receive interval\n"
5992 "Desired min transmit interval\n")
5994 VTY_DECLVAR_CONTEXT(interface
, ifp
);
5996 int idx_number_2
= 4;
5997 int idx_number_3
= 5;
6004 if ((ret
= bfd_validate_param (vty
, argv
[idx_number
]->arg
,
6005 argv
[idx_number_2
]->arg
,
6006 argv
[idx_number_3
]->arg
,
6007 &dm_val
, &rx_val
, &tx_val
)) != CMD_SUCCESS
)
6010 pim_bfd_if_param_set (ifp
, rx_val
, tx_val
, dm_val
, 0);
6015 ALIAS (no_ip_pim_bfd
,
6016 no_ip_pim_bfd_param_cmd
,
6017 "no ip pim bfd (2-255) (50-60000) (50-60000)",
6021 "Enables BFD support\n"
6022 "Detect Multiplier\n"
6023 "Required min receive interval\n"
6024 "Desired min transmit interval\n")
6027 ip_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
, const char *local
)
6029 enum pim_msdp_err result
;
6030 struct in_addr peer_addr
;
6031 struct in_addr local_addr
;
6033 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
6035 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
6036 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6040 result
= inet_pton(AF_INET
, local
, &local_addr
);
6042 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
6043 local
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6047 result
= pim_msdp_peer_add(peer_addr
, local_addr
, "default", NULL
/* mp_p */);
6049 case PIM_MSDP_ERR_NONE
:
6051 case PIM_MSDP_ERR_OOM
:
6052 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
6054 case PIM_MSDP_ERR_PEER_EXISTS
:
6055 vty_out(vty
, "%% Peer exists%s", VTY_NEWLINE
);
6057 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
6058 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
6061 vty_out(vty
, "%% peer add failed%s", VTY_NEWLINE
);
6064 return result
?CMD_WARNING
:CMD_SUCCESS
;
6067 DEFUN_HIDDEN (ip_msdp_peer
,
6069 "ip msdp peer A.B.C.D source A.B.C.D",
6072 "Configure MSDP peer\n"
6074 "Source address for TCP connection\n"
6075 "local ip address\n")
6077 return ip_msdp_peer_cmd_worker (vty
, argv
[3]->arg
, argv
[5]->arg
);
6081 ip_no_msdp_peer_cmd_worker (struct vty
*vty
, const char *peer
)
6083 enum pim_msdp_err result
;
6084 struct in_addr peer_addr
;
6086 result
= inet_pton(AF_INET
, peer
, &peer_addr
);
6088 vty_out(vty
, "%% Bad peer address %s: errno=%d: %s%s",
6089 peer
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6093 result
= pim_msdp_peer_del(peer_addr
);
6095 case PIM_MSDP_ERR_NONE
:
6097 case PIM_MSDP_ERR_NO_PEER
:
6098 vty_out(vty
, "%% Peer does not exist%s", VTY_NEWLINE
);
6101 vty_out(vty
, "%% peer del failed%s", VTY_NEWLINE
);
6104 return result
?CMD_WARNING
:CMD_SUCCESS
;
6107 DEFUN_HIDDEN (no_ip_msdp_peer
,
6108 no_ip_msdp_peer_cmd
,
6109 "no ip msdp peer A.B.C.D",
6113 "Delete MSDP peer\n"
6114 "peer ip address\n")
6116 return ip_no_msdp_peer_cmd_worker (vty
, argv
[4]->arg
);
6120 ip_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
6122 enum pim_msdp_err result
;
6123 struct in_addr mbr_ip
;
6125 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
6127 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
6128 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6132 result
= pim_msdp_mg_mbr_add(mg
, mbr_ip
);
6134 case PIM_MSDP_ERR_NONE
:
6136 case PIM_MSDP_ERR_OOM
:
6137 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
6139 case PIM_MSDP_ERR_MG_MBR_EXISTS
:
6140 vty_out(vty
, "%% mesh-group member exists%s", VTY_NEWLINE
);
6142 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
6143 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
6146 vty_out(vty
, "%% member add failed%s", VTY_NEWLINE
);
6149 return result
?CMD_WARNING
:CMD_SUCCESS
;
6152 DEFUN (ip_msdp_mesh_group_member
,
6153 ip_msdp_mesh_group_member_cmd
,
6154 "ip msdp mesh-group WORD member A.B.C.D",
6157 "Configure MSDP mesh-group\n"
6159 "mesh group member\n"
6160 "peer ip address\n")
6162 return ip_msdp_mesh_group_member_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
6166 ip_no_msdp_mesh_group_member_cmd_worker(struct vty
*vty
, const char *mg
, const char *mbr
)
6168 enum pim_msdp_err result
;
6169 struct in_addr mbr_ip
;
6171 result
= inet_pton(AF_INET
, mbr
, &mbr_ip
);
6173 vty_out(vty
, "%% Bad member address %s: errno=%d: %s%s",
6174 mbr
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6178 result
= pim_msdp_mg_mbr_del(mg
, mbr_ip
);
6180 case PIM_MSDP_ERR_NONE
:
6182 case PIM_MSDP_ERR_NO_MG
:
6183 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
6185 case PIM_MSDP_ERR_NO_MG_MBR
:
6186 vty_out(vty
, "%% mesh-group member does not exist%s", VTY_NEWLINE
);
6189 vty_out(vty
, "%% mesh-group member del failed%s", VTY_NEWLINE
);
6192 return result
?CMD_WARNING
:CMD_SUCCESS
;
6194 DEFUN (no_ip_msdp_mesh_group_member
,
6195 no_ip_msdp_mesh_group_member_cmd
,
6196 "no ip msdp mesh-group WORD member A.B.C.D",
6200 "Delete MSDP mesh-group member\n"
6202 "mesh group member\n"
6203 "peer ip address\n")
6205 return ip_no_msdp_mesh_group_member_cmd_worker(vty
, argv
[4]->arg
, argv
[6]->arg
);
6209 ip_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
, const char *src
)
6211 enum pim_msdp_err result
;
6212 struct in_addr src_ip
;
6214 result
= inet_pton(AF_INET
, src
, &src_ip
);
6216 vty_out(vty
, "%% Bad source address %s: errno=%d: %s%s",
6217 src
, errno
, safe_strerror(errno
), VTY_NEWLINE
);
6221 result
= pim_msdp_mg_src_add(mg
, src_ip
);
6223 case PIM_MSDP_ERR_NONE
:
6225 case PIM_MSDP_ERR_OOM
:
6226 vty_out(vty
, "%% Out of memory%s", VTY_NEWLINE
);
6228 case PIM_MSDP_ERR_MAX_MESH_GROUPS
:
6229 vty_out(vty
, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE
);
6232 vty_out(vty
, "%% source add failed%s", VTY_NEWLINE
);
6235 return result
?CMD_WARNING
:CMD_SUCCESS
;
6239 DEFUN (ip_msdp_mesh_group_source
,
6240 ip_msdp_mesh_group_source_cmd
,
6241 "ip msdp mesh-group WORD source A.B.C.D",
6244 "Configure MSDP mesh-group\n"
6246 "mesh group local address\n"
6247 "source ip address for the TCP connection\n")
6249 return ip_msdp_mesh_group_source_cmd_worker(vty
, argv
[3]->arg
, argv
[5]->arg
);
6253 ip_no_msdp_mesh_group_source_cmd_worker(struct vty
*vty
, const char *mg
)
6255 enum pim_msdp_err result
;
6257 result
= pim_msdp_mg_src_del(mg
);
6259 case PIM_MSDP_ERR_NONE
:
6261 case PIM_MSDP_ERR_NO_MG
:
6262 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
6265 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
6268 return result
?CMD_WARNING
:CMD_SUCCESS
;
6272 ip_no_msdp_mesh_group_cmd_worker(struct vty
*vty
, const char *mg
)
6274 enum pim_msdp_err result
;
6276 result
= pim_msdp_mg_del(mg
);
6278 case PIM_MSDP_ERR_NONE
:
6280 case PIM_MSDP_ERR_NO_MG
:
6281 vty_out(vty
, "%% mesh-group does not exist%s", VTY_NEWLINE
);
6284 vty_out(vty
, "%% mesh-group source del failed%s", VTY_NEWLINE
);
6287 return result
? CMD_WARNING
: CMD_SUCCESS
;
6290 DEFUN (no_ip_msdp_mesh_group_source
,
6291 no_ip_msdp_mesh_group_source_cmd
,
6292 "no ip msdp mesh-group WORD source [A.B.C.D]",
6296 "Delete MSDP mesh-group source\n"
6298 "mesh group source\n"
6299 "mesh group local address\n")
6302 return ip_no_msdp_mesh_group_cmd_worker(vty
, argv
[6]->arg
);
6304 return ip_no_msdp_mesh_group_source_cmd_worker(vty
, argv
[4]->arg
);
6308 print_empty_json_obj(struct vty
*vty
)
6311 json
= json_object_new_object();
6312 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6313 json_object_free(json
);
6317 ip_msdp_show_mesh_group(struct vty
*vty
, u_char uj
)
6319 struct listnode
*mbrnode
;
6320 struct pim_msdp_mg_mbr
*mbr
;
6321 struct pim_msdp_mg
*mg
= msdp
->mg
;
6322 char mbr_str
[INET_ADDRSTRLEN
];
6323 char src_str
[INET_ADDRSTRLEN
];
6324 char state_str
[PIM_MSDP_STATE_STRLEN
];
6325 enum pim_msdp_peer_state state
;
6326 json_object
*json
= NULL
;
6327 json_object
*json_mg_row
= NULL
;
6328 json_object
*json_members
= NULL
;
6329 json_object
*json_row
= NULL
;
6333 print_empty_json_obj(vty
);
6337 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
6339 json
= json_object_new_object();
6340 /* currently there is only one mesh group but we should still make
6341 * it a dict with mg-name as key */
6342 json_mg_row
= json_object_new_object();
6343 json_object_string_add(json_mg_row
, "name", mg
->mesh_group_name
);
6344 json_object_string_add(json_mg_row
, "source", src_str
);
6346 vty_out(vty
, "Mesh group : %s%s", mg
->mesh_group_name
, VTY_NEWLINE
);
6347 vty_out(vty
, " Source : %s%s", src_str
, VTY_NEWLINE
);
6348 vty_out(vty
, " Member State%s", VTY_NEWLINE
);
6351 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
6352 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
6354 state
= mbr
->mp
->state
;
6356 state
= PIM_MSDP_DISABLED
;
6358 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
6360 json_row
= json_object_new_object();
6361 json_object_string_add(json_row
, "member", mbr_str
);
6362 json_object_string_add(json_row
, "state", state_str
);
6363 if (!json_members
) {
6364 json_members
= json_object_new_object();
6365 json_object_object_add(json_mg_row
, "members", json_members
);
6367 json_object_object_add(json_members
, mbr_str
, json_row
);
6369 vty_out(vty
, " %-15s %11s%s",
6370 mbr_str
, state_str
, VTY_NEWLINE
);
6375 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
6376 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6377 json_object_free(json
);
6381 DEFUN (show_ip_msdp_mesh_group
,
6382 show_ip_msdp_mesh_group_cmd
,
6383 "show ip msdp mesh-group [json]",
6387 "MSDP mesh-group information\n"
6388 "JavaScript Object Notation\n")
6390 u_char uj
= use_json(argc
, argv
);
6391 ip_msdp_show_mesh_group(vty
, uj
);
6397 ip_msdp_show_peers(struct vty
*vty
, u_char uj
)
6399 struct listnode
*mpnode
;
6400 struct pim_msdp_peer
*mp
;
6401 char peer_str
[INET_ADDRSTRLEN
];
6402 char local_str
[INET_ADDRSTRLEN
];
6403 char state_str
[PIM_MSDP_STATE_STRLEN
];
6404 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6406 json_object
*json
= NULL
;
6407 json_object
*json_row
= NULL
;
6411 json
= json_object_new_object();
6413 vty_out(vty
, "Peer Local State Uptime SaCnt%s", VTY_NEWLINE
);
6416 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6417 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6418 now
= pim_time_monotonic_sec();
6419 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6421 strcpy(timebuf
, "-");
6423 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6424 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6425 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6427 json_row
= json_object_new_object();
6428 json_object_string_add(json_row
, "peer", peer_str
);
6429 json_object_string_add(json_row
, "local", local_str
);
6430 json_object_string_add(json_row
, "state", state_str
);
6431 json_object_string_add(json_row
, "upTime", timebuf
);
6432 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6433 json_object_object_add(json
, peer_str
, json_row
);
6435 vty_out(vty
, "%-15s %15s %11s %8s %6d%s",
6436 peer_str
, local_str
, state_str
,
6437 timebuf
, mp
->sa_cnt
, VTY_NEWLINE
);
6442 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6443 json_object_free(json
);
6448 ip_msdp_show_peers_detail(struct vty
*vty
, const char *peer
, u_char uj
)
6450 struct listnode
*mpnode
;
6451 struct pim_msdp_peer
*mp
;
6452 char peer_str
[INET_ADDRSTRLEN
];
6453 char local_str
[INET_ADDRSTRLEN
];
6454 char state_str
[PIM_MSDP_STATE_STRLEN
];
6455 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6456 char katimer
[PIM_MSDP_TIMER_STRLEN
];
6457 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
6458 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
6460 json_object
*json
= NULL
;
6461 json_object
*json_row
= NULL
;
6464 json
= json_object_new_object();
6467 for (ALL_LIST_ELEMENTS_RO(msdp
->peer_list
, mpnode
, mp
)) {
6468 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
6469 if (strcmp(peer
, "detail") &&
6470 strcmp(peer
, peer_str
))
6473 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
6474 now
= pim_time_monotonic_sec();
6475 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- mp
->uptime
);
6477 strcpy(timebuf
, "-");
6479 pim_inet4_dump("<local?>", mp
->local
, local_str
, sizeof(local_str
));
6480 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
6481 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
), mp
->ka_timer
);
6482 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
), mp
->cr_timer
);
6483 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
), mp
->hold_timer
);
6486 json_row
= json_object_new_object();
6487 json_object_string_add(json_row
, "peer", peer_str
);
6488 json_object_string_add(json_row
, "local", local_str
);
6489 json_object_string_add(json_row
, "meshGroupName", mp
->mesh_group_name
);
6490 json_object_string_add(json_row
, "state", state_str
);
6491 json_object_string_add(json_row
, "upTime", timebuf
);
6492 json_object_string_add(json_row
, "keepAliveTimer", katimer
);
6493 json_object_string_add(json_row
, "connRetryTimer", crtimer
);
6494 json_object_string_add(json_row
, "holdTimer", holdtimer
);
6495 json_object_string_add(json_row
, "lastReset", mp
->last_reset
);
6496 json_object_int_add(json_row
, "connAttempts", mp
->conn_attempts
);
6497 json_object_int_add(json_row
, "establishedChanges", mp
->est_flaps
);
6498 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
6499 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
6500 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
6501 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
6502 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
6503 json_object_object_add(json
, peer_str
, json_row
);
6505 vty_out(vty
, "Peer : %s%s", peer_str
, VTY_NEWLINE
);
6506 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6507 vty_out(vty
, " Mesh Group : %s%s", mp
->mesh_group_name
, VTY_NEWLINE
);
6508 vty_out(vty
, " State : %s%s", state_str
, VTY_NEWLINE
);
6509 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6511 vty_out(vty
, " Keepalive Timer : %s%s", katimer
, VTY_NEWLINE
);
6512 vty_out(vty
, " Conn Retry Timer : %s%s", crtimer
, VTY_NEWLINE
);
6513 vty_out(vty
, " Hold Timer : %s%s", holdtimer
, VTY_NEWLINE
);
6514 vty_out(vty
, " Last Reset : %s%s", mp
->last_reset
, VTY_NEWLINE
);
6515 vty_out(vty
, " Conn Attempts : %d%s", mp
->conn_attempts
, VTY_NEWLINE
);
6516 vty_out(vty
, " Established Changes : %d%s", mp
->est_flaps
, VTY_NEWLINE
);
6517 vty_out(vty
, " SA Count : %d%s", mp
->sa_cnt
, VTY_NEWLINE
);
6518 vty_out(vty
, " Statistics :%s", VTY_NEWLINE
);
6519 vty_out(vty
, " Sent Rcvd%s", VTY_NEWLINE
);
6520 vty_out(vty
, " Keepalives : %10d %10d%s",
6521 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
, VTY_NEWLINE
);
6522 vty_out(vty
, " SAs : %10d %10d%s",
6523 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
, VTY_NEWLINE
);
6524 vty_out(vty
, "%s", VTY_NEWLINE
);
6529 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6530 json_object_free(json
);
6534 DEFUN (show_ip_msdp_peer_detail
,
6535 show_ip_msdp_peer_detail_cmd
,
6536 "show ip msdp peer [detail|A.B.C.D] [json]",
6540 "MSDP peer information\n"
6543 "JavaScript Object Notation\n")
6545 u_char uj
= use_json(argc
, argv
);
6550 ip_msdp_show_peers_detail(vty
, argv
[4]->arg
, uj
);
6552 ip_msdp_show_peers(vty
, uj
);
6558 ip_msdp_show_sa(struct vty
*vty
, u_char uj
)
6560 struct listnode
*sanode
;
6561 struct pim_msdp_sa
*sa
;
6562 char src_str
[INET_ADDRSTRLEN
];
6563 char grp_str
[INET_ADDRSTRLEN
];
6564 char rp_str
[INET_ADDRSTRLEN
];
6565 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6569 json_object
*json
= NULL
;
6570 json_object
*json_group
= NULL
;
6571 json_object
*json_row
= NULL
;
6574 json
= json_object_new_object();
6576 vty_out(vty
, "Source Group RP Local SPT Uptime%s", VTY_NEWLINE
);
6579 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6580 now
= pim_time_monotonic_sec();
6581 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6582 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6583 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6584 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6585 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6587 strcpy(spt_str
, "yes");
6589 strcpy(spt_str
, "no");
6592 strcpy(rp_str
, "-");
6593 strcpy(spt_str
, "-");
6595 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6596 strcpy(local_str
, "yes");
6598 strcpy(local_str
, "no");
6601 json_object_object_get_ex(json
, grp_str
, &json_group
);
6604 json_group
= json_object_new_object();
6605 json_object_object_add(json
, grp_str
, json_group
);
6608 json_row
= json_object_new_object();
6609 json_object_string_add(json_row
, "source", src_str
);
6610 json_object_string_add(json_row
, "group", grp_str
);
6611 json_object_string_add(json_row
, "rp", rp_str
);
6612 json_object_string_add(json_row
, "local", local_str
);
6613 json_object_string_add(json_row
, "sptSetup", spt_str
);
6614 json_object_string_add(json_row
, "upTime", timebuf
);
6615 json_object_object_add(json_group
, src_str
, json_row
);
6617 vty_out(vty
, "%-15s %15s %15s %5c %3c %8s%s",
6618 src_str
, grp_str
, rp_str
, local_str
[0], spt_str
[0], timebuf
, VTY_NEWLINE
);
6624 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6625 json_object_free(json
);
6630 ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
, const char *src_str
,
6631 const char *grp_str
, struct vty
*vty
,
6632 u_char uj
, json_object
*json
)
6634 char rp_str
[INET_ADDRSTRLEN
];
6635 char peer_str
[INET_ADDRSTRLEN
];
6636 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
6639 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
6641 json_object
*json_group
= NULL
;
6642 json_object
*json_row
= NULL
;
6644 now
= pim_time_monotonic_sec();
6645 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
6646 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
6647 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
6648 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
6650 strcpy(spt_str
, "yes");
6652 strcpy(spt_str
, "no");
6655 strcpy(rp_str
, "-");
6656 strcpy(peer_str
, "-");
6657 strcpy(spt_str
, "-");
6659 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
6660 strcpy(local_str
, "yes");
6662 strcpy(local_str
, "no");
6664 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
), sa
->sa_state_timer
);
6666 json_object_object_get_ex(json
, grp_str
, &json_group
);
6669 json_group
= json_object_new_object();
6670 json_object_object_add(json
, grp_str
, json_group
);
6673 json_row
= json_object_new_object();
6674 json_object_string_add(json_row
, "source", src_str
);
6675 json_object_string_add(json_row
, "group", grp_str
);
6676 json_object_string_add(json_row
, "rp", rp_str
);
6677 json_object_string_add(json_row
, "local", local_str
);
6678 json_object_string_add(json_row
, "sptSetup", spt_str
);
6679 json_object_string_add(json_row
, "upTime", timebuf
);
6680 json_object_string_add(json_row
, "stateTimer", statetimer
);
6681 json_object_object_add(json_group
, src_str
, json_row
);
6683 vty_out(vty
, "SA : %s%s", sa
->sg_str
, VTY_NEWLINE
);
6684 vty_out(vty
, " RP : %s%s", rp_str
, VTY_NEWLINE
);
6685 vty_out(vty
, " Peer : %s%s", peer_str
, VTY_NEWLINE
);
6686 vty_out(vty
, " Local : %s%s", local_str
, VTY_NEWLINE
);
6687 vty_out(vty
, " SPT Setup : %s%s", spt_str
, VTY_NEWLINE
);
6688 vty_out(vty
, " Uptime : %s%s", timebuf
, VTY_NEWLINE
);
6689 vty_out(vty
, " State Timer : %s%s", statetimer
, VTY_NEWLINE
);
6690 vty_out(vty
, "%s", VTY_NEWLINE
);
6695 ip_msdp_show_sa_detail(struct vty
*vty
, u_char uj
)
6697 struct listnode
*sanode
;
6698 struct pim_msdp_sa
*sa
;
6699 char src_str
[INET_ADDRSTRLEN
];
6700 char grp_str
[INET_ADDRSTRLEN
];
6701 json_object
*json
= NULL
;
6704 json
= json_object_new_object();
6707 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6708 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6709 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6710 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6714 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6715 json_object_free(json
);
6719 DEFUN (show_ip_msdp_sa_detail
,
6720 show_ip_msdp_sa_detail_cmd
,
6721 "show ip msdp sa detail [json]",
6725 "MSDP active-source information\n"
6727 "JavaScript Object Notation\n")
6729 u_char uj
= use_json(argc
, argv
);
6730 ip_msdp_show_sa_detail(vty
, uj
);
6736 ip_msdp_show_sa_addr(struct vty
*vty
, const char *addr
, u_char uj
)
6738 struct listnode
*sanode
;
6739 struct pim_msdp_sa
*sa
;
6740 char src_str
[INET_ADDRSTRLEN
];
6741 char grp_str
[INET_ADDRSTRLEN
];
6742 json_object
*json
= NULL
;
6745 json
= json_object_new_object();
6748 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6749 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6750 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6751 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6752 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6757 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6758 json_object_free(json
);
6763 ip_msdp_show_sa_sg(struct vty
*vty
, const char *src
, const char *grp
, u_char uj
)
6765 struct listnode
*sanode
;
6766 struct pim_msdp_sa
*sa
;
6767 char src_str
[INET_ADDRSTRLEN
];
6768 char grp_str
[INET_ADDRSTRLEN
];
6769 json_object
*json
= NULL
;
6772 json
= json_object_new_object();
6775 for (ALL_LIST_ELEMENTS_RO(msdp
->sa_list
, sanode
, sa
)) {
6776 pim_inet4_dump("<src?>", sa
->sg
.src
, src_str
, sizeof(src_str
));
6777 pim_inet4_dump("<grp?>", sa
->sg
.grp
, grp_str
, sizeof(grp_str
));
6778 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6779 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
, json
);
6784 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6785 json_object_free(json
);
6789 DEFUN (show_ip_msdp_sa_sg
,
6790 show_ip_msdp_sa_sg_cmd
,
6791 "show ip msdp sa [A.B.C.D [A.B.C.D]] [json]",
6795 "MSDP active-source information\n"
6796 "source or group ip\n"
6798 "JavaScript Object Notation\n")
6800 u_char uj
= use_json(argc
, argv
);
6803 char *src_ip
= argv_find (argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
: NULL
;
6804 char *grp_ip
= idx
< argc
&& argv_find (argv
, argc
, "A.B.C.D", &idx
) ?
6805 argv
[idx
]->arg
: NULL
;
6807 if (src_ip
&& grp_ip
)
6808 ip_msdp_show_sa_sg(vty
, src_ip
, grp_ip
, uj
);
6810 ip_msdp_show_sa_addr(vty
, src_ip
, uj
);
6812 ip_msdp_show_sa(vty
, uj
);
6819 install_node (&pim_global_node
, pim_global_config_write
); /* PIM_NODE */
6820 install_node (&interface_node
, pim_interface_config_write
); /* INTERFACE_NODE */
6823 install_node (&debug_node
, pim_debug_config_write
);
6825 install_element (CONFIG_NODE
, &ip_multicast_routing_cmd
);
6826 install_element (CONFIG_NODE
, &no_ip_multicast_routing_cmd
);
6827 install_element (CONFIG_NODE
, &ip_pim_rp_cmd
);
6828 install_element (CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6829 install_element (CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6830 install_element (CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6831 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6832 install_element (CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6833 install_element (CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6834 install_element (CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6835 install_element (CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6836 install_element (CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6837 install_element (CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6838 install_element (CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6839 install_element (CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6840 install_element (CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6841 install_element (CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6842 install_element (CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6843 install_element (CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6844 install_element (CONFIG_NODE
, &ip_pim_packets_cmd
);
6845 install_element (CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6846 install_element (CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6847 install_element (CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6848 install_element (CONFIG_NODE
, &ip_ssmpingd_cmd
);
6849 install_element (CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6850 install_element (CONFIG_NODE
, &ip_msdp_peer_cmd
);
6851 install_element (CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6852 install_element (CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6853 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6854 install_element (CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6855 install_element (CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6857 install_element (INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6858 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6859 install_element (INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6860 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6861 install_element (INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6862 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6863 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6864 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_interval_cmd
);
6865 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_cmd
);
6866 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_cmd
);
6867 install_element (INTERFACE_NODE
, &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6868 install_element (INTERFACE_NODE
, &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6869 install_element (INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6870 install_element (INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6871 install_element (INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6872 install_element (INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6873 install_element (INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6874 install_element (INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6875 install_element (INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6876 install_element (INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6878 // Static mroutes NEB
6879 install_element (INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6880 install_element (INTERFACE_NODE
, &interface_ip_mroute_source_cmd
);
6881 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6882 install_element (INTERFACE_NODE
, &interface_no_ip_mroute_source_cmd
);
6884 install_element (VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6885 install_element (VIEW_NODE
, &show_ip_igmp_join_cmd
);
6886 install_element (VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6887 install_element (VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6888 install_element (VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6889 install_element (VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6890 install_element (VIEW_NODE
, &show_ip_pim_assert_cmd
);
6891 install_element (VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6892 install_element (VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6893 install_element (VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6894 install_element (VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6895 install_element (VIEW_NODE
, &show_ip_pim_interface_cmd
);
6896 install_element (VIEW_NODE
, &show_ip_pim_join_cmd
);
6897 install_element (VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6898 install_element (VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6899 install_element (VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6900 install_element (VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6901 install_element (VIEW_NODE
, &show_ip_pim_state_cmd
);
6902 install_element (VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6903 install_element (VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6904 install_element (VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6905 install_element (VIEW_NODE
, &show_ip_pim_rp_cmd
);
6906 install_element (VIEW_NODE
, &show_ip_multicast_cmd
);
6907 install_element (VIEW_NODE
, &show_ip_mroute_cmd
);
6908 install_element (VIEW_NODE
, &show_ip_mroute_count_cmd
);
6909 install_element (VIEW_NODE
, &show_ip_rib_cmd
);
6910 install_element (VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6911 install_element (VIEW_NODE
, &show_debugging_pim_cmd
);
6912 install_element (VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6913 install_element (VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6915 install_element (ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6916 install_element (ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6917 install_element (ENABLE_NODE
, &clear_ip_mroute_cmd
);
6918 install_element (ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6919 install_element (ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6920 install_element (ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6922 install_element (ENABLE_NODE
, &debug_igmp_cmd
);
6923 install_element (ENABLE_NODE
, &no_debug_igmp_cmd
);
6924 install_element (ENABLE_NODE
, &debug_igmp_events_cmd
);
6925 install_element (ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6926 install_element (ENABLE_NODE
, &debug_igmp_packets_cmd
);
6927 install_element (ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6928 install_element (ENABLE_NODE
, &debug_igmp_trace_cmd
);
6929 install_element (ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6930 install_element (ENABLE_NODE
, &debug_mroute_cmd
);
6931 install_element (ENABLE_NODE
, &debug_mroute_detail_cmd
);
6932 install_element (ENABLE_NODE
, &no_debug_mroute_cmd
);
6933 install_element (ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6934 install_element (ENABLE_NODE
, &debug_static_cmd
);
6935 install_element (ENABLE_NODE
, &no_debug_static_cmd
);
6936 install_element (ENABLE_NODE
, &debug_pim_cmd
);
6937 install_element (ENABLE_NODE
, &no_debug_pim_cmd
);
6938 install_element (ENABLE_NODE
, &debug_pim_events_cmd
);
6939 install_element (ENABLE_NODE
, &no_debug_pim_events_cmd
);
6940 install_element (ENABLE_NODE
, &debug_pim_packets_cmd
);
6941 install_element (ENABLE_NODE
, &no_debug_pim_packets_cmd
);
6942 install_element (ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6943 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_send_cmd
);
6944 install_element (ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6945 install_element (ENABLE_NODE
, &no_debug_pim_packetdump_recv_cmd
);
6946 install_element (ENABLE_NODE
, &debug_pim_trace_cmd
);
6947 install_element (ENABLE_NODE
, &no_debug_pim_trace_cmd
);
6948 install_element (ENABLE_NODE
, &debug_ssmpingd_cmd
);
6949 install_element (ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6950 install_element (ENABLE_NODE
, &debug_pim_zebra_cmd
);
6951 install_element (ENABLE_NODE
, &no_debug_pim_zebra_cmd
);
6952 install_element (ENABLE_NODE
, &debug_msdp_cmd
);
6953 install_element (ENABLE_NODE
, &no_debug_msdp_cmd
);
6954 install_element (ENABLE_NODE
, &undebug_msdp_cmd
);
6955 install_element (ENABLE_NODE
, &debug_msdp_events_cmd
);
6956 install_element (ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6957 install_element (ENABLE_NODE
, &undebug_msdp_events_cmd
);
6958 install_element (ENABLE_NODE
, &debug_msdp_packets_cmd
);
6959 install_element (ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6960 install_element (ENABLE_NODE
, &undebug_msdp_packets_cmd
);
6962 install_element (CONFIG_NODE
, &debug_igmp_cmd
);
6963 install_element (CONFIG_NODE
, &no_debug_igmp_cmd
);
6964 install_element (CONFIG_NODE
, &debug_igmp_events_cmd
);
6965 install_element (CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6966 install_element (CONFIG_NODE
, &debug_igmp_packets_cmd
);
6967 install_element (CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6968 install_element (CONFIG_NODE
, &debug_igmp_trace_cmd
);
6969 install_element (CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6970 install_element (CONFIG_NODE
, &debug_mroute_cmd
);
6971 install_element (CONFIG_NODE
, &debug_mroute_detail_cmd
);
6972 install_element (CONFIG_NODE
, &no_debug_mroute_cmd
);
6973 install_element (CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6974 install_element (CONFIG_NODE
, &debug_static_cmd
);
6975 install_element (CONFIG_NODE
, &no_debug_static_cmd
);
6976 install_element (CONFIG_NODE
, &debug_pim_cmd
);
6977 install_element (CONFIG_NODE
, &no_debug_pim_cmd
);
6978 install_element (CONFIG_NODE
, &debug_pim_events_cmd
);
6979 install_element (CONFIG_NODE
, &no_debug_pim_events_cmd
);
6980 install_element (CONFIG_NODE
, &debug_pim_packets_cmd
);
6981 install_element (CONFIG_NODE
, &no_debug_pim_packets_cmd
);
6982 install_element (CONFIG_NODE
, &debug_pim_trace_cmd
);
6983 install_element (CONFIG_NODE
, &no_debug_pim_trace_cmd
);
6984 install_element (CONFIG_NODE
, &debug_ssmpingd_cmd
);
6985 install_element (CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6986 install_element (CONFIG_NODE
, &debug_pim_zebra_cmd
);
6987 install_element (CONFIG_NODE
, &no_debug_pim_zebra_cmd
);
6988 install_element (CONFIG_NODE
, &debug_msdp_cmd
);
6989 install_element (CONFIG_NODE
, &no_debug_msdp_cmd
);
6990 install_element (CONFIG_NODE
, &undebug_msdp_cmd
);
6991 install_element (CONFIG_NODE
, &debug_msdp_events_cmd
);
6992 install_element (CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6993 install_element (CONFIG_NODE
, &undebug_msdp_events_cmd
);
6994 install_element (CONFIG_NODE
, &debug_msdp_packets_cmd
);
6995 install_element (CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6996 install_element (CONFIG_NODE
, &undebug_msdp_packets_cmd
);
6997 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6998 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6999 install_element (CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
7000 install_element (CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
7001 install_element (VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
7002 install_element (VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
7003 install_element (VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
7004 install_element (VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
7005 install_element (VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
7006 install_element (VIEW_NODE
, &show_ip_pim_group_type_cmd
);
7007 install_element (INTERFACE_NODE
, &interface_pim_use_source_cmd
);
7008 install_element (INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
7009 /* Install BFD command */
7010 install_element (INTERFACE_NODE
, &ip_pim_bfd_cmd
);
7011 install_element (INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
7012 install_element (INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
7013 install_element (INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);