]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_debug.c
2 * Copyright (C) 2016 by Open Source Routing.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
26 #include "ldp_debug.h"
29 struct ldp_debug conf_ldp_debug
;
30 struct ldp_debug ldp_debug
;
33 struct cmd_node ldp_debug_node
=
41 ldp_vty_debug(struct vty
*vty
, int disable
, const char *type_str
,
42 const char *dir_str
, int all
)
44 if (strcmp(type_str
, "discovery") == 0) {
48 if (dir_str
[0] == 'r') {
50 DEBUG_OFF(hello
, HELLO_RECV
);
52 DEBUG_ON(hello
, HELLO_RECV
);
55 DEBUG_OFF(hello
, HELLO_SEND
);
57 DEBUG_ON(hello
, HELLO_SEND
);
59 } else if (strcmp(type_str
, "errors") == 0) {
61 DEBUG_OFF(errors
, ERRORS
);
63 DEBUG_ON(errors
, ERRORS
);
64 } else if (strcmp(type_str
, "event") == 0) {
66 DEBUG_OFF(event
, EVENT
);
68 DEBUG_ON(event
, EVENT
);
69 } else if (strcmp(type_str
, "messages") == 0) {
73 if (dir_str
[0] == 'r') {
75 DEBUG_OFF(msg
, MSG_RECV
);
76 DEBUG_OFF(msg
, MSG_RECV_ALL
);
78 DEBUG_ON(msg
, MSG_RECV
);
80 DEBUG_ON(msg
, MSG_RECV_ALL
);
84 DEBUG_OFF(msg
, MSG_SEND
);
85 DEBUG_OFF(msg
, MSG_SEND_ALL
);
87 DEBUG_ON(msg
, MSG_SEND
);
89 DEBUG_ON(msg
, MSG_SEND_ALL
);
92 } else if (strcmp(type_str
, "zebra") == 0) {
94 DEBUG_OFF(zebra
, ZEBRA
);
96 DEBUG_ON(zebra
, ZEBRA
);
99 main_imsg_compose_both(IMSG_DEBUG_UPDATE
, &ldp_debug
,
102 return (CMD_SUCCESS
);
106 ldp_vty_show_debugging(struct vty
*vty
)
108 vty_out(vty
, "LDP debugging status:%s", VTY_NEWLINE
);
110 if (LDP_DEBUG(hello
, HELLO_RECV
))
111 vty_out(vty
, " LDP discovery debugging is on (inbound)%s",
113 if (LDP_DEBUG(hello
, HELLO_SEND
))
114 vty_out(vty
, " LDP discovery debugging is on (outbound)%s",
116 if (LDP_DEBUG(errors
, ERRORS
))
117 vty_out(vty
, " LDP errors debugging is on%s", VTY_NEWLINE
);
118 if (LDP_DEBUG(event
, EVENT
))
119 vty_out(vty
, " LDP events debugging is on%s", VTY_NEWLINE
);
120 if (LDP_DEBUG(msg
, MSG_RECV_ALL
))
121 vty_out(vty
, " LDP detailed messages debugging is on "
122 "(inbound)%s", VTY_NEWLINE
);
123 else if (LDP_DEBUG(msg
, MSG_RECV
))
124 vty_out(vty
, " LDP messages debugging is on (inbound)%s",
126 if (LDP_DEBUG(msg
, MSG_SEND_ALL
))
127 vty_out(vty
, " LDP detailed messages debugging is on "
128 "(outbound)%s", VTY_NEWLINE
);
129 else if (LDP_DEBUG(msg
, MSG_SEND
))
130 vty_out(vty
, " LDP messages debugging is on (outbound)%s",
132 if (LDP_DEBUG(zebra
, ZEBRA
))
133 vty_out(vty
, " LDP zebra debugging is on%s", VTY_NEWLINE
);
134 vty_out (vty
, "%s", VTY_NEWLINE
);
136 return (CMD_SUCCESS
);
140 ldp_debug_config_write(struct vty
*vty
)
144 if (CONF_LDP_DEBUG(hello
, HELLO_RECV
)) {
145 vty_out(vty
, "debug mpls ldp discovery hello recv%s",
150 if (CONF_LDP_DEBUG(hello
, HELLO_SEND
)) {
151 vty_out(vty
, "debug mpls ldp discovery hello sent%s",
156 if (CONF_LDP_DEBUG(errors
, ERRORS
)) {
157 vty_out(vty
, "debug mpls ldp errors%s", VTY_NEWLINE
);
161 if (CONF_LDP_DEBUG(event
, EVENT
)) {
162 vty_out(vty
, "debug mpls ldp event%s", VTY_NEWLINE
);
166 if (CONF_LDP_DEBUG(msg
, MSG_RECV_ALL
)) {
167 vty_out(vty
, "debug mpls ldp messages recv all%s", VTY_NEWLINE
);
169 } else if (CONF_LDP_DEBUG(msg
, MSG_RECV
)) {
170 vty_out(vty
, "debug mpls ldp messages recv%s", VTY_NEWLINE
);
174 if (CONF_LDP_DEBUG(msg
, MSG_SEND_ALL
)) {
175 vty_out(vty
, "debug mpls ldp messages sent all%s", VTY_NEWLINE
);
177 } else if (CONF_LDP_DEBUG(msg
, MSG_SEND
)) {
178 vty_out(vty
, "debug mpls ldp messages sent%s", VTY_NEWLINE
);
182 if (CONF_LDP_DEBUG(zebra
, ZEBRA
)) {
183 vty_out(vty
, "debug mpls ldp zebra%s", VTY_NEWLINE
);