]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_dump.c
all: scrubbed some argc CHECK MEs
[mirror_frr.git] / ospfd / ospf_dump.c
CommitLineData
718e3744 1/*
2 * OSPFd dump routine.
3 * Copyright (C) 1999, 2000 Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
6 *
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
10 * later version.
11 *
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.
16 *
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.
21 */
22
23#include <zebra.h>
24
25#include "linklist.h"
26#include "thread.h"
27#include "prefix.h"
28#include "command.h"
29#include "stream.h"
30#include "log.h"
aa20c6f1 31#include "sockopt.h"
718e3744 32
33#include "ospfd/ospfd.h"
34#include "ospfd/ospf_interface.h"
35#include "ospfd/ospf_ism.h"
36#include "ospfd/ospf_asbr.h"
37#include "ospfd/ospf_lsa.h"
38#include "ospfd/ospf_lsdb.h"
39#include "ospfd/ospf_neighbor.h"
40#include "ospfd/ospf_nsm.h"
41#include "ospfd/ospf_dump.h"
42#include "ospfd/ospf_packet.h"
43#include "ospfd/ospf_network.h"
44
7ba82f70 45const struct message ospf_ism_state_msg[] =
718e3744 46{
47 { ISM_DependUpon, "DependUpon" },
48 { ISM_Down, "Down" },
49 { ISM_Loopback, "Loopback" },
50 { ISM_Waiting, "Waiting" },
51 { ISM_PointToPoint, "Point-To-Point" },
52 { ISM_DROther, "DROther" },
53 { ISM_Backup, "Backup" },
54 { ISM_DR, "DR" },
55};
7ba82f70 56const int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
718e3744 57
7ba82f70 58const struct message ospf_nsm_state_msg[] =
718e3744 59{
60 { NSM_DependUpon, "DependUpon" },
1f2c2743 61 { NSM_Deleted, "Deleted" },
718e3744 62 { NSM_Down, "Down" },
63 { NSM_Attempt, "Attempt" },
64 { NSM_Init, "Init" },
65 { NSM_TwoWay, "2-Way" },
66 { NSM_ExStart, "ExStart" },
67 { NSM_Exchange, "Exchange" },
68 { NSM_Loading, "Loading" },
69 { NSM_Full, "Full" },
70};
7ba82f70 71const int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
718e3744 72
7ba82f70 73const struct message ospf_lsa_type_msg[] =
718e3744 74{
75 { OSPF_UNKNOWN_LSA, "unknown" },
76 { OSPF_ROUTER_LSA, "router-LSA" },
77 { OSPF_NETWORK_LSA, "network-LSA" },
78 { OSPF_SUMMARY_LSA, "summary-LSA" },
79 { OSPF_ASBR_SUMMARY_LSA, "summary-LSA" },
80 { OSPF_AS_EXTERNAL_LSA, "AS-external-LSA" },
81 { OSPF_GROUP_MEMBER_LSA, "GROUP MEMBER LSA" },
82 { OSPF_AS_NSSA_LSA, "NSSA-LSA" },
83 { 8, "Type-8 LSA" },
84 { OSPF_OPAQUE_LINK_LSA, "Link-Local Opaque-LSA" },
85 { OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" },
86 { OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" },
87};
7ba82f70 88const int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
718e3744 89
7ba82f70 90const struct message ospf_link_state_id_type_msg[] =
718e3744 91{
92 { OSPF_UNKNOWN_LSA, "(unknown)" },
93 { OSPF_ROUTER_LSA, "" },
94 { OSPF_NETWORK_LSA, "(address of Designated Router)" },
95 { OSPF_SUMMARY_LSA, "(summary Network Number)" },
96 { OSPF_ASBR_SUMMARY_LSA, "(AS Boundary Router address)" },
97 { OSPF_AS_EXTERNAL_LSA, "(External Network Number)" },
98 { OSPF_GROUP_MEMBER_LSA, "(Group membership information)" },
99 { OSPF_AS_NSSA_LSA, "(External Network Number for NSSA)" },
100 { 8, "(Type-8 LSID)" },
101 { OSPF_OPAQUE_LINK_LSA, "(Link-Local Opaque-Type/ID)" },
102 { OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" },
103 { OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" },
104};
7ba82f70 105const int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
718e3744 106
7ba82f70 107const struct message ospf_network_type_msg[] =
718e3744 108{
109 { OSPF_IFTYPE_NONE, "NONE" },
110 { OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" },
111 { OSPF_IFTYPE_BROADCAST, "Broadcast" },
112 { OSPF_IFTYPE_NBMA, "NBMA" },
113 { OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" },
114 { OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" },
115};
7ba82f70 116const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
718e3744 117
ef1b78cb
DO
118/* AuType */
119const struct message ospf_auth_type_str[] =
120{
121 { OSPF_AUTH_NULL, "Null" },
122 { OSPF_AUTH_SIMPLE, "Simple" },
123 { OSPF_AUTH_CRYPTOGRAPHIC, "Cryptographic" },
124};
125const size_t ospf_auth_type_str_max = sizeof (ospf_auth_type_str) /
126 sizeof (ospf_auth_type_str[0]);
127
718e3744 128/* Configuration debug option variables. */
129unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
130unsigned long conf_debug_ospf_event = 0;
131unsigned long conf_debug_ospf_ism = 0;
132unsigned long conf_debug_ospf_nsm = 0;
133unsigned long conf_debug_ospf_lsa = 0;
134unsigned long conf_debug_ospf_zebra = 0;
135unsigned long conf_debug_ospf_nssa = 0;
16f1b9ee 136unsigned long conf_debug_ospf_te = 0;
718e3744 137
138/* Enable debug option variables -- valid only session. */
139unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
140unsigned long term_debug_ospf_event = 0;
141unsigned long term_debug_ospf_ism = 0;
142unsigned long term_debug_ospf_nsm = 0;
143unsigned long term_debug_ospf_lsa = 0;
144unsigned long term_debug_ospf_zebra = 0;
145unsigned long term_debug_ospf_nssa = 0;
16f1b9ee 146unsigned long term_debug_ospf_te = 0;
6b0655a2 147
f52d13cb 148
149const char *
150ospf_redist_string(u_int route_type)
151{
152 return (route_type == ZEBRA_ROUTE_MAX) ?
153 "Default" : zebra_route_string(route_type);
154}
155
718e3744 156#define OSPF_AREA_STRING_MAXLEN 16
eb1ce605 157const char *
718e3744 158ospf_area_name_string (struct ospf_area *area)
159{
160 static char buf[OSPF_AREA_STRING_MAXLEN] = "";
161 u_int32_t area_id;
162
163 if (!area)
164 return "-";
165
166 area_id = ntohl (area->area_id.s_addr);
167 snprintf (buf, OSPF_AREA_STRING_MAXLEN, "%d.%d.%d.%d",
168 (area_id >> 24) & 0xff, (area_id >> 16) & 0xff,
169 (area_id >> 8) & 0xff, area_id & 0xff);
170 return buf;
171}
172
173#define OSPF_AREA_DESC_STRING_MAXLEN 23
eb1ce605 174const char *
718e3744 175ospf_area_desc_string (struct ospf_area *area)
176{
177 static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = "";
178 u_char type;
179
180 if (!area)
181 return "(incomplete)";
182
183 type = area->external_routing;
184 switch (type)
185 {
186 case OSPF_AREA_NSSA:
187 snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [NSSA]",
188 ospf_area_name_string (area));
189 break;
190 case OSPF_AREA_STUB:
191 snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [Stub]",
192 ospf_area_name_string (area));
193 break;
194 default:
195 return ospf_area_name_string (area);
718e3744 196 }
197
198 return buf;
199}
200
201#define OSPF_IF_STRING_MAXLEN 40
eb1ce605 202const char *
718e3744 203ospf_if_name_string (struct ospf_interface *oi)
204{
205 static char buf[OSPF_IF_STRING_MAXLEN] = "";
206 u_int32_t ifaddr;
207
64e34726 208 if (!oi || !oi->address)
718e3744 209 return "inactive";
210
211 if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
212 return oi->ifp->name;
213
214 ifaddr = ntohl (oi->address->u.prefix4.s_addr);
215 snprintf (buf, OSPF_IF_STRING_MAXLEN,
216 "%s:%d.%d.%d.%d", oi->ifp->name,
217 (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
218 (ifaddr >> 8) & 0xff, ifaddr & 0xff);
219 return buf;
220}
221
6b0655a2 222
718e3744 223void
224ospf_nbr_state_message (struct ospf_neighbor *nbr, char *buf, size_t size)
225{
226 int state;
227 struct ospf_interface *oi = nbr->oi;
228
229 if (IPV4_ADDR_SAME (&DR (oi), &nbr->address.u.prefix4))
230 state = ISM_DR;
231 else if (IPV4_ADDR_SAME (&BDR (oi), &nbr->address.u.prefix4))
232 state = ISM_Backup;
233 else
234 state = ISM_DROther;
235
236 memset (buf, 0, size);
237
238 snprintf (buf, size, "%s/%s",
239 LOOKUP (ospf_nsm_state_msg, nbr->state),
240 LOOKUP (ospf_ism_state_msg, state));
241}
242
eb1ce605 243const char *
d24f6e2a 244ospf_timeval_dump (struct timeval *t, char *buf, size_t size)
718e3744 245{
d24f6e2a 246 /* Making formatted timer strings. */
247#define MINUTE_IN_SECONDS 60
248#define HOUR_IN_SECONDS (60*MINUTE_IN_SECONDS)
249#define DAY_IN_SECONDS (24*HOUR_IN_SECONDS)
250#define WEEK_IN_SECONDS (7*DAY_IN_SECONDS)
cf744958 251 unsigned long w, d, h, m, s, ms, us;
d24f6e2a 252
718e3744 253 if (!t)
254 return "inactive";
f9ad937f 255
cf744958 256 w = d = h = m = s = ms = us = 0;
d24f6e2a 257 memset (buf, 0, size);
cf744958
DS
258
259 us = t->tv_usec;
260 if (us >= 1000)
261 {
262 ms = us / 1000;
263 us %= 1000;
264 }
265
f9ad937f 266 if (ms >= 1000)
267 {
ea4ffc90 268 t->tv_sec += ms / 1000;
269 ms %= 1000;
f9ad937f 270 }
d24f6e2a 271
272 if (t->tv_sec > WEEK_IN_SECONDS)
718e3744 273 {
d24f6e2a 274 w = t->tv_sec / WEEK_IN_SECONDS;
275 t->tv_sec -= w * WEEK_IN_SECONDS;
718e3744 276 }
d24f6e2a 277
278 if (t->tv_sec > DAY_IN_SECONDS)
718e3744 279 {
d24f6e2a 280 d = t->tv_sec / DAY_IN_SECONDS;
281 t->tv_sec -= d * DAY_IN_SECONDS;
718e3744 282 }
d24f6e2a 283
284 if (t->tv_sec >= HOUR_IN_SECONDS)
285 {
286 h = t->tv_sec / HOUR_IN_SECONDS;
287 t->tv_sec -= h * HOUR_IN_SECONDS;
288 }
289
290 if (t->tv_sec >= MINUTE_IN_SECONDS)
291 {
292 m = t->tv_sec / MINUTE_IN_SECONDS;
293 t->tv_sec -= m * MINUTE_IN_SECONDS;
294 }
295
296 if (w > 99)
297 snprintf (buf, size, "%ldw%1ldd", w, d);
298 else if (w)
299 snprintf (buf, size, "%ldw%1ldd%02ldh", w, d, h);
300 else if (d)
301 snprintf (buf, size, "%1ldd%02ldh%02ldm", d, h, m);
302 else if (h)
8f2c16aa 303 snprintf (buf, size, "%ldh%02ldm%02lds", h, m, (long)t->tv_sec);
d24f6e2a 304 else if (m)
8f2c16aa 305 snprintf (buf, size, "%ldm%02lds", m, (long)t->tv_sec);
cf744958 306 else if (ms)
8f2c16aa 307 snprintf (buf, size, "%ld.%03lds", (long)t->tv_sec, ms);
cf744958 308 else
8f2c16aa 309 snprintf (buf, size, "%ld usecs", (long)t->tv_usec);
cf744958 310
718e3744 311 return buf;
312}
313
d24f6e2a 314const char *
315ospf_timer_dump (struct thread *t, char *buf, size_t size)
316{
317 struct timeval result;
d24f6e2a 318 if (!t)
319 return "inactive";
320
2518efd1 321 result = tv_sub (t->u.sands, recent_relative_time());
d24f6e2a 322 return ospf_timeval_dump (&result, buf, size);
323}
324
718e3744 325#define OSPF_OPTION_STR_MAXLEN 24
326
327char *
328ospf_options_dump (u_char options)
329{
330 static char buf[OSPF_OPTION_STR_MAXLEN];
331
16f1b9ee 332 snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s",
718e3744 333 (options & OSPF_OPTION_O) ? "O" : "-",
334 (options & OSPF_OPTION_DC) ? "DC" : "-",
335 (options & OSPF_OPTION_EA) ? "EA" : "-",
336 (options & OSPF_OPTION_NP) ? "N/P" : "-",
337 (options & OSPF_OPTION_MC) ? "MC" : "-",
16f1b9ee
OD
338 (options & OSPF_OPTION_E) ? "E" : "-",
339 (options & OSPF_OPTION_MT) ? "M/T" : "-");
718e3744 340
341 return buf;
342}
343
4dadc291 344static void
718e3744 345ospf_packet_hello_dump (struct stream *s, u_int16_t length)
346{
347 struct ospf_hello *hello;
348 int i;
349
350 hello = (struct ospf_hello *) STREAM_PNT (s);
351
60925303 352 zlog_debug ("Hello");
353 zlog_debug (" NetworkMask %s", inet_ntoa (hello->network_mask));
354 zlog_debug (" HelloInterval %d", ntohs (hello->hello_interval));
355 zlog_debug (" Options %d (%s)", hello->options,
718e3744 356 ospf_options_dump (hello->options));
60925303 357 zlog_debug (" RtrPriority %d", hello->priority);
358 zlog_debug (" RtrDeadInterval %ld", (u_long)ntohl (hello->dead_interval));
359 zlog_debug (" DRouter %s", inet_ntoa (hello->d_router));
360 zlog_debug (" BDRouter %s", inet_ntoa (hello->bd_router));
718e3744 361
362 length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE;
60925303 363 zlog_debug (" # Neighbors %d", length / 4);
718e3744 364 for (i = 0; length > 0; i++, length -= sizeof (struct in_addr))
60925303 365 zlog_debug (" Neighbor %s", inet_ntoa (hello->neighbors[i]));
718e3744 366}
367
4dadc291 368static char *
718e3744 369ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
370{
371 memset (buf, 0, size);
372
373 snprintf (buf, size, "%s|%s|%s",
374 (flags & OSPF_DD_FLAG_I) ? "I" : "-",
375 (flags & OSPF_DD_FLAG_M) ? "M" : "-",
376 (flags & OSPF_DD_FLAG_MS) ? "MS" : "-");
377
378 return buf;
379}
380
381void
382ospf_lsa_header_dump (struct lsa_header *lsah)
383{
eb1ce605 384 const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
0c2be26c 385
60925303 386 zlog_debug (" LSA Header");
387 zlog_debug (" LS age %d", ntohs (lsah->ls_age));
388 zlog_debug (" Options %d (%s)", lsah->options,
718e3744 389 ospf_options_dump (lsah->options));
60925303 390 zlog_debug (" LS type %d (%s)", lsah->type,
553ff113 391 (lsah->type ? lsah_type : "unknown type"));
60925303 392 zlog_debug (" Link State ID %s", inet_ntoa (lsah->id));
393 zlog_debug (" Advertising Router %s", inet_ntoa (lsah->adv_router));
394 zlog_debug (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
395 zlog_debug (" LS checksum 0x%x", ntohs (lsah->checksum));
396 zlog_debug (" length %d", ntohs (lsah->length));
718e3744 397}
398
4dadc291 399static char *
718e3744 400ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size)
401{
402 memset (buf, 0, size);
403
404 snprintf (buf, size, "%s|%s|%s",
405 (flags & ROUTER_LSA_VIRTUAL) ? "V" : "-",
406 (flags & ROUTER_LSA_EXTERNAL) ? "E" : "-",
407 (flags & ROUTER_LSA_BORDER) ? "B" : "-");
408
409 return buf;
410}
411
4dadc291 412static void
718e3744 413ospf_router_lsa_dump (struct stream *s, u_int16_t length)
414{
415 char buf[BUFSIZ];
416 struct router_lsa *rl;
417 int i, len;
418
419 rl = (struct router_lsa *) STREAM_PNT (s);
420
60925303 421 zlog_debug (" Router-LSA");
422 zlog_debug (" flags %s",
718e3744 423 ospf_router_lsa_flags_dump (rl->flags, buf, BUFSIZ));
60925303 424 zlog_debug (" # links %d", ntohs (rl->links));
718e3744 425
426 len = ntohs (rl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
427 for (i = 0; len > 0; i++)
428 {
60925303 429 zlog_debug (" Link ID %s", inet_ntoa (rl->link[i].link_id));
430 zlog_debug (" Link Data %s", inet_ntoa (rl->link[i].link_data));
431 zlog_debug (" Type %d", (u_char) rl->link[i].type);
432 zlog_debug (" TOS %d", (u_char) rl->link[i].tos);
433 zlog_debug (" metric %d", ntohs (rl->link[i].metric));
718e3744 434
435 len -= 12;
436 }
437}
438
4dadc291 439static void
718e3744 440ospf_network_lsa_dump (struct stream *s, u_int16_t length)
441{
442 struct network_lsa *nl;
443 int i, cnt;
444
445 nl = (struct network_lsa *) STREAM_PNT (s);
446 cnt = (ntohs (nl->header.length) - (OSPF_LSA_HEADER_SIZE + 4)) / 4;
447
60925303 448 zlog_debug (" Network-LSA");
718e3744 449 /*
60925303 450 zlog_debug ("LSA total size %d", ntohs (nl->header.length));
451 zlog_debug ("Network-LSA size %d",
718e3744 452 ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE);
453 */
60925303 454 zlog_debug (" Network Mask %s", inet_ntoa (nl->mask));
455 zlog_debug (" # Attached Routers %d", cnt);
718e3744 456 for (i = 0; i < cnt; i++)
60925303 457 zlog_debug (" Attached Router %s", inet_ntoa (nl->routers[i]));
718e3744 458}
459
4dadc291 460static void
718e3744 461ospf_summary_lsa_dump (struct stream *s, u_int16_t length)
462{
463 struct summary_lsa *sl;
464 int size;
465 int i;
466
467 sl = (struct summary_lsa *) STREAM_PNT (s);
468
60925303 469 zlog_debug (" Summary-LSA");
470 zlog_debug (" Network Mask %s", inet_ntoa (sl->mask));
718e3744 471
472 size = ntohs (sl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
473 for (i = 0; size > 0; size -= 4, i++)
60925303 474 zlog_debug (" TOS=%d metric %d", sl->tos,
718e3744 475 GET_METRIC (sl->metric));
476}
477
4dadc291 478static void
718e3744 479ospf_as_external_lsa_dump (struct stream *s, u_int16_t length)
480{
481 struct as_external_lsa *al;
482 int size;
483 int i;
484
485 al = (struct as_external_lsa *) STREAM_PNT (s);
60925303 486 zlog_debug (" %s", ospf_lsa_type_msg[al->header.type].str);
487 zlog_debug (" Network Mask %s", inet_ntoa (al->mask));
718e3744 488
489 size = ntohs (al->header.length) - OSPF_LSA_HEADER_SIZE -4;
490 for (i = 0; size > 0; size -= 12, i++)
491 {
60925303 492 zlog_debug (" bit %s TOS=%d metric %d",
718e3744 493 IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
494 al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
60925303 495 zlog_debug (" Forwarding address %s", inet_ntoa (al->e[i].fwd_addr));
496 zlog_debug (" External Route Tag %d", al->e[i].route_tag);
718e3744 497 }
498}
499
4dadc291 500static void
718e3744 501ospf_lsa_header_list_dump (struct stream *s, u_int16_t length)
502{
503 struct lsa_header *lsa;
504
60925303 505 zlog_debug (" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE);
718e3744 506
507 /* LSA Headers. */
508 while (length > 0)
509 {
510 lsa = (struct lsa_header *) STREAM_PNT (s);
511 ospf_lsa_header_dump (lsa);
512
9985f83c 513 stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
718e3744 514 length -= OSPF_LSA_HEADER_SIZE;
515 }
516}
517
4dadc291 518static void
718e3744 519ospf_packet_db_desc_dump (struct stream *s, u_int16_t length)
520{
521 struct ospf_db_desc *dd;
522 char dd_flags[8];
523
524 u_int32_t gp;
525
526 gp = stream_get_getp (s);
527 dd = (struct ospf_db_desc *) STREAM_PNT (s);
528
60925303 529 zlog_debug ("Database Description");
530 zlog_debug (" Interface MTU %d", ntohs (dd->mtu));
531 zlog_debug (" Options %d (%s)", dd->options,
718e3744 532 ospf_options_dump (dd->options));
60925303 533 zlog_debug (" Flags %d (%s)", dd->flags,
718e3744 534 ospf_dd_flags_dump (dd->flags, dd_flags, sizeof dd_flags));
60925303 535 zlog_debug (" Sequence Number 0x%08lx", (u_long)ntohl (dd->dd_seqnum));
718e3744 536
537 length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
538
9985f83c 539 stream_forward_getp (s, OSPF_DB_DESC_MIN_SIZE);
718e3744 540
541 ospf_lsa_header_list_dump (s, length);
542
543 stream_set_getp (s, gp);
544}
545
4dadc291 546static void
718e3744 547ospf_packet_ls_req_dump (struct stream *s, u_int16_t length)
548{
549 u_int32_t sp;
550 u_int32_t ls_type;
551 struct in_addr ls_id;
552 struct in_addr adv_router;
553
554 sp = stream_get_getp (s);
555
556 length -= OSPF_HEADER_SIZE;
557
60925303 558 zlog_debug ("Link State Request");
559 zlog_debug (" # Requests %d", length / 12);
718e3744 560
561 for (; length > 0; length -= 12)
562 {
563 ls_type = stream_getl (s);
564 ls_id.s_addr = stream_get_ipv4 (s);
565 adv_router.s_addr = stream_get_ipv4 (s);
566
60925303 567 zlog_debug (" LS type %d", ls_type);
568 zlog_debug (" Link State ID %s", inet_ntoa (ls_id));
569 zlog_debug (" Advertising Router %s",
718e3744 570 inet_ntoa (adv_router));
571 }
572
573 stream_set_getp (s, sp);
574}
575
4dadc291 576static void
718e3744 577ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length)
578{
579 u_int32_t sp;
580 struct lsa_header *lsa;
581 int lsa_len;
582 u_int32_t count;
583
584 length -= OSPF_HEADER_SIZE;
585
586 sp = stream_get_getp (s);
587
588 count = stream_getl (s);
589 length -= 4;
590
60925303 591 zlog_debug ("Link State Update");
592 zlog_debug (" # LSAs %d", count);
718e3744 593
594 while (length > 0 && count > 0)
595 {
596 if (length < OSPF_HEADER_SIZE || length % 4 != 0)
597 {
60925303 598 zlog_debug (" Remaining %d bytes; Incorrect length.", length);
718e3744 599 break;
600 }
601
602 lsa = (struct lsa_header *) STREAM_PNT (s);
603 lsa_len = ntohs (lsa->length);
604 ospf_lsa_header_dump (lsa);
605
606 switch (lsa->type)
607 {
608 case OSPF_ROUTER_LSA:
609 ospf_router_lsa_dump (s, length);
610 break;
611 case OSPF_NETWORK_LSA:
612 ospf_network_lsa_dump (s, length);
613 break;
614 case OSPF_SUMMARY_LSA:
615 case OSPF_ASBR_SUMMARY_LSA:
616 ospf_summary_lsa_dump (s, length);
617 break;
618 case OSPF_AS_EXTERNAL_LSA:
619 ospf_as_external_lsa_dump (s, length);
620 break;
718e3744 621 case OSPF_AS_NSSA_LSA:
d4a53d58 622 ospf_as_external_lsa_dump (s, length);
718e3744 623 break;
718e3744 624 case OSPF_OPAQUE_LINK_LSA:
625 case OSPF_OPAQUE_AREA_LSA:
626 case OSPF_OPAQUE_AS_LSA:
627 ospf_opaque_lsa_dump (s, length);
628 break;
718e3744 629 default:
630 break;
631 }
632
9985f83c 633 stream_forward_getp (s, lsa_len);
718e3744 634 length -= lsa_len;
635 count--;
636 }
637
638 stream_set_getp (s, sp);
639}
640
4dadc291 641static void
718e3744 642ospf_packet_ls_ack_dump (struct stream *s, u_int16_t length)
643{
644 u_int32_t sp;
645
646 length -= OSPF_HEADER_SIZE;
647 sp = stream_get_getp (s);
648
60925303 649 zlog_debug ("Link State Acknowledgment");
718e3744 650 ospf_lsa_header_list_dump (s, length);
651
652 stream_set_getp (s, sp);
653}
654
6b333611 655/* Expects header to be in host order */
718e3744 656void
6b333611 657ospf_ip_header_dump (struct ip *iph)
718e3744 658{
718e3744 659 /* IP Header dump. */
60925303 660 zlog_debug ("ip_v %d", iph->ip_v);
661 zlog_debug ("ip_hl %d", iph->ip_hl);
662 zlog_debug ("ip_tos %d", iph->ip_tos);
663 zlog_debug ("ip_len %d", iph->ip_len);
664 zlog_debug ("ip_id %u", (u_int32_t) iph->ip_id);
665 zlog_debug ("ip_off %u", (u_int32_t) iph->ip_off);
666 zlog_debug ("ip_ttl %d", iph->ip_ttl);
667 zlog_debug ("ip_p %d", iph->ip_p);
668 zlog_debug ("ip_sum 0x%x", (u_int32_t) iph->ip_sum);
669 zlog_debug ("ip_src %s", inet_ntoa (iph->ip_src));
670 zlog_debug ("ip_dst %s", inet_ntoa (iph->ip_dst));
718e3744 671}
672
4dadc291 673static void
718e3744 674ospf_header_dump (struct ospf_header *ospfh)
675{
676 char buf[9];
ef1b78cb 677 u_int16_t auth_type = ntohs (ospfh->auth_type);
718e3744 678
60925303 679 zlog_debug ("Header");
680 zlog_debug (" Version %d", ospfh->version);
681 zlog_debug (" Type %d (%s)", ospfh->type,
272ca1e3 682 LOOKUP (ospf_packet_type_str, ospfh->type));
60925303 683 zlog_debug (" Packet Len %d", ntohs (ospfh->length));
684 zlog_debug (" Router ID %s", inet_ntoa (ospfh->router_id));
685 zlog_debug (" Area ID %s", inet_ntoa (ospfh->area_id));
686 zlog_debug (" Checksum 0x%x", ntohs (ospfh->checksum));
ef1b78cb 687 zlog_debug (" AuType %s", LOOKUP (ospf_auth_type_str, auth_type));
718e3744 688
ef1b78cb 689 switch (auth_type)
718e3744 690 {
691 case OSPF_AUTH_NULL:
692 break;
693 case OSPF_AUTH_SIMPLE:
694 memset (buf, 0, 9);
c9e52be3 695 strncpy (buf, (char *) ospfh->u.auth_data, 8);
60925303 696 zlog_debug (" Simple Password %s", buf);
718e3744 697 break;
698 case OSPF_AUTH_CRYPTOGRAPHIC:
60925303 699 zlog_debug (" Cryptographic Authentication");
700 zlog_debug (" Key ID %d", ospfh->u.crypt.key_id);
701 zlog_debug (" Auth Data Len %d", ospfh->u.crypt.auth_data_len);
702 zlog_debug (" Sequence number %ld",
718e3744 703 (u_long)ntohl (ospfh->u.crypt.crypt_seqnum));
704 break;
705 default:
60925303 706 zlog_debug ("* This is not supported authentication type");
718e3744 707 break;
708 }
709
710}
711
712void
713ospf_packet_dump (struct stream *s)
714{
715 struct ospf_header *ospfh;
716 unsigned long gp;
717
718 /* Preserve pointer. */
719 gp = stream_get_getp (s);
720
721 /* OSPF Header dump. */
722 ospfh = (struct ospf_header *) STREAM_PNT (s);
723
724 /* Until detail flag is set, return. */
725 if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL))
726 return;
727
728 /* Show OSPF header detail. */
729 ospf_header_dump (ospfh);
9985f83c 730 stream_forward_getp (s, OSPF_HEADER_SIZE);
718e3744 731
732 switch (ospfh->type)
733 {
734 case OSPF_MSG_HELLO:
735 ospf_packet_hello_dump (s, ntohs (ospfh->length));
736 break;
737 case OSPF_MSG_DB_DESC:
738 ospf_packet_db_desc_dump (s, ntohs (ospfh->length));
739 break;
740 case OSPF_MSG_LS_REQ:
741 ospf_packet_ls_req_dump (s, ntohs (ospfh->length));
742 break;
743 case OSPF_MSG_LS_UPD:
744 ospf_packet_ls_upd_dump (s, ntohs (ospfh->length));
745 break;
746 case OSPF_MSG_LS_ACK:
747 ospf_packet_ls_ack_dump (s, ntohs (ospfh->length));
748 break;
749 default:
750 break;
751 }
752
753 stream_set_getp (s, gp);
754}
755
692b4c65
QY
756DEFUN (debug_ospf_packet,
757 debug_ospf_packet_cmd,
758 "debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
759 DEBUG_STR
760 OSPF_STR
761 "Instance ID\n"
762 "OSPF packets\n"
763 "OSPF Hello\n"
764 "OSPF Database Description\n"
765 "OSPF Link State Request\n"
766 "OSPF Link State Update\n"
767 "OSPF Link State Acknowledgment\n"
768 "OSPF all packets\n"
769 "Packet sent\n"
770 "Detail Information\n"
771 "Packet received\n"
772 "Detail Information\n"
773 "Detail Information\n")
774{
775 int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0;
776 int detail = strmatch (argv[argc - 1]->text, "detail");
777 int send = strmatch (argv[argc - (1+detail)]->text, "send");
778 int recv = strmatch (argv[argc - (1+detail)]->text, "recv");
779 char *packet = argv[3 + inst]->text;
780
781 if (inst) // user passed instance ID
782 {
783 if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
784 return CMD_SUCCESS;
785 }
6b0655a2 786
718e3744 787 int type = 0;
788 int flag = 0;
789 int i;
790
718e3744 791 /* Check packet type. */
692b4c65 792 if (strmatch (packet, "hello"))
718e3744 793 type = OSPF_DEBUG_HELLO;
692b4c65 794 else if (strmatch (packet, "dd"))
718e3744 795 type = OSPF_DEBUG_DB_DESC;
692b4c65 796 else if (strmatch (packet, "ls-request"))
718e3744 797 type = OSPF_DEBUG_LS_REQ;
692b4c65 798 else if (strmatch (packet, "ls-update"))
718e3744 799 type = OSPF_DEBUG_LS_UPD;
692b4c65 800 else if (strmatch (packet, "ls-ack"))
718e3744 801 type = OSPF_DEBUG_LS_ACK;
692b4c65 802 else if (strmatch (packet, "all"))
718e3744 803 type = OSPF_DEBUG_ALL;
804
692b4c65
QY
805 /* Cases:
806 * (none) = send + recv
807 * detail = send + recv + detail
808 * recv = recv
809 * send = send
810 * recv detail = recv + detail
811 * send detail = send + detail
812 */
813 if (!send && !recv)
814 send = recv = 1;
815
816 flag |= (send) ? OSPF_DEBUG_SEND : 0;
817 flag |= (recv) ? OSPF_DEBUG_RECV : 0;
818 flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
718e3744 819
820 for (i = 0; i < 5; i++)
821 if (type & (0x01 << i))
822 {
823 if (vty->node == CONFIG_NODE)
824 DEBUG_PACKET_ON (i, flag);
825 else
826 TERM_DEBUG_PACKET_ON (i, flag);
827 }
828
829 return CMD_SUCCESS;
830}
831
692b4c65
QY
832DEFUN (no_debug_ospf_packet,
833 no_debug_ospf_packet_cmd,
834 "no debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
835 NO_STR
718e3744 836 DEBUG_STR
837 OSPF_STR
7c8ff89e 838 "Instance ID\n"
718e3744 839 "OSPF packets\n"
840 "OSPF Hello\n"
841 "OSPF Database Description\n"
842 "OSPF Link State Request\n"
843 "OSPF Link State Update\n"
844 "OSPF Link State Acknowledgment\n"
692b4c65
QY
845 "OSPF all packets\n"
846 "Packet sent\n"
847 "Detail Information\n"
848 "Packet received\n"
849 "Detail Information\n"
850 "Detail Information\n")
851{
852 int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0;
853 int detail = strmatch (argv[argc - 1]->text, "detail");
854 int send = strmatch (argv[argc - (1+detail)]->text, "send");
855 int recv = strmatch (argv[argc - (1+detail)]->text, "recv");
856 char *packet = argv[4 + inst]->text;
857
858 if (inst) // user passed instance ID
859 {
860 if (!ospf_lookup_instance (strtoul (argv[3]->arg, NULL, 10)))
861 return CMD_SUCCESS;
862 }
7c8ff89e 863
718e3744 864 int type = 0;
865 int flag = 0;
866 int i;
867
718e3744 868 /* Check packet type. */
692b4c65 869 if (strmatch (packet, "hello"))
718e3744 870 type = OSPF_DEBUG_HELLO;
692b4c65 871 else if (strmatch (packet, "dd"))
718e3744 872 type = OSPF_DEBUG_DB_DESC;
692b4c65 873 else if (strmatch (packet, "ls-request"))
718e3744 874 type = OSPF_DEBUG_LS_REQ;
692b4c65 875 else if (strmatch (packet, "ls-update"))
718e3744 876 type = OSPF_DEBUG_LS_UPD;
692b4c65 877 else if (strmatch (packet, "ls-ack"))
718e3744 878 type = OSPF_DEBUG_LS_ACK;
692b4c65 879 else if (strmatch (packet, "all"))
718e3744 880 type = OSPF_DEBUG_ALL;
881
692b4c65
QY
882 /* Cases:
883 * (none) = send + recv
884 * detail = send + recv + detail
885 * recv = recv
886 * send = send
887 * recv detail = recv + detail
888 * send detail = send + detail
889 */
890 if (!send && !recv)
891 send = recv = 1;
892
893 flag |= (send) ? OSPF_DEBUG_SEND : 0;
894 flag |= (recv) ? OSPF_DEBUG_RECV : 0;
895 flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
718e3744 896
897 for (i = 0; i < 5; i++)
898 if (type & (0x01 << i))
899 {
900 if (vty->node == CONFIG_NODE)
901 DEBUG_PACKET_OFF (i, flag);
902 else
903 TERM_DEBUG_PACKET_OFF (i, flag);
904 }
905
906#ifdef DEBUG
6638c1ab 907 /*
718e3744 908 for (i = 0; i < 5; i++)
60925303 909 zlog_debug ("flag[%d] = %d", i, ospf_debug_packet[i]);
6638c1ab 910 */
718e3744 911#endif /* DEBUG */
912
913 return CMD_SUCCESS;
914}
915
692b4c65
QY
916DEFUN (debug_ospf_ism,
917 debug_ospf_ism_cmd,
918 "debug ospf [(1-65535)] ism [<status|events|timers>]",
718e3744 919 DEBUG_STR
920 OSPF_STR
7c8ff89e 921 "Instance ID\n"
692b4c65
QY
922 "OSPF Interface State Machine\n"
923 "ISM Status Information\n"
924 "ISM Event Information\n"
925 "ISM TImer Information\n")
7c8ff89e 926{
692b4c65
QY
927 int inst = (argv[2]->type == RANGE_TKN);
928 char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL;
7c8ff89e 929
692b4c65
QY
930 if (inst) // user passed instance ID
931 {
932 if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
933 return CMD_SUCCESS;
934 }
7c8ff89e 935
718e3744 936 if (vty->node == CONFIG_NODE)
937 {
692b4c65 938 if (!dbgparam)
718e3744 939 DEBUG_ON (ism, ISM);
692b4c65 940 else
718e3744 941 {
692b4c65 942 if (strmatch (dbgparam, "status"))
718e3744 943 DEBUG_ON (ism, ISM_STATUS);
692b4c65 944 else if (strmatch (dbgparam, "events"))
718e3744 945 DEBUG_ON (ism, ISM_EVENTS);
692b4c65 946 else if (strmatch (dbgparam, "timers"))
718e3744 947 DEBUG_ON (ism, ISM_TIMERS);
948 }
949
950 return CMD_SUCCESS;
951 }
952
953 /* ENABLE_NODE. */
692b4c65 954 if (!dbgparam)
718e3744 955 TERM_DEBUG_ON (ism, ISM);
692b4c65 956 else
718e3744 957 {
692b4c65
QY
958 if (strmatch (dbgparam, "status"))
959 TERM_DEBUG_ON (ism, ISM_STATUS);
960 else if (strmatch (dbgparam, "events"))
961 TERM_DEBUG_ON (ism, ISM_EVENTS);
962 else if (strmatch (dbgparam, "timers"))
963 TERM_DEBUG_ON (ism, ISM_TIMERS);
718e3744 964 }
ff788d08
DW
965
966 return CMD_SUCCESS;
718e3744 967}
968
692b4c65
QY
969DEFUN (no_debug_ospf_ism,
970 no_debug_ospf_ism_cmd,
971 "no debug ospf [(1-65535)] ism [<status|events|timers>]",
718e3744 972 DEBUG_STR
973 OSPF_STR
7c8ff89e 974 "Instance ID\n"
692b4c65
QY
975 "OSPF Interface State Machine\n"
976 "ISM Status Information\n"
977 "ISM Event Information\n"
978 "ISM TImer Information\n")
7c8ff89e 979{
692b4c65
QY
980 int inst = (argv[3]->type == RANGE_TKN);
981 char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL;
7c8ff89e 982
692b4c65
QY
983 if (inst) // user passed instance ID
984 {
985 if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
986 return CMD_SUCCESS;
987 }
7c8ff89e 988
718e3744 989 if (vty->node == CONFIG_NODE)
990 {
692b4c65 991 if (!dbgparam)
718e3744 992 DEBUG_OFF (ism, ISM);
692b4c65 993 else
718e3744 994 {
692b4c65 995 if (strmatch (dbgparam, "status"))
718e3744 996 DEBUG_OFF (ism, ISM_STATUS);
692b4c65 997 else if (strmatch (dbgparam, "events"))
718e3744 998 DEBUG_OFF (ism, ISM_EVENTS);
692b4c65 999 else if (strmatch (dbgparam, "timers"))
718e3744 1000 DEBUG_OFF (ism, ISM_TIMERS);
1001 }
692b4c65 1002
718e3744 1003 return CMD_SUCCESS;
1004 }
1005
1006 /* ENABLE_NODE. */
692b4c65 1007 if (!dbgparam)
718e3744 1008 TERM_DEBUG_OFF (ism, ISM);
692b4c65 1009 else
718e3744 1010 {
692b4c65
QY
1011 if (strmatch (dbgparam, "status"))
1012 TERM_DEBUG_OFF (ism, ISM_STATUS);
1013 else if (strmatch (dbgparam, "events"))
1014 TERM_DEBUG_OFF (ism, ISM_EVENTS);
1015 else if (strmatch (dbgparam, "timers"))
1016 TERM_DEBUG_OFF (ism, ISM_TIMERS);
718e3744 1017 }
ff788d08
DW
1018
1019 return CMD_SUCCESS;
718e3744 1020}
1021
7c8ff89e 1022static int
bf2bfafd 1023debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
718e3744 1024{
1025 if (vty->node == CONFIG_NODE)
1026 {
7c8ff89e 1027 if (argc == arg_base + 0)
718e3744 1028 DEBUG_ON (nsm, NSM);
7c8ff89e 1029 else if (argc == arg_base + 1)
718e3744 1030 {
bf2bfafd 1031 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
718e3744 1032 DEBUG_ON (nsm, NSM_STATUS);
bf2bfafd 1033 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
718e3744 1034 DEBUG_ON (nsm, NSM_EVENTS);
bf2bfafd 1035 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
718e3744 1036 DEBUG_ON (nsm, NSM_TIMERS);
1037 }
1038
1039 return CMD_SUCCESS;
1040 }
1041
1042 /* ENABLE_NODE. */
7c8ff89e 1043 if (argc == arg_base + 0)
718e3744 1044 TERM_DEBUG_ON (nsm, NSM);
7c8ff89e 1045 else if (argc == arg_base + 1)
718e3744 1046 {
bf2bfafd 1047 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
718e3744 1048 TERM_DEBUG_ON (nsm, NSM_STATUS);
bf2bfafd 1049 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
718e3744 1050 TERM_DEBUG_ON (nsm, NSM_EVENTS);
bf2bfafd 1051 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
718e3744 1052 TERM_DEBUG_ON (nsm, NSM_TIMERS);
1053 }
1054
1055 return CMD_SUCCESS;
1056}
1057
f412b39a
DW
1058/*
1059 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1060 * "debug ospf nsm (status|events|timers)",
1061 * DEBUG_STR
1062 * OSPF_STR
1063 * "OSPF Neighbor State Machine\n"
1064 * "NSM Status Information\n"
1065 * "NSM Event Information\n"
1066 * "NSM Timer Information\n"
1067 *
1068 */
7c8ff89e
DS
1069DEFUN (debug_ospf_nsm,
1070 debug_ospf_nsm_cmd,
1071 "debug ospf nsm",
1072 DEBUG_STR
1073 OSPF_STR
1074 "OSPF Neighbor State Machine\n")
1075{
67656e9b 1076 /* CHECK ME argc referenced below */
7c8ff89e
DS
1077 return debug_ospf_nsm_common (vty, 0, argc, argv);
1078}
1079
718e3744 1080
f412b39a
DW
1081/*
1082 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1083 * "debug ospf <1-65535> nsm (status|events|timers)",
1084 * DEBUG_STR
1085 * OSPF_STR
1086 * "Instance ID\n"
1087 * "OSPF Neighbor State Machine\n"
1088 * "NSM Status Information\n"
1089 * "NSM Event Information\n"
1090 * "NSM Timer Information\n"
1091 *
1092 */
7c8ff89e
DS
1093DEFUN (debug_ospf_instance_nsm,
1094 debug_ospf_instance_nsm_cmd,
6147e2c6 1095 "debug ospf (1-65535) nsm",
718e3744 1096 DEBUG_STR
1097 OSPF_STR
7c8ff89e
DS
1098 "Instance ID\n"
1099 "OSPF Neighbor State Machine\n")
1100{
67656e9b 1101 /* CHECK ME argc referenced below */
8d769265 1102 int idx_number = 2;
7c8ff89e
DS
1103 u_short instance = 0;
1104
8d769265 1105 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1106 if (!ospf_lookup_instance (instance))
1107 return CMD_SUCCESS;
1108
1109 return debug_ospf_nsm_common (vty, 1, argc, argv);
1110}
1111
7c8ff89e
DS
1112
1113static int
bf2bfafd 1114no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
718e3744 1115{
1116 if (vty->node == CONFIG_NODE)
1117 {
7c8ff89e 1118 if (argc == arg_base + 0)
718e3744 1119 DEBUG_OFF (nsm, NSM);
7c8ff89e 1120 else if (argc == arg_base + 1)
718e3744 1121 {
bf2bfafd 1122 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
718e3744 1123 DEBUG_OFF (nsm, NSM_STATUS);
bf2bfafd 1124 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
718e3744 1125 DEBUG_OFF (nsm, NSM_EVENTS);
bf2bfafd 1126 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
718e3744 1127 DEBUG_OFF (nsm, NSM_TIMERS);
1128 }
1129
1130 return CMD_SUCCESS;
1131 }
1132
1133 /* ENABLE_NODE. */
7c8ff89e 1134 if (argc == arg_base + 0)
718e3744 1135 TERM_DEBUG_OFF (nsm, NSM);
7c8ff89e 1136 else if (argc == arg_base + 1)
718e3744 1137 {
bf2bfafd 1138 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
718e3744 1139 TERM_DEBUG_OFF (nsm, NSM_STATUS);
bf2bfafd 1140 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
718e3744 1141 TERM_DEBUG_OFF (nsm, NSM_EVENTS);
bf2bfafd 1142 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
718e3744 1143 TERM_DEBUG_OFF (nsm, NSM_TIMERS);
1144 }
1145
1146 return CMD_SUCCESS;
1147}
1148
f412b39a
DW
1149/*
1150 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1151 * "no debug ospf nsm (status|events|timers)",
1152 * NO_STR
1153 * "Debugging functions\n"
1154 * "OSPF information\n"
1155 * "OSPF Interface State Machine\n"
1156 * "NSM Status Information\n"
1157 * "NSM Event Information\n"
1158 * "NSM Timer Information\n"
1159 *
1160 */
7c8ff89e
DS
1161DEFUN (no_debug_ospf_nsm,
1162 no_debug_ospf_nsm_cmd,
1163 "no debug ospf nsm",
1164 NO_STR
1165 DEBUG_STR
1166 OSPF_STR
1167 "OSPF Neighbor State Machine")
1168{
67656e9b 1169 /* CHECK ME argc referenced below */
7c8ff89e
DS
1170 return no_debug_ospf_nsm_common(vty, 0, argc, argv);
1171}
1172
718e3744 1173
f412b39a
DW
1174/*
1175 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1176 * "no debug ospf <1-65535> nsm (status|events|timers)",
1177 * NO_STR
1178 * "Debugging functions\n"
1179 * "OSPF information\n"
1180 * "Instance ID\n"
1181 * "OSPF Interface State Machine\n"
1182 * "NSM Status Information\n"
1183 * "NSM Event Information\n"
1184 * "NSM Timer Information\n"
1185 *
1186 */
7c8ff89e
DS
1187DEFUN (no_debug_ospf_instance_nsm,
1188 no_debug_ospf_instance_nsm_cmd,
6147e2c6 1189 "no debug ospf (1-65535) nsm",
7c8ff89e 1190 NO_STR
718e3744 1191 DEBUG_STR
1192 OSPF_STR
7c8ff89e
DS
1193 "Instance ID\n"
1194 "OSPF Neighbor State Machine")
1195{
67656e9b 1196 /* CHECK ME argc referenced below */
8d769265 1197 int idx_number = 3;
7c8ff89e
DS
1198 u_short instance = 0;
1199
8d769265 1200 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1201 if (!ospf_lookup_instance (instance))
1202 return CMD_SUCCESS;
1203
1204 return no_debug_ospf_nsm_common(vty, 1, argc, argv);
1205}
1206
7c8ff89e
DS
1207
1208
1209static int
bf2bfafd 1210debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
718e3744 1211{
1212 if (vty->node == CONFIG_NODE)
1213 {
7c8ff89e 1214 if (argc == arg_base + 0)
718e3744 1215 DEBUG_ON (lsa, LSA);
7c8ff89e 1216 else if (argc == arg_base + 1)
718e3744 1217 {
bf2bfafd 1218 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
718e3744 1219 DEBUG_ON (lsa, LSA_GENERATE);
bf2bfafd 1220 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
718e3744 1221 DEBUG_ON (lsa, LSA_FLOODING);
bf2bfafd 1222 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1223 DEBUG_ON (lsa, LSA_INSTALL);
bf2bfafd 1224 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1225 DEBUG_ON (lsa, LSA_REFRESH);
1226 }
1227
1228 return CMD_SUCCESS;
1229 }
1230
1231 /* ENABLE_NODE. */
7c8ff89e 1232 if (argc == arg_base + 0)
718e3744 1233 TERM_DEBUG_ON (lsa, LSA);
7c8ff89e 1234 else if (argc == arg_base + 1)
718e3744 1235 {
bf2bfafd 1236 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
718e3744 1237 TERM_DEBUG_ON (lsa, LSA_GENERATE);
bf2bfafd 1238 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
718e3744 1239 TERM_DEBUG_ON (lsa, LSA_FLOODING);
bf2bfafd 1240 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1241 TERM_DEBUG_ON (lsa, LSA_INSTALL);
bf2bfafd 1242 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1243 TERM_DEBUG_ON (lsa, LSA_REFRESH);
1244 }
1245
1246 return CMD_SUCCESS;
1247}
1248
f412b39a
DW
1249/*
1250 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1251 * "debug ospf lsa (generate|flooding|install|refresh)",
1252 * DEBUG_STR
1253 * OSPF_STR
1254 * "OSPF Link State Advertisement\n"
1255 * "LSA Generation\n"
1256 * "LSA Flooding\n"
1257 * "LSA Install/Delete\n"
1258 * "LSA Refresh\n"
1259 *
1260 */
7c8ff89e
DS
1261DEFUN (debug_ospf_lsa,
1262 debug_ospf_lsa_cmd,
1263 "debug ospf lsa",
1264 DEBUG_STR
1265 OSPF_STR
1266 "OSPF Link State Advertisement\n")
1267{
67656e9b 1268 /* CHECK ME argc referenced below */
7c8ff89e
DS
1269 return debug_ospf_lsa_common(vty, 0, argc, argv);
1270}
1271
718e3744 1272
f412b39a
DW
1273/*
1274 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1275 * "debug ospf <1-65535> lsa (generate|flooding|install|refresh)",
1276 * DEBUG_STR
1277 * OSPF_STR
1278 * "Instance ID\n"
1279 * "OSPF Link State Advertisement\n"
1280 * "LSA Generation\n"
1281 * "LSA Flooding\n"
1282 * "LSA Install/Delete\n"
1283 * "LSA Refresh\n"
1284 *
1285 */
7c8ff89e
DS
1286DEFUN (debug_ospf_instance_lsa,
1287 debug_ospf_instance_lsa_cmd,
6147e2c6 1288 "debug ospf (1-65535) lsa",
718e3744 1289 DEBUG_STR
1290 OSPF_STR
7c8ff89e 1291 "Instance ID\n"
718e3744 1292 "OSPF Link State Advertisement\n")
7c8ff89e 1293{
67656e9b 1294 /* CHECK ME argc referenced below */
8d769265 1295 int idx_number = 2;
7c8ff89e
DS
1296 u_short instance = 0;
1297
8d769265 1298 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1299 if (!ospf_lookup_instance (instance))
1300 return CMD_SUCCESS;
1301
1302 return debug_ospf_lsa_common(vty, 1, argc, argv);
1303}
1304
7c8ff89e
DS
1305
1306static int
bf2bfafd 1307no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
718e3744 1308{
1309 if (vty->node == CONFIG_NODE)
1310 {
7c8ff89e 1311 if (argc == arg_base + 0)
718e3744 1312 DEBUG_OFF (lsa, LSA);
7c8ff89e 1313 else if (argc == arg_base + 1)
718e3744 1314 {
bf2bfafd 1315 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
718e3744 1316 DEBUG_OFF (lsa, LSA_GENERATE);
bf2bfafd 1317 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
718e3744 1318 DEBUG_OFF (lsa, LSA_FLOODING);
bf2bfafd 1319 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1320 DEBUG_OFF (lsa, LSA_INSTALL);
bf2bfafd 1321 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1322 DEBUG_OFF (lsa, LSA_REFRESH);
1323 }
1324
1325 return CMD_SUCCESS;
1326 }
1327
1328 /* ENABLE_NODE. */
7c8ff89e 1329 if (argc == arg_base + 0)
718e3744 1330 TERM_DEBUG_OFF (lsa, LSA);
7c8ff89e 1331 else if (argc == arg_base + 1)
718e3744 1332 {
bf2bfafd 1333 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
718e3744 1334 TERM_DEBUG_OFF (lsa, LSA_GENERATE);
bf2bfafd 1335 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
718e3744 1336 TERM_DEBUG_OFF (lsa, LSA_FLOODING);
bf2bfafd 1337 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1338 TERM_DEBUG_OFF (lsa, LSA_INSTALL);
bf2bfafd 1339 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1340 TERM_DEBUG_OFF (lsa, LSA_REFRESH);
1341 }
1342
1343 return CMD_SUCCESS;
1344}
1345
f412b39a
DW
1346/*
1347 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1348 * "no debug ospf lsa (generate|flooding|install|refresh)",
1349 * NO_STR
1350 * DEBUG_STR
1351 * OSPF_STR
1352 * "OSPF Link State Advertisement\n"
1353 * "LSA Generation\n"
1354 * "LSA Flooding\n"
1355 * "LSA Install/Delete\n"
1356 * "LSA Refres\n"
1357 *
1358 */
7c8ff89e
DS
1359DEFUN (no_debug_ospf_lsa,
1360 no_debug_ospf_lsa_cmd,
1361 "no debug ospf lsa",
1362 NO_STR
1363 DEBUG_STR
1364 OSPF_STR
1365 "OSPF Link State Advertisement\n")
1366{
67656e9b 1367 /* CHECK ME argc referenced below */
7c8ff89e
DS
1368 return no_debug_ospf_lsa_common (vty, 0, argc, argv);
1369}
1370
718e3744 1371
f412b39a
DW
1372/*
1373 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1374 * "no debug ospf <1-65535> lsa (generate|flooding|install|refresh)",
1375 * NO_STR
1376 * DEBUG_STR
1377 * OSPF_STR
1378 * "Instance ID\n"
1379 * "OSPF Link State Advertisement\n"
1380 * "LSA Generation\n"
1381 * "LSA Flooding\n"
1382 * "LSA Install/Delete\n"
1383 * "LSA Refres\n"
1384 *
1385 */
7c8ff89e
DS
1386DEFUN (no_debug_ospf_instance_lsa,
1387 no_debug_ospf_instance_lsa_cmd,
6147e2c6 1388 "no debug ospf (1-65535) lsa",
7c8ff89e
DS
1389 NO_STR
1390 DEBUG_STR
1391 OSPF_STR
1392 "Instance ID\n"
1393 "OSPF Link State Advertisement\n")
1394{
67656e9b 1395 /* CHECK ME argc referenced below */
8d769265 1396 int idx_number = 3;
7c8ff89e
DS
1397 u_short instance = 0;
1398
8d769265 1399 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1400 if (!ospf_lookup_instance (instance))
1401 return CMD_SUCCESS;
6b0655a2 1402
7c8ff89e
DS
1403 return no_debug_ospf_lsa_common (vty, 1, argc, argv);
1404}
1405
7c8ff89e
DS
1406
1407
1408static int
bf2bfafd 1409debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
718e3744 1410{
1411 if (vty->node == CONFIG_NODE)
1412 {
7c8ff89e 1413 if (argc == arg_base + 0)
718e3744 1414 DEBUG_ON (zebra, ZEBRA);
7c8ff89e 1415 else if (argc == arg_base + 1)
718e3744 1416 {
bf2bfafd 1417 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1418 DEBUG_ON (zebra, ZEBRA_INTERFACE);
bf2bfafd 1419 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1420 DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1421 }
1422
1423 return CMD_SUCCESS;
1424 }
1425
1426 /* ENABLE_NODE. */
7c8ff89e 1427 if (argc == arg_base + 0)
718e3744 1428 TERM_DEBUG_ON (zebra, ZEBRA);
7c8ff89e 1429 else if (argc == arg_base + 1)
718e3744 1430 {
bf2bfafd 1431 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1432 TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE);
bf2bfafd 1433 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1434 TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1435 }
1436
1437 return CMD_SUCCESS;
1438}
1439
f412b39a
DW
1440/*
1441 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1442 * "debug ospf zebra (interface|redistribute)",
1443 * DEBUG_STR
1444 * OSPF_STR
1445 * "OSPF Zebra information\n"
1446 * "Zebra interface\n"
1447 * "Zebra redistribute\n"
1448 *
1449 */
7c8ff89e
DS
1450DEFUN (debug_ospf_zebra,
1451 debug_ospf_zebra_cmd,
1452 "debug ospf zebra",
1453 DEBUG_STR
1454 OSPF_STR
1455 "OSPF Zebra information\n")
1456{
67656e9b 1457 /* CHECK ME argc referenced below */
7c8ff89e
DS
1458 return debug_ospf_zebra_common(vty, 0, argc, argv);
1459}
1460
718e3744 1461
f412b39a
DW
1462/*
1463 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1464 * "debug ospf <1-65535> zebra (interface|redistribute)",
1465 * DEBUG_STR
1466 * OSPF_STR
1467 * "Instance ID\n"
1468 * "OSPF Zebra information\n"
1469 * "Zebra interface\n"
1470 * "Zebra redistribute\n"
1471 *
1472 */
7c8ff89e
DS
1473DEFUN (debug_ospf_instance_zebra,
1474 debug_ospf_instance_zebra_cmd,
6147e2c6 1475 "debug ospf (1-65535) zebra",
718e3744 1476 DEBUG_STR
1477 OSPF_STR
7c8ff89e 1478 "Instance ID\n"
718e3744 1479 "OSPF Zebra information\n")
7c8ff89e 1480{
67656e9b 1481 /* CHECK ME argc referenced below */
8d769265 1482 int idx_number = 2;
7c8ff89e
DS
1483 u_short instance = 0;
1484
8d769265 1485 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1486 if (!ospf_lookup_instance (instance))
1487 return CMD_SUCCESS;
1488
1489 return debug_ospf_zebra_common(vty, 1, argc, argv);
1490}
1491
7c8ff89e
DS
1492
1493static int
1494no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc,
bf2bfafd 1495 struct cmd_token **argv)
718e3744 1496{
1497 if (vty->node == CONFIG_NODE)
1498 {
7c8ff89e 1499 if (argc == arg_base + 0)
718e3744 1500 DEBUG_OFF (zebra, ZEBRA);
7c8ff89e 1501 else if (argc == arg_base + 1)
718e3744 1502 {
bf2bfafd 1503 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1504 DEBUG_OFF (zebra, ZEBRA_INTERFACE);
bf2bfafd 1505 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1506 DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1507 }
1508
1509 return CMD_SUCCESS;
1510 }
1511
1512 /* ENABLE_NODE. */
7c8ff89e 1513 if (argc == arg_base + 0)
718e3744 1514 TERM_DEBUG_OFF (zebra, ZEBRA);
7c8ff89e 1515 else if (argc == arg_base + 1)
718e3744 1516 {
bf2bfafd 1517 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
718e3744 1518 TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
bf2bfafd 1519 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
718e3744 1520 TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1521 }
1522
1523 return CMD_SUCCESS;
1524}
1525
f412b39a
DW
1526/*
1527 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1528 * "no debug ospf zebra (interface|redistribute)",
1529 * NO_STR
1530 * DEBUG_STR
1531 * OSPF_STR
1532 * "OSPF Zebra information\n"
1533 * "Zebra interface\n"
1534 * "Zebra redistribute\n"
1535 *
1536 */
7c8ff89e
DS
1537DEFUN (no_debug_ospf_zebra,
1538 no_debug_ospf_zebra_cmd,
1539 "no debug ospf zebra",
1540 NO_STR
1541 DEBUG_STR
1542 OSPF_STR
1543 "OSPF Zebra information\n")
1544{
67656e9b 1545 /* CHECK ME argc referenced below */
7c8ff89e
DS
1546 return no_debug_ospf_zebra_common(vty, 0, argc, argv);
1547}
1548
6b0655a2 1549
f412b39a
DW
1550/*
1551 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1552 * "no debug ospf <1-65535> zebra (interface|redistribute)",
1553 * NO_STR
1554 * DEBUG_STR
1555 * OSPF_STR
1556 * "Instance ID\n"
1557 * "OSPF Zebra information\n"
1558 * "Zebra interface\n"
1559 * "Zebra redistribute\n"
1560 *
1561 */
7c8ff89e
DS
1562DEFUN (no_debug_ospf_instance_zebra,
1563 no_debug_ospf_instance_zebra_cmd,
6147e2c6 1564 "no debug ospf (1-65535) zebra",
7c8ff89e
DS
1565 NO_STR
1566 DEBUG_STR
1567 OSPF_STR
1568 "Instance ID\n"
1569 "OSPF Zebra information\n")
1570{
67656e9b 1571 /* CHECK ME argc referenced below */
8d769265 1572 int idx_number = 3;
7c8ff89e
DS
1573 u_short instance = 0;
1574
8d769265 1575 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1576 if (!ospf_lookup_instance (instance))
1577 return CMD_SUCCESS;
1578
1579 return no_debug_ospf_zebra_common(vty, 1, argc, argv);
1580}
1581
7c8ff89e
DS
1582
1583
718e3744 1584DEFUN (debug_ospf_event,
1585 debug_ospf_event_cmd,
1586 "debug ospf event",
1587 DEBUG_STR
1588 OSPF_STR
1589 "OSPF event information\n")
1590{
1591 if (vty->node == CONFIG_NODE)
1592 CONF_DEBUG_ON (event, EVENT);
1593 TERM_DEBUG_ON (event, EVENT);
1594 return CMD_SUCCESS;
1595}
1596
1597DEFUN (no_debug_ospf_event,
1598 no_debug_ospf_event_cmd,
1599 "no debug ospf event",
1600 NO_STR
1601 DEBUG_STR
1602 OSPF_STR
1603 "OSPF event information\n")
1604{
1605 if (vty->node == CONFIG_NODE)
1606 CONF_DEBUG_OFF (event, EVENT);
1607 TERM_DEBUG_OFF (event, EVENT);
1608 return CMD_SUCCESS;
1609}
1610
7c8ff89e
DS
1611DEFUN (debug_ospf_instance_event,
1612 debug_ospf_instance_event_cmd,
6147e2c6 1613 "debug ospf (1-65535) event",
7c8ff89e
DS
1614 DEBUG_STR
1615 OSPF_STR
1616 "Instance ID\n"
1617 "OSPF event information\n")
1618{
8d769265 1619 int idx_number = 2;
7c8ff89e
DS
1620 u_short instance = 0;
1621
8d769265 1622 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1623 if (!ospf_lookup_instance (instance))
1624 return CMD_SUCCESS;
1625
1626 if (vty->node == CONFIG_NODE)
1627 CONF_DEBUG_ON (event, EVENT);
1628 TERM_DEBUG_ON (event, EVENT);
1629 return CMD_SUCCESS;
1630}
1631
1632DEFUN (no_debug_ospf_instance_event,
1633 no_debug_ospf_instance_event_cmd,
6147e2c6 1634 "no debug ospf (1-65535) event",
7c8ff89e
DS
1635 NO_STR
1636 DEBUG_STR
1637 OSPF_STR
1638 "Instance ID\n"
1639 "OSPF event information\n")
1640{
8d769265 1641 int idx_number = 3;
7c8ff89e
DS
1642 u_short instance = 0;
1643
8d769265 1644 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1645 if (!ospf_lookup_instance (instance))
1646 return CMD_SUCCESS;
1647
1648 if (vty->node == CONFIG_NODE)
1649 CONF_DEBUG_OFF (event, EVENT);
1650 TERM_DEBUG_OFF (event, EVENT);
1651 return CMD_SUCCESS;
1652}
1653
718e3744 1654DEFUN (debug_ospf_nssa,
1655 debug_ospf_nssa_cmd,
1656 "debug ospf nssa",
1657 DEBUG_STR
1658 OSPF_STR
1659 "OSPF nssa information\n")
1660{
1661 if (vty->node == CONFIG_NODE)
1662 CONF_DEBUG_ON (nssa, NSSA);
1663 TERM_DEBUG_ON (nssa, NSSA);
1664 return CMD_SUCCESS;
1665}
1666
1667DEFUN (no_debug_ospf_nssa,
1668 no_debug_ospf_nssa_cmd,
1669 "no debug ospf nssa",
1670 NO_STR
1671 DEBUG_STR
1672 OSPF_STR
1673 "OSPF nssa information\n")
1674{
1675 if (vty->node == CONFIG_NODE)
1676 CONF_DEBUG_OFF (nssa, NSSA);
1677 TERM_DEBUG_OFF (nssa, NSSA);
1678 return CMD_SUCCESS;
1679}
1680
7c8ff89e
DS
1681DEFUN (debug_ospf_instance_nssa,
1682 debug_ospf_instance_nssa_cmd,
6147e2c6 1683 "debug ospf (1-65535) nssa",
7c8ff89e
DS
1684 DEBUG_STR
1685 OSPF_STR
1686 "Instance ID\n"
1687 "OSPF nssa information\n")
1688{
8d769265 1689 int idx_number = 2;
7c8ff89e
DS
1690 u_short instance = 0;
1691
8d769265 1692 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1693 if (!ospf_lookup_instance (instance))
1694 return CMD_SUCCESS;
6b0655a2 1695
7c8ff89e
DS
1696 if (vty->node == CONFIG_NODE)
1697 CONF_DEBUG_ON (nssa, NSSA);
1698 TERM_DEBUG_ON (nssa, NSSA);
1699 return CMD_SUCCESS;
1700}
1701
1702DEFUN (no_debug_ospf_instance_nssa,
1703 no_debug_ospf_instance_nssa_cmd,
6147e2c6 1704 "no debug ospf (1-65535) nssa",
7c8ff89e 1705 NO_STR
718e3744 1706 DEBUG_STR
7c8ff89e
DS
1707 OSPF_STR
1708 "Instance ID\n"
1709 "OSPF nssa information\n")
1710{
8d769265 1711 int idx_number = 3;
7c8ff89e
DS
1712 u_short instance = 0;
1713
8d769265 1714 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1715 if (!ospf_lookup_instance (instance))
1716 return CMD_SUCCESS;
1717
1718 if (vty->node == CONFIG_NODE)
1719 CONF_DEBUG_OFF (nssa, NSSA);
1720 TERM_DEBUG_OFF (nssa, NSSA);
1721 return CMD_SUCCESS;
1722}
1723
16f1b9ee
OD
1724DEFUN (debug_ospf_te,
1725 debug_ospf_te_cmd,
1726 "debug ospf te",
1727 DEBUG_STR
1728 OSPF_STR
1729 "OSPF-TE information\n")
1730{
1731 if (vty->node == CONFIG_NODE)
1732 CONF_DEBUG_ON (te, TE);
1733 TERM_DEBUG_ON (te, TE);
1734 return CMD_SUCCESS;
1735}
1736
1737DEFUN (no_debug_ospf_te,
1738 no_debug_ospf_te_cmd,
1739 "no debug ospf te",
1740 NO_STR
1741 DEBUG_STR
1742 OSPF_STR
1743 "OSPF-TE information\n")
1744{
1745 if (vty->node == CONFIG_NODE)
1746 CONF_DEBUG_OFF (te, TE);
1747 TERM_DEBUG_OFF (te, TE);
1748 return CMD_SUCCESS;
1749}
1750
4dfd8aff
DW
1751DEFUN (no_debug_ospf,
1752 no_debug_ospf_cmd,
1753 "no debug ospf",
1754 NO_STR
1755 DEBUG_STR
1756 OSPF_STR)
1757{
1758 int flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
1759 int i;
1760
1761 if (vty->node == CONFIG_NODE)
1762 {
1763 CONF_DEBUG_OFF (event, EVENT);
1764 CONF_DEBUG_OFF (nssa, NSSA);
1765 DEBUG_OFF (ism, ISM_EVENTS);
1766 DEBUG_OFF (ism, ISM_STATUS);
1767 DEBUG_OFF (ism, ISM_TIMERS);
1768 DEBUG_OFF (lsa, LSA);
1769 DEBUG_OFF (lsa, LSA_FLOODING);
1770 DEBUG_OFF (lsa, LSA_GENERATE);
1771 DEBUG_OFF (lsa, LSA_INSTALL);
1772 DEBUG_OFF (lsa, LSA_REFRESH);
1773 DEBUG_OFF (nsm, NSM);
1774 DEBUG_OFF (nsm, NSM_EVENTS);
1775 DEBUG_OFF (nsm, NSM_STATUS);
1776 DEBUG_OFF (nsm, NSM_TIMERS);
1777 DEBUG_OFF (zebra, ZEBRA);
1778 DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1779 DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1780
1781 for (i = 0; i < 5; i++)
1782 DEBUG_PACKET_OFF (i, flag);
1783 }
1784
1785 for (i = 0; i < 5; i++)
1786 TERM_DEBUG_PACKET_OFF (i, flag);
1787
1788 TERM_DEBUG_OFF (event, EVENT);
1789 TERM_DEBUG_OFF (ism, ISM);
1790 TERM_DEBUG_OFF (ism, ISM_EVENTS);
1791 TERM_DEBUG_OFF (ism, ISM_STATUS);
1792 TERM_DEBUG_OFF (ism, ISM_TIMERS);
1793 TERM_DEBUG_OFF (lsa, LSA);
1794 TERM_DEBUG_OFF (lsa, LSA_FLOODING);
1795 TERM_DEBUG_OFF (lsa, LSA_GENERATE);
1796 TERM_DEBUG_OFF (lsa, LSA_INSTALL);
1797 TERM_DEBUG_OFF (lsa, LSA_REFRESH);
1798 TERM_DEBUG_OFF (nsm, NSM);
1799 TERM_DEBUG_OFF (nsm, NSM_EVENTS);
1800 TERM_DEBUG_OFF (nsm, NSM_STATUS);
1801 TERM_DEBUG_OFF (nsm, NSM_TIMERS);
1802 TERM_DEBUG_OFF (nssa, NSSA);
1803 TERM_DEBUG_OFF (zebra, ZEBRA);
1804 TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1805 TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1806
1807 return CMD_SUCCESS;
1808}
7c8ff89e
DS
1809
1810static int
1811show_debugging_ospf_common (struct vty *vty, struct ospf *ospf)
718e3744 1812{
1813 int i;
1814
7c8ff89e
DS
1815 if (ospf->instance)
1816 vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
1817 VTY_NEWLINE, VTY_NEWLINE);
1818
df43a137 1819 vty_out (vty, "OSPF debugging status:%s", VTY_NEWLINE);
718e3744 1820
aca72fda 1821 /* Show debug status for events. */
1822 if (IS_DEBUG_OSPF(event,EVENT))
1823 vty_out (vty, " OSPF event debugging is on%s", VTY_NEWLINE);
1824
718e3744 1825 /* Show debug status for ISM. */
1826 if (IS_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
1827 vty_out (vty, " OSPF ISM debugging is on%s", VTY_NEWLINE);
1828 else
1829 {
1830 if (IS_DEBUG_OSPF (ism, ISM_STATUS))
1831 vty_out (vty, " OSPF ISM status debugging is on%s", VTY_NEWLINE);
1832 if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
1833 vty_out (vty, " OSPF ISM event debugging is on%s", VTY_NEWLINE);
1834 if (IS_DEBUG_OSPF (ism, ISM_TIMERS))
1835 vty_out (vty, " OSPF ISM timer debugging is on%s", VTY_NEWLINE);
1836 }
1837
1838 /* Show debug status for NSM. */
1839 if (IS_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
1840 vty_out (vty, " OSPF NSM debugging is on%s", VTY_NEWLINE);
1841 else
1842 {
1843 if (IS_DEBUG_OSPF (nsm, NSM_STATUS))
1844 vty_out (vty, " OSPF NSM status debugging is on%s", VTY_NEWLINE);
1845 if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
1846 vty_out (vty, " OSPF NSM event debugging is on%s", VTY_NEWLINE);
1847 if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
1848 vty_out (vty, " OSPF NSM timer debugging is on%s", VTY_NEWLINE);
1849 }
1850
1851 /* Show debug status for OSPF Packets. */
1852 for (i = 0; i < 5; i++)
1853 if (IS_DEBUG_OSPF_PACKET (i, SEND) && IS_DEBUG_OSPF_PACKET (i, RECV))
1854 {
1855 vty_out (vty, " OSPF packet %s%s debugging is on%s",
272ca1e3 1856 LOOKUP (ospf_packet_type_str, i + 1),
718e3744 1857 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1858 VTY_NEWLINE);
1859 }
1860 else
1861 {
1862 if (IS_DEBUG_OSPF_PACKET (i, SEND))
1863 vty_out (vty, " OSPF packet %s send%s debugging is on%s",
272ca1e3 1864 LOOKUP (ospf_packet_type_str, i + 1),
718e3744 1865 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1866 VTY_NEWLINE);
1867 if (IS_DEBUG_OSPF_PACKET (i, RECV))
1868 vty_out (vty, " OSPF packet %s receive%s debugging is on%s",
272ca1e3 1869 LOOKUP (ospf_packet_type_str, i + 1),
718e3744 1870 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
1871 VTY_NEWLINE);
1872 }
1873
1874 /* Show debug status for OSPF LSAs. */
1875 if (IS_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
1876 vty_out (vty, " OSPF LSA debugging is on%s", VTY_NEWLINE);
1877 else
1878 {
1879 if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
1880 vty_out (vty, " OSPF LSA generation debugging is on%s", VTY_NEWLINE);
1881 if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
1882 vty_out (vty, " OSPF LSA flooding debugging is on%s", VTY_NEWLINE);
1883 if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
1884 vty_out (vty, " OSPF LSA install debugging is on%s", VTY_NEWLINE);
1885 if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
1886 vty_out (vty, " OSPF LSA refresh debugging is on%s", VTY_NEWLINE);
1887 }
1888
1889 /* Show debug status for Zebra. */
1890 if (IS_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
1891 vty_out (vty, " OSPF Zebra debugging is on%s", VTY_NEWLINE);
1892 else
1893 {
1894 if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
1895 vty_out (vty, " OSPF Zebra interface debugging is on%s", VTY_NEWLINE);
1896 if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
1897 vty_out (vty, " OSPF Zebra redistribute debugging is on%s", VTY_NEWLINE);
1898 }
aca72fda 1899
1900 /* Show debug status for NSSA. */
ead687e1 1901 if (IS_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
1902 vty_out (vty, " OSPF NSSA debugging is on%s", VTY_NEWLINE);
718e3744 1903
7c8ff89e
DS
1904 vty_out (vty, "%s", VTY_NEWLINE);
1905
718e3744 1906 return CMD_SUCCESS;
1907}
1908
7c8ff89e
DS
1909DEFUN (show_debugging_ospf,
1910 show_debugging_ospf_cmd,
1911 "show debugging ospf",
1912 SHOW_STR
1913 DEBUG_STR
1914 OSPF_STR)
1915{
1916 struct ospf *ospf;
1917
1918 if ((ospf = ospf_lookup()) == NULL)
1919 return CMD_SUCCESS;
1920
1921 return show_debugging_ospf_common(vty, ospf);
1922}
1923
1924DEFUN (show_debugging_ospf_instance,
1925 show_debugging_ospf_instance_cmd,
6147e2c6 1926 "show debugging ospf (1-65535)",
7c8ff89e
DS
1927 SHOW_STR
1928 DEBUG_STR
1929 OSPF_STR
1930 "Instance ID\n")
1931{
8d769265 1932 int idx_number = 3;
7c8ff89e
DS
1933 struct ospf *ospf;
1934 u_short instance = 0;
1935
8d769265 1936 VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
7c8ff89e
DS
1937 if ((ospf = ospf_lookup_instance (instance)) == NULL )
1938 return CMD_SUCCESS;
1939
1940 return show_debugging_ospf_common(vty, ospf);
1941}
1942
718e3744 1943/* Debug node. */
7fc626de 1944static struct cmd_node debug_node =
718e3744 1945{
1946 DEBUG_NODE,
1d806288 1947 "",
1948 1 /* VTYSH */
718e3744 1949};
1950
4dadc291 1951static int
718e3744 1952config_write_debug (struct vty *vty)
1953{
1954 int write = 0;
1955 int i, r;
1956
eb1ce605 1957 const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
1958 const char *detail_str[] = {"", " send", " recv", "", " detail",
718e3744 1959 " send detail", " recv detail", " detail"};
1960
7c8ff89e
DS
1961 struct ospf *ospf;
1962 char str[16];
7fe9687b 1963 memset (str, 0, 16);
7c8ff89e
DS
1964
1965 if ((ospf = ospf_lookup()) == NULL)
1966 return CMD_SUCCESS;
1967
1968 if (ospf->instance)
1969 sprintf(str, " %d", ospf->instance);
7c8ff89e 1970
718e3744 1971 /* debug ospf ism (status|events|timers). */
1972 if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
7c8ff89e 1973 vty_out (vty, "debug ospf%s ism%s", str, VTY_NEWLINE);
718e3744 1974 else
1975 {
1976 if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
7c8ff89e 1977 vty_out (vty, "debug ospf%s ism status%s", str, VTY_NEWLINE);
718e3744 1978 if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
7c8ff89e 1979 vty_out (vty, "debug ospf%s ism event%s", str, VTY_NEWLINE);
718e3744 1980 if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
7c8ff89e 1981 vty_out (vty, "debug ospf%s ism timer%s", str, VTY_NEWLINE);
718e3744 1982 }
1983
1984 /* debug ospf nsm (status|events|timers). */
1985 if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
7c8ff89e 1986 vty_out (vty, "debug ospf%s nsm%s", str, VTY_NEWLINE);
718e3744 1987 else
1988 {
1989 if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
7c8ff89e 1990 vty_out (vty, "debug ospf%s nsm status%s", str, VTY_NEWLINE);
718e3744 1991 if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
7c8ff89e 1992 vty_out (vty, "debug ospf%s nsm event%s", str, VTY_NEWLINE);
718e3744 1993 if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
7c8ff89e 1994 vty_out (vty, "debug ospf%s nsm timer%s", str, VTY_NEWLINE);
718e3744 1995 }
1996
1997 /* debug ospf lsa (generate|flooding|install|refresh). */
1998 if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
7c8ff89e 1999 vty_out (vty, "debug ospf%s lsa%s", str, VTY_NEWLINE);
718e3744 2000 else
2001 {
2002 if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
7c8ff89e 2003 vty_out (vty, "debug ospf%s lsa generate%s", str, VTY_NEWLINE);
718e3744 2004 if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
7c8ff89e 2005 vty_out (vty, "debug ospf%s lsa flooding%s", str, VTY_NEWLINE);
718e3744 2006 if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
7c8ff89e 2007 vty_out (vty, "debug ospf%s lsa install%s", str, VTY_NEWLINE);
718e3744 2008 if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
7c8ff89e 2009 vty_out (vty, "debug ospf%s lsa refresh%s", str, VTY_NEWLINE);
718e3744 2010
2011 write = 1;
2012 }
2013
2014 /* debug ospf zebra (interface|redistribute). */
2015 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
7c8ff89e 2016 vty_out (vty, "debug ospf%s zebra%s", str, VTY_NEWLINE);
718e3744 2017 else
2018 {
2019 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
7c8ff89e 2020 vty_out (vty, "debug ospf%s zebra interface%s", str, VTY_NEWLINE);
718e3744 2021 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
7c8ff89e 2022 vty_out (vty, "debug ospf%s zebra redistribute%s", str, VTY_NEWLINE);
718e3744 2023
2024 write = 1;
2025 }
2026
2027 /* debug ospf event. */
2028 if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
2029 {
7c8ff89e 2030 vty_out (vty, "debug ospf%s event%s", str, VTY_NEWLINE);
718e3744 2031 write = 1;
2032 }
2033
2034 /* debug ospf nssa. */
2035 if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
2036 {
7c8ff89e 2037 vty_out (vty, "debug ospf%s nssa%s", str, VTY_NEWLINE);
718e3744 2038 write = 1;
2039 }
2040
2041 /* debug ospf packet all detail. */
2042 r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
2043 for (i = 0; i < 5; i++)
2044 r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
2045 if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
2046 {
7c8ff89e 2047 vty_out (vty, "debug ospf%s packet all detail%s", str, VTY_NEWLINE);
718e3744 2048 return 1;
2049 }
2050
2051 /* debug ospf packet all. */
2052 r = OSPF_DEBUG_SEND_RECV;
2053 for (i = 0; i < 5; i++)
2054 r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
2055 if (r == OSPF_DEBUG_SEND_RECV)
2056 {
7c8ff89e 2057 vty_out (vty, "debug ospf%s packet all%s", str, VTY_NEWLINE);
718e3744 2058 for (i = 0; i < 5; i++)
2059 if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
7c8ff89e 2060 vty_out (vty, "debug ospf%s packet %s detail%s", str,
718e3744 2061 type_str[i],
2062 VTY_NEWLINE);
2063 return 1;
2064 }
2065
2066 /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
2067 (send|recv) (detail). */
2068 for (i = 0; i < 5; i++)
2069 {
2070 if (conf_debug_ospf_packet[i] == 0)
2071 continue;
2072
7c8ff89e 2073 vty_out (vty, "debug ospf%s packet %s%s%s", str,
718e3744 2074 type_str[i], detail_str[conf_debug_ospf_packet[i]],
2075 VTY_NEWLINE);
2076 write = 1;
2077 }
2078
2079 return write;
2080}
2081
2082/* Initialize debug commands. */
2083void
2084debug_init ()
2085{
2086 install_node (&debug_node, config_write_debug);
2087
2088 install_element (ENABLE_NODE, &show_debugging_ospf_cmd);
718e3744 2089 install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
718e3744 2090 install_element (ENABLE_NODE, &debug_ospf_nsm_cmd);
718e3744 2091 install_element (ENABLE_NODE, &debug_ospf_lsa_cmd);
718e3744 2092 install_element (ENABLE_NODE, &debug_ospf_zebra_cmd);
2093 install_element (ENABLE_NODE, &debug_ospf_event_cmd);
718e3744 2094 install_element (ENABLE_NODE, &debug_ospf_nssa_cmd);
16f1b9ee 2095 install_element (ENABLE_NODE, &debug_ospf_te_cmd);
718e3744 2096 install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
718e3744 2097 install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd);
718e3744 2098 install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd);
718e3744 2099 install_element (ENABLE_NODE, &no_debug_ospf_zebra_cmd);
2100 install_element (ENABLE_NODE, &no_debug_ospf_event_cmd);
718e3744 2101 install_element (ENABLE_NODE, &no_debug_ospf_nssa_cmd);
16f1b9ee 2102 install_element (ENABLE_NODE, &no_debug_ospf_te_cmd);
718e3744 2103
7c8ff89e 2104 install_element (ENABLE_NODE, &show_debugging_ospf_instance_cmd);
692b4c65
QY
2105 install_element (ENABLE_NODE, &debug_ospf_packet_cmd);
2106 install_element (ENABLE_NODE, &no_debug_ospf_packet_cmd);
2107 install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
2108 install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
2109
7c8ff89e 2110 install_element (ENABLE_NODE, &debug_ospf_instance_nsm_cmd);
7c8ff89e 2111 install_element (ENABLE_NODE, &debug_ospf_instance_lsa_cmd);
7c8ff89e
DS
2112 install_element (ENABLE_NODE, &debug_ospf_instance_zebra_cmd);
2113 install_element (ENABLE_NODE, &debug_ospf_instance_event_cmd);
2114 install_element (ENABLE_NODE, &debug_ospf_instance_nssa_cmd);
7c8ff89e 2115 install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd);
7c8ff89e 2116 install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd);
7c8ff89e
DS
2117 install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd);
2118 install_element (ENABLE_NODE, &no_debug_ospf_instance_event_cmd);
2119 install_element (ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd);
4dfd8aff 2120 install_element (ENABLE_NODE, &no_debug_ospf_cmd);
7c8ff89e 2121
692b4c65
QY
2122
2123
2124 install_element (CONFIG_NODE, &debug_ospf_packet_cmd);
2125 install_element (CONFIG_NODE, &no_debug_ospf_packet_cmd);
718e3744 2126 install_element (CONFIG_NODE, &debug_ospf_ism_cmd);
692b4c65
QY
2127 install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
2128
718e3744 2129 install_element (CONFIG_NODE, &debug_ospf_nsm_cmd);
718e3744 2130 install_element (CONFIG_NODE, &debug_ospf_lsa_cmd);
718e3744 2131 install_element (CONFIG_NODE, &debug_ospf_zebra_cmd);
2132 install_element (CONFIG_NODE, &debug_ospf_event_cmd);
718e3744 2133 install_element (CONFIG_NODE, &debug_ospf_nssa_cmd);
16f1b9ee 2134 install_element (CONFIG_NODE, &debug_ospf_te_cmd);
718e3744 2135 install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
718e3744 2136 install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd);
718e3744 2137 install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd);
718e3744 2138 install_element (CONFIG_NODE, &no_debug_ospf_zebra_cmd);
2139 install_element (CONFIG_NODE, &no_debug_ospf_event_cmd);
718e3744 2140 install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd);
16f1b9ee 2141 install_element (CONFIG_NODE, &no_debug_ospf_te_cmd);
7c8ff89e 2142
7c8ff89e 2143 install_element (CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
7c8ff89e 2144 install_element (CONFIG_NODE, &debug_ospf_instance_lsa_cmd);
7c8ff89e
DS
2145 install_element (CONFIG_NODE, &debug_ospf_instance_zebra_cmd);
2146 install_element (CONFIG_NODE, &debug_ospf_instance_event_cmd);
2147 install_element (CONFIG_NODE, &debug_ospf_instance_nssa_cmd);
7c8ff89e 2148 install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd);
7c8ff89e 2149 install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd);
7c8ff89e
DS
2150 install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd);
2151 install_element (CONFIG_NODE, &no_debug_ospf_instance_event_cmd);
2152 install_element (CONFIG_NODE, &no_debug_ospf_instance_nssa_cmd);
4dfd8aff 2153 install_element (CONFIG_NODE, &no_debug_ospf_cmd);
718e3744 2154}