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