]>
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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "ldp_debug.h"
30 struct ldp_debug conf_ldp_debug
;
31 struct ldp_debug ldp_debug
;
34 struct cmd_node ldp_debug_node
=
42 ldp_vty_debug(struct vty
*vty
, struct vty_arg
*args
[])
44 const char *type_str
, *dir_str
;
47 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
48 type_str
= vty_get_arg_value(args
, "type");
50 if (strcmp(type_str
, "discovery") == 0) {
51 dir_str
= vty_get_arg_value(args
, "dir");
55 if (dir_str
[0] == 'r') {
57 DEBUG_OFF(hello
, HELLO_RECV
);
59 DEBUG_ON(hello
, HELLO_RECV
);
62 DEBUG_OFF(hello
, HELLO_SEND
);
64 DEBUG_ON(hello
, HELLO_SEND
);
66 } else if (strcmp(type_str
, "errors") == 0) {
68 DEBUG_OFF(errors
, ERRORS
);
70 DEBUG_ON(errors
, ERRORS
);
71 } else if (strcmp(type_str
, "event") == 0) {
73 DEBUG_OFF(event
, EVENT
);
75 DEBUG_ON(event
, EVENT
);
76 } else if (strcmp(type_str
, "messages") == 0) {
77 all
= (vty_get_arg_value(args
, "all")) ? 1 : 0;
78 dir_str
= vty_get_arg_value(args
, "dir");
82 if (dir_str
[0] == 'r') {
84 DEBUG_OFF(msg
, MSG_RECV
);
85 DEBUG_OFF(msg
, MSG_RECV_ALL
);
87 DEBUG_ON(msg
, MSG_RECV
);
89 DEBUG_ON(msg
, MSG_RECV_ALL
);
93 DEBUG_OFF(msg
, MSG_SEND
);
94 DEBUG_OFF(msg
, MSG_SEND_ALL
);
96 DEBUG_ON(msg
, MSG_SEND
);
98 DEBUG_ON(msg
, MSG_SEND_ALL
);
101 } else if (strcmp(type_str
, "zebra") == 0) {
103 DEBUG_OFF(zebra
, ZEBRA
);
105 DEBUG_ON(zebra
, ZEBRA
);
108 main_imsg_compose_both(IMSG_DEBUG_UPDATE
, &ldp_debug
,
111 return (CMD_SUCCESS
);
115 ldp_vty_show_debugging(struct vty
*vty
, struct vty_arg
*args
[])
117 vty_out(vty
, "LDP debugging status:%s", VTY_NEWLINE
);
119 if (LDP_DEBUG(hello
, HELLO_RECV
))
120 vty_out(vty
, " LDP discovery debugging is on (inbound)%s",
122 if (LDP_DEBUG(hello
, HELLO_SEND
))
123 vty_out(vty
, " LDP discovery debugging is on (outbound)%s",
125 if (LDP_DEBUG(errors
, ERRORS
))
126 vty_out(vty
, " LDP errors debugging is on%s", VTY_NEWLINE
);
127 if (LDP_DEBUG(event
, EVENT
))
128 vty_out(vty
, " LDP events debugging is on%s", VTY_NEWLINE
);
129 if (LDP_DEBUG(msg
, MSG_RECV_ALL
))
130 vty_out(vty
, " LDP detailed messages debugging is on "
131 "(inbound)%s", VTY_NEWLINE
);
132 else if (LDP_DEBUG(msg
, MSG_RECV
))
133 vty_out(vty
, " LDP messages debugging is on (inbound)%s",
135 if (LDP_DEBUG(msg
, MSG_SEND_ALL
))
136 vty_out(vty
, " LDP detailed messages debugging is on "
137 "(outbound)%s", VTY_NEWLINE
);
138 else if (LDP_DEBUG(msg
, MSG_SEND
))
139 vty_out(vty
, " LDP messages debugging is on (outbound)%s",
141 if (LDP_DEBUG(zebra
, ZEBRA
))
142 vty_out(vty
, " LDP zebra debugging is on%s", VTY_NEWLINE
);
143 vty_out (vty
, "%s", VTY_NEWLINE
);
145 return (CMD_SUCCESS
);
149 ldp_debug_config_write(struct vty
*vty
)
153 if (CONF_LDP_DEBUG(hello
, HELLO_RECV
)) {
154 vty_out(vty
, "debug mpls ldp discovery hello recv%s",
159 if (CONF_LDP_DEBUG(hello
, HELLO_SEND
)) {
160 vty_out(vty
, "debug mpls ldp discovery hello sent%s",
165 if (CONF_LDP_DEBUG(errors
, ERRORS
)) {
166 vty_out(vty
, "debug mpls ldp errors%s", VTY_NEWLINE
);
170 if (CONF_LDP_DEBUG(event
, EVENT
)) {
171 vty_out(vty
, "debug mpls ldp event%s", VTY_NEWLINE
);
175 if (CONF_LDP_DEBUG(msg
, MSG_RECV_ALL
)) {
176 vty_out(vty
, "debug mpls ldp messages recv all%s", VTY_NEWLINE
);
178 } else if (CONF_LDP_DEBUG(msg
, MSG_RECV
)) {
179 vty_out(vty
, "debug mpls ldp messages recv%s", VTY_NEWLINE
);
183 if (CONF_LDP_DEBUG(msg
, MSG_SEND_ALL
)) {
184 vty_out(vty
, "debug mpls ldp messages sent all%s", VTY_NEWLINE
);
186 } else if (CONF_LDP_DEBUG(msg
, MSG_SEND
)) {
187 vty_out(vty
, "debug mpls ldp messages sent%s", VTY_NEWLINE
);
191 if (CONF_LDP_DEBUG(zebra
, ZEBRA
)) {
192 vty_out(vty
, "debug mpls ldp zebra%s", VTY_NEWLINE
);