]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_vty.c
pim6d: Changing igmp_enable to gm_enable.
[mirror_frr.git] / pimd / pim_vty.c
CommitLineData
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"
12e41d03
DL
32#include "pim_str.h"
33#include "pim_ssmpingd.h"
dedccda6 34#include "pim_pim.h"
9867746a 35#include "pim_oil.h"
f91f89bc 36#include "pim_static.h"
75a26779 37#include "pim_rp.h"
3c72d654 38#include "pim_msdp.h"
15a5dafe 39#include "pim_ssm.h"
ba4eb1bc 40#include "pim_bfd.h"
16c926c8 41#include "pim_bsm.h"
7c85225c 42#include "pim_vxlan.h"
5afe22f5 43#include "pim6_mld.h"
12e41d03 44
d62a17ae 45int 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 }
e9c59240
DL
69 /* PIM_DEBUG_IGMP_TRACE catches _DETAIL too */
70 if (router->debugs & PIM_MASK_IGMP_TRACE) {
d62a17ae 71 vty_out(vty, "debug igmp trace\n");
72 ++writes;
e9c59240
DL
73 }
74 if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
75 vty_out(vty, "debug igmp trace detail\n");
76 ++writes;
d62a17ae 77 }
d62a17ae 78
92fed03c
DL
79 /* PIM_DEBUG_MROUTE catches _DETAIL too */
80 if (router->debugs & PIM_MASK_MROUTE) {
d62a17ae 81 vty_out(vty, "debug mroute\n");
82 ++writes;
83 }
92fed03c
DL
84 if (PIM_DEBUG_MROUTE_DETAIL) {
85 vty_out(vty, "debug mroute detail\n");
4d9ad5dc
MS
86 ++writes;
87 }
88
92fed03c
DL
89 if (PIM_DEBUG_MTRACE) {
90 vty_out(vty, "debug mtrace\n");
d62a17ae 91 ++writes;
92 }
93
94 if (PIM_DEBUG_PIM_EVENTS) {
95 vty_out(vty, "debug pim events\n");
96 ++writes;
97 }
98 if (PIM_DEBUG_PIM_PACKETS) {
99 vty_out(vty, "debug pim packets\n");
100 ++writes;
101 }
102 if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {
103 vty_out(vty, "debug pim packet-dump send\n");
104 ++writes;
105 }
106 if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
107 vty_out(vty, "debug pim packet-dump receive\n");
108 ++writes;
109 }
110
92fed03c
DL
111 /* PIM_DEBUG_PIM_TRACE catches _DETAIL too */
112 if (router->debugs & PIM_MASK_PIM_TRACE) {
d62a17ae 113 vty_out(vty, "debug pim trace\n");
114 ++writes;
115 }
92fed03c 116 if (PIM_DEBUG_PIM_TRACE_DETAIL) {
d62a17ae 117 vty_out(vty, "debug pim trace detail\n");
118 ++writes;
119 }
120
121 if (PIM_DEBUG_ZEBRA) {
122 vty_out(vty, "debug pim zebra\n");
123 ++writes;
124 }
125
17823cdd
DS
126 if (PIM_DEBUG_MLAG) {
127 vty_out(vty, "debug pim mlag\n");
128 ++writes;
129 }
130
16c926c8 131 if (PIM_DEBUG_BSM) {
132 vty_out(vty, "debug pim bsm\n");
133 ++writes;
134 }
135
4d913fa6
AK
136 if (PIM_DEBUG_VXLAN) {
137 vty_out(vty, "debug pim vxlan\n");
138 ++writes;
139 }
140
d62a17ae 141 if (PIM_DEBUG_SSMPINGD) {
142 vty_out(vty, "debug ssmpingd\n");
143 ++writes;
144 }
145
146 if (PIM_DEBUG_PIM_HELLO) {
147 vty_out(vty, "debug pim packets hello\n");
148 ++writes;
149 }
150
151 if (PIM_DEBUG_PIM_J_P) {
152 vty_out(vty, "debug pim packets joins\n");
153 ++writes;
154 }
155
156 if (PIM_DEBUG_PIM_REG) {
157 vty_out(vty, "debug pim packets register\n");
158 ++writes;
159 }
160
161 if (PIM_DEBUG_STATIC) {
162 vty_out(vty, "debug pim static\n");
163 ++writes;
164 }
165
40f1f31b
DS
166 if (PIM_DEBUG_PIM_NHT) {
167 vty_out(vty, "debug pim nht\n");
168 ++writes;
169 }
170
5c4508cb 171 if (PIM_DEBUG_PIM_NHT_RP) {
172 vty_out(vty, "debug pim nht rp\n");
173 ++writes;
174 }
175
6d733f0d
SG
176 if (PIM_DEBUG_PIM_NHT_DETAIL) {
177 vty_out(vty, "debug pim nht detail\n");
178 ++writes;
179 }
180
d62a17ae 181 return writes;
12e41d03
DL
182}
183
9ecb7b77 184int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
12e41d03 185{
d62a17ae 186 int writes = 0;
6196ed71 187 struct pim_ssm *ssm = pim->ssm_info;
0c8b717e
DS
188 char spaces[10];
189
d3cc1e45 190 if (pim->vrf->vrf_id == VRF_DEFAULT)
772270f3 191 snprintf(spaces, sizeof(spaces), "%s", "");
0c8b717e 192 else
772270f3 193 snprintf(spaces, sizeof(spaces), "%s", " ");
12e41d03 194
8c70c9e2 195 writes += pim_msdp_peer_config_write(vty, pim, spaces);
84f25989 196 writes += pim_msdp_config_write(pim, vty, spaces);
d62a17ae 197
6196ed71 198 if (!pim->send_v6_secondary) {
c9657fdc 199 vty_out(vty, "%sno ip pim send-v6-secondary\n", spaces);
d62a17ae 200 ++writes;
6b775f61 201 }
12e41d03 202
0c8b717e 203 writes += pim_rp_config_write(pim, vty, spaces);
d62a17ae 204
d3cc1e45 205 if (pim->vrf->vrf_id == VRF_DEFAULT) {
bb4b6eb5
DS
206 if (router->register_suppress_time
207 != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) {
ae97d577
MR
208 vty_out(vty, "%s" PIM_AF_NAME " pim register-suppress-time %d\n",
209 spaces, router->register_suppress_time);
bb4b6eb5
DS
210 ++writes;
211 }
212 if (router->t_periodic != PIM_DEFAULT_T_PERIODIC) {
ae97d577 213 vty_out(vty, "%s" PIM_AF_NAME " pim join-prune-interval %d\n",
bb4b6eb5
DS
214 spaces, router->t_periodic);
215 ++writes;
216 }
217
218 if (router->packet_process != PIM_DEFAULT_PACKET_PROCESS) {
ae97d577 219 vty_out(vty, "%s" PIM_AF_NAME " pim packets %d\n", spaces,
bb4b6eb5
DS
220 router->packet_process);
221 ++writes;
222 }
d62a17ae 223 }
19b807ca 224 if (pim->keep_alive_time != PIM_KEEPALIVE_PERIOD) {
ae97d577
MR
225 vty_out(vty, "%s" PIM_AF_NAME " pim keep-alive-timer %d\n",
226 spaces, pim->keep_alive_time);
d62a17ae 227 ++writes;
228 }
cc14df13 229 if (pim->rp_keep_alive_time != (unsigned int)PIM_RP_KEEPALIVE_PERIOD) {
ae97d577
MR
230 vty_out(vty, "%s" PIM_AF_NAME " pim rp keep-alive-timer %d\n",
231 spaces, pim->rp_keep_alive_time);
cc14df13
DS
232 ++writes;
233 }
d62a17ae 234 if (ssm->plist_name) {
c9657fdc
DS
235 vty_out(vty, "%sip pim ssm prefix-list %s\n", spaces,
236 ssm->plist_name);
d62a17ae 237 ++writes;
f4e74bd0
DS
238 }
239 if (pim->register_plist) {
240 vty_out(vty, "%sip pim register-accept-list %s\n", spaces,
241 pim->register_plist);
242 ++writes;
d62a17ae 243 }
6196ed71
DS
244 if (pim->spt.switchover == PIM_SPT_INFINITY) {
245 if (pim->spt.plist)
d62a17ae 246 vty_out(vty,
ae97d577 247 "%s" PIM_AF_NAME " pim spt-switchover infinity-and-beyond prefix-list %s\n",
c9657fdc 248 spaces, pim->spt.plist);
d62a17ae 249 else
250 vty_out(vty,
ae97d577 251 "%s" PIM_AF_NAME " pim spt-switchover infinity-and-beyond\n",
c9657fdc 252 spaces);
d62a17ae 253 ++writes;
254 }
4795fff7 255 if (pim->ecmp_rebalance_enable) {
c9657fdc 256 vty_out(vty, "%sip pim ecmp rebalance\n", spaces);
d62a17ae 257 ++writes;
4795fff7 258 } else if (pim->ecmp_enable) {
c9657fdc 259 vty_out(vty, "%sip pim ecmp\n", spaces);
d62a17ae 260 ++writes;
261 }
339f7695 262
263 if (pim->igmp_watermark_limit != 0) {
264 vty_out(vty, "%sip igmp watermark-warn %u\n", spaces,
265 pim->igmp_watermark_limit);
266 ++writes;
267 }
268
71ad9915 269 if (pim->ssmpingd_list) {
d62a17ae 270 struct listnode *node;
271 struct ssmpingd_sock *ss;
d62a17ae 272 ++writes;
71ad9915 273 for (ALL_LIST_ELEMENTS_RO(pim->ssmpingd_list, node, ss)) {
a8caf78d
BG
274 vty_out(vty, "%s" PIM_AF_NAME " ssmpingd %pPA\n",
275 spaces, &ss->source_addr);
d62a17ae 276 ++writes;
277 }
278 }
279
622fd3f1
RZ
280 if (pim->msdp.hold_time != PIM_MSDP_PEER_HOLD_TIME
281 || pim->msdp.keep_alive != PIM_MSDP_PEER_KA_TIME
282 || pim->msdp.connection_retry != PIM_MSDP_PEER_CONNECT_RETRY_TIME) {
283 vty_out(vty, "%sip msdp timers %u %u", spaces,
284 pim->msdp.hold_time, pim->msdp.keep_alive);
285 if (pim->msdp.connection_retry
286 != PIM_MSDP_PEER_CONNECT_RETRY_TIME)
287 vty_out(vty, " %u", pim->msdp.connection_retry);
288 vty_out(vty, "\n");
289 }
290
d62a17ae 291 return writes;
292}
12e41d03 293
0da95b2f 294#if PIM_IPV == 4
5afe22f5
DL
295static int gm_config_write(struct vty *vty, int writes,
296 struct pim_interface *pim_ifp)
0da95b2f 297{
0da95b2f 298 /* IF ip igmp */
4fecac21 299 if (pim_ifp->gm_enable) {
0da95b2f
SG
300 vty_out(vty, " ip igmp\n");
301 ++writes;
302 }
303
304 /* ip igmp version */
305 if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION) {
306 vty_out(vty, " ip igmp version %d\n", pim_ifp->igmp_version);
307 ++writes;
308 }
309
310 /* IF ip igmp query-max-response-time */
311 if (pim_ifp->gm_query_max_response_time_dsec !=
312 IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) {
313 vty_out(vty, " ip igmp query-max-response-time %d\n",
314 pim_ifp->gm_query_max_response_time_dsec);
315 ++writes;
316 }
317
318 /* IF ip igmp query-interval */
319 if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) {
320 vty_out(vty, " ip igmp query-interval %d\n",
321 pim_ifp->gm_default_query_interval);
322 ++writes;
323 }
324
325 /* IF ip igmp last-member_query-count */
326 if (pim_ifp->gm_last_member_query_count !=
327 IGMP_DEFAULT_ROBUSTNESS_VARIABLE) {
328 vty_out(vty, " ip igmp last-member-query-count %d\n",
329 pim_ifp->gm_last_member_query_count);
330 ++writes;
331 }
332
333 /* IF ip igmp last-member_query-interval */
334 if (pim_ifp->gm_specific_query_max_response_time_dsec !=
335 IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC) {
336 vty_out(vty, " ip igmp last-member-query-interval %d\n",
337 pim_ifp->gm_specific_query_max_response_time_dsec);
338 ++writes;
339 }
340
341 /* IF ip igmp join */
342 if (pim_ifp->gm_join_list) {
343 struct listnode *node;
344 struct gm_join *ij;
345 for (ALL_LIST_ELEMENTS_RO(pim_ifp->gm_join_list, node, ij)) {
346 char group_str[INET_ADDRSTRLEN];
347 char source_str[INET_ADDRSTRLEN];
348 pim_inet4_dump("<grp?>", ij->group_addr, group_str,
349 sizeof(group_str));
350 if (ij->source_addr.s_addr == INADDR_ANY) {
351 vty_out(vty, " ip igmp join %s\n", group_str);
352 } else {
353 inet_ntop(AF_INET, &ij->source_addr, source_str,
354 sizeof(source_str));
355 vty_out(vty, " ip igmp join %s %s\n", group_str,
356 source_str);
357 }
358 ++writes;
359 }
360 }
361
078c5867
MR
362 return writes;
363}
5afe22f5
DL
364#else
365static int gm_config_write(struct vty *vty, int writes,
366 struct pim_interface *pim_ifp)
367{
368 if (pim_ifp->mld_version != MLD_DEFAULT_VERSION)
369 vty_out(vty, " ipv6 mld version %d\n", pim_ifp->mld_version);
370 if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)
371 vty_out(vty, " ipv6 mld query-interval %d\n",
372 pim_ifp->gm_default_query_interval);
373 return 0;
374}
078c5867
MR
375#endif
376
078c5867
MR
377int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
378 struct pim_instance *pim)
379{
380 struct pim_interface *pim_ifp = ifp->info;
381
b6fcc0b7 382 if (pim_ifp->pim_enable) {
d17b6892 383 vty_out(vty, " " PIM_AF_NAME " pim\n");
078c5867
MR
384 ++writes;
385 }
386
387 /* IF ip pim drpriority */
388 if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) {
d17b6892 389 vty_out(vty, " " PIM_AF_NAME " pim drpriority %u\n",
078c5867
MR
390 pim_ifp->pim_dr_priority);
391 ++writes;
392 }
393
394 /* IF ip pim hello */
395 if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) {
d17b6892 396 vty_out(vty, " " PIM_AF_NAME " pim hello %d", pim_ifp->pim_hello_period);
078c5867
MR
397 if (pim_ifp->pim_default_holdtime != -1)
398 vty_out(vty, " %d", pim_ifp->pim_default_holdtime);
399 vty_out(vty, "\n");
400 ++writes;
401 }
402
5afe22f5 403 writes += gm_config_write(vty, writes, pim_ifp);
078c5867
MR
404
405 /* update source */
406 if (!pim_addr_is_any(pim_ifp->update_source)) {
d17b6892 407 vty_out(vty, " " PIM_AF_NAME " pim use-source %pPA\n",
078c5867
MR
408 &pim_ifp->update_source);
409 ++writes;
410 }
411
0da95b2f 412 if (pim_ifp->activeactive)
d17b6892 413 vty_out(vty, " " PIM_AF_NAME " pim active-active\n");
0da95b2f
SG
414
415 /* boundary */
416 if (pim_ifp->boundary_oil_plist) {
d17b6892 417 vty_out(vty, " " PIM_AF_NAME " multicast boundary oil %s\n",
0da95b2f
SG
418 pim_ifp->boundary_oil_plist);
419 ++writes;
420 }
421
2a66cf63 422 if (pim_ifp->pim_passive_enable) {
423 vty_out(vty, " " PIM_AF_NAME " pim passive\n");
424 ++writes;
425 }
426
0da95b2f
SG
427 writes += pim_static_write_mroute(pim, vty, ifp);
428 pim_bsm_write_config(vty, ifp);
429 ++writes;
430 pim_bfd_write_config(vty, ifp);
431 ++writes;
432
433 return writes;
434}
0da95b2f 435
d62a17ae 436int pim_interface_config_write(struct vty *vty)
437{
024d6a75 438 struct pim_instance *pim;
d62a17ae 439 struct interface *ifp;
024d6a75
DS
440 struct vrf *vrf;
441 int writes = 0;
d62a17ae 442
a2addae8 443 RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
024d6a75
DS
444 pim = vrf->info;
445 if (!pim)
446 continue;
d62a17ae 447
451fda4f 448 FOR_ALL_INTERFACES (pim->vrf, ifp) {
d149c75a
AK
449 /* pim is enabled internally/implicitly on the vxlan
450 * termination device ipmr-lo. skip displaying that
451 * config to avoid confusion
452 */
453 if (pim_vxlan_is_term_dev_cfg(pim, ifp))
454 continue;
455
024d6a75 456 /* IF name */
788a036f
IR
457 if_vty_config_start(vty, ifp);
458
024d6a75 459 ++writes;
d62a17ae 460
91e5b43a
RW
461 if (ifp->desc) {
462 vty_out(vty, " description %s\n", ifp->desc);
463 ++writes;
464 }
d17b6892
SG
465
466 if (ifp->info) {
0da95b2f 467 pim_config_write(vty, writes, ifp, pim);
d17b6892 468 }
788a036f 469 if_vty_config_end(vty);
d17b6892 470
024d6a75 471 ++writes;
d62a17ae 472 }
12e41d03 473 }
12e41d03 474
d62a17ae 475 return writes;
12e41d03 476}