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"
43 int pim_debug_config_write(struct vty
*vty
)
47 if (PIM_DEBUG_MSDP_EVENTS
) {
48 vty_out(vty
, "debug msdp events\n");
51 if (PIM_DEBUG_MSDP_PACKETS
) {
52 vty_out(vty
, "debug msdp packets\n");
55 if (PIM_DEBUG_MSDP_INTERNAL
) {
56 vty_out(vty
, "debug msdp internal\n");
59 if (PIM_DEBUG_IGMP_EVENTS
) {
60 vty_out(vty
, "debug igmp events\n");
63 if (PIM_DEBUG_IGMP_PACKETS
) {
64 vty_out(vty
, "debug igmp packets\n");
67 if (PIM_DEBUG_IGMP_TRACE
) {
68 vty_out(vty
, "debug igmp trace\n");
71 if (PIM_DEBUG_IGMP_TRACE_DETAIL
) {
72 vty_out(vty
, "debug igmp trace detail\n");
76 if (PIM_DEBUG_MROUTE
) {
77 vty_out(vty
, "debug mroute\n");
81 if (PIM_DEBUG_MROUTE_DETAIL
) {
82 vty_out(vty
, "debug mroute detail\n");
86 if (PIM_DEBUG_PIM_EVENTS
) {
87 vty_out(vty
, "debug pim events\n");
90 if (PIM_DEBUG_PIM_PACKETS
) {
91 vty_out(vty
, "debug pim packets\n");
94 if (PIM_DEBUG_PIM_PACKETDUMP_SEND
) {
95 vty_out(vty
, "debug pim packet-dump send\n");
98 if (PIM_DEBUG_PIM_PACKETDUMP_RECV
) {
99 vty_out(vty
, "debug pim packet-dump receive\n");
103 if (PIM_DEBUG_PIM_TRACE
) {
104 vty_out(vty
, "debug pim trace\n");
107 if (PIM_DEBUG_PIM_TRACE_DETAIL
) {
108 vty_out(vty
, "debug pim trace detail\n");
112 if (PIM_DEBUG_ZEBRA
) {
113 vty_out(vty
, "debug pim zebra\n");
117 if (PIM_DEBUG_SSMPINGD
) {
118 vty_out(vty
, "debug ssmpingd\n");
122 if (PIM_DEBUG_PIM_HELLO
) {
123 vty_out(vty
, "debug pim packets hello\n");
127 if (PIM_DEBUG_PIM_J_P
) {
128 vty_out(vty
, "debug pim packets joins\n");
132 if (PIM_DEBUG_PIM_REG
) {
133 vty_out(vty
, "debug pim packets register\n");
137 if (PIM_DEBUG_STATIC
) {
138 vty_out(vty
, "debug pim static\n");
142 if (PIM_DEBUG_PIM_NHT
) {
143 vty_out(vty
, "debug pim nht\n");
150 int pim_global_config_write_worker(struct pim_instance
*pim
, struct vty
*vty
)
153 struct pim_ssm
*ssm
= pim
->ssm_info
;
156 if (pim
->vrf_id
== VRF_DEFAULT
)
157 sprintf(spaces
, "%s", "");
159 sprintf(spaces
, "%s", " ");
161 writes
+= pim_msdp_config_write_helper(pim
, vty
, spaces
);
163 if (!pim
->send_v6_secondary
) {
164 vty_out(vty
, "%sno ip pim send-v6-secondary\n", spaces
);
168 writes
+= pim_rp_config_write(pim
, vty
, spaces
);
170 if (qpim_register_suppress_time
171 != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
) {
172 vty_out(vty
, "%sip pim register-suppress-time %d\n", spaces
,
173 qpim_register_suppress_time
);
176 if (qpim_t_periodic
!= PIM_DEFAULT_T_PERIODIC
) {
177 vty_out(vty
, "%sip pim join-prune-interval %d\n", spaces
,
181 if (pim
->keep_alive_time
!= PIM_KEEPALIVE_PERIOD
) {
182 vty_out(vty
, "%sip pim keep-alive-timer %d\n", spaces
,
183 pim
->keep_alive_time
);
186 if (pim
->rp_keep_alive_time
!= (unsigned int)PIM_RP_KEEPALIVE_PERIOD
) {
187 vty_out(vty
, "%sip pim rp keep-alive-timer %d\n", spaces
,
188 pim
->rp_keep_alive_time
);
191 if (qpim_packet_process
!= PIM_DEFAULT_PACKET_PROCESS
) {
192 vty_out(vty
, "%sip pim packets %d\n", spaces
,
193 qpim_packet_process
);
196 if (ssm
->plist_name
) {
197 vty_out(vty
, "%sip pim ssm prefix-list %s\n", spaces
,
201 if (pim
->spt
.switchover
== PIM_SPT_INFINITY
) {
204 "%sip pim spt-switchover infinity-and-beyond prefix-list %s\n",
205 spaces
, pim
->spt
.plist
);
208 "%sip pim spt-switchover infinity-and-beyond\n",
212 if (qpim_ecmp_rebalance_enable
) {
213 vty_out(vty
, "%sip pim ecmp rebalance\n", spaces
);
215 } else if (qpim_ecmp_enable
) {
216 vty_out(vty
, "%sip pim ecmp\n", spaces
);
219 if (pim
->ssmpingd_list
) {
220 struct listnode
*node
;
221 struct ssmpingd_sock
*ss
;
223 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
224 char source_str
[INET_ADDRSTRLEN
];
225 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
227 vty_out(vty
, "%sip ssmpingd %s\n", spaces
, source_str
);
235 int pim_global_config_write(struct vty
*vty
)
237 return pim_global_config_write_worker(pimg
, vty
);
240 int pim_interface_config_write(struct vty
*vty
)
242 struct pim_instance
*pim
;
243 struct listnode
*node
;
244 struct interface
*ifp
;
248 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
253 for (ALL_LIST_ELEMENTS_RO(vrf_iflist(pim
->vrf_id
), node
, ifp
)) {
256 if (vrf
->vrf_id
== VRF_DEFAULT
)
257 vty_frame(vty
, "interface %s\n", ifp
->name
);
259 vty_frame(vty
, "interface %s vrf %s\n",
260 ifp
->name
, vrf
->name
);
264 struct pim_interface
*pim_ifp
= ifp
->info
;
266 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
267 vty_out(vty
, " ip pim sm\n");
271 /* IF ip pim drpriority */
272 if (pim_ifp
->pim_dr_priority
273 != PIM_DEFAULT_DR_PRIORITY
) {
274 vty_out(vty
, " ip pim drpriority %u\n",
275 pim_ifp
->pim_dr_priority
);
279 /* IF ip pim hello */
280 if (pim_ifp
->pim_hello_period
281 != PIM_DEFAULT_HELLO_PERIOD
) {
282 vty_out(vty
, " ip pim hello %d",
283 pim_ifp
->pim_hello_period
);
284 if (pim_ifp
->pim_default_holdtime
!= -1)
286 pim_ifp
->pim_default_holdtime
);
291 if (PIM_INADDR_ISNOT_ANY(
292 pim_ifp
->update_source
)) {
293 char src_str
[INET_ADDRSTRLEN
];
294 pim_inet4_dump("<src?>",
295 pim_ifp
->update_source
,
298 vty_out(vty
, " ip pim use-source %s\n",
304 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
305 vty_out(vty
, " ip igmp\n");
309 /* ip igmp version */
310 if (pim_ifp
->igmp_version
311 != IGMP_DEFAULT_VERSION
) {
312 vty_out(vty
, " ip igmp version %d\n",
313 pim_ifp
->igmp_version
);
317 /* IF ip igmp query-interval */
318 if (pim_ifp
->igmp_default_query_interval
319 != IGMP_GENERAL_QUERY_INTERVAL
) {
321 " ip igmp query-interval %d\n",
322 pim_ifp
->igmp_default_query_interval
);
326 /* IF ip igmp query-max-response-time */
327 if (pim_ifp
->igmp_query_max_response_time_dsec
328 != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
) {
330 " ip igmp query-max-response-time %d\n",
331 pim_ifp
->igmp_query_max_response_time_dsec
);
335 /* IF ip igmp join */
336 if (pim_ifp
->igmp_join_list
) {
337 struct listnode
*node
;
338 struct igmp_join
*ij
;
339 for (ALL_LIST_ELEMENTS_RO(
340 pim_ifp
->igmp_join_list
,
342 char group_str
[INET_ADDRSTRLEN
];
355 " ip igmp join %s %s\n",
356 group_str
, source_str
);
362 pim_static_write_mroute(pim
, vty
, ifp
);
363 pim_bfd_write_config(vty
, ifp
);
365 vty_endframe(vty
, "!\n");