3
* Copyright (C) 1999, 2000 Toshiaki Takada
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
18
* along with GNU Zebra; see the file COPYING. If not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
32
#include "ospfd/ospfd.h"
33
#include "ospfd/ospf_interface.h"
34
#include "ospfd/ospf_ism.h"
35
#include "ospfd/ospf_asbr.h"
36
#include "ospfd/ospf_lsa.h"
37
#include "ospfd/ospf_lsdb.h"
38
#include "ospfd/ospf_neighbor.h"
39
#include "ospfd/ospf_nsm.h"
40
#include "ospfd/ospf_dump.h"
41
#include "ospfd/ospf_packet.h"
42
#include "ospfd/ospf_network.h"
44
struct message ospf_ism_state_msg[] =
46
{ ISM_DependUpon, "DependUpon" },
48
{ ISM_Loopback, "Loopback" },
49
{ ISM_Waiting, "Waiting" },
50
{ ISM_PointToPoint, "Point-To-Point" },
51
{ ISM_DROther, "DROther" },
52
{ ISM_Backup, "Backup" },
55
int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
57
struct message ospf_nsm_state_msg[] =
59
{ NSM_DependUpon, "DependUpon" },
61
{ NSM_Attempt, "Attempt" },
63
{ NSM_TwoWay, "2-Way" },
64
{ NSM_ExStart, "ExStart" },
65
{ NSM_Exchange, "Exchange" },
66
{ NSM_Loading, "Loading" },
69
int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
71
struct message ospf_lsa_type_msg[] =
73
{ OSPF_UNKNOWN_LSA, "unknown" },
74
{ OSPF_ROUTER_LSA, "router-LSA" },
75
{ OSPF_NETWORK_LSA, "network-LSA" },
76
{ OSPF_SUMMARY_LSA, "summary-LSA" },
77
{ OSPF_ASBR_SUMMARY_LSA, "summary-LSA" },
78
{ OSPF_AS_EXTERNAL_LSA, "AS-external-LSA" },
79
{ OSPF_GROUP_MEMBER_LSA, "GROUP MEMBER LSA" },
80
{ OSPF_AS_NSSA_LSA, "NSSA-LSA" },
82
{ OSPF_OPAQUE_LINK_LSA, "Link-Local Opaque-LSA" },
83
{ OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" },
84
{ OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" },
86
int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
88
struct message ospf_link_state_id_type_msg[] =
90
{ OSPF_UNKNOWN_LSA, "(unknown)" },
91
{ OSPF_ROUTER_LSA, "" },
92
{ OSPF_NETWORK_LSA, "(address of Designated Router)" },
93
{ OSPF_SUMMARY_LSA, "(summary Network Number)" },
94
{ OSPF_ASBR_SUMMARY_LSA, "(AS Boundary Router address)" },
95
{ OSPF_AS_EXTERNAL_LSA, "(External Network Number)" },
96
{ OSPF_GROUP_MEMBER_LSA, "(Group membership information)" },
97
{ OSPF_AS_NSSA_LSA, "(External Network Number for NSSA)" },
98
{ 8, "(Type-8 LSID)" },
99
{ OSPF_OPAQUE_LINK_LSA, "(Link-Local Opaque-Type/ID)" },
100
{ OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" },
101
{ OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" },
103
int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
105
struct message ospf_redistributed_proto[] =
107
{ ZEBRA_ROUTE_SYSTEM, "System" },
108
{ ZEBRA_ROUTE_KERNEL, "Kernel" },
109
{ ZEBRA_ROUTE_CONNECT, "Connected" },
110
{ ZEBRA_ROUTE_STATIC, "Static" },
111
{ ZEBRA_ROUTE_RIP, "RIP" },
112
{ ZEBRA_ROUTE_RIPNG, "RIPng" },
113
{ ZEBRA_ROUTE_OSPF, "OSPF" },
114
{ ZEBRA_ROUTE_OSPF6, "OSPFv3" },
115
{ ZEBRA_ROUTE_BGP, "BGP" },
116
{ ZEBRA_ROUTE_MAX, "Default" },
118
int ospf_redistributed_proto_max = ZEBRA_ROUTE_MAX + 1;
120
struct message ospf_network_type_msg[] =
122
{ OSPF_IFTYPE_NONE, "NONE" },
123
{ OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" },
124
{ OSPF_IFTYPE_BROADCAST, "Broadcast" },
125
{ OSPF_IFTYPE_NBMA, "NBMA" },
126
{ OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" },
127
{ OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" },
129
int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
131
/* Configuration debug option variables. */
132
unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
133
unsigned long conf_debug_ospf_event = 0;
134
unsigned long conf_debug_ospf_ism = 0;
135
unsigned long conf_debug_ospf_nsm = 0;
136
unsigned long conf_debug_ospf_lsa = 0;
137
unsigned long conf_debug_ospf_zebra = 0;
138
unsigned long conf_debug_ospf_nssa = 0;
140
/* Enable debug option variables -- valid only session. */
141
unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
142
unsigned long term_debug_ospf_event = 0;
143
unsigned long term_debug_ospf_ism = 0;
144
unsigned long term_debug_ospf_nsm = 0;
145
unsigned long term_debug_ospf_lsa = 0;
146
unsigned long term_debug_ospf_zebra = 0;
147
unsigned long term_debug_ospf_nssa = 0;
150
#define OSPF_AREA_STRING_MAXLEN 16
152
ospf_area_name_string (struct ospf_area *area)
154
static char buf[OSPF_AREA_STRING_MAXLEN] = "";
160
area_id = ntohl (area->area_id.s_addr);
161
snprintf (buf, OSPF_AREA_STRING_MAXLEN, "%d.%d.%d.%d",
162
(area_id >> 24) & 0xff, (area_id >> 16) & 0xff,
163
(area_id >> 8) & 0xff, area_id & 0xff);
167
#define OSPF_AREA_DESC_STRING_MAXLEN 23
169
ospf_area_desc_string (struct ospf_area *area)
171
static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = "";
175
return "(incomplete)";
177
type = area->external_routing;
181
snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [NSSA]",
182
ospf_area_name_string (area));
185
snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [Stub]",
186
ospf_area_name_string (area));
189
return ospf_area_name_string (area);
196
#define OSPF_IF_STRING_MAXLEN 40
198
ospf_if_name_string (struct ospf_interface *oi)
200
static char buf[OSPF_IF_STRING_MAXLEN] = "";
206
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
207
return oi->ifp->name;
209
ifaddr = ntohl (oi->address->u.prefix4.s_addr);
210
snprintf (buf, OSPF_IF_STRING_MAXLEN,
211
"%s:%d.%d.%d.%d", oi->ifp->name,
212
(ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
213
(ifaddr >> 8) & 0xff, ifaddr & 0xff);
219
ospf_nbr_state_message (struct ospf_neighbor *nbr, char *buf, size_t size)
222
struct ospf_interface *oi = nbr->oi;
224
if (IPV4_ADDR_SAME (&DR (oi), &nbr->address.u.prefix4))
226
else if (IPV4_ADDR_SAME (&BDR (oi), &nbr->address.u.prefix4))
231
memset (buf, 0, size);
233
snprintf (buf, size, "%s/%s",
234
LOOKUP (ospf_nsm_state_msg, nbr->state),
235
LOOKUP (ospf_ism_state_msg, state));
239
ospf_timer_dump (struct thread *t, char *buf, size_t size)
242
unsigned long h, m, s;
248
memset (buf, 0, size);
250
gettimeofday (&now, NULL);
252
s = t->u.sands.tv_sec - now.tv_sec;
265
snprintf (buf, size, "%02ld:%02ld:%02ld", h, m, s);
270
#define OSPF_OPTION_STR_MAXLEN 24
273
ospf_options_dump (u_char options)
275
static char buf[OSPF_OPTION_STR_MAXLEN];
277
snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|*",
278
(options & OSPF_OPTION_O) ? "O" : "-",
279
(options & OSPF_OPTION_DC) ? "DC" : "-",
280
(options & OSPF_OPTION_EA) ? "EA" : "-",
281
(options & OSPF_OPTION_NP) ? "N/P" : "-",
282
(options & OSPF_OPTION_MC) ? "MC" : "-",
283
(options & OSPF_OPTION_E) ? "E" : "-");
289
ospf_packet_hello_dump (struct stream *s, u_int16_t length)
291
struct ospf_hello *hello;
294
hello = (struct ospf_hello *) STREAM_PNT (s);
297
zlog_info (" NetworkMask %s", inet_ntoa (hello->network_mask));
298
zlog_info (" HelloInterval %d", ntohs (hello->hello_interval));
299
zlog_info (" Options %d (%s)", hello->options,
300
ospf_options_dump (hello->options));
301
zlog_info (" RtrPriority %d", hello->priority);
302
zlog_info (" RtrDeadInterval %ld", (u_long)ntohl (hello->dead_interval));
303
zlog_info (" DRouter %s", inet_ntoa (hello->d_router));
304
zlog_info (" BDRouter %s", inet_ntoa (hello->bd_router));
306
length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE;
307
zlog_info (" # Neighbors %d", length / 4);
308
for (i = 0; length > 0; i++, length -= sizeof (struct in_addr))
309
zlog_info (" Neighbor %s", inet_ntoa (hello->neighbors[i]));
313
ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
315
memset (buf, 0, size);
317
snprintf (buf, size, "%s|%s|%s",
318
(flags & OSPF_DD_FLAG_I) ? "I" : "-",
319
(flags & OSPF_DD_FLAG_M) ? "M" : "-",
320
(flags & OSPF_DD_FLAG_MS) ? "MS" : "-");
326
ospf_lsa_header_dump (struct lsa_header *lsah)
328
zlog_info (" LSA Header");
329
zlog_info (" LS age %d", ntohs (lsah->ls_age));
330
zlog_info (" Options %d (%s)", lsah->options,
331
ospf_options_dump (lsah->options));
332
zlog_info (" LS type %d (%s)", lsah->type,
333
LOOKUP (ospf_lsa_type_msg, lsah->type));
334
zlog_info (" Link State ID %s", inet_ntoa (lsah->id));
335
zlog_info (" Advertising Router %s", inet_ntoa (lsah->adv_router));
336
zlog_info (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
337
zlog_info (" LS checksum 0x%x", ntohs (lsah->checksum));
338
zlog_info (" length %d", ntohs (lsah->length));
342
ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size)
344
memset (buf, 0, size);
346
snprintf (buf, size, "%s|%s|%s",
347
(flags & ROUTER_LSA_VIRTUAL) ? "V" : "-",
348
(flags & ROUTER_LSA_EXTERNAL) ? "E" : "-",
349
(flags & ROUTER_LSA_BORDER) ? "B" : "-");
355
ospf_router_lsa_dump (struct stream *s, u_int16_t length)
358
struct router_lsa *rl;
361
rl = (struct router_lsa *) STREAM_PNT (s);
363
zlog_info (" Router-LSA");
364
zlog_info (" flags %s",
365
ospf_router_lsa_flags_dump (rl->flags, buf, BUFSIZ));
366
zlog_info (" # links %d", ntohs (rl->links));
368
len = ntohs (rl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
369
for (i = 0; len > 0; i++)
371
zlog_info (" Link ID %s", inet_ntoa (rl->link[i].link_id));
372
zlog_info (" Link Data %s", inet_ntoa (rl->link[i].link_data));
373
zlog_info (" Type %d", (u_char) rl->link[i].type);
374
zlog_info (" TOS %d", (u_char) rl->link[i].tos);
375
zlog_info (" metric %d", ntohs (rl->link[i].metric));
382
ospf_network_lsa_dump (struct stream *s, u_int16_t length)
384
struct network_lsa *nl;
387
nl = (struct network_lsa *) STREAM_PNT (s);
388
cnt = (ntohs (nl->header.length) - (OSPF_LSA_HEADER_SIZE + 4)) / 4;
390
zlog_info (" Network-LSA");
392
zlog_info ("LSA total size %d", ntohs (nl->header.length));
393
zlog_info ("Network-LSA size %d",
394
ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE);
396
zlog_info (" Network Mask %s", inet_ntoa (nl->mask));
397
zlog_info (" # Attached Routers %d", cnt);
398
for (i = 0; i < cnt; i++)
399
zlog_info (" Attached Router %s", inet_ntoa (nl->routers[i]));
403
ospf_summary_lsa_dump (struct stream *s, u_int16_t length)
405
struct summary_lsa *sl;
409
sl = (struct summary_lsa *) STREAM_PNT (s);
411
zlog_info (" Summary-LSA");
412
zlog_info (" Network Mask %s", inet_ntoa (sl->mask));
414
size = ntohs (sl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
415
for (i = 0; size > 0; size -= 4, i++)
416
zlog_info (" TOS=%d metric %d", sl->tos,
417
GET_METRIC (sl->metric));
421
ospf_as_external_lsa_dump (struct stream *s, u_int16_t length)
423
struct as_external_lsa *al;
427
al = (struct as_external_lsa *) STREAM_PNT (s);
428
zlog_info (" %s", ospf_lsa_type_msg[al->header.type].str);
429
zlog_info (" Network Mask %s", inet_ntoa (al->mask));
431
size = ntohs (al->header.length) - OSPF_LSA_HEADER_SIZE -4;
432
for (i = 0; size > 0; size -= 12, i++)
434
zlog_info (" bit %s TOS=%d metric %d",
435
IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
436
al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
437
zlog_info (" Forwarding address %s", inet_ntoa (al->e[i].fwd_addr));
438
zlog_info (" External Route Tag %d", al->e[i].route_tag);
443
ospf_lsa_header_list_dump (struct stream *s, u_int16_t length)
445
struct lsa_header *lsa;
447
zlog_info (" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE);
452
lsa = (struct lsa_header *) STREAM_PNT (s);
453
ospf_lsa_header_dump (lsa);
455
stream_forward (s, OSPF_LSA_HEADER_SIZE);
456
length -= OSPF_LSA_HEADER_SIZE;
461
ospf_packet_db_desc_dump (struct stream *s, u_int16_t length)
463
struct ospf_db_desc *dd;
468
gp = stream_get_getp (s);
469
dd = (struct ospf_db_desc *) STREAM_PNT (s);
471
zlog_info ("Database Description");
472
zlog_info (" Interface MTU %d", ntohs (dd->mtu));
473
zlog_info (" Options %d (%s)", dd->options,
474
ospf_options_dump (dd->options));
475
zlog_info (" Flags %d (%s)", dd->flags,
476
ospf_dd_flags_dump (dd->flags, dd_flags, sizeof dd_flags));
477
zlog_info (" Sequence Number 0x%08lx", (u_long)ntohl (dd->dd_seqnum));
479
length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
481
stream_forward (s, OSPF_DB_DESC_MIN_SIZE);
483
ospf_lsa_header_list_dump (s, length);
485
stream_set_getp (s, gp);
489
ospf_packet_ls_req_dump (struct stream *s, u_int16_t length)
493
struct in_addr ls_id;
494
struct in_addr adv_router;
496
sp = stream_get_getp (s);
498
length -= OSPF_HEADER_SIZE;
500
zlog_info ("Link State Request");
501
zlog_info (" # Requests %d", length / 12);
503
for (; length > 0; length -= 12)
505
ls_type = stream_getl (s);
506
ls_id.s_addr = stream_get_ipv4 (s);
507
adv_router.s_addr = stream_get_ipv4 (s);
509
zlog_info (" LS type %d", ls_type);
510
zlog_info (" Link State ID %s", inet_ntoa (ls_id));
511
zlog_info (" Advertising Router %s",
512
inet_ntoa (adv_router));
515
stream_set_getp (s, sp);
519
ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length)
522
struct lsa_header *lsa;
526
length -= OSPF_HEADER_SIZE;
528
sp = stream_get_getp (s);
530
count = stream_getl (s);
533
zlog_info ("Link State Update");
534
zlog_info (" # LSAs %d", count);
536
while (length > 0 && count > 0)
538
if (length < OSPF_HEADER_SIZE || length % 4 != 0)
540
zlog_info (" Remaining %d bytes; Incorrect length.", length);
544
lsa = (struct lsa_header *) STREAM_PNT (s);
545
lsa_len = ntohs (lsa->length);
546
ospf_lsa_header_dump (lsa);
550
case OSPF_ROUTER_LSA:
551
ospf_router_lsa_dump (s, length);
553
case OSPF_NETWORK_LSA:
554
ospf_network_lsa_dump (s, length);
556
case OSPF_SUMMARY_LSA:
557
case OSPF_ASBR_SUMMARY_LSA:
558
ospf_summary_lsa_dump (s, length);
560
case OSPF_AS_EXTERNAL_LSA:
561
ospf_as_external_lsa_dump (s, length);
564
case OSPF_AS_NSSA_LSA:
565
ospf_as_external_lsa_dump (s, length);
567
#endif /* HAVE_NSSA */
568
#ifdef HAVE_OPAQUE_LSA
569
case OSPF_OPAQUE_LINK_LSA:
570
case OSPF_OPAQUE_AREA_LSA:
571
case OSPF_OPAQUE_AS_LSA:
572
ospf_opaque_lsa_dump (s, length);
574
#endif /* HAVE_OPAQUE_LSA */
579
stream_forward (s, lsa_len);
584
stream_set_getp (s, sp);
588
ospf_packet_ls_ack_dump (struct stream *s, u_int16_t length)
592
length -= OSPF_HEADER_SIZE;
593
sp = stream_get_getp (s);
595
zlog_info ("Link State Acknowledgment");
596
ospf_lsa_header_list_dump (s, length);
598
stream_set_getp (s, sp);
602
ospf_ip_header_dump (struct stream *s)
607
iph = (struct ip *) STREAM_PNT (s);
610
length = ntohs (iph->ip_len);
611
#else /* GNU_LINUX */
612
length = iph->ip_len;
613
#endif /* GNU_LINUX */
615
/* IP Header dump. */
616
zlog_info ("ip_v %d", iph->ip_v);
617
zlog_info ("ip_hl %d", iph->ip_hl);
618
zlog_info ("ip_tos %d", iph->ip_tos);
619
zlog_info ("ip_len %d", length);
620
zlog_info ("ip_id %u", (u_int32_t) iph->ip_id);
621
zlog_info ("ip_off %u", (u_int32_t) iph->ip_off);
622
zlog_info ("ip_ttl %d", iph->ip_ttl);
623
zlog_info ("ip_p %d", iph->ip_p);
624
/* There is a report that Linux 2.0.37 does not have ip_sum. But
625
I'm not sure. Temporary commented out by kunihiro. */
626
/* zlog_info ("ip_sum 0x%x", (u_int32_t) ntohs (iph->ip_sum)); */
627
zlog_info ("ip_src %s", inet_ntoa (iph->ip_src));
628
zlog_info ("ip_dst %s", inet_ntoa (iph->ip_dst));
632
ospf_header_dump (struct ospf_header *ospfh)
636
zlog_info ("Header");
637
zlog_info (" Version %d", ospfh->version);
638
zlog_info (" Type %d (%s)", ospfh->type,
639
ospf_packet_type_str[ospfh->type]);
640
zlog_info (" Packet Len %d", ntohs (ospfh->length));
641
zlog_info (" Router ID %s", inet_ntoa (ospfh->router_id));
642
zlog_info (" Area ID %s", inet_ntoa (ospfh->area_id));
643
zlog_info (" Checksum 0x%x", ntohs (ospfh->checksum));
644
zlog_info (" AuType %d", ntohs (ospfh->auth_type));
646
switch (ntohs (ospfh->auth_type))
650
case OSPF_AUTH_SIMPLE:
652
strncpy (buf, ospfh->u.auth_data, 8);
653
zlog_info (" Simple Password %s", buf);
655
case OSPF_AUTH_CRYPTOGRAPHIC:
656
zlog_info (" Cryptographic Authentication");
657
zlog_info (" Key ID %d", ospfh->u.crypt.key_id);
658
zlog_info (" Auth Data Len %d", ospfh->u.crypt.auth_data_len);
659
zlog_info (" Sequence number %ld",
660
(u_long)ntohl (ospfh->u.crypt.crypt_seqnum));
663
zlog_info ("* This is not supported authentication type");
670
ospf_packet_dump (struct stream *s)
672
struct ospf_header *ospfh;
675
/* Preserve pointer. */
676
gp = stream_get_getp (s);
678
/* OSPF Header dump. */
679
ospfh = (struct ospf_header *) STREAM_PNT (s);
681
/* Until detail flag is set, return. */
682
if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL))
685
/* Show OSPF header detail. */
686
ospf_header_dump (ospfh);
687
stream_forward (s, OSPF_HEADER_SIZE);
692
ospf_packet_hello_dump (s, ntohs (ospfh->length));
694
case OSPF_MSG_DB_DESC:
695
ospf_packet_db_desc_dump (s, ntohs (ospfh->length));
697
case OSPF_MSG_LS_REQ:
698
ospf_packet_ls_req_dump (s, ntohs (ospfh->length));
700
case OSPF_MSG_LS_UPD:
701
ospf_packet_ls_upd_dump (s, ntohs (ospfh->length));
703
case OSPF_MSG_LS_ACK:
704
ospf_packet_ls_ack_dump (s, ntohs (ospfh->length));
710
stream_set_getp (s, gp);
715
[no] debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)
718
DEFUN (debug_ospf_packet,
719
debug_ospf_packet_all_cmd,
720
"debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)",
725
"OSPF Database Description\n"
726
"OSPF Link State Request\n"
727
"OSPF Link State Update\n"
728
"OSPF Link State Acknowledgment\n"
729
"OSPF all packets\n")
737
/* Check packet type. */
738
if (strncmp (argv[0], "h", 1) == 0)
739
type = OSPF_DEBUG_HELLO;
740
else if (strncmp (argv[0], "d", 1) == 0)
741
type = OSPF_DEBUG_DB_DESC;
742
else if (strncmp (argv[0], "ls-r", 4) == 0)
743
type = OSPF_DEBUG_LS_REQ;
744
else if (strncmp (argv[0], "ls-u", 4) == 0)
745
type = OSPF_DEBUG_LS_UPD;
746
else if (strncmp (argv[0], "ls-a", 4) == 0)
747
type = OSPF_DEBUG_LS_ACK;
748
else if (strncmp (argv[0], "a", 1) == 0)
749
type = OSPF_DEBUG_ALL;
751
/* Default, both send and recv. */
753
flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV;
758
if (strncmp (argv[1], "s", 1) == 0)
759
flag = OSPF_DEBUG_SEND;
760
else if (strncmp (argv[1], "r", 1) == 0)
761
flag = OSPF_DEBUG_RECV;
762
else if (strncmp (argv[1], "d", 1) == 0)
763
flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
768
if (strncmp (argv[2], "d", 1) == 0)
769
flag |= OSPF_DEBUG_DETAIL;
771
for (i = 0; i < 5; i++)
772
if (type & (0x01 << i))
774
if (vty->node == CONFIG_NODE)
775
DEBUG_PACKET_ON (i, flag);
777
TERM_DEBUG_PACKET_ON (i, flag);
783
ALIAS (debug_ospf_packet,
784
debug_ospf_packet_send_recv_cmd,
785
"debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
786
"Debugging functions\n"
790
"OSPF Database Description\n"
791
"OSPF Link State Request\n"
792
"OSPF Link State Update\n"
793
"OSPF Link State Acknowledgment\n"
797
"Detail information\n")
799
ALIAS (debug_ospf_packet,
800
debug_ospf_packet_send_recv_detail_cmd,
801
"debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
802
"Debugging functions\n"
806
"OSPF Database Description\n"
807
"OSPF Link State Request\n"
808
"OSPF Link State Update\n"
809
"OSPF Link State Acknowledgment\n"
813
"Detail Information\n")
816
DEFUN (no_debug_ospf_packet,
817
no_debug_ospf_packet_all_cmd,
818
"no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)",
824
"OSPF Database Description\n"
825
"OSPF Link State Request\n"
826
"OSPF Link State Update\n"
827
"OSPF Link State Acknowledgment\n"
828
"OSPF all packets\n")
836
/* Check packet type. */
837
if (strncmp (argv[0], "h", 1) == 0)
838
type = OSPF_DEBUG_HELLO;
839
else if (strncmp (argv[0], "d", 1) == 0)
840
type = OSPF_DEBUG_DB_DESC;
841
else if (strncmp (argv[0], "ls-r", 4) == 0)
842
type = OSPF_DEBUG_LS_REQ;
843
else if (strncmp (argv[0], "ls-u", 4) == 0)
844
type = OSPF_DEBUG_LS_UPD;
845
else if (strncmp (argv[0], "ls-a", 4) == 0)
846
type = OSPF_DEBUG_LS_ACK;
847
else if (strncmp (argv[0], "a", 1) == 0)
848
type = OSPF_DEBUG_ALL;
850
/* Default, both send and recv. */
852
flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL ;
857
if (strncmp (argv[1], "s", 1) == 0)
858
flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL;
859
else if (strncmp (argv[1], "r", 1) == 0)
860
flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
861
else if (strncmp (argv[1], "d", 1) == 0)
862
flag = OSPF_DEBUG_DETAIL;
867
if (strncmp (argv[2], "d", 1) == 0)
868
flag = OSPF_DEBUG_DETAIL;
870
for (i = 0; i < 5; i++)
871
if (type & (0x01 << i))
873
if (vty->node == CONFIG_NODE)
874
DEBUG_PACKET_OFF (i, flag);
876
TERM_DEBUG_PACKET_OFF (i, flag);
880
for (i = 0; i < 5; i++)
881
zlog_info ("flag[%d] = %d", i, ospf_debug_packet[i]);
887
ALIAS (no_debug_ospf_packet,
888
no_debug_ospf_packet_send_recv_cmd,
889
"no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
891
"Debugging functions\n"
895
"OSPF Database Description\n"
896
"OSPF Link State Request\n"
897
"OSPF Link State Update\n"
898
"OSPF Link State Acknowledgment\n"
902
"Detail Information\n")
904
ALIAS (no_debug_ospf_packet,
905
no_debug_ospf_packet_send_recv_detail_cmd,
906
"no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
908
"Debugging functions\n"
912
"OSPF Database Description\n"
913
"OSPF Link State Request\n"
914
"OSPF Link State Update\n"
915
"OSPF Link State Acknowledgment\n"
919
"Detail Information\n")
922
DEFUN (debug_ospf_ism,
927
"OSPF Interface State Machine\n")
929
if (vty->node == CONFIG_NODE)
935
if (strncmp (argv[0], "s", 1) == 0)
936
DEBUG_ON (ism, ISM_STATUS);
937
else if (strncmp (argv[0], "e", 1) == 0)
938
DEBUG_ON (ism, ISM_EVENTS);
939
else if (strncmp (argv[0], "t", 1) == 0)
940
DEBUG_ON (ism, ISM_TIMERS);
948
TERM_DEBUG_ON (ism, ISM);
951
if (strncmp (argv[0], "s", 1) == 0)
952
TERM_DEBUG_ON (ism, ISM_STATUS);
953
else if (strncmp (argv[0], "e", 1) == 0)
954
TERM_DEBUG_ON (ism, ISM_EVENTS);
955
else if (strncmp (argv[0], "t", 1) == 0)
956
TERM_DEBUG_ON (ism, ISM_TIMERS);
962
ALIAS (debug_ospf_ism,
963
debug_ospf_ism_sub_cmd,
964
"debug ospf ism (status|events|timers)",
967
"OSPF Interface State Machine\n"
968
"ISM Status Information\n"
969
"ISM Event Information\n"
970
"ISM TImer Information\n")
972
DEFUN (no_debug_ospf_ism,
973
no_debug_ospf_ism_cmd,
978
"OSPF Interface State Machine")
980
if (vty->node == CONFIG_NODE)
983
DEBUG_OFF (ism, ISM);
986
if (strncmp (argv[0], "s", 1) == 0)
987
DEBUG_OFF (ism, ISM_STATUS);
988
else if (strncmp (argv[0], "e", 1) == 0)
989
DEBUG_OFF (ism, ISM_EVENTS);
990
else if (strncmp (argv[0], "t", 1) == 0)
991
DEBUG_OFF (ism, ISM_TIMERS);
998
TERM_DEBUG_OFF (ism, ISM);
1001
if (strncmp (argv[0], "s", 1) == 0)
1002
TERM_DEBUG_OFF (ism, ISM_STATUS);
1003
else if (strncmp (argv[0], "e", 1) == 0)
1004
TERM_DEBUG_OFF (ism, ISM_EVENTS);
1005
else if (strncmp (argv[0], "t", 1) == 0)
1006
TERM_DEBUG_OFF (ism, ISM_TIMERS);
1012
ALIAS (no_debug_ospf_ism,
1013
no_debug_ospf_ism_sub_cmd,
1014
"no debug ospf ism (status|events|timers)",
1016
"Debugging functions\n"
1017
"OSPF information\n"
1018
"OSPF Interface State Machine\n"
1019
"ISM Status Information\n"
1020
"ISM Event Information\n"
1021
"ISM Timer Information\n")
1024
DEFUN (debug_ospf_nsm,
1029
"OSPF Neighbor State Machine\n")
1031
if (vty->node == CONFIG_NODE)
1034
DEBUG_ON (nsm, NSM);
1037
if (strncmp (argv[0], "s", 1) == 0)
1038
DEBUG_ON (nsm, NSM_STATUS);
1039
else if (strncmp (argv[0], "e", 1) == 0)
1040
DEBUG_ON (nsm, NSM_EVENTS);
1041
else if (strncmp (argv[0], "t", 1) == 0)
1042
DEBUG_ON (nsm, NSM_TIMERS);
1050
TERM_DEBUG_ON (nsm, NSM);
1053
if (strncmp (argv[0], "s", 1) == 0)
1054
TERM_DEBUG_ON (nsm, NSM_STATUS);
1055
else if (strncmp (argv[0], "e", 1) == 0)
1056
TERM_DEBUG_ON (nsm, NSM_EVENTS);
1057
else if (strncmp (argv[0], "t", 1) == 0)
1058
TERM_DEBUG_ON (nsm, NSM_TIMERS);
1064
ALIAS (debug_ospf_nsm,
1065
debug_ospf_nsm_sub_cmd,
1066
"debug ospf nsm (status|events|timers)",
1069
"OSPF Neighbor State Machine\n"
1070
"NSM Status Information\n"
1071
"NSM Event Information\n"
1072
"NSM Timer Information\n")
1074
DEFUN (no_debug_ospf_nsm,
1075
no_debug_ospf_nsm_cmd,
1076
"no debug ospf nsm",
1080
"OSPF Neighbor State Machine")
1082
if (vty->node == CONFIG_NODE)
1085
DEBUG_OFF (nsm, NSM);
1088
if (strncmp (argv[0], "s", 1) == 0)
1089
DEBUG_OFF (nsm, NSM_STATUS);
1090
else if (strncmp (argv[0], "e", 1) == 0)
1091
DEBUG_OFF (nsm, NSM_EVENTS);
1092
else if (strncmp (argv[0], "t", 1) == 0)
1093
DEBUG_OFF (nsm, NSM_TIMERS);
1101
TERM_DEBUG_OFF (nsm, NSM);
1104
if (strncmp (argv[0], "s", 1) == 0)
1105
TERM_DEBUG_OFF (nsm, NSM_STATUS);
1106
else if (strncmp (argv[0], "e", 1) == 0)
1107
TERM_DEBUG_OFF (nsm, NSM_EVENTS);
1108
else if (strncmp (argv[0], "t", 1) == 0)
1109
TERM_DEBUG_OFF (nsm, NSM_TIMERS);
1115
ALIAS (no_debug_ospf_nsm,
1116
no_debug_ospf_nsm_sub_cmd,
1117
"no debug ospf nsm (status|events|timers)",
1119
"Debugging functions\n"
1120
"OSPF information\n"
1121
"OSPF Interface State Machine\n"
1122
"NSM Status Information\n"
1123
"NSM Event Information\n"
1124
"NSM Timer Information\n")
1127
DEFUN (debug_ospf_lsa,
1132
"OSPF Link State Advertisement\n")
1134
if (vty->node == CONFIG_NODE)
1137
DEBUG_ON (lsa, LSA);
1140
if (strncmp (argv[0], "g", 1) == 0)
1141
DEBUG_ON (lsa, LSA_GENERATE);
1142
else if (strncmp (argv[0], "f", 1) == 0)
1143
DEBUG_ON (lsa, LSA_FLOODING);
1144
else if (strncmp (argv[0], "i", 1) == 0)
1145
DEBUG_ON (lsa, LSA_INSTALL);
1146
else if (strncmp (argv[0], "r", 1) == 0)
1147
DEBUG_ON (lsa, LSA_REFRESH);
1155
TERM_DEBUG_ON (lsa, LSA);
1158
if (strncmp (argv[0], "g", 1) == 0)
1159
TERM_DEBUG_ON (lsa, LSA_GENERATE);
1160
else if (strncmp (argv[0], "f", 1) == 0)
1161
TERM_DEBUG_ON (lsa, LSA_FLOODING);
1162
else if (strncmp (argv[0], "i", 1) == 0)
1163
TERM_DEBUG_ON (lsa, LSA_INSTALL);
1164
else if (strncmp (argv[0], "r", 1) == 0)
1165
TERM_DEBUG_ON (lsa, LSA_REFRESH);
1171
ALIAS (debug_ospf_lsa,
1172
debug_ospf_lsa_sub_cmd,
1173
"debug ospf lsa (generate|flooding|install|refresh)",
1176
"OSPF Link State Advertisement\n"
1179
"LSA Install/Delete\n"
1182
DEFUN (no_debug_ospf_lsa,
1183
no_debug_ospf_lsa_cmd,
1184
"no debug ospf lsa",
1188
"OSPF Link State Advertisement\n")
1190
if (vty->node == CONFIG_NODE)
1193
DEBUG_OFF (lsa, LSA);
1196
if (strncmp (argv[0], "g", 1) == 0)
1197
DEBUG_OFF (lsa, LSA_GENERATE);
1198
else if (strncmp (argv[0], "f", 1) == 0)
1199
DEBUG_OFF (lsa, LSA_FLOODING);
1200
else if (strncmp (argv[0], "i", 1) == 0)
1201
DEBUG_OFF (lsa, LSA_INSTALL);
1202
else if (strncmp (argv[0], "r", 1) == 0)
1203
DEBUG_OFF (lsa, LSA_REFRESH);
1211
TERM_DEBUG_OFF (lsa, LSA);
1214
if (strncmp (argv[0], "g", 1) == 0)
1215
TERM_DEBUG_OFF (lsa, LSA_GENERATE);
1216
else if (strncmp (argv[0], "f", 1) == 0)
1217
TERM_DEBUG_OFF (lsa, LSA_FLOODING);
1218
else if (strncmp (argv[0], "i", 1) == 0)
1219
TERM_DEBUG_OFF (lsa, LSA_INSTALL);
1220
else if (strncmp (argv[0], "r", 1) == 0)
1221
TERM_DEBUG_OFF (lsa, LSA_REFRESH);
1227
ALIAS (no_debug_ospf_lsa,
1228
no_debug_ospf_lsa_sub_cmd,
1229
"no debug ospf lsa (generate|flooding|install|refresh)",
1233
"OSPF Link State Advertisement\n"
1236
"LSA Install/Delete\n"
1240
DEFUN (debug_ospf_zebra,
1241
debug_ospf_zebra_cmd,
1245
"OSPF Zebra information\n")
1247
if (vty->node == CONFIG_NODE)
1250
DEBUG_ON (zebra, ZEBRA);
1253
if (strncmp (argv[0], "i", 1) == 0)
1254
DEBUG_ON (zebra, ZEBRA_INTERFACE);
1255
else if (strncmp (argv[0], "r", 1) == 0)
1256
DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1264
TERM_DEBUG_ON (zebra, ZEBRA);
1267
if (strncmp (argv[0], "i", 1) == 0)
1268
TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE);
1269
else if (strncmp (argv[0], "r", 1) == 0)
1270
TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1276
ALIAS (debug_ospf_zebra,
1277
debug_ospf_zebra_sub_cmd,
1278
"debug ospf zebra (interface|redistribute)",
1281
"OSPF Zebra information\n"
1283
"Zebra redistribute\n")
1285
DEFUN (no_debug_ospf_zebra,
1286
no_debug_ospf_zebra_cmd,
1287
"no debug ospf zebra",
1291
"OSPF Zebra information\n")
1293
if (vty->node == CONFIG_NODE)
1296
DEBUG_OFF (zebra, ZEBRA);
1299
if (strncmp (argv[0], "i", 1) == 0)
1300
DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1301
else if (strncmp (argv[0], "r", 1) == 0)
1302
DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1310
TERM_DEBUG_OFF (zebra, ZEBRA);
1313
if (strncmp (argv[0], "i", 1) == 0)
1314
TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1315
else if (strncmp (argv[0], "r", 1) == 0)
1316
TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1322
ALIAS (no_debug_ospf_zebra,
1323
no_debug_ospf_zebra_sub_cmd,
1324
"no debug ospf zebra (interface|redistribute)",
1328
"OSPF Zebra information\n"
1330
"Zebra redistribute\n")
1332
DEFUN (debug_ospf_event,
1333
debug_ospf_event_cmd,
1337
"OSPF event information\n")
1339
if (vty->node == CONFIG_NODE)
1340
CONF_DEBUG_ON (event, EVENT);
1341
TERM_DEBUG_ON (event, EVENT);
1345
DEFUN (no_debug_ospf_event,
1346
no_debug_ospf_event_cmd,
1347
"no debug ospf event",
1351
"OSPF event information\n")
1353
if (vty->node == CONFIG_NODE)
1354
CONF_DEBUG_OFF (event, EVENT);
1355
TERM_DEBUG_OFF (event, EVENT);
1359
DEFUN (debug_ospf_nssa,
1360
debug_ospf_nssa_cmd,
1364
"OSPF nssa information\n")
1366
if (vty->node == CONFIG_NODE)
1367
CONF_DEBUG_ON (nssa, NSSA);
1368
TERM_DEBUG_ON (nssa, NSSA);
1372
DEFUN (no_debug_ospf_nssa,
1373
no_debug_ospf_nssa_cmd,
1374
"no debug ospf nssa",
1378
"OSPF nssa information\n")
1380
if (vty->node == CONFIG_NODE)
1381
CONF_DEBUG_OFF (nssa, NSSA);
1382
TERM_DEBUG_OFF (nssa, NSSA);
1387
DEFUN (show_debugging_ospf,
1388
show_debugging_ospf_cmd,
1389
"show debugging ospf",
1396
vty_out (vty, "Zebra debugging status:%s", VTY_NEWLINE);
1398
/* Show debug status for ISM. */
1399
if (IS_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
1400
vty_out (vty, " OSPF ISM debugging is on%s", VTY_NEWLINE);
1403
if (IS_DEBUG_OSPF (ism, ISM_STATUS))
1404
vty_out (vty, " OSPF ISM status debugging is on%s", VTY_NEWLINE);
1405
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
1406
vty_out (vty, " OSPF ISM event debugging is on%s", VTY_NEWLINE);
1407
if (IS_DEBUG_OSPF (ism, ISM_TIMERS))
1408
vty_out (vty, " OSPF ISM timer debugging is on%s", VTY_NEWLINE);
1411
/* Show debug status for NSM. */
1412
if (IS_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
1413
vty_out (vty, " OSPF NSM debugging is on%s", VTY_NEWLINE);
1416
if (IS_DEBUG_OSPF (nsm, NSM_STATUS))
1417
vty_out (vty, " OSPF NSM status debugging is on%s", VTY_NEWLINE);
1418
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
1419
vty_out (vty, " OSPF NSM event debugging is on%s", VTY_NEWLINE);
1420
if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
1421
vty_out (vty, " OSPF NSM timer debugging is on%s", VTY_NEWLINE);
1424
/* Show debug status for OSPF Packets. */
1425
for (i = 0; i < 5; i++)
1426
if (IS_DEBUG_OSPF_PACKET (i, SEND) && IS_DEBUG_OSPF_PACKET (i, RECV))
1428
vty_out (vty, " OSPF packet %s%s debugging is on%s",
1429
ospf_packet_type_str[i + 1],
1430
IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1435
if (IS_DEBUG_OSPF_PACKET (i, SEND))
1436
vty_out (vty, " OSPF packet %s send%s debugging is on%s",
1437
ospf_packet_type_str[i + 1],
1438
IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1440
if (IS_DEBUG_OSPF_PACKET (i, RECV))
1441
vty_out (vty, " OSPF packet %s receive%s debugging is on%s",
1442
ospf_packet_type_str[i + 1],
1443
IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1447
/* Show debug status for OSPF LSAs. */
1448
if (IS_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
1449
vty_out (vty, " OSPF LSA debugging is on%s", VTY_NEWLINE);
1452
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
1453
vty_out (vty, " OSPF LSA generation debugging is on%s", VTY_NEWLINE);
1454
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
1455
vty_out (vty, " OSPF LSA flooding debugging is on%s", VTY_NEWLINE);
1456
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
1457
vty_out (vty, " OSPF LSA install debugging is on%s", VTY_NEWLINE);
1458
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
1459
vty_out (vty, " OSPF LSA refresh debugging is on%s", VTY_NEWLINE);
1462
/* Show debug status for Zebra. */
1463
if (IS_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
1464
vty_out (vty, " OSPF Zebra debugging is on%s", VTY_NEWLINE);
1467
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
1468
vty_out (vty, " OSPF Zebra interface debugging is on%s", VTY_NEWLINE);
1469
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
1470
vty_out (vty, " OSPF Zebra redistribute debugging is on%s", VTY_NEWLINE);
1472
if (IS_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
1473
vty_out (vty, " OSPF NSSA debugging is on%s", VTY_NEWLINE);
1479
struct cmd_node debug_node =
1486
config_write_debug (struct vty *vty)
1491
char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
1492
char *detail_str[] = {"", " send", " recv", "", " detail",
1493
" send detail", " recv detail", " detail"};
1495
/* debug ospf ism (status|events|timers). */
1496
if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
1497
vty_out (vty, "debug ospf ism%s", VTY_NEWLINE);
1500
if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
1501
vty_out (vty, "debug ospf ism status%s", VTY_NEWLINE);
1502
if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
1503
vty_out (vty, "debug ospf ism event%s", VTY_NEWLINE);
1504
if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
1505
vty_out (vty, "debug ospf ism timer%s", VTY_NEWLINE);
1508
/* debug ospf nsm (status|events|timers). */
1509
if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
1510
vty_out (vty, "debug ospf nsm%s", VTY_NEWLINE);
1513
if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
1514
vty_out (vty, "debug ospf ism status%s", VTY_NEWLINE);
1515
if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
1516
vty_out (vty, "debug ospf nsm event%s", VTY_NEWLINE);
1517
if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
1518
vty_out (vty, "debug ospf nsm timer%s", VTY_NEWLINE);
1521
/* debug ospf lsa (generate|flooding|install|refresh). */
1522
if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
1523
vty_out (vty, "debug ospf lsa%s", VTY_NEWLINE);
1526
if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
1527
vty_out (vty, "debug ospf lsa generate%s", VTY_NEWLINE);
1528
if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
1529
vty_out (vty, "debug ospf lsa flooding%s", VTY_NEWLINE);
1530
if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
1531
vty_out (vty, "debug ospf lsa install%s", VTY_NEWLINE);
1532
if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
1533
vty_out (vty, "debug ospf lsa refresh%s", VTY_NEWLINE);
1538
/* debug ospf zebra (interface|redistribute). */
1539
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
1540
vty_out (vty, "debug ospf zebra%s", VTY_NEWLINE);
1543
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
1544
vty_out (vty, "debug ospf zebra interface%s", VTY_NEWLINE);
1545
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
1546
vty_out (vty, "debug ospf zebra redistribute%s", VTY_NEWLINE);
1551
/* debug ospf event. */
1552
if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
1554
vty_out (vty, "debug ospf event%s", VTY_NEWLINE);
1558
/* debug ospf nssa. */
1559
if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
1561
vty_out (vty, "debug ospf nssa%s", VTY_NEWLINE);
1565
/* debug ospf packet all detail. */
1566
r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
1567
for (i = 0; i < 5; i++)
1568
r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
1569
if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
1571
vty_out (vty, "debug ospf packet all detail%s", VTY_NEWLINE);
1575
/* debug ospf packet all. */
1576
r = OSPF_DEBUG_SEND_RECV;
1577
for (i = 0; i < 5; i++)
1578
r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
1579
if (r == OSPF_DEBUG_SEND_RECV)
1581
vty_out (vty, "debug ospf packet all%s", VTY_NEWLINE);
1582
for (i = 0; i < 5; i++)
1583
if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
1584
vty_out (vty, "debug ospf packet %s detail%s",
1590
/* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
1591
(send|recv) (detail). */
1592
for (i = 0; i < 5; i++)
1594
if (conf_debug_ospf_packet[i] == 0)
1597
vty_out (vty, "debug ospf packet %s%s%s",
1598
type_str[i], detail_str[conf_debug_ospf_packet[i]],
1606
/* Initialize debug commands. */
1610
install_node (&debug_node, config_write_debug);
1612
install_element (ENABLE_NODE, &show_debugging_ospf_cmd);
1613
install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_detail_cmd);
1614
install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_cmd);
1615
install_element (ENABLE_NODE, &debug_ospf_packet_all_cmd);
1616
install_element (ENABLE_NODE, &debug_ospf_ism_sub_cmd);
1617
install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
1618
install_element (ENABLE_NODE, &debug_ospf_nsm_sub_cmd);
1619
install_element (ENABLE_NODE, &debug_ospf_nsm_cmd);
1620
install_element (ENABLE_NODE, &debug_ospf_lsa_sub_cmd);
1621
install_element (ENABLE_NODE, &debug_ospf_lsa_cmd);
1622
install_element (ENABLE_NODE, &debug_ospf_zebra_sub_cmd);
1623
install_element (ENABLE_NODE, &debug_ospf_zebra_cmd);
1624
install_element (ENABLE_NODE, &debug_ospf_event_cmd);
1626
install_element (ENABLE_NODE, &debug_ospf_nssa_cmd);
1627
#endif /* HAVE_NSSA */
1628
install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_detail_cmd);
1629
install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_cmd);
1630
install_element (ENABLE_NODE, &no_debug_ospf_packet_all_cmd);
1631
install_element (ENABLE_NODE, &no_debug_ospf_ism_sub_cmd);
1632
install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
1633
install_element (ENABLE_NODE, &no_debug_ospf_nsm_sub_cmd);
1634
install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd);
1635
install_element (ENABLE_NODE, &no_debug_ospf_lsa_sub_cmd);
1636
install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd);
1637
install_element (ENABLE_NODE, &no_debug_ospf_zebra_sub_cmd);
1638
install_element (ENABLE_NODE, &no_debug_ospf_zebra_cmd);
1639
install_element (ENABLE_NODE, &no_debug_ospf_event_cmd);
1641
install_element (ENABLE_NODE, &no_debug_ospf_nssa_cmd);
1642
#endif /* HAVE_NSSA */
1644
install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_detail_cmd);
1645
install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_cmd);
1646
install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd);
1647
install_element (CONFIG_NODE, &debug_ospf_ism_sub_cmd);
1648
install_element (CONFIG_NODE, &debug_ospf_ism_cmd);
1649
install_element (CONFIG_NODE, &debug_ospf_nsm_sub_cmd);
1650
install_element (CONFIG_NODE, &debug_ospf_nsm_cmd);
1651
install_element (CONFIG_NODE, &debug_ospf_lsa_sub_cmd);
1652
install_element (CONFIG_NODE, &debug_ospf_lsa_cmd);
1653
install_element (CONFIG_NODE, &debug_ospf_zebra_sub_cmd);
1654
install_element (CONFIG_NODE, &debug_ospf_zebra_cmd);
1655
install_element (CONFIG_NODE, &debug_ospf_event_cmd);
1657
install_element (CONFIG_NODE, &debug_ospf_nssa_cmd);
1658
#endif /* HAVE_NSSA */
1659
install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_detail_cmd);
1660
install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_cmd);
1661
install_element (CONFIG_NODE, &no_debug_ospf_packet_all_cmd);
1662
install_element (CONFIG_NODE, &no_debug_ospf_ism_sub_cmd);
1663
install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
1664
install_element (CONFIG_NODE, &no_debug_ospf_nsm_sub_cmd);
1665
install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd);
1666
install_element (CONFIG_NODE, &no_debug_ospf_lsa_sub_cmd);
1667
install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd);
1668
install_element (CONFIG_NODE, &no_debug_ospf_zebra_sub_cmd);
1669
install_element (CONFIG_NODE, &no_debug_ospf_zebra_cmd);
1670
install_element (CONFIG_NODE, &no_debug_ospf_event_cmd);
1672
install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd);
1673
#endif /* HAVE_NSSA */