]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_debug.c
2 * Copyright (C) 2016 by Open Source Routing.
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 #include "ldp_debug.h"
31 struct ldp_debug conf_ldp_debug
;
32 struct ldp_debug ldp_debug
;
35 struct cmd_node ldp_debug_node
=
43 ldp_vty_debug(struct vty
*vty
, struct vty_arg
*args
[])
45 const char *type_str
, *dir_str
;
48 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
49 type_str
= vty_get_arg_value(args
, "type");
51 if (strcmp(type_str
, "discovery") == 0) {
52 dir_str
= vty_get_arg_value(args
, "dir");
56 if (dir_str
[0] == 'r') {
58 DEBUG_OFF(hello
, HELLO_RECV
);
60 DEBUG_ON(hello
, HELLO_RECV
);
63 DEBUG_OFF(hello
, HELLO_SEND
);
65 DEBUG_ON(hello
, HELLO_SEND
);
67 } else if (strcmp(type_str
, "errors") == 0) {
69 DEBUG_OFF(errors
, ERRORS
);
71 DEBUG_ON(errors
, ERRORS
);
72 } else if (strcmp(type_str
, "event") == 0) {
74 DEBUG_OFF(event
, EVENT
);
76 DEBUG_ON(event
, EVENT
);
77 } else if (strcmp(type_str
, "messages") == 0) {
78 all
= (vty_get_arg_value(args
, "all")) ? 1 : 0;
79 dir_str
= vty_get_arg_value(args
, "dir");
83 if (dir_str
[0] == 'r') {
85 DEBUG_OFF(msg
, MSG_RECV
);
86 DEBUG_OFF(msg
, MSG_RECV_ALL
);
88 DEBUG_ON(msg
, MSG_RECV
);
90 DEBUG_ON(msg
, MSG_RECV_ALL
);
94 DEBUG_OFF(msg
, MSG_SEND
);
95 DEBUG_OFF(msg
, MSG_SEND_ALL
);
97 DEBUG_ON(msg
, MSG_SEND
);
99 DEBUG_ON(msg
, MSG_SEND_ALL
);
102 } else if (strcmp(type_str
, "zebra") == 0) {
104 DEBUG_OFF(zebra
, ZEBRA
);
106 DEBUG_ON(zebra
, ZEBRA
);
109 main_imsg_compose_both(IMSG_DEBUG_UPDATE
, &ldp_debug
,
112 return (CMD_SUCCESS
);
116 ldp_vty_show_debugging(struct vty
*vty
, struct vty_arg
*args
[])
118 vty_out(vty
, "LDP debugging status:%s", VTY_NEWLINE
);
120 if (LDP_DEBUG(hello
, HELLO_RECV
))
121 vty_out(vty
, " LDP discovery debugging is on (inbound)%s",
123 if (LDP_DEBUG(hello
, HELLO_SEND
))
124 vty_out(vty
, " LDP discovery debugging is on (outbound)%s",
126 if (LDP_DEBUG(errors
, ERRORS
))
127 vty_out(vty
, " LDP errors debugging is on%s", VTY_NEWLINE
);
128 if (LDP_DEBUG(event
, EVENT
))
129 vty_out(vty
, " LDP events debugging is on%s", VTY_NEWLINE
);
130 if (LDP_DEBUG(msg
, MSG_RECV_ALL
))
131 vty_out(vty
, " LDP detailed messages debugging is on "
132 "(inbound)%s", VTY_NEWLINE
);
133 else if (LDP_DEBUG(msg
, MSG_RECV
))
134 vty_out(vty
, " LDP messages debugging is on (inbound)%s",
136 if (LDP_DEBUG(msg
, MSG_SEND_ALL
))
137 vty_out(vty
, " LDP detailed messages debugging is on "
138 "(outbound)%s", VTY_NEWLINE
);
139 else if (LDP_DEBUG(msg
, MSG_SEND
))
140 vty_out(vty
, " LDP messages debugging is on (outbound)%s",
142 if (LDP_DEBUG(zebra
, ZEBRA
))
143 vty_out(vty
, " LDP zebra debugging is on%s", VTY_NEWLINE
);
144 vty_out (vty
, "%s", VTY_NEWLINE
);
146 return (CMD_SUCCESS
);
150 ldp_debug_config_write(struct vty
*vty
)
154 if (CONF_LDP_DEBUG(hello
, HELLO_RECV
)) {
155 vty_out(vty
, "debug mpls ldp discovery hello recv%s",
160 if (CONF_LDP_DEBUG(hello
, HELLO_SEND
)) {
161 vty_out(vty
, "debug mpls ldp discovery hello sent%s",
166 if (CONF_LDP_DEBUG(errors
, ERRORS
)) {
167 vty_out(vty
, "debug mpls ldp errors%s", VTY_NEWLINE
);
171 if (CONF_LDP_DEBUG(event
, EVENT
)) {
172 vty_out(vty
, "debug mpls ldp event%s", VTY_NEWLINE
);
176 if (CONF_LDP_DEBUG(msg
, MSG_RECV_ALL
)) {
177 vty_out(vty
, "debug mpls ldp messages recv all%s", VTY_NEWLINE
);
179 } else if (CONF_LDP_DEBUG(msg
, MSG_RECV
)) {
180 vty_out(vty
, "debug mpls ldp messages recv%s", VTY_NEWLINE
);
184 if (CONF_LDP_DEBUG(msg
, MSG_SEND_ALL
)) {
185 vty_out(vty
, "debug mpls ldp messages sent all%s", VTY_NEWLINE
);
187 } else if (CONF_LDP_DEBUG(msg
, MSG_SEND
)) {
188 vty_out(vty
, "debug mpls ldp messages sent%s", VTY_NEWLINE
);
192 if (CONF_LDP_DEBUG(zebra
, ZEBRA
)) {
193 vty_out(vty
, "debug mpls ldp zebra%s", VTY_NEWLINE
);