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