2 * RIPng debug output routines
3 * Copyright (C) 1998 Kunihiro Ishiguro
5 * This file is part of GNU Zebra.
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
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.
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
24 #include "ripngd/ripng_debug.h"
26 /* For debug statement. */
27 unsigned long ripng_debug_event
= 0;
28 unsigned long ripng_debug_packet
= 0;
29 unsigned long ripng_debug_zebra
= 0;
31 DEFUN_NOSH (show_debugging_ripng
,
32 show_debugging_ripng_cmd
,
33 "show debugging [ripng]",
36 "RIPng configuration\n")
38 vty_out(vty
, "RIPng debugging status:\n");
40 if (IS_RIPNG_DEBUG_EVENT
)
41 vty_out(vty
, " RIPng event debugging is on\n");
43 if (IS_RIPNG_DEBUG_PACKET
) {
44 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
) {
45 vty_out(vty
, " RIPng packet debugging is on\n");
47 if (IS_RIPNG_DEBUG_SEND
)
49 " RIPng packet send debugging is on\n");
52 " RIPng packet receive debugging is on\n");
56 if (IS_RIPNG_DEBUG_ZEBRA
)
57 vty_out(vty
, " RIPng zebra debugging is on\n");
62 DEFUN (debug_ripng_events
,
63 debug_ripng_events_cmd
,
66 "RIPng configuration\n"
67 "Debug option set for ripng events\n")
69 ripng_debug_event
= RIPNG_DEBUG_EVENT
;
73 DEFUN (debug_ripng_packet
,
74 debug_ripng_packet_cmd
,
77 "RIPng configuration\n"
78 "Debug option set for ripng packet\n")
80 ripng_debug_packet
= RIPNG_DEBUG_PACKET
;
81 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
82 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
86 DEFUN (debug_ripng_packet_direct
,
87 debug_ripng_packet_direct_cmd
,
88 "debug ripng packet <recv|send>",
90 "RIPng configuration\n"
91 "Debug option set for ripng packet\n"
92 "Debug option set for receive packet\n"
93 "Debug option set for send packet\n")
95 int idx_recv_send
= 3;
96 ripng_debug_packet
|= RIPNG_DEBUG_PACKET
;
97 if (strncmp("send", argv
[idx_recv_send
]->arg
,
98 strlen(argv
[idx_recv_send
]->arg
))
100 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
101 if (strncmp("recv", argv
[idx_recv_send
]->arg
,
102 strlen(argv
[idx_recv_send
]->arg
))
104 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
109 DEFUN (debug_ripng_zebra
,
110 debug_ripng_zebra_cmd
,
113 "RIPng configuration\n"
114 "Debug option set for ripng and zebra communication\n")
116 ripng_debug_zebra
= RIPNG_DEBUG_ZEBRA
;
120 DEFUN (no_debug_ripng_events
,
121 no_debug_ripng_events_cmd
,
122 "no debug ripng events",
125 "RIPng configuration\n"
126 "Debug option set for ripng events\n")
128 ripng_debug_event
= 0;
132 DEFUN (no_debug_ripng_packet
,
133 no_debug_ripng_packet_cmd
,
134 "no debug ripng packet",
137 "RIPng configuration\n"
138 "Debug option set for ripng packet\n")
140 ripng_debug_packet
= 0;
144 DEFUN (no_debug_ripng_packet_direct
,
145 no_debug_ripng_packet_direct_cmd
,
146 "no debug ripng packet <recv|send>",
149 "RIPng configuration\n"
150 "Debug option set for ripng packet\n"
151 "Debug option set for receive packet\n"
152 "Debug option set for send packet\n")
154 int idx_recv_send
= 4;
155 if (strncmp("send", argv
[idx_recv_send
]->arg
,
156 strlen(argv
[idx_recv_send
]->arg
))
158 if (IS_RIPNG_DEBUG_RECV
)
159 ripng_debug_packet
&= ~RIPNG_DEBUG_SEND
;
161 ripng_debug_packet
= 0;
162 } else if (strncmp("recv", argv
[idx_recv_send
]->arg
,
163 strlen(argv
[idx_recv_send
]->arg
))
165 if (IS_RIPNG_DEBUG_SEND
)
166 ripng_debug_packet
&= ~RIPNG_DEBUG_RECV
;
168 ripng_debug_packet
= 0;
173 DEFUN (no_debug_ripng_zebra
,
174 no_debug_ripng_zebra_cmd
,
175 "no debug ripng zebra",
178 "RIPng configuration\n"
179 "Debug option set for ripng and zebra communication\n")
181 ripng_debug_zebra
= 0;
186 static struct cmd_node debug_node
= {
187 DEBUG_NODE
, "", /* Debug node has no interface. */
191 static int config_write_debug(struct vty
*vty
)
195 if (IS_RIPNG_DEBUG_EVENT
) {
196 vty_out(vty
, "debug ripng events\n");
199 if (IS_RIPNG_DEBUG_PACKET
) {
200 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
) {
201 vty_out(vty
, "debug ripng packet\n");
204 if (IS_RIPNG_DEBUG_SEND
)
205 vty_out(vty
, "debug ripng packet send\n");
207 vty_out(vty
, "debug ripng packet recv\n");
211 if (IS_RIPNG_DEBUG_ZEBRA
) {
212 vty_out(vty
, "debug ripng zebra\n");
218 void ripng_debug_reset()
220 ripng_debug_event
= 0;
221 ripng_debug_packet
= 0;
222 ripng_debug_zebra
= 0;
225 void ripng_debug_init()
227 ripng_debug_event
= 0;
228 ripng_debug_packet
= 0;
229 ripng_debug_zebra
= 0;
231 install_node(&debug_node
, config_write_debug
);
233 install_element(VIEW_NODE
, &show_debugging_ripng_cmd
);
235 install_element(ENABLE_NODE
, &debug_ripng_events_cmd
);
236 install_element(ENABLE_NODE
, &debug_ripng_packet_cmd
);
237 install_element(ENABLE_NODE
, &debug_ripng_packet_direct_cmd
);
238 install_element(ENABLE_NODE
, &debug_ripng_zebra_cmd
);
239 install_element(ENABLE_NODE
, &no_debug_ripng_events_cmd
);
240 install_element(ENABLE_NODE
, &no_debug_ripng_packet_cmd
);
241 install_element(ENABLE_NODE
, &no_debug_ripng_packet_direct_cmd
);
242 install_element(ENABLE_NODE
, &no_debug_ripng_zebra_cmd
);
244 install_element(CONFIG_NODE
, &debug_ripng_events_cmd
);
245 install_element(CONFIG_NODE
, &debug_ripng_packet_cmd
);
246 install_element(CONFIG_NODE
, &debug_ripng_packet_direct_cmd
);
247 install_element(CONFIG_NODE
, &debug_ripng_zebra_cmd
);
248 install_element(CONFIG_NODE
, &no_debug_ripng_events_cmd
);
249 install_element(CONFIG_NODE
, &no_debug_ripng_packet_cmd
);
250 install_element(CONFIG_NODE
, &no_debug_ripng_packet_direct_cmd
);
251 install_element(CONFIG_NODE
, &no_debug_ripng_zebra_cmd
);