Line data Source code
1 : /*
2 : * Zebra debug related function
3 : * Copyright (C) 1999 Kunihiro Ishiguro
4 : *
5 : * This file is part of GNU Zebra.
6 : *
7 : * GNU Zebra is free software; you can redistribute it and/or modify it
8 : * under the terms of the GNU General Public License as published by the
9 : * Free Software Foundation; either version 2, or (at your option) any
10 : * later version.
11 : *
12 : * GNU Zebra is distributed in the hope that it will be useful, but
13 : * WITHOUT ANY WARRANTY; without even the implied warranty of
14 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 : * General Public License for more details.
16 : *
17 : * You should have received a copy of the GNU General Public License along
18 : * with this program; see the file COPYING; if not, write to the Free Software
19 : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 : */
21 :
22 : #include <zebra.h>
23 : #include "command.h"
24 : #include "debug.h"
25 :
26 : #include "zebra/debug_clippy.c"
27 :
28 : /* For debug statement. */
29 : unsigned long zebra_debug_event;
30 : unsigned long zebra_debug_packet;
31 : unsigned long zebra_debug_kernel;
32 : unsigned long zebra_debug_rib;
33 : unsigned long zebra_debug_fpm;
34 : unsigned long zebra_debug_nht;
35 : unsigned long zebra_debug_mpls;
36 : unsigned long zebra_debug_vxlan;
37 : unsigned long zebra_debug_pw;
38 : unsigned long zebra_debug_dplane;
39 : unsigned long zebra_debug_dplane_dpdk;
40 : unsigned long zebra_debug_mlag;
41 : unsigned long zebra_debug_nexthop;
42 : unsigned long zebra_debug_evpn_mh;
43 : unsigned long zebra_debug_pbr;
44 : unsigned long zebra_debug_neigh;
45 : unsigned long zebra_debug_tc;
46 :
47 0 : DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty));
48 :
49 0 : DEFUN_NOSH (show_debugging_zebra,
50 : show_debugging_zebra_cmd,
51 : "show debugging [zebra]",
52 : SHOW_STR
53 : "Debugging information\n"
54 : "Zebra configuration\n")
55 : {
56 0 : vty_out(vty, "Zebra debugging status:\n");
57 :
58 0 : if (IS_ZEBRA_DEBUG_EVENT)
59 0 : vty_out(vty, " Zebra event debugging is on\n");
60 :
61 0 : if (IS_ZEBRA_DEBUG_PACKET) {
62 0 : if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) {
63 0 : vty_out(vty, " Zebra packet%s debugging is on\n",
64 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
65 : } else {
66 0 : if (IS_ZEBRA_DEBUG_SEND)
67 0 : vty_out(vty,
68 : " Zebra packet send%s debugging is on\n",
69 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
70 : else
71 0 : vty_out(vty,
72 : " Zebra packet receive%s debugging is on\n",
73 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
74 : }
75 : }
76 :
77 0 : if (IS_ZEBRA_DEBUG_KERNEL)
78 0 : vty_out(vty, " Zebra kernel debugging is on\n");
79 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND)
80 0 : vty_out(vty,
81 : " Zebra kernel netlink message dumps (send) are on\n");
82 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV)
83 0 : vty_out(vty,
84 : " Zebra kernel netlink message dumps (recv) are on\n");
85 :
86 : /* Check here using flags as the 'macro' does an OR */
87 0 : if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED))
88 0 : vty_out(vty, " Zebra RIB detailed debugging is on\n");
89 0 : else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB))
90 0 : vty_out(vty, " Zebra RIB debugging is on\n");
91 :
92 0 : if (IS_ZEBRA_DEBUG_FPM)
93 0 : vty_out(vty, " Zebra FPM debugging is on\n");
94 0 : if (IS_ZEBRA_DEBUG_NHT_DETAILED)
95 0 : vty_out(vty, " Zebra detailed next-hop tracking debugging is on\n");
96 0 : else if (IS_ZEBRA_DEBUG_NHT)
97 0 : vty_out(vty, " Zebra next-hop tracking debugging is on\n");
98 0 : if (IS_ZEBRA_DEBUG_MPLS_DETAIL)
99 0 : vty_out(vty, " Zebra detailed MPLS debugging is on\n");
100 0 : else if (IS_ZEBRA_DEBUG_MPLS)
101 0 : vty_out(vty, " Zebra MPLS debugging is on\n");
102 :
103 0 : if (IS_ZEBRA_DEBUG_VXLAN)
104 0 : vty_out(vty, " Zebra VXLAN debugging is on\n");
105 0 : if (IS_ZEBRA_DEBUG_PW)
106 0 : vty_out(vty, " Zebra pseudowire debugging is on\n");
107 0 : if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
108 0 : vty_out(vty, " Zebra detailed dataplane debugging is on\n");
109 0 : else if (IS_ZEBRA_DEBUG_DPLANE)
110 0 : vty_out(vty, " Zebra dataplane debugging is on\n");
111 0 : if (IS_ZEBRA_DEBUG_DPLANE_DPDK_DETAIL)
112 0 : vty_out(vty,
113 : " Zebra detailed dpdk dataplane debugging is on\n");
114 0 : else if (IS_ZEBRA_DEBUG_DPLANE_DPDK)
115 0 : vty_out(vty, " Zebra dataplane dpdk debugging is on\n");
116 0 : if (IS_ZEBRA_DEBUG_MLAG)
117 0 : vty_out(vty, " Zebra mlag debugging is on\n");
118 0 : if (IS_ZEBRA_DEBUG_NHG_DETAIL)
119 0 : vty_out(vty, " Zebra detailed nexthop debugging is on\n");
120 0 : else if (IS_ZEBRA_DEBUG_NHG)
121 0 : vty_out(vty, " Zebra nexthop debugging is on\n");
122 :
123 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
124 0 : vty_out(vty, " Zebra EVPN-MH ethernet segment debugging is on\n");
125 :
126 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
127 0 : vty_out(vty, " Zebra EVPN-MH nexthop debugging is on\n");
128 :
129 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
130 0 : vty_out(vty, " Zebra EVPN-MH MAC debugging is on\n");
131 :
132 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH)
133 0 : vty_out(vty, " Zebra EVPN-MH Neigh debugging is on\n");
134 :
135 0 : if (IS_ZEBRA_DEBUG_PBR)
136 0 : vty_out(vty, " Zebra PBR debugging is on\n");
137 :
138 0 : hook_call(zebra_debug_show_debugging, vty);
139 :
140 0 : cmd_show_lib_debugs(vty);
141 :
142 0 : return CMD_SUCCESS;
143 : }
144 :
145 1 : DEFUN (debug_zebra_events,
146 : debug_zebra_events_cmd,
147 : "debug zebra events",
148 : DEBUG_STR
149 : "Zebra configuration\n"
150 : "Debug option set for zebra events\n")
151 : {
152 1 : zebra_debug_event = ZEBRA_DEBUG_EVENT;
153 1 : return CMD_SUCCESS;
154 : }
155 :
156 1 : DEFUN (debug_zebra_nht,
157 : debug_zebra_nht_cmd,
158 : "debug zebra nht [detailed]",
159 : DEBUG_STR
160 : "Zebra configuration\n"
161 : "Debug option set for zebra next hop tracking\n"
162 : "Debug option set for detailed info\n")
163 : {
164 1 : int idx = 0;
165 :
166 1 : zebra_debug_nht = ZEBRA_DEBUG_NHT;
167 :
168 1 : if (argv_find(argv, argc, "detailed", &idx))
169 1 : zebra_debug_nht |= ZEBRA_DEBUG_NHT_DETAILED;
170 :
171 1 : return CMD_SUCCESS;
172 : }
173 :
174 0 : DEFPY (debug_zebra_mpls,
175 : debug_zebra_mpls_cmd,
176 : "debug zebra mpls [detailed$detail]",
177 : DEBUG_STR
178 : "Zebra configuration\n"
179 : "Debug option set for zebra MPLS LSPs\n"
180 : "Debug option for detailed info\n")
181 : {
182 0 : zebra_debug_mpls = ZEBRA_DEBUG_MPLS;
183 :
184 0 : if (detail)
185 0 : zebra_debug_mpls |= ZEBRA_DEBUG_MPLS_DETAILED;
186 :
187 0 : return CMD_SUCCESS;
188 : }
189 :
190 0 : DEFPY (debug_zebra_vxlan,
191 : debug_zebra_vxlan_cmd,
192 : "debug zebra vxlan",
193 : DEBUG_STR
194 : "Zebra configuration\n"
195 : "Debug option set for zebra VxLAN (EVPN)\n")
196 : {
197 0 : zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN;
198 0 : return CMD_SUCCESS;
199 : }
200 :
201 0 : DEFUN (debug_zebra_pw,
202 : debug_zebra_pw_cmd,
203 : "[no] debug zebra pseudowires",
204 : NO_STR
205 : DEBUG_STR
206 : "Zebra configuration\n"
207 : "Debug option set for zebra pseudowires\n")
208 : {
209 0 : if (strmatch(argv[0]->text, "no"))
210 0 : UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
211 : else
212 0 : SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
213 0 : return CMD_SUCCESS;
214 : }
215 :
216 1 : DEFUN (debug_zebra_packet,
217 : debug_zebra_packet_cmd,
218 : "debug zebra packet [<recv|send>] [detail]",
219 : DEBUG_STR
220 : "Zebra configuration\n"
221 : "Debug option set for zebra packet\n"
222 : "Debug option set for receive packet\n"
223 : "Debug option set for send packet\n"
224 : "Debug option set for detailed info\n")
225 : {
226 1 : int idx = 0;
227 1 : zebra_debug_packet = ZEBRA_DEBUG_PACKET;
228 :
229 1 : if (argv_find(argv, argc, "send", &idx))
230 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
231 1 : else if (argv_find(argv, argc, "recv", &idx))
232 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
233 : else {
234 1 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
235 1 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
236 : }
237 :
238 1 : if (argv_find(argv, argc, "detail", &idx))
239 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL);
240 :
241 1 : return CMD_SUCCESS;
242 : }
243 :
244 0 : DEFUN (debug_zebra_kernel,
245 : debug_zebra_kernel_cmd,
246 : "debug zebra kernel",
247 : DEBUG_STR
248 : "Zebra configuration\n"
249 : "Debug option set for zebra between kernel interface\n")
250 : {
251 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL);
252 :
253 0 : return CMD_SUCCESS;
254 : }
255 :
256 : #if defined(HAVE_NETLINK)
257 0 : DEFUN (debug_zebra_kernel_msgdump,
258 : debug_zebra_kernel_msgdump_cmd,
259 : "debug zebra kernel msgdump [<recv|send>]",
260 : DEBUG_STR
261 : "Zebra configuration\n"
262 : "Debug option set for zebra between kernel interface\n"
263 : "Dump raw netlink messages, sent and received\n"
264 : "Dump raw netlink messages received\n"
265 : "Dump raw netlink messages sent\n")
266 : {
267 0 : int idx = 0;
268 :
269 0 : if (argv_find(argv, argc, "recv", &idx))
270 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
271 0 : else if (argv_find(argv, argc, "send", &idx))
272 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
273 : else {
274 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
275 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
276 : }
277 :
278 0 : return CMD_SUCCESS;
279 : }
280 : #endif
281 :
282 1 : DEFUN (debug_zebra_rib,
283 : debug_zebra_rib_cmd,
284 : "debug zebra rib [detailed]",
285 : DEBUG_STR
286 : "Zebra configuration\n"
287 : "Debug RIB events\n"
288 : "Detailed debugs\n")
289 : {
290 1 : int idx = 0;
291 1 : SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB);
292 :
293 1 : if (argv_find(argv, argc, "detailed", &idx))
294 1 : SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED);
295 :
296 1 : return CMD_SUCCESS;
297 : }
298 :
299 0 : DEFUN (debug_zebra_fpm,
300 : debug_zebra_fpm_cmd,
301 : "debug zebra fpm",
302 : DEBUG_STR
303 : "Zebra configuration\n"
304 : "Debug zebra FPM events\n")
305 : {
306 0 : SET_FLAG(zebra_debug_fpm, ZEBRA_DEBUG_FPM);
307 0 : return CMD_SUCCESS;
308 : }
309 :
310 0 : DEFUN (debug_zebra_dplane,
311 : debug_zebra_dplane_cmd,
312 : "debug zebra dplane [detailed]",
313 : DEBUG_STR
314 : "Zebra configuration\n"
315 : "Debug zebra dataplane events\n"
316 : "Detailed debug information\n")
317 : {
318 0 : int idx = 0;
319 :
320 0 : SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE);
321 :
322 0 : if (argv_find(argv, argc, "detailed", &idx))
323 0 : SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED);
324 :
325 0 : return CMD_SUCCESS;
326 : }
327 :
328 0 : DEFPY(debug_zebra_dplane_dpdk, debug_zebra_dplane_dpdk_cmd,
329 : "[no$no] debug zebra dplane dpdk [detailed$detail]",
330 : NO_STR DEBUG_STR
331 : "Zebra configuration\n"
332 : "Debug zebra dataplane events\n"
333 : "Debug zebra DPDK offload events\n"
334 : "Detailed debug information\n")
335 : {
336 0 : if (no) {
337 0 : UNSET_FLAG(zebra_debug_dplane_dpdk, ZEBRA_DEBUG_DPLANE_DPDK);
338 0 : UNSET_FLAG(zebra_debug_dplane_dpdk,
339 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL);
340 : } else {
341 0 : SET_FLAG(zebra_debug_dplane_dpdk, ZEBRA_DEBUG_DPLANE_DPDK);
342 :
343 0 : if (detail)
344 0 : SET_FLAG(zebra_debug_dplane_dpdk,
345 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL);
346 : }
347 :
348 0 : return CMD_SUCCESS;
349 : }
350 :
351 0 : DEFUN (debug_zebra_pbr,
352 : debug_zebra_pbr_cmd,
353 : "debug zebra pbr",
354 : DEBUG_STR
355 : "Zebra configuration\n"
356 : "Debug zebra pbr events\n")
357 : {
358 0 : SET_FLAG(zebra_debug_pbr, ZEBRA_DEBUG_PBR);
359 0 : return CMD_SUCCESS;
360 : }
361 :
362 0 : DEFPY (debug_zebra_neigh,
363 : debug_zebra_neigh_cmd,
364 : "[no$no] debug zebra neigh",
365 : NO_STR
366 : DEBUG_STR
367 : "Zebra configuration\n"
368 : "Debug zebra neigh events\n")
369 : {
370 0 : if (no)
371 0 : UNSET_FLAG(zebra_debug_neigh, ZEBRA_DEBUG_NEIGH);
372 : else
373 0 : SET_FLAG(zebra_debug_neigh, ZEBRA_DEBUG_NEIGH);
374 :
375 0 : return CMD_SUCCESS;
376 : }
377 :
378 0 : DEFUN (debug_zebra_tc,
379 : debug_zebra_tc_cmd,
380 : "debug zebra tc",
381 : DEBUG_STR
382 : "Zebra configuration\n"
383 : "Debug zebra tc events\n")
384 : {
385 0 : SET_FLAG(zebra_debug_tc, ZEBRA_DEBUG_TC);
386 0 : return CMD_SUCCESS;
387 : }
388 :
389 0 : DEFPY (debug_zebra_mlag,
390 : debug_zebra_mlag_cmd,
391 : "[no$no] debug zebra mlag",
392 : NO_STR
393 : DEBUG_STR
394 : "Zebra configuration\n"
395 : "Debug option set for mlag events\n")
396 : {
397 0 : if (no)
398 0 : UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
399 : else
400 0 : SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
401 0 : return CMD_SUCCESS;
402 : }
403 :
404 0 : DEFPY (debug_zebra_evpn_mh,
405 : debug_zebra_evpn_mh_cmd,
406 : "[no$no] debug zebra evpn mh <es$es|mac$mac|neigh$neigh|nh$nh>",
407 : NO_STR
408 : DEBUG_STR
409 : "Zebra configuration\n"
410 : "EVPN\n"
411 : "Multihoming\n"
412 : "Ethernet Segment Debugging\n"
413 : "MAC Debugging\n"
414 : "Neigh Debugging\n"
415 : "Nexthop Debugging\n")
416 : {
417 0 : if (es) {
418 0 : if (no)
419 0 : UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
420 : else
421 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
422 : }
423 :
424 0 : if (mac) {
425 0 : if (no)
426 0 : UNSET_FLAG(zebra_debug_evpn_mh,
427 : ZEBRA_DEBUG_EVPN_MH_MAC);
428 : else
429 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_MAC);
430 : }
431 :
432 0 : if (neigh) {
433 0 : if (no)
434 0 : UNSET_FLAG(zebra_debug_evpn_mh,
435 : ZEBRA_DEBUG_EVPN_MH_NEIGH);
436 : else
437 0 : SET_FLAG(zebra_debug_evpn_mh,
438 : ZEBRA_DEBUG_EVPN_MH_NEIGH);
439 : }
440 :
441 0 : if (nh) {
442 0 : if (no)
443 0 : UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
444 : else
445 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
446 : }
447 :
448 0 : return CMD_SUCCESS;
449 : }
450 :
451 0 : DEFUN (no_debug_zebra_events,
452 : no_debug_zebra_events_cmd,
453 : "no debug zebra events",
454 : NO_STR
455 : DEBUG_STR
456 : "Zebra configuration\n"
457 : "Debug option set for zebra events\n")
458 : {
459 0 : zebra_debug_event = 0;
460 0 : return CMD_SUCCESS;
461 : }
462 :
463 0 : DEFUN (no_debug_zebra_nht,
464 : no_debug_zebra_nht_cmd,
465 : "no debug zebra nht [detailed]",
466 : NO_STR
467 : DEBUG_STR
468 : "Zebra configuration\n"
469 : "Debug option set for zebra next hop tracking\n"
470 : "Debug option set for detailed info\n")
471 : {
472 0 : zebra_debug_nht = 0;
473 0 : return CMD_SUCCESS;
474 : }
475 :
476 0 : DEFUN (no_debug_zebra_mpls,
477 : no_debug_zebra_mpls_cmd,
478 : "no debug zebra mpls [detailed]",
479 : NO_STR
480 : DEBUG_STR
481 : "Zebra configuration\n"
482 : "Debug option set for zebra MPLS LSPs\n"
483 : "Debug option for zebra detailed info\n")
484 : {
485 0 : zebra_debug_mpls = 0;
486 0 : return CMD_SUCCESS;
487 : }
488 :
489 0 : DEFUN (no_debug_zebra_vxlan,
490 : no_debug_zebra_vxlan_cmd,
491 : "no debug zebra vxlan",
492 : NO_STR
493 : DEBUG_STR
494 : "Zebra configuration\n"
495 : "Debug option set for zebra VxLAN (EVPN)\n")
496 : {
497 0 : zebra_debug_vxlan = 0;
498 0 : return CMD_SUCCESS;
499 : }
500 :
501 0 : DEFUN (no_debug_zebra_packet,
502 : no_debug_zebra_packet_cmd,
503 : "no debug zebra packet [<recv|send>] [detail]",
504 : NO_STR
505 : DEBUG_STR
506 : "Zebra configuration\n"
507 : "Debug option set for zebra packet\n"
508 : "Debug option set for receive packet\n"
509 : "Debug option set for send packet\n"
510 : "Debug option set for detailed info\n")
511 : {
512 0 : zebra_debug_packet = 0;
513 0 : return CMD_SUCCESS;
514 : }
515 :
516 0 : DEFUN (no_debug_zebra_kernel,
517 : no_debug_zebra_kernel_cmd,
518 : "no debug zebra kernel",
519 : NO_STR
520 : DEBUG_STR
521 : "Zebra configuration\n"
522 : "Debug option set for zebra between kernel interface\n")
523 : {
524 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL);
525 :
526 0 : return CMD_SUCCESS;
527 : }
528 :
529 : #if defined(HAVE_NETLINK)
530 0 : DEFUN (no_debug_zebra_kernel_msgdump,
531 : no_debug_zebra_kernel_msgdump_cmd,
532 : "no debug zebra kernel msgdump [<recv|send>]",
533 : NO_STR
534 : DEBUG_STR
535 : "Zebra configuration\n"
536 : "Debug option set for zebra between kernel interface\n"
537 : "Dump raw netlink messages, sent and received\n"
538 : "Dump raw netlink messages received\n"
539 : "Dump raw netlink messages sent\n")
540 : {
541 0 : int idx = 0;
542 :
543 0 : if (argv_find(argv, argc, "recv", &idx))
544 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
545 0 : else if (argv_find(argv, argc, "send", &idx))
546 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
547 : else {
548 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
549 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
550 : }
551 :
552 0 : return CMD_SUCCESS;
553 : }
554 : #endif
555 :
556 0 : DEFUN (no_debug_zebra_rib,
557 : no_debug_zebra_rib_cmd,
558 : "no debug zebra rib [detailed]",
559 : NO_STR
560 : DEBUG_STR
561 : "Zebra configuration\n"
562 : "Debug zebra RIB\n"
563 : "Detailed debugs\n")
564 : {
565 0 : zebra_debug_rib = 0;
566 0 : return CMD_SUCCESS;
567 : }
568 :
569 0 : DEFUN (no_debug_zebra_fpm,
570 : no_debug_zebra_fpm_cmd,
571 : "no debug zebra fpm",
572 : NO_STR
573 : DEBUG_STR
574 : "Zebra configuration\n"
575 : "Debug zebra FPM events\n")
576 : {
577 0 : zebra_debug_fpm = 0;
578 0 : return CMD_SUCCESS;
579 : }
580 :
581 0 : DEFUN (no_debug_zebra_dplane,
582 : no_debug_zebra_dplane_cmd,
583 : "no debug zebra dplane",
584 : NO_STR
585 : DEBUG_STR
586 : "Zebra configuration\n"
587 : "Debug zebra dataplane events\n")
588 : {
589 0 : zebra_debug_dplane = 0;
590 0 : return CMD_SUCCESS;
591 : }
592 :
593 0 : DEFUN (no_debug_zebra_pbr,
594 : no_debug_zebra_pbr_cmd,
595 : "no debug zebra pbr",
596 : NO_STR
597 : DEBUG_STR
598 : "Zebra configuration\n"
599 : "Debug zebra pbr events\n")
600 : {
601 0 : zebra_debug_pbr = 0;
602 0 : return CMD_SUCCESS;
603 : }
604 :
605 0 : DEFPY (debug_zebra_nexthop,
606 : debug_zebra_nexthop_cmd,
607 : "[no$no] debug zebra nexthop [detail$detail]",
608 : NO_STR
609 : DEBUG_STR
610 : "Zebra configuration\n"
611 : "Debug zebra nexthop events\n"
612 : "Detailed information\n")
613 : {
614 0 : if (no)
615 0 : zebra_debug_nexthop = 0;
616 : else {
617 0 : SET_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG);
618 :
619 0 : if (detail)
620 0 : SET_FLAG(zebra_debug_nexthop,
621 : ZEBRA_DEBUG_NHG_DETAILED);
622 : }
623 :
624 0 : return CMD_SUCCESS;
625 : }
626 :
627 : /* Debug node. */
628 : static int config_write_debug(struct vty *vty);
629 : struct cmd_node debug_node = {
630 : .name = "debug",
631 : .node = DEBUG_NODE,
632 : .prompt = "",
633 : .config_write = config_write_debug,
634 : };
635 :
636 0 : static int config_write_debug(struct vty *vty)
637 : {
638 0 : int write = 0;
639 :
640 0 : if (IS_ZEBRA_DEBUG_EVENT) {
641 0 : vty_out(vty, "debug zebra events\n");
642 0 : write++;
643 : }
644 0 : if (IS_ZEBRA_DEBUG_PACKET) {
645 0 : if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) {
646 0 : vty_out(vty, "debug zebra packet%s\n",
647 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
648 0 : write++;
649 : } else {
650 0 : if (IS_ZEBRA_DEBUG_SEND)
651 0 : vty_out(vty, "debug zebra packet send%s\n",
652 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
653 : else
654 0 : vty_out(vty, "debug zebra packet recv%s\n",
655 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
656 0 : write++;
657 : }
658 : }
659 :
660 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND
661 0 : && IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
662 0 : vty_out(vty, "debug zebra kernel msgdump\n");
663 0 : write++;
664 0 : } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
665 0 : vty_out(vty, "debug zebra kernel msgdump recv\n");
666 0 : write++;
667 0 : } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) {
668 0 : vty_out(vty, "debug zebra kernel msgdump send\n");
669 0 : write++;
670 : }
671 :
672 0 : if (IS_ZEBRA_DEBUG_KERNEL) {
673 0 : vty_out(vty, "debug zebra kernel\n");
674 0 : write++;
675 : }
676 :
677 0 : if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) {
678 0 : vty_out(vty, "debug zebra rib detailed\n");
679 0 : write++;
680 0 : } else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) {
681 0 : vty_out(vty, "debug zebra rib\n");
682 0 : write++;
683 : }
684 :
685 0 : if (IS_ZEBRA_DEBUG_FPM) {
686 0 : vty_out(vty, "debug zebra fpm\n");
687 0 : write++;
688 : }
689 :
690 0 : if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
691 0 : vty_out(vty, "debug zebra nht detailed\n");
692 0 : write++;
693 0 : } else if (IS_ZEBRA_DEBUG_NHT) {
694 0 : vty_out(vty, "debug zebra nht\n");
695 0 : write++;
696 : }
697 :
698 0 : if (IS_ZEBRA_DEBUG_MPLS_DETAIL) {
699 0 : vty_out(vty, "debug zebra mpls detailed\n");
700 0 : write++;
701 0 : } else if (IS_ZEBRA_DEBUG_MPLS) {
702 0 : vty_out(vty, "debug zebra mpls\n");
703 0 : write++;
704 : }
705 :
706 0 : if (IS_ZEBRA_DEBUG_VXLAN) {
707 0 : vty_out(vty, "debug zebra vxlan\n");
708 0 : write++;
709 : }
710 0 : if (IS_ZEBRA_DEBUG_MLAG) {
711 0 : vty_out(vty, "debug zebra mlag\n");
712 0 : write++;
713 : }
714 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_ES) {
715 0 : vty_out(vty, "debug zebra evpn mh es\n");
716 0 : write++;
717 : }
718 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NH) {
719 0 : vty_out(vty, "debug zebra evpn mh nh\n");
720 0 : write++;
721 : }
722 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
723 0 : vty_out(vty, "debug zebra evpn mh mac\n");
724 0 : write++;
725 : }
726 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) {
727 0 : vty_out(vty, "debug zebra evpn mh neigh\n");
728 0 : write++;
729 : }
730 0 : if (IS_ZEBRA_DEBUG_PW) {
731 0 : vty_out(vty, "debug zebra pseudowires\n");
732 0 : write++;
733 : }
734 :
735 0 : if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) {
736 0 : vty_out(vty, "debug zebra dplane detailed\n");
737 0 : write++;
738 0 : } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) {
739 0 : vty_out(vty, "debug zebra dplane\n");
740 0 : write++;
741 : }
742 :
743 0 : if (CHECK_FLAG(zebra_debug_dplane_dpdk,
744 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL)) {
745 0 : vty_out(vty, "debug zebra dplane dpdk detailed\n");
746 0 : write++;
747 0 : } else if (CHECK_FLAG(zebra_debug_dplane_dpdk,
748 : ZEBRA_DEBUG_DPLANE_DPDK)) {
749 0 : vty_out(vty, "debug zebra dplane dpdk\n");
750 0 : write++;
751 : }
752 :
753 0 : if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG_DETAILED)) {
754 0 : vty_out(vty, "debug zebra nexthop detail\n");
755 0 : write++;
756 0 : } else if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG)) {
757 0 : vty_out(vty, "debug zebra nexthop\n");
758 0 : write++;
759 : }
760 :
761 0 : if (IS_ZEBRA_DEBUG_PBR) {
762 0 : vty_out(vty, "debug zebra pbr\n");
763 0 : write++;
764 : }
765 :
766 0 : if (IS_ZEBRA_DEBUG_NEIGH) {
767 0 : vty_out(vty, "debug zebra neigh\n");
768 0 : write++;
769 : }
770 :
771 0 : return write;
772 : }
773 :
774 1 : void zebra_debug_init(void)
775 : {
776 1 : zebra_debug_event = 0;
777 1 : zebra_debug_packet = 0;
778 1 : zebra_debug_kernel = 0;
779 1 : zebra_debug_rib = 0;
780 1 : zebra_debug_fpm = 0;
781 1 : zebra_debug_mpls = 0;
782 1 : zebra_debug_vxlan = 0;
783 1 : zebra_debug_pw = 0;
784 1 : zebra_debug_dplane = 0;
785 1 : zebra_debug_dplane_dpdk = 0;
786 1 : zebra_debug_mlag = 0;
787 1 : zebra_debug_evpn_mh = 0;
788 1 : zebra_debug_nht = 0;
789 1 : zebra_debug_nexthop = 0;
790 1 : zebra_debug_pbr = 0;
791 1 : zebra_debug_neigh = 0;
792 :
793 1 : install_node(&debug_node);
794 :
795 1 : install_element(ENABLE_NODE, &show_debugging_zebra_cmd);
796 :
797 1 : install_element(ENABLE_NODE, &debug_zebra_events_cmd);
798 1 : install_element(ENABLE_NODE, &debug_zebra_nht_cmd);
799 1 : install_element(ENABLE_NODE, &debug_zebra_mpls_cmd);
800 1 : install_element(ENABLE_NODE, &debug_zebra_vxlan_cmd);
801 1 : install_element(ENABLE_NODE, &debug_zebra_pw_cmd);
802 1 : install_element(ENABLE_NODE, &debug_zebra_packet_cmd);
803 1 : install_element(ENABLE_NODE, &debug_zebra_kernel_cmd);
804 : #if defined(HAVE_NETLINK)
805 1 : install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
806 : #endif
807 1 : install_element(ENABLE_NODE, &debug_zebra_rib_cmd);
808 1 : install_element(ENABLE_NODE, &debug_zebra_fpm_cmd);
809 1 : install_element(ENABLE_NODE, &debug_zebra_dplane_cmd);
810 1 : install_element(ENABLE_NODE, &debug_zebra_mlag_cmd);
811 1 : install_element(ENABLE_NODE, &debug_zebra_nexthop_cmd);
812 1 : install_element(ENABLE_NODE, &debug_zebra_pbr_cmd);
813 1 : install_element(ENABLE_NODE, &debug_zebra_neigh_cmd);
814 1 : install_element(ENABLE_NODE, &debug_zebra_tc_cmd);
815 1 : install_element(ENABLE_NODE, &debug_zebra_dplane_dpdk_cmd);
816 1 : install_element(ENABLE_NODE, &no_debug_zebra_events_cmd);
817 1 : install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd);
818 1 : install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd);
819 1 : install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd);
820 1 : install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd);
821 1 : install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd);
822 : #if defined(HAVE_NETLINK)
823 1 : install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd);
824 : #endif
825 1 : install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd);
826 1 : install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd);
827 1 : install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd);
828 1 : install_element(ENABLE_NODE, &no_debug_zebra_pbr_cmd);
829 1 : install_element(ENABLE_NODE, &debug_zebra_evpn_mh_cmd);
830 :
831 1 : install_element(CONFIG_NODE, &debug_zebra_events_cmd);
832 1 : install_element(CONFIG_NODE, &debug_zebra_nht_cmd);
833 1 : install_element(CONFIG_NODE, &debug_zebra_mpls_cmd);
834 1 : install_element(CONFIG_NODE, &debug_zebra_vxlan_cmd);
835 1 : install_element(CONFIG_NODE, &debug_zebra_pw_cmd);
836 1 : install_element(CONFIG_NODE, &debug_zebra_packet_cmd);
837 1 : install_element(CONFIG_NODE, &debug_zebra_kernel_cmd);
838 : #if defined(HAVE_NETLINK)
839 1 : install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
840 : #endif
841 1 : install_element(CONFIG_NODE, &debug_zebra_rib_cmd);
842 1 : install_element(CONFIG_NODE, &debug_zebra_fpm_cmd);
843 1 : install_element(CONFIG_NODE, &debug_zebra_dplane_cmd);
844 1 : install_element(CONFIG_NODE, &debug_zebra_dplane_dpdk_cmd);
845 1 : install_element(CONFIG_NODE, &debug_zebra_nexthop_cmd);
846 1 : install_element(CONFIG_NODE, &debug_zebra_pbr_cmd);
847 1 : install_element(CONFIG_NODE, &debug_zebra_neigh_cmd);
848 :
849 1 : install_element(CONFIG_NODE, &no_debug_zebra_events_cmd);
850 1 : install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd);
851 1 : install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd);
852 1 : install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd);
853 1 : install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd);
854 1 : install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd);
855 : #if defined(HAVE_NETLINK)
856 1 : install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd);
857 : #endif
858 1 : install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd);
859 1 : install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd);
860 1 : install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd);
861 1 : install_element(CONFIG_NODE, &no_debug_zebra_pbr_cmd);
862 1 : install_element(CONFIG_NODE, &debug_zebra_mlag_cmd);
863 1 : install_element(CONFIG_NODE, &debug_zebra_evpn_mh_cmd);
864 1 : }
|