3 Copyright (C) 2008 Everton da Silva Marques
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
33 #include "pim_iface.h"
36 #include "pim_ssmpingd.h"
39 #include "pim_static.h"
43 pim_debug_config_write (struct vty
*vty
)
47 if (PIM_DEBUG_IGMP_EVENTS
) {
48 vty_out(vty
, "debug igmp events%s", VTY_NEWLINE
);
51 if (PIM_DEBUG_IGMP_PACKETS
) {
52 vty_out(vty
, "debug igmp packets%s", VTY_NEWLINE
);
55 if (PIM_DEBUG_IGMP_TRACE
) {
56 vty_out(vty
, "debug igmp trace%s", VTY_NEWLINE
);
59 if (PIM_DEBUG_IGMP_TRACE_DETAIL
) {
60 vty_out(vty
, "debug igmp trace detail%s", VTY_NEWLINE
);
64 if (PIM_DEBUG_MROUTE
) {
65 vty_out(vty
, "debug mroute%s", VTY_NEWLINE
);
69 if (PIM_DEBUG_MROUTE_DETAIL
) {
70 vty_out (vty
, "debug mroute detail%s", VTY_NEWLINE
);
74 if (PIM_DEBUG_PIM_EVENTS
) {
75 vty_out(vty
, "debug pim events%s", VTY_NEWLINE
);
78 if (PIM_DEBUG_PIM_PACKETS
) {
79 vty_out(vty
, "debug pim packets%s", VTY_NEWLINE
);
82 if (PIM_DEBUG_PIM_PACKETDUMP_SEND
) {
83 vty_out(vty
, "debug pim packet-dump send%s", VTY_NEWLINE
);
86 if (PIM_DEBUG_PIM_PACKETDUMP_RECV
) {
87 vty_out(vty
, "debug pim packet-dump receive%s", VTY_NEWLINE
);
91 if (PIM_DEBUG_PIM_TRACE
) {
92 vty_out(vty
, "debug pim trace%s", VTY_NEWLINE
);
95 if (PIM_DEBUG_PIM_TRACE_DETAIL
) {
96 vty_out(vty
, "debug pim trace detail%s", VTY_NEWLINE
);
100 if (PIM_DEBUG_ZEBRA
) {
101 vty_out(vty
, "debug pim zebra%s", VTY_NEWLINE
);
105 if (PIM_DEBUG_SSMPINGD
) {
106 vty_out(vty
, "debug ssmpingd%s", VTY_NEWLINE
);
110 if (PIM_DEBUG_PIM_HELLO
) {
111 vty_out (vty
, "debug pim packets hello%s", VTY_NEWLINE
);
115 if (PIM_DEBUG_PIM_J_P
) {
116 vty_out (vty
, "debug pim packets join%s", VTY_NEWLINE
);
120 if (PIM_DEBUG_PIM_REG
) {
121 vty_out (vty
, "debug pim packets register%s", VTY_NEWLINE
);
125 if (PIM_DEBUG_STATIC
) {
126 vty_out (vty
, "debug pim static%s", VTY_NEWLINE
);
133 int pim_global_config_write(struct vty
*vty
)
137 if (PIM_MROUTE_IS_ENABLED
) {
138 vty_out(vty
, "ip multicast-routing%s", VTY_NEWLINE
);
142 writes
+= pim_rp_config_write (vty
);
144 if (qpim_keep_alive_time
!= PIM_KEEPALIVE_PERIOD
)
146 vty_out (vty
, "ip pim keep-alive-timer %d%s",
147 qpim_keep_alive_time
, VTY_NEWLINE
);
150 if (qpim_rp_keep_alive_time
!= PIM_RP_KEEPALIVE_PERIOD
)
152 vty_out (vty
, "ip pim rp keep-alive-timer %d%s",
153 qpim_keep_alive_time
, VTY_NEWLINE
);
157 if (qpim_ssmpingd_list
) {
158 struct listnode
*node
;
159 struct ssmpingd_sock
*ss
;
160 vty_out(vty
, "!%s", VTY_NEWLINE
);
162 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
163 char source_str
[100];
164 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
165 vty_out(vty
, "ip ssmpingd %s%s", source_str
, VTY_NEWLINE
);
173 int pim_interface_config_write(struct vty
*vty
)
176 struct listnode
*node
;
177 struct interface
*ifp
;
179 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
182 vty_out(vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
186 struct pim_interface
*pim_ifp
= ifp
->info
;
189 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
190 if (pim_ifp
->itype
== PIM_INTERFACE_SSM
)
191 vty_out(vty
, " ip pim ssm%s", VTY_NEWLINE
);
193 vty_out(vty
, " ip pim sm%s", VTY_NEWLINE
);
197 /* IF ip pim drpriority */
198 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
199 vty_out(vty
, " ip pim drpriority %u%s", pim_ifp
->pim_dr_priority
,
204 /* IF ip pim hello */
205 if (pim_ifp
->pim_hello_period
!= PIM_DEFAULT_HELLO_PERIOD
) {
206 vty_out(vty
, " ip pim hello %d", pim_ifp
->pim_hello_period
);
207 if (pim_ifp
->pim_default_holdtime
!= -1)
208 vty_out(vty
, " %d", pim_ifp
->pim_default_holdtime
);
209 vty_out(vty
, "%s", VTY_NEWLINE
);
213 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
214 vty_out(vty
, " ip igmp%s", VTY_NEWLINE
);
218 /* ip igmp version */
219 if (pim_ifp
->igmp_version
!= IGMP_DEFAULT_VERSION
)
221 vty_out(vty
, " ip igmp version %d%s",
222 pim_ifp
->igmp_version
,
227 /* IF ip igmp query-interval */
228 if (pim_ifp
->igmp_default_query_interval
!= IGMP_GENERAL_QUERY_INTERVAL
)
230 vty_out(vty
, " ip igmp query-interval %d%s",
231 pim_ifp
->igmp_default_query_interval
,
236 /* IF ip igmp query-max-response-time */
237 if (pim_ifp
->igmp_query_max_response_time_dsec
!= IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
)
239 vty_out(vty
, " ip igmp query-max-response-time-dsec %d%s",
240 pim_ifp
->igmp_query_max_response_time_dsec
,
245 /* IF ip igmp join */
246 if (pim_ifp
->igmp_join_list
) {
247 struct listnode
*node
;
248 struct igmp_join
*ij
;
249 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, node
, ij
)) {
251 char source_str
[100];
252 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
253 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
, sizeof(source_str
));
254 vty_out(vty
, " ip igmp join %s %s%s",
255 group_str
, source_str
,
261 writes
+= pim_static_write_mroute (vty
, ifp
);
263 vty_out(vty
, "!%s", VTY_NEWLINE
);