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 pim_debug_config_write (struct vty
*vty
)
47 if (PIM_DEBUG_MSDP_EVENTS
) {
48 vty_out(vty
, "debug msdp events%s", VTY_NEWLINE
);
51 if (PIM_DEBUG_MSDP_PACKETS
) {
52 vty_out(vty
, "debug msdp packets%s", VTY_NEWLINE
);
55 if (PIM_DEBUG_MSDP_INTERNAL
) {
56 vty_out(vty
, "debug msdp internal%s", VTY_NEWLINE
);
59 if (PIM_DEBUG_IGMP_EVENTS
) {
60 vty_out(vty
, "debug igmp events%s", VTY_NEWLINE
);
63 if (PIM_DEBUG_IGMP_PACKETS
) {
64 vty_out(vty
, "debug igmp packets%s", VTY_NEWLINE
);
67 if (PIM_DEBUG_IGMP_TRACE
) {
68 vty_out(vty
, "debug igmp trace%s", VTY_NEWLINE
);
71 if (PIM_DEBUG_IGMP_TRACE_DETAIL
) {
72 vty_out(vty
, "debug igmp trace detail%s", VTY_NEWLINE
);
76 if (PIM_DEBUG_MROUTE
) {
77 vty_out(vty
, "debug mroute%s", VTY_NEWLINE
);
81 if (PIM_DEBUG_MROUTE_DETAIL
) {
82 vty_out (vty
, "debug mroute detail%s", VTY_NEWLINE
);
86 if (PIM_DEBUG_PIM_EVENTS
) {
87 vty_out(vty
, "debug pim events%s", VTY_NEWLINE
);
90 if (PIM_DEBUG_PIM_PACKETS
) {
91 vty_out(vty
, "debug pim packets%s", VTY_NEWLINE
);
94 if (PIM_DEBUG_PIM_PACKETDUMP_SEND
) {
95 vty_out(vty
, "debug pim packet-dump send%s", VTY_NEWLINE
);
98 if (PIM_DEBUG_PIM_PACKETDUMP_RECV
) {
99 vty_out(vty
, "debug pim packet-dump receive%s", VTY_NEWLINE
);
103 if (PIM_DEBUG_PIM_TRACE
) {
104 vty_out(vty
, "debug pim trace%s", VTY_NEWLINE
);
107 if (PIM_DEBUG_PIM_TRACE_DETAIL
) {
108 vty_out(vty
, "debug pim trace detail%s", VTY_NEWLINE
);
112 if (PIM_DEBUG_ZEBRA
) {
113 vty_out(vty
, "debug pim zebra%s", VTY_NEWLINE
);
117 if (PIM_DEBUG_SSMPINGD
) {
118 vty_out(vty
, "debug ssmpingd%s", VTY_NEWLINE
);
122 if (PIM_DEBUG_PIM_HELLO
) {
123 vty_out (vty
, "debug pim packets hello%s", VTY_NEWLINE
);
127 if (PIM_DEBUG_PIM_J_P
) {
128 vty_out (vty
, "debug pim packets joins%s", VTY_NEWLINE
);
132 if (PIM_DEBUG_PIM_REG
) {
133 vty_out (vty
, "debug pim packets register%s", VTY_NEWLINE
);
137 if (PIM_DEBUG_STATIC
) {
138 vty_out (vty
, "debug pim static%s", VTY_NEWLINE
);
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
)
154 vty_out (vty
, "no ip pim send-v6-secondary%s", VTY_NEWLINE
);
158 writes
+= pim_rp_config_write (vty
);
160 if (qpim_register_suppress_time
!= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT
)
162 vty_out (vty
, "ip pim register-suppress-time %d%s",
163 qpim_register_suppress_time
, VTY_NEWLINE
);
166 if (qpim_t_periodic
!= PIM_DEFAULT_T_PERIODIC
)
168 vty_out (vty
, "ip pim join-prune-interval %d%s",
169 qpim_t_periodic
, VTY_NEWLINE
);
172 if (qpim_keep_alive_time
!= PIM_KEEPALIVE_PERIOD
)
174 vty_out (vty
, "ip pim keep-alive-timer %d%s",
175 qpim_keep_alive_time
, VTY_NEWLINE
);
178 if (qpim_packet_process
!= PIM_DEFAULT_PACKET_PROCESS
)
180 vty_out (vty
, "ip pim packets %d%s",
181 qpim_packet_process
, VTY_NEWLINE
);
186 vty_out (vty
, "ip pim ssm prefix-list %s%s",
187 ssm
->plist_name
, VTY_NEWLINE
);
190 if (pimg
->spt
.switchover
== PIM_SPT_INFINITY
)
193 vty_out (vty
, "ip pim spt-switchover infinity-and-beyond prefix-list %s%s",
194 pimg
->spt
.plist
, VTY_NEWLINE
);
196 vty_out (vty
, "ip pim spt-switchover infinity-and-beyond%s",
200 if (qpim_ecmp_rebalance_enable
)
202 vty_out (vty
, "ip pim ecmp rebalance%s", VTY_NEWLINE
);
205 else if (qpim_ecmp_enable
)
207 vty_out (vty
, "ip pim ecmp%s", VTY_NEWLINE
);
210 if (qpim_ssmpingd_list
) {
211 struct listnode
*node
;
212 struct ssmpingd_sock
*ss
;
213 vty_out(vty
, "!%s", VTY_NEWLINE
);
215 for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list
, node
, ss
)) {
216 char source_str
[INET_ADDRSTRLEN
];
217 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
, sizeof(source_str
));
218 vty_out(vty
, "ip ssmpingd %s%s", source_str
, VTY_NEWLINE
);
226 int pim_interface_config_write(struct vty
*vty
)
229 struct listnode
*node
;
230 struct interface
*ifp
;
232 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
235 vty_out(vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
239 struct pim_interface
*pim_ifp
= ifp
->info
;
241 if (PIM_IF_TEST_PIM(pim_ifp
->options
)) {
242 vty_out(vty
, " ip pim sm%s", VTY_NEWLINE
);
246 /* IF ip pim drpriority */
247 if (pim_ifp
->pim_dr_priority
!= PIM_DEFAULT_DR_PRIORITY
) {
248 vty_out(vty
, " ip pim drpriority %u%s", pim_ifp
->pim_dr_priority
,
253 /* IF ip pim hello */
254 if (pim_ifp
->pim_hello_period
!= PIM_DEFAULT_HELLO_PERIOD
) {
255 vty_out(vty
, " ip pim hello %d", pim_ifp
->pim_hello_period
);
256 if (pim_ifp
->pim_default_holdtime
!= -1)
257 vty_out(vty
, " %d", pim_ifp
->pim_default_holdtime
);
258 vty_out(vty
, "%s", VTY_NEWLINE
);
262 if (PIM_INADDR_ISNOT_ANY(pim_ifp
->update_source
)) {
263 char src_str
[INET_ADDRSTRLEN
];
264 pim_inet4_dump("<src?>", pim_ifp
->update_source
, src_str
,
266 vty_out(vty
, " ip pim use-source %s%s", src_str
, VTY_NEWLINE
);
271 if (PIM_IF_TEST_IGMP(pim_ifp
->options
)) {
272 vty_out(vty
, " ip igmp%s", VTY_NEWLINE
);
276 /* ip igmp version */
277 if (pim_ifp
->igmp_version
!= IGMP_DEFAULT_VERSION
)
279 vty_out(vty
, " ip igmp version %d%s",
280 pim_ifp
->igmp_version
,
285 /* IF ip igmp query-interval */
286 if (pim_ifp
->igmp_default_query_interval
!= IGMP_GENERAL_QUERY_INTERVAL
)
288 vty_out(vty
, " ip igmp query-interval %d%s",
289 pim_ifp
->igmp_default_query_interval
,
294 /* IF ip igmp query-max-response-time */
295 if (pim_ifp
->igmp_query_max_response_time_dsec
!= IGMP_QUERY_MAX_RESPONSE_TIME_DSEC
)
297 vty_out(vty
, " ip igmp query-max-response-time %d%s",
298 pim_ifp
->igmp_query_max_response_time_dsec
,
303 /* IF ip igmp join */
304 if (pim_ifp
->igmp_join_list
) {
305 struct listnode
*node
;
306 struct igmp_join
*ij
;
307 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->igmp_join_list
, node
, ij
)) {
308 char group_str
[INET_ADDRSTRLEN
];
309 char source_str
[INET_ADDRSTRLEN
];
310 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
, sizeof(group_str
));
311 inet_ntop(AF_INET
, &ij
->source_addr
, source_str
, sizeof(source_str
));
312 vty_out(vty
, " ip igmp join %s %s%s",
313 group_str
, source_str
,
319 writes
+= pim_static_write_mroute (vty
, ifp
);
321 vty_out(vty
, "!%s", VTY_NEWLINE
);