]> git.proxmox.com Git - mirror_frr.git/blame - eigrpd/eigrp_dump.c
lib: Fix missing vrf_int.h from `make distribute`
[mirror_frr.git] / eigrpd / eigrp_dump.c
CommitLineData
7f57883e
DS
1/*
2 * EIGRP Dump Functions and Debugging.
3 * Copyright (C) 2013-2014
4 * Authors:
5 * Donnie Savage
6 * Jan Janovic
7 * Matej Perina
8 * Peter Orsag
9 * Peter Paluch
10 *
11 * This file is part of GNU Zebra.
12 *
13 * GNU Zebra is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2, or (at your option) any
16 * later version.
17 *
18 * GNU Zebra is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with GNU Zebra; see the file COPYING. If not, write to the Free
25 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 * 02111-1307, USA.
27 */
28
29#include <zebra.h>
30
31#include "linklist.h"
32#include "thread.h"
33#include "prefix.h"
34#include "command.h"
35#include "stream.h"
36#include "log.h"
37#include "sockopt.h"
38#include "table.h"
39#include "keychain.h"
40
41#include "eigrpd/eigrp_structs.h"
42#include "eigrpd/eigrpd.h"
43#include "eigrpd/eigrp_interface.h"
44#include "eigrpd/eigrp_neighbor.h"
45#include "eigrpd/eigrp_packet.h"
46#include "eigrpd/eigrp_zebra.h"
47#include "eigrpd/eigrp_vty.h"
48#include "eigrpd/eigrp_network.h"
49#include "eigrpd/eigrp_dump.h"
50#include "eigrpd/eigrp_topology.h"
51
52/* Enable debug option variables -- valid only session. */
53unsigned long term_debug_eigrp = 0;
54unsigned long term_debug_eigrp_nei = 0;
55unsigned long term_debug_eigrp_packet[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
56unsigned long term_debug_eigrp_zebra = 6;
57unsigned long term_debug_eigrp_transmit = 0;
58
59/* Configuration debug option variables. */
60unsigned long conf_debug_eigrp = 0;
61unsigned long conf_debug_eigrp_nei = 0;
62unsigned long conf_debug_eigrp_packet[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
63unsigned long conf_debug_eigrp_zebra = 0;
64unsigned long conf_debug_eigrp_transmit = 0;
65
66
67static int
68config_write_debug (struct vty *vty)
69{
70 int write = 0;
71 int i;
72
f9e5c9ca
DS
73 const char *type_str[] = {"update", "request", "query", "reply",
74 "hello", "", "probe", "ack", "",
75 "SIA query", "SIA reply", "stub", "all"};
7f57883e 76 const char *detail_str[] = {"", " send", " recv", "", " detail",
f9e5c9ca 77 " send detail", " recv detail", " detail"};
7f57883e
DS
78
79
80 /* debug eigrp event. */
7f57883e
DS
81
82 /* debug eigrp packet */
83 for (i = 0; i < 10; i++)
84 {
f9e5c9ca
DS
85 if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 )
86 continue;
7f57883e 87
f9e5c9ca
DS
88 vty_out (vty, "debug eigrp packet %s%s%s",
89 type_str[i], detail_str[conf_debug_eigrp_packet[i]],
90 VTY_NEWLINE);
91 write = 1;
7f57883e
DS
92 }
93
7f57883e
DS
94 return write;
95}
96
7f57883e
DS
97static int
98eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei)
99{
100 struct eigrp_neighbor *nbr;
101 struct listnode *node, *nnode;
102 int sum;
103 sum = 0;
104
105 for (ALL_LIST_ELEMENTS (ei->nbrs, node, nnode, nbr))
106 {
107 sum += nbr->retrans_queue->count;
108 }
109
110 return sum;
111}
112
113/*
114 * Expects header to be in host order
115 */
116void
117eigrp_ip_header_dump (struct ip *iph)
118{
119 /* IP Header dump. */
120 zlog_debug ("ip_v %u", iph->ip_v);
121 zlog_debug ("ip_hl %u", iph->ip_hl);
122 zlog_debug ("ip_tos %u", iph->ip_tos);
123 zlog_debug ("ip_len %u", iph->ip_len);
124 zlog_debug ("ip_id %u", (u_int32_t) iph->ip_id);
125 zlog_debug ("ip_off %u", (u_int32_t) iph->ip_off);
126 zlog_debug ("ip_ttl %u", iph->ip_ttl);
127 zlog_debug ("ip_p %u", iph->ip_p);
128 zlog_debug ("ip_sum 0x%x", (u_int32_t) iph->ip_sum);
129 zlog_debug ("ip_src %s", inet_ntoa (iph->ip_src));
130 zlog_debug ("ip_dst %s", inet_ntoa (iph->ip_dst));
131}
132
133/*
134 * Expects header to be in host order
135 */
136void
137eigrp_header_dump (struct eigrp_header *eigrph)
138{
139 /* EIGRP Header dump. */
f9e5c9ca
DS
140 zlog_debug ("eigrp_version %u", eigrph->version);
141 zlog_debug ("eigrp_opcode %u", eigrph->opcode);
142 zlog_debug ("eigrp_checksum 0x%x", ntohs(eigrph->checksum));
143 zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags));
144 zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence));
145 zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack));
146 zlog_debug ("eigrp_vrid %u", ntohs(eigrph->vrid));
147 zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber));
7f57883e
DS
148}
149
150const char *
151eigrp_if_name_string (struct eigrp_interface *ei)
152{
153 static char buf[EIGRP_IF_STRING_MAXLEN] = "";
154
155 if (!ei)
156 return "inactive";
157
158 snprintf (buf, EIGRP_IF_STRING_MAXLEN,
159 "%s", ei->ifp->name);
160 return buf;
161}
162
163const char *
164eigrp_topology_ip_string (struct eigrp_prefix_entry *tn)
165{
166 static char buf[EIGRP_IF_STRING_MAXLEN] = "";
167 u_int32_t ifaddr;
168
169 ifaddr = ntohl (tn->destination_ipv4->prefix.s_addr);
170 snprintf (buf, EIGRP_IF_STRING_MAXLEN,
171 "%u.%u.%u.%u",
172 (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
173 (ifaddr >> 8) & 0xff, ifaddr & 0xff);
174 return buf;
175}
176
177
178const char *
179eigrp_if_ip_string (struct eigrp_interface *ei)
180{
181 static char buf[EIGRP_IF_STRING_MAXLEN] = "";
182 u_int32_t ifaddr;
183
184 if (!ei)
185 return "inactive";
186
187 ifaddr = ntohl (ei->address->u.prefix4.s_addr);
188 snprintf (buf, EIGRP_IF_STRING_MAXLEN,
189 "%u.%u.%u.%u",
190 (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
191 (ifaddr >> 8) & 0xff, ifaddr & 0xff);
192
193 return buf;
194}
195
196const char *
197eigrp_neigh_ip_string (struct eigrp_neighbor *nbr)
198{
199 static char buf[EIGRP_IF_STRING_MAXLEN] = "";
200 u_int32_t ifaddr;
201
202 ifaddr = ntohl (nbr->src.s_addr);
203 snprintf (buf, EIGRP_IF_STRING_MAXLEN,
204 "%u.%u.%u.%u",
205 (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
206 (ifaddr >> 8) & 0xff, ifaddr & 0xff);
207
208 return buf;
209}
210
211void
212show_ip_eigrp_interface_header (struct vty *vty, struct eigrp *eigrp)
213{
214
215 vty_out (vty, "%s%s%d%s%s%s %-10s %-10s %-10s %-6s %-12s %-7s %-14s %-12s %-8s %-8s %-8s%s %-39s %-12s %-7s %-14s %-12s %-8s%s",
216 VTY_NEWLINE,
217 "EIGRP interfaces for AS(",eigrp->AS,")",VTY_NEWLINE,VTY_NEWLINE,
218 "Interface", "Bandwidth", "Delay", "Peers", "Xmit Queue", "Mean",
219 "Pacing Time", "Multicast", "Pending", "Hello", "Holdtime",
220 VTY_NEWLINE,"","Un/Reliable","SRTT","Un/Reliable","Flow Timer","Routes",
221 VTY_NEWLINE);
222}
223
224void
225show_ip_eigrp_interface_sub (struct vty *vty, struct eigrp *eigrp,
f9e5c9ca 226 struct eigrp_interface *ei)
7f57883e
DS
227{
228 vty_out (vty, "%-11s ", eigrp_if_name_string (ei));
f9e5c9ca
DS
229 vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->bandwidth);
230 vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->delay);
7f57883e 231 vty_out (vty, "%-7u", ei->nbrs->count);
f9e5c9ca
DS
232 vty_out (vty, "%u %c %-10u",0,'/', eigrp_neighbor_packet_queue_sum (ei));
233 vty_out (vty, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
234 vty_out (vty, "%-8u %-8u %s",
235 IF_DEF_PARAMS (ei->ifp)->v_hello,
236 IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
7f57883e
DS
237}
238
239void
240show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp,
f9e5c9ca 241 struct eigrp_interface *ei)
7f57883e 242{
f9e5c9ca
DS
243 vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ", 0, " sec", VTY_NEWLINE);
244 vty_out (vty, "%-2s %s %s %s","", "Next xmit serial","<none>", VTY_NEWLINE);
245 vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s",
246 "", "Un/reliable mcasts: ", 0, "/", 0, "Un/reliable ucasts: ",
247 0, "/", 0, VTY_NEWLINE);
248 vty_out (vty, "%-2s %s %d %s %d %s %d %s",
249 "", "Mcast exceptions: ", 0, " CR packets: ",
250 0, " ACKs supressed: ", 0, VTY_NEWLINE);
251 vty_out (vty, "%-2s %s %d %s %d %s",
252 "", "Retransmissions sent: ", 0, "Out-of-sequence rcvd: ",
253 0 ,VTY_NEWLINE);
254 vty_out (vty, "%-2s %s %s %s %s",
255 "", "Authentication mode is ", "not","set", VTY_NEWLINE);
256 vty_out (vty, "%-2s %s %s", "", "Use multicast", VTY_NEWLINE);
7f57883e
DS
257}
258
259void
260show_ip_eigrp_neighbor_header (struct vty *vty, struct eigrp *eigrp)
261{
262 vty_out (vty, "%s%s%d%s%s%s%-3s %-17s %-20s %-6s %-8s %-6s %-5s %-5s %-5s%s %-41s %-6s %-8s %-6s %-4s %-6s %-5s %s",
263 VTY_NEWLINE,
264 "EIGRP neighbors for AS(",eigrp->AS,")",VTY_NEWLINE,VTY_NEWLINE,
265 "H", "Address", "Interface", "Hold", "Uptime",
266 "SRTT", "RTO", "Q", "Seq", VTY_NEWLINE
267 ,"","(sec)","","(ms)","","Cnt","Num", VTY_NEWLINE);
268}
269
270void
271show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr,
f9e5c9ca 272 int detail)
7f57883e
DS
273{
274
f9e5c9ca
DS
275 vty_out (vty, "%-3u %-17s %-21s", 0,
276 eigrp_neigh_ip_string (nbr), eigrp_if_name_string (nbr->ei));
277 vty_out (vty,"%-7lu", thread_timer_remain_second (nbr->t_holddown));
278 vty_out (vty,"%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);
279 vty_out (vty,"%-7lu", nbr->retrans_queue->count);
280 vty_out (vty,"%u%s", nbr->recv_sequence_number, VTY_NEWLINE);
7f57883e
DS
281
282
283 if (detail)
284 {
285 vty_out(vty," Version %u.%u/%u.%u",
f9e5c9ca
DS
286 nbr->os_rel_major, nbr->os_rel_minor,
287 nbr->tlv_rel_major, nbr->tlv_rel_minor);
7f57883e 288 vty_out(vty,", Retrans: %lu, Retries: %lu",
f9e5c9ca 289 nbr->retrans_queue->count, 0UL);
7f57883e
DS
290 vty_out(vty,", %s%s", eigrp_nbr_state_str(nbr), VTY_NEWLINE);
291 }
292}
293
294/*
295 * Print standard header for show EIGRP topology output
296 */
297void
298show_ip_eigrp_topology_header (struct vty *vty, struct eigrp *eigrp)
299{
300 struct in_addr router_id;
1ad13df9 301 router_id.s_addr = eigrp->router_id;
7f57883e 302
1ad13df9
DS
303 vty_out (vty, "%sEIGRP Topology Table for AS(%d)/ID(%s)%s%s",
304 VTY_NEWLINE, eigrp->AS, inet_ntoa(router_id), VTY_NEWLINE, VTY_NEWLINE);
305 vty_out (vty, "Codes: P - Passive, A - Active, U - Update, Q - Query, "
306 "R - Reply%s r - reply Status, s - sia Status%s%s",
307 VTY_NEWLINE, VTY_NEWLINE,VTY_NEWLINE);
7f57883e
DS
308}
309
310void
311show_ip_eigrp_prefix_entry (struct vty *vty, struct eigrp_prefix_entry *tn)
312{
057fad8d
DS
313 struct list *successors = eigrp_topology_get_successor(tn);
314
7f57883e 315 vty_out (vty, "%-3c",(tn->state > 0) ? 'A' : 'P');
057fad8d
DS
316 vty_out (vty, "%s/%u, ",
317 inet_ntoa (tn->destination_ipv4->prefix), tn->destination_ipv4->prefixlen);
318 vty_out (vty, "%u successors, ", successors->count);
319 vty_out (vty, "FD is %u, serno: %lu %s", tn->fdistance, tn->serno, VTY_NEWLINE);
320
321 list_delete(successors);
7f57883e
DS
322}
323
324void
325show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te)
326{
327 if (te->adv_router == eigrp->neighbor_self)
f9e5c9ca
DS
328 vty_out (vty, "%-7s%s, %s%s", " ", "via Connected",
329 eigrp_if_name_string (te->ei), VTY_NEWLINE);
7f57883e
DS
330 else
331 {
f9e5c9ca
DS
332 vty_out (vty, "%-7s%s%s (%u/%u), %s%s",
333 " ", "via ", inet_ntoa (te->adv_router->src),
334 te->distance, te->reported_distance,
335 eigrp_if_name_string (te->ei), VTY_NEWLINE);
7f57883e
DS
336 }
337}
338
339
340DEFUN (show_debugging_eigrp,
341 show_debugging_eigrp_cmd,
342 "show debugging eigrp",
343 SHOW_STR
344 DEBUG_STR
345 EIGRP_STR)
346{
347 int i;
348
349 vty_out (vty, "EIGRP debugging status:%s", VTY_NEWLINE);
350
351 /* Show debug status for events. */
352 if (IS_DEBUG_EIGRP(event,EVENT))
353 vty_out (vty, " EIGRP event debugging is on%s", VTY_NEWLINE);
354
355 /* Show debug status for EIGRP Packets. */
356 for (i = 0; i < 11 ; i++)
f9e5c9ca 357 {
7f57883e
DS
358 if (i == 8)
359 continue;
360
f9e5c9ca
DS
361 if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV))
362 {
363 vty_out (vty, " EIGRP packet %s%s debugging is on%s",
364 LOOKUP (eigrp_packet_type_str, i + 1),
365 IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
366 VTY_NEWLINE);
367 }
368 else
369 {
370 if (IS_DEBUG_EIGRP_PACKET (i, SEND))
371 vty_out (vty, " EIGRP packet %s send%s debugging is on%s",
372 LOOKUP (eigrp_packet_type_str, i + 1),
373 IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
374 VTY_NEWLINE);
375 if (IS_DEBUG_EIGRP_PACKET (i, RECV))
376 vty_out (vty, " EIGRP packet %s receive%s debugging is on%s",
377 LOOKUP (eigrp_packet_type_str, i + 1),
378 IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
379 VTY_NEWLINE);
380 }
381 }
7f57883e
DS
382
383 return CMD_SUCCESS;
384}
385
386
387/*
f9e5c9ca
DS
388 [no] debug eigrp packet (hello|dd|ls-request|ls-update|ls-ack|all)
389 [send|recv [detail]]
7f57883e
DS
390*/
391
392DEFUN (debug_eigrp_transmit,
393 debug_eigrp_transmit_cmd,
394 "debug eigrp transmit <send|recv|all> [detail]",
395 DEBUG_STR
396 EIGRP_STR
397 "EIGRP transmission events\n"
398 "packet sent\n"
399 "packet received\n"
400 "all packets\n"
401 "Detailed Information\n")
402{
403 int flag = 0;
404 int idx = 2;
405
406 /* send or recv. */
407 if (argv_find (argv, argc, "send", &idx))
408 flag = EIGRP_DEBUG_SEND;
409 else if (argv_find (argv, argc, "recv", &idx))
410 flag = EIGRP_DEBUG_RECV;
411 else if (argv_find (argv, argc, "all", &idx) == 0)
412 flag = EIGRP_DEBUG_SEND_RECV;
413
414 /* detail option */
415 if (argv_find (argv, argc, "detail", &idx) == 0)
416 flag = EIGRP_DEBUG_PACKET_DETAIL;
417
418 if (vty->node == CONFIG_NODE)
419 DEBUG_TRANSMIT_ON (0, flag);
420 else
421 TERM_DEBUG_TRANSMIT_ON (0, flag);
422
423 return CMD_SUCCESS;
424}
425
426DEFUN (no_debug_eigrp_transmit,
427 no_debug_eigrp_transmit_cmd,
428 "no debug eigrp transmit <send|recv|all> [detail]",
429 NO_STR
430 UNDEBUG_STR
431 EIGRP_STR
432 "EIGRP transmission events\n"
433 "packet sent\n"
434 "packet received\n"
435 "all packets\n"
436 "Detailed Information\n")
437{
438 int flag = 0;
439 int idx = 3;
440
441 /* send or recv. */
442 if (argv_find (argv, argc, "send", &idx) == 0)
443 flag = EIGRP_DEBUG_SEND;
444 else if (argv_find (argv, argc, "recv", &idx) == 0)
445 flag = EIGRP_DEBUG_RECV;
446 else if (argv_find (argv, argc, "all", &idx) == 0)
447 flag = EIGRP_DEBUG_SEND_RECV;
448
449 /* detail option */
450 if (argv_find (argv, argc, "detail", &idx) == 0)
451 flag = EIGRP_DEBUG_PACKET_DETAIL;
452
453 if (vty->node == CONFIG_NODE)
454 DEBUG_TRANSMIT_OFF (0, flag);
455 else
456 TERM_DEBUG_TRANSMIT_OFF (0, flag);
457
458 return CMD_SUCCESS;
459}
460
461DEFUN (debug_eigrp_packets,
462 debug_eigrp_packets_all_cmd,
463 "debug eigrp packets <siaquery|siareply|ack|hello|probe|query|reply|request|retry|stub|terse|update|all> [send|receive] [detail]",
464 DEBUG_STR
465 EIGRP_STR
466 "EIGRP packets\n"
467 "EIGRP SIA-Query packets\n"
468 "EIGRP SIA-Reply packets\n"
469 "EIGRP ack packets\n"
470 "EIGRP hello packets\n"
471 "EIGRP probe packets\n"
472 "EIGRP query packets\n"
473 "EIGRP reply packets\n"
474 "EIGRP request packets\n"
475 "EIGRP retransmissions\n"
476 "EIGRP stub packets\n"
477 "Display all EIGRP packets except Hellos\n"
478 "EIGRP update packets\n"
479 "Display all EIGRP packets\n"
480 "Send Packets\n"
481 "Receive Packets\n"
482 "Detail Information\n")
483{
484 int type = 0;
485 int flag = 0;
486 int i;
487 int idx = 0;
488
489 /* Check packet type. */
490 if (argv_find (argv, argc, "hello", &idx) == 0)
491 type = EIGRP_DEBUG_HELLO;
492 if (argv_find (argv, argc, "update", &idx) == 0)
493 type = EIGRP_DEBUG_UPDATE;
494 if (argv_find (argv, argc, "query", &idx) == 0)
495 type = EIGRP_DEBUG_QUERY;
496 if (argv_find (argv, argc, "ack", &idx) == 0)
497 type = EIGRP_DEBUG_ACK;
498 if (argv_find (argv, argc, "probe", &idx) == 0)
499 type = EIGRP_DEBUG_PROBE;
500 if (argv_find (argv, argc, "stub", &idx) == 0)
501 type = EIGRP_DEBUG_STUB;
502 if (argv_find (argv, argc, "reply", &idx) == 0)
503 type = EIGRP_DEBUG_REPLY;
504 if (argv_find (argv, argc, "request", &idx) == 0)
505 type = EIGRP_DEBUG_REQUEST;
506 if (argv_find (argv, argc, "siaquery", &idx) == 0)
507 type = EIGRP_DEBUG_SIAQUERY;
508 if (argv_find (argv, argc, "siareply", &idx) == 0)
509 type = EIGRP_DEBUG_SIAREPLY;
510 if (argv_find (argv, argc, "all", &idx) == 0)
511 type = EIGRP_DEBUG_PACKETS_ALL;
512
513
514 /* All packet types, both send and recv. */
515 flag = EIGRP_DEBUG_SEND_RECV;
516
517 /* send or recv. */
518 if (argv_find (argv, argc, "s", &idx) == 0)
519 flag = EIGRP_DEBUG_SEND;
520 else if (argv_find (argv, argc, "r", &idx) == 0)
521 flag = EIGRP_DEBUG_RECV;
522
523 /* detail. */
524 if (argv_find (argv, argc, "detail", &idx) == 0)
525 flag |= EIGRP_DEBUG_PACKET_DETAIL;
526
527 for (i = 0; i < 11; i++)
528 if (type & (0x01 << i))
529 {
530 if (vty->node == CONFIG_NODE)
531 DEBUG_PACKET_ON (i, flag);
532 else
533 TERM_DEBUG_PACKET_ON (i, flag);
534 }
535
536 return CMD_SUCCESS;
537}
538
539DEFUN (no_debug_eigrp_packets,
540 no_debug_eigrp_packets_all_cmd,
541 "no debug eigrp packets <siaquery|siareply|ack|hello|probe|query|reply|request|retry|stub|terse|update|all> [send|receive] [detail]",
542 NO_STR
543 UNDEBUG_STR
544 EIGRP_STR
545 "EIGRP packets\n"
546 "EIGRP SIA-Query packets\n"
547 "EIGRP SIA-Reply packets\n"
548 "EIGRP ack packets\n"
549 "EIGRP hello packets\n"
550 "EIGRP probe packets\n"
551 "EIGRP query packets\n"
552 "EIGRP reply packets\n"
553 "EIGRP request packets\n"
554 "EIGRP retransmissions\n"
555 "EIGRP stub packets\n"
556 "Display all EIGRP packets except Hellos\n"
557 "EIGRP update packets\n"
558 "Display all EIGRP packets\n"
559 "Send Packets\n"
560 "Receive Packets\n"
561 "Detailed Information\n")
562{
563 int type = 0;
564 int flag = 0;
565 int i;
566 int idx = 0;
567
568 /* Check packet type. */
569 if (argv_find (argv, argc, "hello", &idx) == 0)
570 type = EIGRP_DEBUG_HELLO;
571 if (argv_find (argv, argc, "update", &idx) == 0)
572 type = EIGRP_DEBUG_UPDATE;
573 if (argv_find (argv, argc, "query", &idx) == 0)
574 type = EIGRP_DEBUG_QUERY;
575 if (argv_find (argv, argc, "ack", &idx) == 0)
576 type = EIGRP_DEBUG_ACK;
577 if (argv_find (argv, argc, "probe", &idx) == 0)
578 type = EIGRP_DEBUG_PROBE;
579 if (argv_find (argv, argc, "stub", &idx) == 0)
580 type = EIGRP_DEBUG_STUB;
581 if (argv_find (argv, argc, "reply", &idx) == 0)
582 type = EIGRP_DEBUG_REPLY;
583 if (argv_find (argv, argc, "request", &idx) == 0)
584 type = EIGRP_DEBUG_REQUEST;
585 if (argv_find (argv, argc, "siaquery", &idx) == 0)
586 type = EIGRP_DEBUG_SIAQUERY;
587 if (argv_find (argv, argc, "siareply", &idx) == 0)
588 type = EIGRP_DEBUG_SIAREPLY;
589
590 /* Default, both send and recv. */
591 flag = EIGRP_DEBUG_SEND_RECV;
592
593 /* send or recv. */
594 if (argv_find (argv, argc, "send", &idx) == 0)
595 flag = EIGRP_DEBUG_SEND;
596 else if (argv_find (argv, argc, "reply", &idx) == 0)
597 flag = EIGRP_DEBUG_RECV;
598
599 /* detail. */
600 if (argv_find (argv, argc, "detail", &idx) == 0)
601 flag |= EIGRP_DEBUG_PACKET_DETAIL;
602
603 for (i = 0; i < 11; i++)
604 if (type & (0x01 << i))
605 {
606 if (vty->node == CONFIG_NODE)
607 DEBUG_PACKET_OFF (i, flag);
608 else
609 TERM_DEBUG_PACKET_OFF (i, flag);
610 }
611
612 return CMD_SUCCESS;
613}
614
615/* Debug node. */
616static struct cmd_node eigrp_debug_node =
617{
618 DEBUG_NODE,
619 "",
620 1 /* VTYSH */
621};
622
623/* Initialize debug commands. */
624void
625eigrp_debug_init ()
626{
627 install_node (&eigrp_debug_node, config_write_debug);
628
629 install_element (ENABLE_NODE, &show_debugging_eigrp_cmd);
630 install_element (ENABLE_NODE, &debug_eigrp_packets_all_cmd);
631 install_element (ENABLE_NODE, &no_debug_eigrp_packets_all_cmd);
632 install_element (ENABLE_NODE, &debug_eigrp_transmit_cmd);
633 install_element (ENABLE_NODE, &no_debug_eigrp_transmit_cmd);
634
635 install_element (CONFIG_NODE, &show_debugging_eigrp_cmd);
636 install_element (CONFIG_NODE, &debug_eigrp_packets_all_cmd);
637 install_element (CONFIG_NODE, &no_debug_eigrp_packets_all_cmd);
638 install_element (CONFIG_NODE, &no_debug_eigrp_transmit_cmd);
639}
640
641