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