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