]>
Commit | Line | Data |
---|---|---|
12e41d03 | 1 | /* |
896014f4 DL |
2 | * PIM for Quagga |
3 | * Copyright (C) 2008 Everton da Silva Marques | |
4 | * | |
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. | |
9 | * | |
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. | |
14 | * | |
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 | |
18 | */ | |
12e41d03 DL |
19 | |
20 | #include <zebra.h> | |
21 | ||
22 | #include "if.h" | |
23 | #include "linklist.h" | |
dfe43e25 DW |
24 | #include "prefix.h" |
25 | #include "vty.h" | |
469351b3 | 26 | #include "vrf.h" |
dfe43e25 | 27 | #include "plist.h" |
12e41d03 DL |
28 | |
29 | #include "pimd.h" | |
30 | #include "pim_vty.h" | |
31 | #include "pim_iface.h" | |
32 | #include "pim_cmd.h" | |
33 | #include "pim_str.h" | |
34 | #include "pim_ssmpingd.h" | |
dedccda6 | 35 | #include "pim_pim.h" |
9867746a | 36 | #include "pim_oil.h" |
f91f89bc | 37 | #include "pim_static.h" |
75a26779 | 38 | #include "pim_rp.h" |
3c72d654 | 39 | #include "pim_msdp.h" |
15a5dafe | 40 | #include "pim_ssm.h" |
12e41d03 | 41 | |
c823065d DS |
42 | int |
43 | pim_debug_config_write (struct vty *vty) | |
12e41d03 DL |
44 | { |
45 | int writes = 0; | |
46 | ||
2a333e0f | 47 | if (PIM_DEBUG_MSDP_EVENTS) { |
48 | vty_out(vty, "debug msdp events%s", VTY_NEWLINE); | |
49 | ++writes; | |
50 | } | |
51 | if (PIM_DEBUG_MSDP_PACKETS) { | |
52 | vty_out(vty, "debug msdp packets%s", VTY_NEWLINE); | |
53 | ++writes; | |
54 | } | |
977d71cc | 55 | if (PIM_DEBUG_MSDP_INTERNAL) { |
56 | vty_out(vty, "debug msdp internal%s", VTY_NEWLINE); | |
57 | ++writes; | |
58 | } | |
12e41d03 DL |
59 | if (PIM_DEBUG_IGMP_EVENTS) { |
60 | vty_out(vty, "debug igmp events%s", VTY_NEWLINE); | |
61 | ++writes; | |
62 | } | |
63 | if (PIM_DEBUG_IGMP_PACKETS) { | |
64 | vty_out(vty, "debug igmp packets%s", VTY_NEWLINE); | |
65 | ++writes; | |
66 | } | |
67 | if (PIM_DEBUG_IGMP_TRACE) { | |
68 | vty_out(vty, "debug igmp trace%s", VTY_NEWLINE); | |
69 | ++writes; | |
70 | } | |
c823065d DS |
71 | if (PIM_DEBUG_IGMP_TRACE_DETAIL) { |
72 | vty_out(vty, "debug igmp trace detail%s", VTY_NEWLINE); | |
73 | ++writes; | |
74 | } | |
12e41d03 DL |
75 | |
76 | if (PIM_DEBUG_MROUTE) { | |
77 | vty_out(vty, "debug mroute%s", VTY_NEWLINE); | |
78 | ++writes; | |
79 | } | |
80 | ||
6c7197b1 DS |
81 | if (PIM_DEBUG_MROUTE_DETAIL) { |
82 | vty_out (vty, "debug mroute detail%s", VTY_NEWLINE); | |
83 | ++writes; | |
84 | } | |
85 | ||
12e41d03 DL |
86 | if (PIM_DEBUG_PIM_EVENTS) { |
87 | vty_out(vty, "debug pim events%s", VTY_NEWLINE); | |
88 | ++writes; | |
89 | } | |
90 | if (PIM_DEBUG_PIM_PACKETS) { | |
91 | vty_out(vty, "debug pim packets%s", VTY_NEWLINE); | |
92 | ++writes; | |
93 | } | |
94 | if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { | |
95 | vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE); | |
96 | ++writes; | |
97 | } | |
98 | if (PIM_DEBUG_PIM_PACKETDUMP_RECV) { | |
99 | vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE); | |
100 | ++writes; | |
101 | } | |
c823065d | 102 | |
12e41d03 DL |
103 | if (PIM_DEBUG_PIM_TRACE) { |
104 | vty_out(vty, "debug pim trace%s", VTY_NEWLINE); | |
105 | ++writes; | |
106 | } | |
c823065d DS |
107 | if (PIM_DEBUG_PIM_TRACE_DETAIL) { |
108 | vty_out(vty, "debug pim trace detail%s", VTY_NEWLINE); | |
109 | ++writes; | |
110 | } | |
12e41d03 DL |
111 | |
112 | if (PIM_DEBUG_ZEBRA) { | |
113 | vty_out(vty, "debug pim zebra%s", VTY_NEWLINE); | |
114 | ++writes; | |
115 | } | |
116 | ||
117 | if (PIM_DEBUG_SSMPINGD) { | |
118 | vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE); | |
119 | ++writes; | |
120 | } | |
121 | ||
c823065d DS |
122 | if (PIM_DEBUG_PIM_HELLO) { |
123 | vty_out (vty, "debug pim packets hello%s", VTY_NEWLINE); | |
124 | ++writes; | |
125 | } | |
126 | ||
127 | if (PIM_DEBUG_PIM_J_P) { | |
a23ee35b | 128 | vty_out (vty, "debug pim packets joins%s", VTY_NEWLINE); |
c823065d DS |
129 | ++writes; |
130 | } | |
131 | ||
9add3b88 DS |
132 | if (PIM_DEBUG_PIM_REG) { |
133 | vty_out (vty, "debug pim packets register%s", VTY_NEWLINE); | |
134 | ++writes; | |
135 | } | |
136 | ||
c823065d DS |
137 | if (PIM_DEBUG_STATIC) { |
138 | vty_out (vty, "debug pim static%s", VTY_NEWLINE); | |
139 | ++writes; | |
140 | } | |
141 | ||
12e41d03 DL |
142 | return writes; |
143 | } | |
144 | ||
145 | int pim_global_config_write(struct vty *vty) | |
146 | { | |
147 | int writes = 0; | |
15a5dafe | 148 | struct pim_ssm *ssm = pimg->ssm_info; |
12e41d03 | 149 | |
3c72d654 | 150 | writes += pim_msdp_config_write (vty); |
151 | ||
71bbe73d DS |
152 | if (!pimg->send_v6_secondary) |
153 | { | |
154 | vty_out (vty, "no ip pim send-v6-secondary%s", VTY_NEWLINE); | |
155 | ++writes; | |
156 | } | |
157 | ||
75a26779 | 158 | writes += pim_rp_config_write (vty); |
12e41d03 | 159 | |
191f5695 | 160 | if (qpim_register_suppress_time != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) |
4304f95c | 161 | { |
191f5695 DS |
162 | vty_out (vty, "ip pim register-suppress-time %d%s", |
163 | qpim_register_suppress_time, VTY_NEWLINE); | |
4304f95c DS |
164 | ++writes; |
165 | } | |
ee1a0718 DS |
166 | if (qpim_t_periodic != PIM_DEFAULT_T_PERIODIC) |
167 | { | |
168 | vty_out (vty, "ip pim join-prune-interval %d%s", | |
169 | qpim_t_periodic, VTY_NEWLINE); | |
170 | ++writes; | |
171 | } | |
191f5695 | 172 | if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD) |
01408ede | 173 | { |
191f5695 DS |
174 | vty_out (vty, "ip pim keep-alive-timer %d%s", |
175 | qpim_keep_alive_time, VTY_NEWLINE); | |
01408ede DS |
176 | ++writes; |
177 | } | |
8e4c9ef3 DS |
178 | if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS) |
179 | { | |
180 | vty_out (vty, "ip pim packets %d%s", | |
181 | qpim_packet_process, VTY_NEWLINE); | |
182 | ++writes; | |
183 | } | |
15a5dafe | 184 | if (ssm->plist_name) |
185 | { | |
186 | vty_out (vty, "ip pim ssm prefix-list %s%s", | |
187 | ssm->plist_name, VTY_NEWLINE); | |
188 | ++writes; | |
189 | } | |
df94f9a9 | 190 | if (pimg->spt.switchover == PIM_SPT_INFINITY) |
a7b2b1e2 | 191 | { |
df94f9a9 DS |
192 | if (pimg->spt.plist) |
193 | vty_out (vty, "ip pim spt-switchover infinity-and-beyond prefix-list %s%s", | |
194 | pimg->spt.plist, VTY_NEWLINE); | |
195 | else | |
196 | vty_out (vty, "ip pim spt-switchover infinity-and-beyond%s", | |
197 | VTY_NEWLINE); | |
a7b2b1e2 DS |
198 | ++writes; |
199 | } | |
0c62a899 CS |
200 | if (qpim_ecmp_rebalance_enable) |
201 | { | |
202 | vty_out (vty, "ip pim ecmp rebalance%s", VTY_NEWLINE); | |
203 | ++writes; | |
204 | } | |
205 | else if (qpim_ecmp_enable) | |
206 | { | |
207 | vty_out (vty, "ip pim ecmp%s", VTY_NEWLINE); | |
208 | ++writes; | |
209 | } | |
12e41d03 DL |
210 | if (qpim_ssmpingd_list) { |
211 | struct listnode *node; | |
212 | struct ssmpingd_sock *ss; | |
213 | vty_out(vty, "!%s", VTY_NEWLINE); | |
214 | ++writes; | |
215 | for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) { | |
eaa54bdb | 216 | char source_str[INET_ADDRSTRLEN]; |
12e41d03 DL |
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); | |
219 | ++writes; | |
220 | } | |
221 | } | |
222 | ||
223 | return writes; | |
224 | } | |
225 | ||
226 | int pim_interface_config_write(struct vty *vty) | |
227 | { | |
228 | int writes = 0; | |
229 | struct listnode *node; | |
230 | struct interface *ifp; | |
231 | ||
469351b3 | 232 | for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { |
12e41d03 DL |
233 | |
234 | /* IF name */ | |
235 | vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); | |
236 | ++writes; | |
237 | ||
238 | if (ifp->info) { | |
239 | struct pim_interface *pim_ifp = ifp->info; | |
240 | ||
12e41d03 | 241 | if (PIM_IF_TEST_PIM(pim_ifp->options)) { |
d2772e7b | 242 | vty_out(vty, " ip pim sm%s", VTY_NEWLINE); |
12e41d03 DL |
243 | ++writes; |
244 | } | |
245 | ||
dedccda6 DS |
246 | /* IF ip pim drpriority */ |
247 | if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) { | |
94d95cde | 248 | vty_out(vty, " ip pim drpriority %u%s", pim_ifp->pim_dr_priority, |
dedccda6 DS |
249 | VTY_NEWLINE); |
250 | ++writes; | |
251 | } | |
252 | ||
7960fa8f DS |
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); | |
259 | } | |
260 | ||
4763cd0e | 261 | /* update source */ |
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, | |
265 | sizeof(src_str)); | |
266 | vty_out(vty, " ip pim use-source %s%s", src_str, VTY_NEWLINE); | |
267 | ++writes; | |
268 | } | |
269 | ||
12e41d03 DL |
270 | /* IF ip igmp */ |
271 | if (PIM_IF_TEST_IGMP(pim_ifp->options)) { | |
272 | vty_out(vty, " ip igmp%s", VTY_NEWLINE); | |
273 | ++writes; | |
274 | } | |
275 | ||
b05b72e8 DW |
276 | /* ip igmp version */ |
277 | if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION) | |
278 | { | |
279 | vty_out(vty, " ip igmp version %d%s", | |
280 | pim_ifp->igmp_version, | |
281 | VTY_NEWLINE); | |
282 | ++writes; | |
283 | } | |
284 | ||
12e41d03 | 285 | /* IF ip igmp query-interval */ |
6b775f61 DS |
286 | if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) |
287 | { | |
199d90a1 | 288 | vty_out(vty, " ip igmp query-interval %d%s", |
6b775f61 DS |
289 | pim_ifp->igmp_default_query_interval, |
290 | VTY_NEWLINE); | |
291 | ++writes; | |
292 | } | |
12e41d03 DL |
293 | |
294 | /* IF ip igmp query-max-response-time */ | |
6b775f61 DS |
295 | if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) |
296 | { | |
58344b65 | 297 | vty_out(vty, " ip igpm query-max-response-time %d%s", |
6b775f61 DS |
298 | pim_ifp->igmp_query_max_response_time_dsec, |
299 | VTY_NEWLINE); | |
300 | ++writes; | |
301 | } | |
12e41d03 DL |
302 | |
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)) { | |
eaa54bdb DW |
308 | char group_str[INET_ADDRSTRLEN]; |
309 | char source_str[INET_ADDRSTRLEN]; | |
12e41d03 | 310 | pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str)); |
a277fb84 | 311 | inet_ntop(AF_INET, &ij->source_addr, source_str, sizeof(source_str)); |
12e41d03 DL |
312 | vty_out(vty, " ip igmp join %s %s%s", |
313 | group_str, source_str, | |
314 | VTY_NEWLINE); | |
315 | ++writes; | |
316 | } | |
317 | } | |
f91f89bc DS |
318 | |
319 | writes += pim_static_write_mroute (vty, ifp); | |
12e41d03 DL |
320 | } |
321 | vty_out(vty, "!%s", VTY_NEWLINE); | |
322 | ++writes; | |
323 | } | |
324 | ||
325 | return writes; | |
326 | } |