]>
Commit | Line | Data |
---|---|---|
718e3744 | 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 | * | |
896014f4 DL |
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 | |
718e3744 | 20 | */ |
21 | ||
22 | #include <zebra.h> | |
23 | #include "command.h" | |
24 | #include "debug.h" | |
25 | ||
23666725 DS |
26 | #ifndef VTYSH_EXTRACT_PL |
27 | #include "zebra/debug_clippy.c" | |
28 | #endif | |
29 | ||
718e3744 | 30 | /* For debug statement. */ |
31 | unsigned long zebra_debug_event; | |
32 | unsigned long zebra_debug_packet; | |
33 | unsigned long zebra_debug_kernel; | |
b0498dc6 | 34 | unsigned long zebra_debug_rib; |
5adc2528 | 35 | unsigned long zebra_debug_fpm; |
fb018d25 | 36 | unsigned long zebra_debug_nht; |
7758e3f3 | 37 | unsigned long zebra_debug_mpls; |
13d60d35 | 38 | unsigned long zebra_debug_vxlan; |
6833ae01 | 39 | unsigned long zebra_debug_pw; |
6582b002 | 40 | unsigned long zebra_debug_dplane; |
23666725 | 41 | unsigned long zebra_debug_mlag; |
718e3744 | 42 | |
77151b6f PG |
43 | DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty)); |
44 | ||
87f6dc50 DS |
45 | DEFUN_NOSH (show_debugging_zebra, |
46 | show_debugging_zebra_cmd, | |
47 | "show debugging [zebra]", | |
48 | SHOW_STR | |
49 | "Debugging information\n" | |
50 | "Zebra configuration\n") | |
718e3744 | 51 | { |
d62a17ae | 52 | vty_out(vty, "Zebra debugging status:\n"); |
53 | ||
54 | if (IS_ZEBRA_DEBUG_EVENT) | |
55 | vty_out(vty, " Zebra event debugging is on\n"); | |
56 | ||
57 | if (IS_ZEBRA_DEBUG_PACKET) { | |
58 | if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) { | |
59 | vty_out(vty, " Zebra packet%s debugging is on\n", | |
60 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
61 | } else { | |
62 | if (IS_ZEBRA_DEBUG_SEND) | |
63 | vty_out(vty, | |
64 | " Zebra packet send%s debugging is on\n", | |
65 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
66 | else | |
67 | vty_out(vty, | |
68 | " Zebra packet receive%s debugging is on\n", | |
69 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
70 | } | |
718e3744 | 71 | } |
d62a17ae | 72 | |
73 | if (IS_ZEBRA_DEBUG_KERNEL) | |
74 | vty_out(vty, " Zebra kernel debugging is on\n"); | |
75 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
76 | vty_out(vty, | |
77 | " Zebra kernel netlink message dumps (send) are on\n"); | |
78 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) | |
79 | vty_out(vty, | |
80 | " Zebra kernel netlink message dumps (recv) are on\n"); | |
81 | ||
82 | /* Check here using flags as the 'macro' does an OR */ | |
d62a17ae | 83 | if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) |
84 | vty_out(vty, " Zebra RIB detailed debugging is on\n"); | |
ba9d46ff DW |
85 | else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) |
86 | vty_out(vty, " Zebra RIB debugging is on\n"); | |
d62a17ae | 87 | |
88 | if (IS_ZEBRA_DEBUG_FPM) | |
89 | vty_out(vty, " Zebra FPM debugging is on\n"); | |
90 | if (IS_ZEBRA_DEBUG_NHT) | |
91 | vty_out(vty, " Zebra next-hop tracking debugging is on\n"); | |
92 | if (IS_ZEBRA_DEBUG_MPLS) | |
93 | vty_out(vty, " Zebra MPLS debugging is on\n"); | |
95744ad8 DS |
94 | if (IS_ZEBRA_DEBUG_VXLAN) |
95 | vty_out(vty, " Zebra VXLAN debugging is on\n"); | |
6833ae01 | 96 | if (IS_ZEBRA_DEBUG_PW) |
97 | vty_out(vty, " Zebra pseudowire debugging is on\n"); | |
6582b002 MS |
98 | if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) |
99 | vty_out(vty, " Zebra detailed dataplane debugging is on\n"); | |
100 | else if (IS_ZEBRA_DEBUG_DPLANE) | |
101 | vty_out(vty, " Zebra dataplane debugging is on\n"); | |
23666725 DS |
102 | if (IS_ZEBRA_DEBUG_MLAG) |
103 | vty_out(vty, " Zebra mlag debugging is on\n"); | |
d62a17ae | 104 | |
77151b6f | 105 | hook_call(zebra_debug_show_debugging, vty); |
d62a17ae | 106 | return CMD_SUCCESS; |
718e3744 | 107 | } |
108 | ||
109 | DEFUN (debug_zebra_events, | |
110 | debug_zebra_events_cmd, | |
111 | "debug zebra events", | |
112 | DEBUG_STR | |
113 | "Zebra configuration\n" | |
114 | "Debug option set for zebra events\n") | |
115 | { | |
d62a17ae | 116 | zebra_debug_event = ZEBRA_DEBUG_EVENT; |
8527ce3a | 117 | return CMD_SUCCESS; |
718e3744 | 118 | } |
119 | ||
fb018d25 DS |
120 | DEFUN (debug_zebra_nht, |
121 | debug_zebra_nht_cmd, | |
122 | "debug zebra nht", | |
123 | DEBUG_STR | |
124 | "Zebra configuration\n" | |
125 | "Debug option set for zebra next hop tracking\n") | |
126 | { | |
d62a17ae | 127 | zebra_debug_nht = ZEBRA_DEBUG_NHT; |
8527ce3a | 128 | return CMD_SUCCESS; |
fb018d25 DS |
129 | } |
130 | ||
7758e3f3 | 131 | DEFUN (debug_zebra_mpls, |
132 | debug_zebra_mpls_cmd, | |
133 | "debug zebra mpls", | |
134 | DEBUG_STR | |
135 | "Zebra configuration\n" | |
136 | "Debug option set for zebra MPLS LSPs\n") | |
137 | { | |
d62a17ae | 138 | zebra_debug_mpls = ZEBRA_DEBUG_MPLS; |
8527ce3a | 139 | return CMD_SUCCESS; |
7758e3f3 | 140 | } |
141 | ||
13d60d35 | 142 | DEFUN (debug_zebra_vxlan, |
143 | debug_zebra_vxlan_cmd, | |
144 | "debug zebra vxlan", | |
145 | DEBUG_STR | |
146 | "Zebra configuration\n" | |
147 | "Debug option set for zebra VxLAN (EVPN)\n") | |
148 | { | |
d62a17ae | 149 | zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN; |
8527ce3a | 150 | return CMD_SUCCESS; |
13d60d35 | 151 | } |
152 | ||
6833ae01 | 153 | DEFUN (debug_zebra_pw, |
154 | debug_zebra_pw_cmd, | |
155 | "[no] debug zebra pseudowires", | |
efd7904e | 156 | NO_STR |
6833ae01 | 157 | DEBUG_STR |
158 | "Zebra configuration\n" | |
159 | "Debug option set for zebra pseudowires\n") | |
160 | { | |
161 | if (strmatch(argv[0]->text, "no")) | |
162 | UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW); | |
163 | else | |
164 | SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW); | |
8527ce3a | 165 | return CMD_SUCCESS; |
6833ae01 | 166 | } |
167 | ||
718e3744 | 168 | DEFUN (debug_zebra_packet, |
169 | debug_zebra_packet_cmd, | |
16cedbb0 | 170 | "debug zebra packet [<recv|send>] [detail]", |
718e3744 | 171 | DEBUG_STR |
172 | "Zebra configuration\n" | |
173 | "Debug option set for zebra packet\n" | |
174 | "Debug option set for receive packet\n" | |
16cedbb0 QY |
175 | "Debug option set for send packet\n" |
176 | "Debug option set for detailed info\n") | |
718e3744 | 177 | { |
d62a17ae | 178 | int idx = 0; |
179 | zebra_debug_packet = ZEBRA_DEBUG_PACKET; | |
180 | ||
181 | if (argv_find(argv, argc, "send", &idx)) | |
182 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); | |
ba9d46ff | 183 | else if (argv_find(argv, argc, "recv", &idx)) |
d62a17ae | 184 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); |
ba9d46ff | 185 | else { |
d62a17ae | 186 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); |
187 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); | |
188 | } | |
ba9d46ff DW |
189 | |
190 | if (argv_find(argv, argc, "detail", &idx)) | |
191 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); | |
192 | ||
d62a17ae | 193 | return CMD_SUCCESS; |
718e3744 | 194 | } |
195 | ||
196 | DEFUN (debug_zebra_kernel, | |
197 | debug_zebra_kernel_cmd, | |
198 | "debug zebra kernel", | |
199 | DEBUG_STR | |
200 | "Zebra configuration\n" | |
201 | "Debug option set for zebra between kernel interface\n") | |
202 | { | |
d62a17ae | 203 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL); |
ba9d46ff DW |
204 | |
205 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) | |
206 | UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
207 | ||
208 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
209 | UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
210 | ||
d62a17ae | 211 | return CMD_SUCCESS; |
556b904e QY |
212 | } |
213 | ||
214 | DEFUN (debug_zebra_kernel_msgdump, | |
215 | debug_zebra_kernel_msgdump_cmd, | |
6de69f83 | 216 | "debug zebra kernel msgdump [<recv|send>]", |
556b904e QY |
217 | DEBUG_STR |
218 | "Zebra configuration\n" | |
219 | "Debug option set for zebra between kernel interface\n" | |
220 | "Dump raw netlink messages, sent and received\n" | |
221 | "Dump raw netlink messages received\n" | |
222 | "Dump raw netlink messages sent\n") | |
223 | { | |
d62a17ae | 224 | int idx = 0; |
ba9d46ff DW |
225 | |
226 | if (argv_find(argv, argc, "recv", &idx)) { | |
d62a17ae | 227 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); |
ba9d46ff DW |
228 | |
229 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
996c9314 LB |
230 | UNSET_FLAG(zebra_debug_kernel, |
231 | ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
ba9d46ff DW |
232 | |
233 | } else if (argv_find(argv, argc, "send", &idx)) { | |
d62a17ae | 234 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); |
313605cb | 235 | |
ba9d46ff | 236 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) |
996c9314 LB |
237 | UNSET_FLAG(zebra_debug_kernel, |
238 | ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
ba9d46ff DW |
239 | |
240 | } else { | |
241 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
242 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
243 | } | |
244 | ||
d62a17ae | 245 | return CMD_SUCCESS; |
718e3744 | 246 | } |
247 | ||
b0498dc6 PJ |
248 | DEFUN (debug_zebra_rib, |
249 | debug_zebra_rib_cmd, | |
ba9d46ff | 250 | "debug zebra rib [detailed]", |
b0498dc6 PJ |
251 | DEBUG_STR |
252 | "Zebra configuration\n" | |
253 | "Debug RIB events\n" | |
41ec9222 | 254 | "Detailed debugs\n") |
b0498dc6 | 255 | { |
ba9d46ff DW |
256 | int idx = 0; |
257 | SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB); | |
258 | ||
259 | if (argv_find(argv, argc, "detailed", &idx)) | |
260 | SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED); | |
261 | ||
d62a17ae | 262 | return CMD_SUCCESS; |
b0498dc6 PJ |
263 | } |
264 | ||
5adc2528 AS |
265 | DEFUN (debug_zebra_fpm, |
266 | debug_zebra_fpm_cmd, | |
267 | "debug zebra fpm", | |
268 | DEBUG_STR | |
269 | "Zebra configuration\n" | |
270 | "Debug zebra FPM events\n") | |
271 | { | |
d62a17ae | 272 | SET_FLAG(zebra_debug_fpm, ZEBRA_DEBUG_FPM); |
273 | return CMD_SUCCESS; | |
5adc2528 AS |
274 | } |
275 | ||
6582b002 MS |
276 | DEFUN (debug_zebra_dplane, |
277 | debug_zebra_dplane_cmd, | |
5be41a1c | 278 | "debug zebra dplane [detailed]", |
6582b002 MS |
279 | DEBUG_STR |
280 | "Zebra configuration\n" | |
5be41a1c MS |
281 | "Debug zebra dataplane events\n" |
282 | "Detailed debug information\n") | |
6582b002 MS |
283 | { |
284 | int idx = 0; | |
5709131c | 285 | |
6582b002 MS |
286 | SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE); |
287 | ||
288 | if (argv_find(argv, argc, "detailed", &idx)) | |
289 | SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED); | |
290 | ||
291 | return CMD_SUCCESS; | |
292 | } | |
293 | ||
23666725 DS |
294 | DEFPY (debug_zebra_mlag, |
295 | debug_zebra_mlag_cmd, | |
296 | "[no$no] debug zebra mlag", | |
297 | NO_STR | |
298 | DEBUG_STR | |
299 | "Zebra configuration\n" | |
300 | "Debug option set for mlag events\n") | |
301 | { | |
302 | if (no) | |
303 | UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG); | |
304 | else | |
305 | SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG); | |
306 | return CMD_SUCCESS; | |
307 | } | |
308 | ||
718e3744 | 309 | DEFUN (no_debug_zebra_events, |
310 | no_debug_zebra_events_cmd, | |
311 | "no debug zebra events", | |
312 | NO_STR | |
313 | DEBUG_STR | |
314 | "Zebra configuration\n" | |
315 | "Debug option set for zebra events\n") | |
316 | { | |
d62a17ae | 317 | zebra_debug_event = 0; |
318 | return CMD_SUCCESS; | |
718e3744 | 319 | } |
320 | ||
fb018d25 DS |
321 | DEFUN (no_debug_zebra_nht, |
322 | no_debug_zebra_nht_cmd, | |
323 | "no debug zebra nht", | |
324 | NO_STR | |
325 | DEBUG_STR | |
326 | "Zebra configuration\n" | |
327 | "Debug option set for zebra next hop tracking\n") | |
328 | { | |
d62a17ae | 329 | zebra_debug_nht = 0; |
330 | return CMD_SUCCESS; | |
fb018d25 DS |
331 | } |
332 | ||
7758e3f3 | 333 | DEFUN (no_debug_zebra_mpls, |
334 | no_debug_zebra_mpls_cmd, | |
335 | "no debug zebra mpls", | |
336 | NO_STR | |
337 | DEBUG_STR | |
338 | "Zebra configuration\n" | |
339 | "Debug option set for zebra MPLS LSPs\n") | |
340 | { | |
d62a17ae | 341 | zebra_debug_mpls = 0; |
342 | return CMD_SUCCESS; | |
7758e3f3 | 343 | } |
344 | ||
13d60d35 | 345 | DEFUN (no_debug_zebra_vxlan, |
346 | no_debug_zebra_vxlan_cmd, | |
347 | "no debug zebra vxlan", | |
348 | NO_STR | |
349 | DEBUG_STR | |
350 | "Zebra configuration\n" | |
351 | "Debug option set for zebra VxLAN (EVPN)\n") | |
352 | { | |
d62a17ae | 353 | zebra_debug_vxlan = 0; |
354 | return CMD_SUCCESS; | |
13d60d35 | 355 | } |
356 | ||
718e3744 | 357 | DEFUN (no_debug_zebra_packet, |
358 | no_debug_zebra_packet_cmd, | |
ba9d46ff | 359 | "no debug zebra packet [<recv|send>] [detail]", |
718e3744 | 360 | NO_STR |
361 | DEBUG_STR | |
362 | "Zebra configuration\n" | |
363 | "Debug option set for zebra packet\n" | |
364 | "Debug option set for receive packet\n" | |
ba9d46ff DW |
365 | "Debug option set for send packet\n" |
366 | "Debug option set for detailed info\n") | |
718e3744 | 367 | { |
ba9d46ff | 368 | zebra_debug_packet = 0; |
d62a17ae | 369 | return CMD_SUCCESS; |
718e3744 | 370 | } |
371 | ||
372 | DEFUN (no_debug_zebra_kernel, | |
373 | no_debug_zebra_kernel_cmd, | |
374 | "no debug zebra kernel", | |
375 | NO_STR | |
376 | DEBUG_STR | |
377 | "Zebra configuration\n" | |
378 | "Debug option set for zebra between kernel interface\n") | |
379 | { | |
ba9d46ff | 380 | zebra_debug_kernel = 0; |
d62a17ae | 381 | return CMD_SUCCESS; |
556b904e QY |
382 | } |
383 | ||
384 | DEFUN (no_debug_zebra_kernel_msgdump, | |
385 | no_debug_zebra_kernel_msgdump_cmd, | |
6de69f83 | 386 | "no debug zebra kernel msgdump [<recv|send>]", |
16cedbb0 | 387 | NO_STR |
556b904e QY |
388 | DEBUG_STR |
389 | "Zebra configuration\n" | |
390 | "Debug option set for zebra between kernel interface\n" | |
391 | "Dump raw netlink messages, sent and received\n" | |
392 | "Dump raw netlink messages received\n" | |
393 | "Dump raw netlink messages sent\n") | |
394 | { | |
ba9d46ff | 395 | zebra_debug_kernel = 0; |
d62a17ae | 396 | return CMD_SUCCESS; |
718e3744 | 397 | } |
398 | ||
b0498dc6 PJ |
399 | DEFUN (no_debug_zebra_rib, |
400 | no_debug_zebra_rib_cmd, | |
ba9d46ff | 401 | "no debug zebra rib [detailed]", |
b0498dc6 PJ |
402 | NO_STR |
403 | DEBUG_STR | |
404 | "Zebra configuration\n" | |
405 | "Debug zebra RIB\n" | |
41ec9222 | 406 | "Detailed debugs\n") |
b0498dc6 | 407 | { |
ba9d46ff | 408 | zebra_debug_rib = 0; |
d62a17ae | 409 | return CMD_SUCCESS; |
b0498dc6 PJ |
410 | } |
411 | ||
5adc2528 AS |
412 | DEFUN (no_debug_zebra_fpm, |
413 | no_debug_zebra_fpm_cmd, | |
414 | "no debug zebra fpm", | |
415 | NO_STR | |
416 | DEBUG_STR | |
417 | "Zebra configuration\n" | |
418 | "Debug zebra FPM events\n") | |
419 | { | |
d62a17ae | 420 | zebra_debug_fpm = 0; |
421 | return CMD_SUCCESS; | |
5adc2528 AS |
422 | } |
423 | ||
6582b002 MS |
424 | DEFUN (no_debug_zebra_dplane, |
425 | no_debug_zebra_dplane_cmd, | |
426 | "no debug zebra dplane", | |
427 | NO_STR | |
428 | DEBUG_STR | |
429 | "Zebra configuration\n" | |
430 | "Debug zebra dataplane events\n") | |
431 | { | |
432 | zebra_debug_dplane = 0; | |
433 | return CMD_SUCCESS; | |
434 | } | |
435 | ||
718e3744 | 436 | /* Debug node. */ |
d62a17ae | 437 | struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */ |
438 | 1}; | |
718e3744 | 439 | |
d62a17ae | 440 | static int config_write_debug(struct vty *vty) |
718e3744 | 441 | { |
d62a17ae | 442 | int write = 0; |
443 | ||
444 | if (IS_ZEBRA_DEBUG_EVENT) { | |
445 | vty_out(vty, "debug zebra events\n"); | |
446 | write++; | |
447 | } | |
448 | if (IS_ZEBRA_DEBUG_PACKET) { | |
449 | if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) { | |
450 | vty_out(vty, "debug zebra packet%s\n", | |
451 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
452 | write++; | |
453 | } else { | |
454 | if (IS_ZEBRA_DEBUG_SEND) | |
455 | vty_out(vty, "debug zebra packet send%s\n", | |
456 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
457 | else | |
458 | vty_out(vty, "debug zebra packet recv%s\n", | |
459 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
460 | write++; | |
461 | } | |
462 | } | |
ba9d46ff | 463 | |
d62a17ae | 464 | if (IS_ZEBRA_DEBUG_KERNEL) { |
996c9314 LB |
465 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND |
466 | && IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) { | |
ba9d46ff DW |
467 | vty_out(vty, "debug zebra kernel msgdump\n"); |
468 | write++; | |
469 | } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) { | |
470 | vty_out(vty, "debug zebra kernel msgdump recv\n"); | |
471 | write++; | |
472 | } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) { | |
473 | vty_out(vty, "debug zebra kernel msgdump send\n"); | |
474 | write++; | |
475 | } else { | |
476 | vty_out(vty, "debug zebra kernel\n"); | |
477 | write++; | |
478 | } | |
d62a17ae | 479 | } |
ba9d46ff | 480 | |
d62a17ae | 481 | if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) { |
482 | vty_out(vty, "debug zebra rib detailed\n"); | |
483 | write++; | |
ba9d46ff DW |
484 | } else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) { |
485 | vty_out(vty, "debug zebra rib\n"); | |
486 | write++; | |
d62a17ae | 487 | } |
ba9d46ff | 488 | |
d62a17ae | 489 | if (IS_ZEBRA_DEBUG_FPM) { |
490 | vty_out(vty, "debug zebra fpm\n"); | |
491 | write++; | |
492 | } | |
493 | if (IS_ZEBRA_DEBUG_NHT) { | |
494 | vty_out(vty, "debug zebra nht\n"); | |
495 | write++; | |
496 | } | |
497 | if (IS_ZEBRA_DEBUG_MPLS) { | |
498 | vty_out(vty, "debug zebra mpls\n"); | |
499 | write++; | |
718e3744 | 500 | } |
d62a17ae | 501 | if (IS_ZEBRA_DEBUG_VXLAN) { |
502 | vty_out(vty, "debug zebra vxlan\n"); | |
503 | write++; | |
718e3744 | 504 | } |
6833ae01 | 505 | if (IS_ZEBRA_DEBUG_PW) { |
69965f53 | 506 | vty_out(vty, "debug zebra pseudowires\n"); |
6833ae01 | 507 | write++; |
508 | } | |
6582b002 MS |
509 | |
510 | if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) { | |
511 | vty_out(vty, "debug zebra dplane detailed\n"); | |
512 | write++; | |
513 | } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) { | |
514 | vty_out(vty, "debug zebra dplane\n"); | |
515 | write++; | |
516 | } | |
517 | ||
d62a17ae | 518 | return write; |
718e3744 | 519 | } |
520 | ||
d62a17ae | 521 | void zebra_debug_init(void) |
718e3744 | 522 | { |
d62a17ae | 523 | zebra_debug_event = 0; |
524 | zebra_debug_packet = 0; | |
525 | zebra_debug_kernel = 0; | |
526 | zebra_debug_rib = 0; | |
527 | zebra_debug_fpm = 0; | |
528 | zebra_debug_mpls = 0; | |
529 | zebra_debug_vxlan = 0; | |
6833ae01 | 530 | zebra_debug_pw = 0; |
6582b002 | 531 | zebra_debug_dplane = 0; |
23666725 | 532 | zebra_debug_mlag = 0; |
d62a17ae | 533 | |
534 | install_node(&debug_node, config_write_debug); | |
535 | ||
536 | install_element(VIEW_NODE, &show_debugging_zebra_cmd); | |
537 | ||
538 | install_element(ENABLE_NODE, &debug_zebra_events_cmd); | |
539 | install_element(ENABLE_NODE, &debug_zebra_nht_cmd); | |
540 | install_element(ENABLE_NODE, &debug_zebra_mpls_cmd); | |
541 | install_element(ENABLE_NODE, &debug_zebra_vxlan_cmd); | |
6833ae01 | 542 | install_element(ENABLE_NODE, &debug_zebra_pw_cmd); |
d62a17ae | 543 | install_element(ENABLE_NODE, &debug_zebra_packet_cmd); |
544 | install_element(ENABLE_NODE, &debug_zebra_kernel_cmd); | |
545 | install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd); | |
546 | install_element(ENABLE_NODE, &debug_zebra_rib_cmd); | |
d62a17ae | 547 | install_element(ENABLE_NODE, &debug_zebra_fpm_cmd); |
6582b002 | 548 | install_element(ENABLE_NODE, &debug_zebra_dplane_cmd); |
23666725 | 549 | install_element(ENABLE_NODE, &debug_zebra_mlag_cmd); |
d62a17ae | 550 | install_element(ENABLE_NODE, &no_debug_zebra_events_cmd); |
551 | install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd); | |
552 | install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd); | |
553 | install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd); | |
554 | install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd); | |
555 | install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd); | |
556 | install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd); | |
557 | install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd); | |
d62a17ae | 558 | install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd); |
6582b002 | 559 | install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd); |
d62a17ae | 560 | |
561 | install_element(CONFIG_NODE, &debug_zebra_events_cmd); | |
562 | install_element(CONFIG_NODE, &debug_zebra_nht_cmd); | |
563 | install_element(CONFIG_NODE, &debug_zebra_mpls_cmd); | |
564 | install_element(CONFIG_NODE, &debug_zebra_vxlan_cmd); | |
6833ae01 | 565 | install_element(CONFIG_NODE, &debug_zebra_pw_cmd); |
d62a17ae | 566 | install_element(CONFIG_NODE, &debug_zebra_packet_cmd); |
567 | install_element(CONFIG_NODE, &debug_zebra_kernel_cmd); | |
568 | install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd); | |
569 | install_element(CONFIG_NODE, &debug_zebra_rib_cmd); | |
d62a17ae | 570 | install_element(CONFIG_NODE, &debug_zebra_fpm_cmd); |
6582b002 | 571 | install_element(CONFIG_NODE, &debug_zebra_dplane_cmd); |
d62a17ae | 572 | install_element(CONFIG_NODE, &no_debug_zebra_events_cmd); |
573 | install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd); | |
574 | install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd); | |
575 | install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd); | |
576 | install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd); | |
577 | install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd); | |
578 | install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd); | |
579 | install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd); | |
d62a17ae | 580 | install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd); |
6582b002 | 581 | install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd); |
718e3744 | 582 | } |