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