]>
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" |
ba4eb1bc | 41 | #include "pim_bfd.h" |
16c926c8 | 42 | #include "pim_bsm.h" |
7c85225c | 43 | #include "pim_vxlan.h" |
12e41d03 | 44 | |
d62a17ae | 45 | int pim_debug_config_write(struct vty *vty) |
12e41d03 | 46 | { |
d62a17ae | 47 | int writes = 0; |
48 | ||
49 | if (PIM_DEBUG_MSDP_EVENTS) { | |
50 | vty_out(vty, "debug msdp events\n"); | |
51 | ++writes; | |
52 | } | |
53 | if (PIM_DEBUG_MSDP_PACKETS) { | |
54 | vty_out(vty, "debug msdp packets\n"); | |
55 | ++writes; | |
56 | } | |
57 | if (PIM_DEBUG_MSDP_INTERNAL) { | |
58 | vty_out(vty, "debug msdp internal\n"); | |
59 | ++writes; | |
60 | } | |
61 | if (PIM_DEBUG_IGMP_EVENTS) { | |
62 | vty_out(vty, "debug igmp events\n"); | |
63 | ++writes; | |
64 | } | |
65 | if (PIM_DEBUG_IGMP_PACKETS) { | |
66 | vty_out(vty, "debug igmp packets\n"); | |
67 | ++writes; | |
68 | } | |
69 | if (PIM_DEBUG_IGMP_TRACE) { | |
70 | vty_out(vty, "debug igmp trace\n"); | |
71 | ++writes; | |
72 | } | |
d62a17ae | 73 | |
74 | if (PIM_DEBUG_MROUTE) { | |
75 | vty_out(vty, "debug mroute\n"); | |
76 | ++writes; | |
77 | } | |
78 | ||
4d9ad5dc MS |
79 | if (PIM_DEBUG_MTRACE) { |
80 | vty_out(vty, "debug mtrace\n"); | |
81 | ++writes; | |
82 | } | |
83 | ||
5e530de4 | 84 | if (PIM_DEBUG_MROUTE_DETAIL_ONLY) { |
d62a17ae | 85 | vty_out(vty, "debug mroute detail\n"); |
86 | ++writes; | |
87 | } | |
88 | ||
89 | if (PIM_DEBUG_PIM_EVENTS) { | |
90 | vty_out(vty, "debug pim events\n"); | |
91 | ++writes; | |
92 | } | |
93 | if (PIM_DEBUG_PIM_PACKETS) { | |
94 | vty_out(vty, "debug pim packets\n"); | |
95 | ++writes; | |
96 | } | |
97 | if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { | |
98 | vty_out(vty, "debug pim packet-dump send\n"); | |
99 | ++writes; | |
100 | } | |
101 | if (PIM_DEBUG_PIM_PACKETDUMP_RECV) { | |
102 | vty_out(vty, "debug pim packet-dump receive\n"); | |
103 | ++writes; | |
104 | } | |
105 | ||
106 | if (PIM_DEBUG_PIM_TRACE) { | |
107 | vty_out(vty, "debug pim trace\n"); | |
108 | ++writes; | |
109 | } | |
5e530de4 | 110 | if (PIM_DEBUG_PIM_TRACE_DETAIL_ONLY) { |
d62a17ae | 111 | vty_out(vty, "debug pim trace detail\n"); |
112 | ++writes; | |
113 | } | |
114 | ||
115 | if (PIM_DEBUG_ZEBRA) { | |
116 | vty_out(vty, "debug pim zebra\n"); | |
117 | ++writes; | |
118 | } | |
119 | ||
16c926c8 | 120 | if (PIM_DEBUG_BSM) { |
121 | vty_out(vty, "debug pim bsm\n"); | |
122 | ++writes; | |
123 | } | |
124 | ||
4d913fa6 AK |
125 | if (PIM_DEBUG_VXLAN) { |
126 | vty_out(vty, "debug pim vxlan\n"); | |
127 | ++writes; | |
128 | } | |
129 | ||
d62a17ae | 130 | if (PIM_DEBUG_SSMPINGD) { |
131 | vty_out(vty, "debug ssmpingd\n"); | |
132 | ++writes; | |
133 | } | |
134 | ||
135 | if (PIM_DEBUG_PIM_HELLO) { | |
136 | vty_out(vty, "debug pim packets hello\n"); | |
137 | ++writes; | |
138 | } | |
139 | ||
140 | if (PIM_DEBUG_PIM_J_P) { | |
141 | vty_out(vty, "debug pim packets joins\n"); | |
142 | ++writes; | |
143 | } | |
144 | ||
145 | if (PIM_DEBUG_PIM_REG) { | |
146 | vty_out(vty, "debug pim packets register\n"); | |
147 | ++writes; | |
148 | } | |
149 | ||
150 | if (PIM_DEBUG_STATIC) { | |
151 | vty_out(vty, "debug pim static\n"); | |
152 | ++writes; | |
153 | } | |
154 | ||
40f1f31b DS |
155 | if (PIM_DEBUG_PIM_NHT) { |
156 | vty_out(vty, "debug pim nht\n"); | |
157 | ++writes; | |
158 | } | |
159 | ||
d62a17ae | 160 | return writes; |
12e41d03 DL |
161 | } |
162 | ||
9ecb7b77 | 163 | int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty) |
12e41d03 | 164 | { |
d62a17ae | 165 | int writes = 0; |
6196ed71 | 166 | struct pim_ssm *ssm = pim->ssm_info; |
0c8b717e DS |
167 | char spaces[10]; |
168 | ||
169 | if (pim->vrf_id == VRF_DEFAULT) | |
170 | sprintf(spaces, "%s", ""); | |
171 | else | |
172 | sprintf(spaces, "%s", " "); | |
12e41d03 | 173 | |
84f25989 | 174 | writes += pim_msdp_config_write(pim, vty, spaces); |
d62a17ae | 175 | |
6196ed71 | 176 | if (!pim->send_v6_secondary) { |
c9657fdc | 177 | vty_out(vty, "%sno ip pim send-v6-secondary\n", spaces); |
d62a17ae | 178 | ++writes; |
6b775f61 | 179 | } |
12e41d03 | 180 | |
0c8b717e | 181 | writes += pim_rp_config_write(pim, vty, spaces); |
d62a17ae | 182 | |
2925dff5 | 183 | if (router->register_suppress_time |
d62a17ae | 184 | != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) { |
c9657fdc | 185 | vty_out(vty, "%sip pim register-suppress-time %d\n", spaces, |
2925dff5 | 186 | router->register_suppress_time); |
d62a17ae | 187 | ++writes; |
6b775f61 | 188 | } |
5b45753e | 189 | if (router->t_periodic != PIM_DEFAULT_T_PERIODIC) { |
c9657fdc | 190 | vty_out(vty, "%sip pim join-prune-interval %d\n", spaces, |
5b45753e | 191 | router->t_periodic); |
d62a17ae | 192 | ++writes; |
193 | } | |
19b807ca | 194 | if (pim->keep_alive_time != PIM_KEEPALIVE_PERIOD) { |
c9657fdc | 195 | vty_out(vty, "%sip pim keep-alive-timer %d\n", spaces, |
19b807ca | 196 | pim->keep_alive_time); |
d62a17ae | 197 | ++writes; |
198 | } | |
cc14df13 DS |
199 | if (pim->rp_keep_alive_time != (unsigned int)PIM_RP_KEEPALIVE_PERIOD) { |
200 | vty_out(vty, "%sip pim rp keep-alive-timer %d\n", spaces, | |
201 | pim->rp_keep_alive_time); | |
202 | ++writes; | |
203 | } | |
75373cca | 204 | if (router->packet_process != PIM_DEFAULT_PACKET_PROCESS) { |
c9657fdc | 205 | vty_out(vty, "%sip pim packets %d\n", spaces, |
75373cca | 206 | router->packet_process); |
d62a17ae | 207 | ++writes; |
208 | } | |
209 | if (ssm->plist_name) { | |
c9657fdc DS |
210 | vty_out(vty, "%sip pim ssm prefix-list %s\n", spaces, |
211 | ssm->plist_name); | |
d62a17ae | 212 | ++writes; |
213 | } | |
6196ed71 DS |
214 | if (pim->spt.switchover == PIM_SPT_INFINITY) { |
215 | if (pim->spt.plist) | |
d62a17ae | 216 | vty_out(vty, |
c9657fdc DS |
217 | "%sip pim spt-switchover infinity-and-beyond prefix-list %s\n", |
218 | spaces, pim->spt.plist); | |
d62a17ae | 219 | else |
220 | vty_out(vty, | |
c9657fdc DS |
221 | "%sip pim spt-switchover infinity-and-beyond\n", |
222 | spaces); | |
d62a17ae | 223 | ++writes; |
224 | } | |
4795fff7 | 225 | if (pim->ecmp_rebalance_enable) { |
c9657fdc | 226 | vty_out(vty, "%sip pim ecmp rebalance\n", spaces); |
d62a17ae | 227 | ++writes; |
4795fff7 | 228 | } else if (pim->ecmp_enable) { |
c9657fdc | 229 | vty_out(vty, "%sip pim ecmp\n", spaces); |
d62a17ae | 230 | ++writes; |
231 | } | |
71ad9915 | 232 | if (pim->ssmpingd_list) { |
d62a17ae | 233 | struct listnode *node; |
234 | struct ssmpingd_sock *ss; | |
d62a17ae | 235 | ++writes; |
71ad9915 | 236 | for (ALL_LIST_ELEMENTS_RO(pim->ssmpingd_list, node, ss)) { |
d62a17ae | 237 | char source_str[INET_ADDRSTRLEN]; |
238 | pim_inet4_dump("<src?>", ss->source_addr, source_str, | |
239 | sizeof(source_str)); | |
c9657fdc | 240 | vty_out(vty, "%sip ssmpingd %s\n", spaces, source_str); |
d62a17ae | 241 | ++writes; |
242 | } | |
243 | } | |
244 | ||
7c85225c AK |
245 | pim_vxlan_config_write(vty, spaces, &writes); |
246 | ||
d62a17ae | 247 | return writes; |
248 | } | |
12e41d03 | 249 | |
d62a17ae | 250 | int pim_interface_config_write(struct vty *vty) |
251 | { | |
024d6a75 | 252 | struct pim_instance *pim; |
d62a17ae | 253 | struct interface *ifp; |
024d6a75 DS |
254 | struct vrf *vrf; |
255 | int writes = 0; | |
d62a17ae | 256 | |
a2addae8 | 257 | RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { |
024d6a75 DS |
258 | pim = vrf->info; |
259 | if (!pim) | |
260 | continue; | |
d62a17ae | 261 | |
451fda4f | 262 | FOR_ALL_INTERFACES (pim->vrf, ifp) { |
024d6a75 DS |
263 | /* IF name */ |
264 | if (vrf->vrf_id == VRF_DEFAULT) | |
a8b828f3 | 265 | vty_frame(vty, "interface %s\n", ifp->name); |
024d6a75 | 266 | else |
019eb073 DS |
267 | vty_frame(vty, "interface %s vrf %s\n", |
268 | ifp->name, vrf->name); | |
024d6a75 | 269 | ++writes; |
d62a17ae | 270 | |
91e5b43a RW |
271 | if (ifp->desc) { |
272 | vty_out(vty, " description %s\n", ifp->desc); | |
273 | ++writes; | |
274 | } | |
275 | ||
024d6a75 DS |
276 | if (ifp->info) { |
277 | struct pim_interface *pim_ifp = ifp->info; | |
d62a17ae | 278 | |
024d6a75 | 279 | if (PIM_IF_TEST_PIM(pim_ifp->options)) { |
2f5e937c | 280 | vty_out(vty, " ip pim\n"); |
024d6a75 DS |
281 | ++writes; |
282 | } | |
d62a17ae | 283 | |
024d6a75 DS |
284 | /* IF ip pim drpriority */ |
285 | if (pim_ifp->pim_dr_priority | |
286 | != PIM_DEFAULT_DR_PRIORITY) { | |
287 | vty_out(vty, " ip pim drpriority %u\n", | |
288 | pim_ifp->pim_dr_priority); | |
289 | ++writes; | |
290 | } | |
d62a17ae | 291 | |
024d6a75 DS |
292 | /* IF ip pim hello */ |
293 | if (pim_ifp->pim_hello_period | |
294 | != PIM_DEFAULT_HELLO_PERIOD) { | |
295 | vty_out(vty, " ip pim hello %d", | |
296 | pim_ifp->pim_hello_period); | |
297 | if (pim_ifp->pim_default_holdtime != -1) | |
298 | vty_out(vty, " %d", | |
299 | pim_ifp->pim_default_holdtime); | |
300 | vty_out(vty, "\n"); | |
b0f525a8 | 301 | ++writes; |
024d6a75 | 302 | } |
d62a17ae | 303 | |
024d6a75 DS |
304 | /* update source */ |
305 | if (PIM_INADDR_ISNOT_ANY( | |
306 | pim_ifp->update_source)) { | |
307 | char src_str[INET_ADDRSTRLEN]; | |
308 | pim_inet4_dump("<src?>", | |
309 | pim_ifp->update_source, | |
310 | src_str, | |
311 | sizeof(src_str)); | |
312 | vty_out(vty, " ip pim use-source %s\n", | |
313 | src_str); | |
314 | ++writes; | |
315 | } | |
d62a17ae | 316 | |
024d6a75 DS |
317 | /* IF ip igmp */ |
318 | if (PIM_IF_TEST_IGMP(pim_ifp->options)) { | |
319 | vty_out(vty, " ip igmp\n"); | |
320 | ++writes; | |
321 | } | |
d62a17ae | 322 | |
024d6a75 DS |
323 | /* ip igmp version */ |
324 | if (pim_ifp->igmp_version | |
325 | != IGMP_DEFAULT_VERSION) { | |
326 | vty_out(vty, " ip igmp version %d\n", | |
327 | pim_ifp->igmp_version); | |
328 | ++writes; | |
329 | } | |
d62a17ae | 330 | |
024d6a75 DS |
331 | /* IF ip igmp query-max-response-time */ |
332 | if (pim_ifp->igmp_query_max_response_time_dsec | |
333 | != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) { | |
334 | vty_out(vty, | |
335 | " ip igmp query-max-response-time %d\n", | |
336 | pim_ifp->igmp_query_max_response_time_dsec); | |
d62a17ae | 337 | ++writes; |
338 | } | |
d62a17ae | 339 | |
c55f7a80 DS |
340 | /* IF ip igmp query-interval */ |
341 | if (pim_ifp->igmp_default_query_interval | |
342 | != IGMP_GENERAL_QUERY_INTERVAL) { | |
343 | vty_out(vty, | |
344 | " ip igmp query-interval %d\n", | |
345 | pim_ifp->igmp_default_query_interval); | |
346 | ++writes; | |
347 | } | |
348 | ||
59115451 SP |
349 | /* IF ip igmp last-member_query-count */ |
350 | if (pim_ifp->igmp_last_member_query_count | |
351 | != IGMP_DEFAULT_ROBUSTNESS_VARIABLE) { | |
352 | vty_out(vty, | |
353 | " ip igmp last-member-query-count %d\n", | |
354 | pim_ifp->igmp_last_member_query_count); | |
355 | ++writes; | |
356 | } | |
357 | ||
358 | /* IF ip igmp last-member_query-interval */ | |
359 | if (pim_ifp->igmp_specific_query_max_response_time_dsec | |
360 | != IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC) { | |
361 | vty_out(vty, | |
362 | " ip igmp last-member-query-interval %d\n", | |
363 | pim_ifp->igmp_specific_query_max_response_time_dsec); | |
364 | ++writes; | |
365 | } | |
366 | ||
024d6a75 DS |
367 | /* IF ip igmp join */ |
368 | if (pim_ifp->igmp_join_list) { | |
369 | struct listnode *node; | |
370 | struct igmp_join *ij; | |
371 | for (ALL_LIST_ELEMENTS_RO( | |
372 | pim_ifp->igmp_join_list, | |
373 | node, ij)) { | |
374 | char group_str[INET_ADDRSTRLEN]; | |
375 | char source_str | |
376 | [INET_ADDRSTRLEN]; | |
377 | pim_inet4_dump( | |
378 | "<grp?>", | |
379 | ij->group_addr, | |
380 | group_str, | |
381 | sizeof(group_str)); | |
771ce8ad LM |
382 | if (ij->source_addr.s_addr == INADDR_ANY) { |
383 | vty_out(vty, | |
384 | " ip igmp join %s\n", | |
385 | group_str); | |
386 | } else { | |
387 | inet_ntop(AF_INET, | |
388 | &ij->source_addr, | |
389 | source_str, | |
390 | sizeof(source_str)); | |
391 | vty_out(vty, | |
392 | " ip igmp join %s %s\n", | |
393 | group_str, source_str); | |
394 | } | |
024d6a75 DS |
395 | ++writes; |
396 | } | |
397 | } | |
398 | ||
414d885a DS |
399 | if (pim_ifp->activeactive) |
400 | vty_out(vty, " ip pim active-active\n"); | |
401 | ||
b0f525a8 QY |
402 | /* boundary */ |
403 | if (pim_ifp->boundary_oil_plist) { | |
404 | vty_out(vty, | |
513c8462 | 405 | " ip multicast boundary oil %s\n", |
b0f525a8 QY |
406 | pim_ifp->boundary_oil_plist); |
407 | ++writes; | |
408 | } | |
409 | ||
4e0bc0f0 | 410 | writes += |
64c86530 | 411 | pim_static_write_mroute(pim, vty, ifp); |
16c926c8 | 412 | pim_bsm_write_config(vty, ifp); |
413 | ++writes; | |
024d6a75 | 414 | pim_bfd_write_config(vty, ifp); |
16c926c8 | 415 | ++writes; |
024d6a75 | 416 | } |
a8b828f3 | 417 | vty_endframe(vty, "!\n"); |
024d6a75 | 418 | ++writes; |
d62a17ae | 419 | } |
12e41d03 | 420 | } |
12e41d03 | 421 | |
d62a17ae | 422 | return writes; |
12e41d03 | 423 | } |