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
31 #include "pim_iface.h"
34 #include "pim_ssmpingd.h"
37 #include "pim_static.h"
44 pim_debug_config_write (struct vty
*vty
)
48 if (PIM_DEBUG_MSDP_EVENTS
) {
49 vty_out(vty
, "debug msdp events%s", VTY_NEWLINE
);
52 if (PIM_DEBUG_MSDP_PACKETS
) {
53 vty_out(vty
, "debug msdp packets%s", VTY_NEWLINE
);
56 if (PIM_DEBUG_MSDP_INTERNAL
) {
57 vty_out(vty
, "debug msdp internal%s", VTY_NEWLINE
);
60 if (PIM_DEBUG_IGMP_EVENTS
) {
61 vty_out(vty
, "debug igmp events%s", VTY_NEWLINE
);
64 if (PIM_DEBUG_IGMP_PACKETS
) {
65 vty_out(vty
, "debug igmp packets%s", VTY_NEWLINE
);
68 if (PIM_DEBUG_IGMP_TRACE
) {
69 vty_out(vty
, "debug igmp trace%s", VTY_NEWLINE
);
72 if (PIM_DEBUG_IGMP_TRACE_DETAIL
) {
73 vty_out(vty
, "debug igmp trace detail%s", VTY_NEWLINE
);
77 if (PIM_DEBUG_MROUTE
) {
78 vty_out(vty
, "debug mroute%s", VTY_NEWLINE
);
82 if (PIM_DEBUG_MROUTE_DETAIL
) {
83 vty_out (vty
, "debug mroute detail%s", VTY_NEWLINE
);
87 if (PIM_DEBUG_PIM_EVENTS
) {
88 vty_out(vty
, "debug pim events%s", VTY_NEWLINE
);
91 if (PIM_DEBUG_PIM_PACKETS
) {
92 vty_out(vty
, "debug pim packets%s", VTY_NEWLINE
);
95 if (PIM_DEBUG_PIM_PACKETDUMP_SEND
) {
96 vty_out(vty
, "debug pim packet-dump send%s", VTY_NEWLINE
);
99 if (PIM_DEBUG_PIM_PACKETDUMP_RECV
) {
100 vty_out(vty
, "debug pim packet-dump receive%s", VTY_NEWLINE
);
104 if (PIM_DEBUG_PIM_TRACE
) {
105 vty_out(vty
, "debug pim trace%s", VTY_NEWLINE
);
108 if (PIM_DEBUG_PIM_TRACE_DETAIL
) {
109 vty_out(vty
, "debug pim trace detail%s", VTY_NEWLINE
);
113 if (PIM_DEBUG_ZEBRA
) {
114 vty_out(vty
, "debug pim zebra%s", VTY_NEWLINE
);
118 if (PIM_DEBUG_SSMPINGD
) {
119 vty_out(vty
, "debug ssmpingd%s", VTY_NEWLINE
);
123 if (PIM_DEBUG_PIM_HELLO
) {
124 vty_out (vty
, "debug pim packets hello%s", VTY_NEWLINE
);
128 if (PIM_DEBUG_PIM_J_P
) {
129 vty_out (vty
, "debug pim packets joins%s", VTY_NEWLINE
);
133 if (PIM_DEBUG_PIM_REG
) {
134 vty_out (vty
, "debug pim packets register%s", VTY_NEWLINE
);
138 if (PIM_DEBUG_STATIC
) {
139 vty_out (vty
, "debug pim static%s", VTY_NEWLINE
);
146 int pim_global_config_write(struct vty
*vty
)
149 struct pim_ssm
*ssm
= pimg
->ssm_info
;
151 writes
+= pim_msdp_config_write (vty
);
153 if (!pimg
->send_v6_secondary
)
155 vty_out (vty
, "no ip pim send-v6-secondary%s", VTY_NEWLINE
);
159 writes
+= pim_rp_config_write (vty
);
161 if (qpim_register_suppress_time
!= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
)
163 vty_out (vty
, "ip pim register-suppress-time %d%s",
164 qpim_register_suppress_time
, VTY_NEWLINE
);
167 if (qpim_t_periodic
!= PIM_DEFAULT_T_PERIODIC
)
169 vty_out (vty
, "ip pim join-prune-interval %d%s",
170 qpim_t_periodic
, VTY_NEWLINE
);
173 if (qpim_keep_alive_time
!= PIM_KEEPALIVE_PERIOD
)
175 vty_out (vty
, "ip pim keep-alive-timer %d%s",
176 qpim_keep_alive_time
, VTY_NEWLINE
);
179 if (qpim_packet_process
!= PIM_DEFAULT_PACKET_PROCESS
)
181 vty_out (vty
, "ip pim packets %d%s",
182 qpim_packet_process
, VTY_NEWLINE
);
187 vty_out (vty
, "ip pim ssm prefix-list %s%s",
188 ssm
->plist_name
, VTY_NEWLINE
);
191 if (pimg
->spt
.switchover
== PIM_SPT_INFINITY
)
194 vty_out (vty
, "ip pim spt-switchover infinity-and-beyond prefix-list %s%s",
195 pimg
->spt
.plist
, VTY_NEWLINE
);
197 vty_out (vty
, "ip pim spt-switchover infinity-and-beyond%s",
201 if (qpim_ecmp_rebalance_enable
)
203 vty_out (vty
, "ip pim ecmp rebalance%s", VTY_NEWLINE
);
206 else if (qpim_ecmp_enable
)
208 vty_out (vty
, "ip pim ecmp%s", VTY_NEWLINE
);
211 if (qpim_ssmpingd_list
) {
212 struct listnode
*node
;
213 struct ssmpingd_sock
*ss
;
214 vty_out(vty
, "!%s", VTY_NEWLINE
);
216 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
217 char source_str
[INET_ADDRSTRLEN
];
218 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
219 vty_out(vty
, "ip ssmpingd %s%s", source_str
, VTY_NEWLINE
);
227 int pim_interface_config_write(struct vty
*vty
)
230 struct listnode
*node
;
231 struct interface
*ifp
;
233 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
236 vty_out(vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
240 struct pim_interface
*pim_ifp
= ifp
->info
;
242 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
243 vty_out(vty
, " ip pim sm%s", VTY_NEWLINE
);
247 /* IF ip pim drpriority */
248 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
249 vty_out(vty
, " ip pim drpriority %u%s", pim_ifp
->pim_dr_priority
,
254 /* IF ip pim hello */
255 if (pim_ifp
->pim_hello_period
!= PIM_DEFAULT_HELLO_PERIOD
) {
256 vty_out(vty
, " ip pim hello %d", pim_ifp
->pim_hello_period
);
257 if (pim_ifp
->pim_default_holdtime
!= -1)
258 vty_out(vty
, " %d", pim_ifp
->pim_default_holdtime
);
259 vty_out(vty
, "%s", VTY_NEWLINE
);
263 if (PIM_INADDR_ISNOT_ANY(pim_ifp
->update_source
)) {
264 char src_str
[INET_ADDRSTRLEN
];
265 pim_inet4_dump("<src?>", pim_ifp
->update_source
, src_str
,
267 vty_out(vty
, " ip pim use-source %s%s", src_str
, VTY_NEWLINE
);
272 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
273 vty_out(vty
, " ip igmp%s", VTY_NEWLINE
);
277 /* ip igmp version */
278 if (pim_ifp
->igmp_version
!= IGMP_DEFAULT_VERSION
)
280 vty_out(vty
, " ip igmp version %d%s",
281 pim_ifp
->igmp_version
,
286 /* IF ip igmp query-interval */
287 if (pim_ifp
->igmp_default_query_interval
!= IGMP_GENERAL_QUERY_INTERVAL
)
289 vty_out(vty
, " ip igmp query-interval %d%s",
290 pim_ifp
->igmp_default_query_interval
,
295 /* IF ip igmp query-max-response-time */
296 if (pim_ifp
->igmp_query_max_response_time_dsec
!= IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
)
298 vty_out(vty
, " ip igmp query-max-response-time %d%s",
299 pim_ifp
->igmp_query_max_response_time_dsec
,
304 /* IF ip igmp join */
305 if (pim_ifp
->igmp_join_list
) {
306 struct listnode
*node
;
307 struct igmp_join
*ij
;
308 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, node
, ij
)) {
309 char group_str
[INET_ADDRSTRLEN
];
310 char source_str
[INET_ADDRSTRLEN
];
311 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
312 inet_ntop(AF_INET
, &ij
->source_addr
, source_str
, sizeof(source_str
));
313 vty_out(vty
, " ip igmp join %s %s%s",
314 group_str
, source_str
,
320 writes
+= pim_static_write_mroute (vty
, ifp
);
322 vty_out(vty
, "!%s", VTY_NEWLINE
);
325 pim_bfd_write_config (vty
, ifp
);