3 Copyright (C) 2008 Everton da Silva Marques
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
29 #include "pim_iface.h"
32 #include "pim_ssmpingd.h"
35 #include "pim_static.h"
37 int pim_debug_config_write(struct vty
*vty
)
41 if (PIM_DEBUG_IGMP_EVENTS
) {
42 vty_out(vty
, "debug igmp events%s", VTY_NEWLINE
);
45 if (PIM_DEBUG_IGMP_PACKETS
) {
46 vty_out(vty
, "debug igmp packets%s", VTY_NEWLINE
);
49 if (PIM_DEBUG_IGMP_TRACE
) {
50 vty_out(vty
, "debug igmp trace%s", VTY_NEWLINE
);
54 if (PIM_DEBUG_MROUTE
) {
55 vty_out(vty
, "debug mroute%s", VTY_NEWLINE
);
59 if (PIM_DEBUG_PIM_EVENTS
) {
60 vty_out(vty
, "debug pim events%s", VTY_NEWLINE
);
63 if (PIM_DEBUG_PIM_PACKETS
) {
64 vty_out(vty
, "debug pim packets%s", VTY_NEWLINE
);
67 if (PIM_DEBUG_PIM_PACKETDUMP_SEND
) {
68 vty_out(vty
, "debug pim packet-dump send%s", VTY_NEWLINE
);
71 if (PIM_DEBUG_PIM_PACKETDUMP_RECV
) {
72 vty_out(vty
, "debug pim packet-dump receive%s", VTY_NEWLINE
);
75 if (PIM_DEBUG_PIM_TRACE
) {
76 vty_out(vty
, "debug pim trace%s", VTY_NEWLINE
);
80 if (PIM_DEBUG_ZEBRA
) {
81 vty_out(vty
, "debug pim zebra%s", VTY_NEWLINE
);
85 if (PIM_DEBUG_SSMPINGD
) {
86 vty_out(vty
, "debug ssmpingd%s", VTY_NEWLINE
);
93 int pim_global_config_write(struct vty
*vty
)
98 if (PIM_MROUTE_IS_ENABLED
) {
99 vty_out(vty
, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING
, VTY_NEWLINE
);
102 if (qpim_rp
.rpf_addr
.s_addr
!= INADDR_NONE
) {
103 vty_out(vty
, "ip pim rp %s%s", inet_ntop(AF_INET
, &qpim_rp
.rpf_addr
, buffer
, 32), VTY_NEWLINE
);
107 if (qpim_ssmpingd_list
) {
108 struct listnode
*node
;
109 struct ssmpingd_sock
*ss
;
110 vty_out(vty
, "!%s", VTY_NEWLINE
);
112 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
113 char source_str
[100];
114 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
115 vty_out(vty
, "ip ssmpingd %s%s", source_str
, VTY_NEWLINE
);
123 int pim_interface_config_write(struct vty
*vty
)
126 struct listnode
*node
;
127 struct interface
*ifp
;
129 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
132 vty_out(vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
136 struct pim_interface
*pim_ifp
= ifp
->info
;
139 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
140 if (pim_ifp
->itype
== PIM_INTERFACE_SSM
)
141 vty_out(vty
, " ip pim ssm%s", VTY_NEWLINE
);
143 vty_out(vty
, " ip pim sm%s", VTY_NEWLINE
);
147 /* IF ip pim drpriority */
148 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
149 vty_out(vty
, " ip pim drpriority %u%s", pim_ifp
->pim_dr_priority
,
154 /* IF ip pim hello */
155 if (pim_ifp
->pim_hello_period
!= PIM_DEFAULT_HELLO_PERIOD
) {
156 vty_out(vty
, " ip pim hello %d", pim_ifp
->pim_hello_period
);
157 if (pim_ifp
->pim_default_holdtime
!= -1)
158 vty_out(vty
, " %d", pim_ifp
->pim_default_holdtime
);
159 vty_out(vty
, "%s", VTY_NEWLINE
);
163 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
164 vty_out(vty
, " ip igmp%s", VTY_NEWLINE
);
168 /* IF ip igmp query-interval */
169 if (pim_ifp
->igmp_default_query_interval
!= IGMP_GENERAL_QUERY_INTERVAL
)
171 vty_out(vty
, " %s %d%s",
172 PIM_CMD_IP_IGMP_QUERY_INTERVAL
,
173 pim_ifp
->igmp_default_query_interval
,
178 /* IF ip igmp query-max-response-time */
179 if (pim_ifp
->igmp_query_max_response_time_dsec
!= IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
)
181 vty_out(vty
, " %s %d%s",
182 PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
,
183 pim_ifp
->igmp_query_max_response_time_dsec
,
188 /* IF ip igmp join */
189 if (pim_ifp
->igmp_join_list
) {
190 struct listnode
*node
;
191 struct igmp_join
*ij
;
192 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, node
, ij
)) {
194 char source_str
[100];
195 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
196 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
197 vty_out(vty
, " ip igmp join %s %s%s",
198 group_str
, source_str
,
204 writes
+= pim_static_write_mroute (vty
, ifp
);
206 vty_out(vty
, "!%s", VTY_NEWLINE
);