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");
145 int pim_global_config_write(struct vty
*vty
)
148 struct pim_ssm
*ssm
= pimg
->ssm_info
;
150 writes
+= pim_msdp_config_write(vty
);
152 if (!pimg
->send_v6_secondary
) {
153 vty_out(vty
, "no ip pim send-v6-secondary\n");
157 writes
+= pim_rp_config_write(vty
);
159 if (qpim_register_suppress_time
160 != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
) {
161 vty_out(vty
, "ip pim register-suppress-time %d\n",
162 qpim_register_suppress_time
);
165 if (qpim_t_periodic
!= PIM_DEFAULT_T_PERIODIC
) {
166 vty_out(vty
, "ip pim join-prune-interval %d\n",
170 if (qpim_keep_alive_time
!= PIM_KEEPALIVE_PERIOD
) {
171 vty_out(vty
, "ip pim keep-alive-timer %d\n",
172 qpim_keep_alive_time
);
175 if (qpim_packet_process
!= PIM_DEFAULT_PACKET_PROCESS
) {
176 vty_out(vty
, "ip pim packets %d\n", qpim_packet_process
);
179 if (ssm
->plist_name
) {
180 vty_out(vty
, "ip pim ssm prefix-list %s\n", ssm
->plist_name
);
183 if (pimg
->spt
.switchover
== PIM_SPT_INFINITY
) {
186 "ip pim spt-switchover infinity-and-beyond prefix-list %s\n",
190 "ip pim spt-switchover infinity-and-beyond\n");
193 if (qpim_ecmp_rebalance_enable
) {
194 vty_out(vty
, "ip pim ecmp rebalance\n");
196 } else if (qpim_ecmp_enable
) {
197 vty_out(vty
, "ip pim ecmp\n");
200 if (qpim_ssmpingd_list
) {
201 struct listnode
*node
;
202 struct ssmpingd_sock
*ss
;
205 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
206 char source_str
[INET_ADDRSTRLEN
];
207 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
209 vty_out(vty
, "ip ssmpingd %s\n", source_str
);
217 int pim_interface_config_write(struct vty
*vty
)
220 struct listnode
*node
;
221 struct interface
*ifp
;
223 for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT
), node
, ifp
)) {
226 vty_out(vty
, "interface %s\n", ifp
->name
);
230 struct pim_interface
*pim_ifp
= ifp
->info
;
232 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
233 vty_out(vty
, " ip pim sm\n");
237 /* IF ip pim drpriority */
238 if (pim_ifp
->pim_dr_priority
239 != PIM_DEFAULT_DR_PRIORITY
) {
240 vty_out(vty
, " ip pim drpriority %u\n",
241 pim_ifp
->pim_dr_priority
);
245 /* IF ip pim hello */
246 if (pim_ifp
->pim_hello_period
247 != PIM_DEFAULT_HELLO_PERIOD
) {
248 vty_out(vty
, " ip pim hello %d",
249 pim_ifp
->pim_hello_period
);
250 if (pim_ifp
->pim_default_holdtime
!= -1)
252 pim_ifp
->pim_default_holdtime
);
257 if (PIM_INADDR_ISNOT_ANY(pim_ifp
->update_source
)) {
258 char src_str
[INET_ADDRSTRLEN
];
259 pim_inet4_dump("<src?>", pim_ifp
->update_source
,
260 src_str
, sizeof(src_str
));
261 vty_out(vty
, " ip pim use-source %s\n",
267 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
268 vty_out(vty
, " ip igmp\n");
272 /* ip igmp version */
273 if (pim_ifp
->igmp_version
!= IGMP_DEFAULT_VERSION
) {
274 vty_out(vty
, " ip igmp version %d\n",
275 pim_ifp
->igmp_version
);
279 /* IF ip igmp query-interval */
280 if (pim_ifp
->igmp_default_query_interval
281 != IGMP_GENERAL_QUERY_INTERVAL
) {
282 vty_out(vty
, " ip igmp query-interval %d\n",
283 pim_ifp
->igmp_default_query_interval
);
287 /* IF ip igmp query-max-response-time */
288 if (pim_ifp
->igmp_query_max_response_time_dsec
289 != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
) {
291 " ip igmp query-max-response-time %d\n",
292 pim_ifp
->igmp_query_max_response_time_dsec
);
296 /* IF ip igmp join */
297 if (pim_ifp
->igmp_join_list
) {
298 struct listnode
*node
;
299 struct igmp_join
*ij
;
300 for (ALL_LIST_ELEMENTS_RO(
301 pim_ifp
->igmp_join_list
, node
,
303 char group_str
[INET_ADDRSTRLEN
];
304 char source_str
[INET_ADDRSTRLEN
];
305 pim_inet4_dump("<grp?>", ij
->group_addr
,
308 inet_ntop(AF_INET
, &ij
->source_addr
,
311 vty_out(vty
, " ip igmp join %s %s\n",
312 group_str
, source_str
);
317 writes
+= pim_static_write_mroute(vty
, ifp
);
322 pim_bfd_write_config(vty
, ifp
);