]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_dump.c
convert <1-255> to (1-255), ()s to <>s, etc
[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 unsigned long conf_debug_ospf_te = 0;
137
138 /* Enable debug option variables -- valid only session. */
139 unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
140 unsigned long term_debug_ospf_event = 0;
141 unsigned long term_debug_ospf_ism = 0;
142 unsigned long term_debug_ospf_nsm = 0;
143 unsigned long term_debug_ospf_lsa = 0;
144 unsigned long term_debug_ospf_zebra = 0;
145 unsigned long term_debug_ospf_nssa = 0;
146 unsigned long term_debug_ospf_te = 0;
147
148
149 const char *
150 ospf_redist_string(u_int route_type)
151 {
152 return (route_type == ZEBRA_ROUTE_MAX) ?
153 "Default" : zebra_route_string(route_type);
154 }
155
156 #define OSPF_AREA_STRING_MAXLEN 16
157 const char *
158 ospf_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
174 const char *
175 ospf_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);
196 }
197
198 return buf;
199 }
200
201 #define OSPF_IF_STRING_MAXLEN 40
202 const char *
203 ospf_if_name_string (struct ospf_interface *oi)
204 {
205 static char buf[OSPF_IF_STRING_MAXLEN] = "";
206 u_int32_t ifaddr;
207
208 if (!oi || !oi->address)
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
222
223 void
224 ospf_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
243 const char *
244 ospf_timeval_dump (struct timeval *t, char *buf, size_t size)
245 {
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)
251 unsigned long w, d, h, m, s, ms, us;
252
253 if (!t)
254 return "inactive";
255
256 w = d = h = m = s = ms = us = 0;
257 memset (buf, 0, size);
258
259 us = t->tv_usec;
260 if (us >= 1000)
261 {
262 ms = us / 1000;
263 us %= 1000;
264 }
265
266 if (ms >= 1000)
267 {
268 t->tv_sec += ms / 1000;
269 ms %= 1000;
270 }
271
272 if (t->tv_sec > WEEK_IN_SECONDS)
273 {
274 w = t->tv_sec / WEEK_IN_SECONDS;
275 t->tv_sec -= w * WEEK_IN_SECONDS;
276 }
277
278 if (t->tv_sec > DAY_IN_SECONDS)
279 {
280 d = t->tv_sec / DAY_IN_SECONDS;
281 t->tv_sec -= d * DAY_IN_SECONDS;
282 }
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)
303 snprintf (buf, size, "%ldh%02ldm%02lds", h, m, (long)t->tv_sec);
304 else if (m)
305 snprintf (buf, size, "%ldm%02lds", m, (long)t->tv_sec);
306 else if (ms)
307 snprintf (buf, size, "%ld.%03lds", (long)t->tv_sec, ms);
308 else
309 snprintf (buf, size, "%ld usecs", (long)t->tv_usec);
310
311 return buf;
312 }
313
314 const char *
315 ospf_timer_dump (struct thread *t, char *buf, size_t size)
316 {
317 struct timeval result;
318 if (!t)
319 return "inactive";
320
321 result = tv_sub (t->u.sands, recent_relative_time());
322 return ospf_timeval_dump (&result, buf, size);
323 }
324
325 #define OSPF_OPTION_STR_MAXLEN 24
326
327 char *
328 ospf_options_dump (u_char options)
329 {
330 static char buf[OSPF_OPTION_STR_MAXLEN];
331
332 snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s",
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" : "-",
338 (options & OSPF_OPTION_E) ? "E" : "-",
339 (options & OSPF_OPTION_MT) ? "M/T" : "-");
340
341 return buf;
342 }
343
344 static void
345 ospf_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
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,
356 ospf_options_dump (hello->options));
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));
361
362 length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE;
363 zlog_debug (" # Neighbors %d", length / 4);
364 for (i = 0; length > 0; i++, length -= sizeof (struct in_addr))
365 zlog_debug (" Neighbor %s", inet_ntoa (hello->neighbors[i]));
366 }
367
368 static char *
369 ospf_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
381 void
382 ospf_lsa_header_dump (struct lsa_header *lsah)
383 {
384 const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
385
386 zlog_debug (" LSA Header");
387 zlog_debug (" LS age %d", ntohs (lsah->ls_age));
388 zlog_debug (" Options %d (%s)", lsah->options,
389 ospf_options_dump (lsah->options));
390 zlog_debug (" LS type %d (%s)", lsah->type,
391 (lsah->type ? lsah_type : "unknown type"));
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));
397 }
398
399 static char *
400 ospf_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
412 static void
413 ospf_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
421 zlog_debug (" Router-LSA");
422 zlog_debug (" flags %s",
423 ospf_router_lsa_flags_dump (rl->flags, buf, BUFSIZ));
424 zlog_debug (" # links %d", ntohs (rl->links));
425
426 len = ntohs (rl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
427 for (i = 0; len > 0; i++)
428 {
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));
434
435 len -= 12;
436 }
437 }
438
439 static void
440 ospf_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
448 zlog_debug (" Network-LSA");
449 /*
450 zlog_debug ("LSA total size %d", ntohs (nl->header.length));
451 zlog_debug ("Network-LSA size %d",
452 ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE);
453 */
454 zlog_debug (" Network Mask %s", inet_ntoa (nl->mask));
455 zlog_debug (" # Attached Routers %d", cnt);
456 for (i = 0; i < cnt; i++)
457 zlog_debug (" Attached Router %s", inet_ntoa (nl->routers[i]));
458 }
459
460 static void
461 ospf_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
469 zlog_debug (" Summary-LSA");
470 zlog_debug (" Network Mask %s", inet_ntoa (sl->mask));
471
472 size = ntohs (sl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
473 for (i = 0; size > 0; size -= 4, i++)
474 zlog_debug (" TOS=%d metric %d", sl->tos,
475 GET_METRIC (sl->metric));
476 }
477
478 static void
479 ospf_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);
486 zlog_debug (" %s", ospf_lsa_type_msg[al->header.type].str);
487 zlog_debug (" Network Mask %s", inet_ntoa (al->mask));
488
489 size = ntohs (al->header.length) - OSPF_LSA_HEADER_SIZE -4;
490 for (i = 0; size > 0; size -= 12, i++)
491 {
492 zlog_debug (" bit %s TOS=%d metric %d",
493 IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
494 al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
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);
497 }
498 }
499
500 static void
501 ospf_lsa_header_list_dump (struct stream *s, u_int16_t length)
502 {
503 struct lsa_header *lsa;
504
505 zlog_debug (" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE);
506
507 /* LSA Headers. */
508 while (length > 0)
509 {
510 lsa = (struct lsa_header *) STREAM_PNT (s);
511 ospf_lsa_header_dump (lsa);
512
513 stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
514 length -= OSPF_LSA_HEADER_SIZE;
515 }
516 }
517
518 static void
519 ospf_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
529 zlog_debug ("Database Description");
530 zlog_debug (" Interface MTU %d", ntohs (dd->mtu));
531 zlog_debug (" Options %d (%s)", dd->options,
532 ospf_options_dump (dd->options));
533 zlog_debug (" Flags %d (%s)", dd->flags,
534 ospf_dd_flags_dump (dd->flags, dd_flags, sizeof dd_flags));
535 zlog_debug (" Sequence Number 0x%08lx", (u_long)ntohl (dd->dd_seqnum));
536
537 length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
538
539 stream_forward_getp (s, OSPF_DB_DESC_MIN_SIZE);
540
541 ospf_lsa_header_list_dump (s, length);
542
543 stream_set_getp (s, gp);
544 }
545
546 static void
547 ospf_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
558 zlog_debug ("Link State Request");
559 zlog_debug (" # Requests %d", length / 12);
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
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",
570 inet_ntoa (adv_router));
571 }
572
573 stream_set_getp (s, sp);
574 }
575
576 static void
577 ospf_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
591 zlog_debug ("Link State Update");
592 zlog_debug (" # LSAs %d", count);
593
594 while (length > 0 && count > 0)
595 {
596 if (length < OSPF_HEADER_SIZE || length % 4 != 0)
597 {
598 zlog_debug (" Remaining %d bytes; Incorrect length.", length);
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;
621 case OSPF_AS_NSSA_LSA:
622 ospf_as_external_lsa_dump (s, length);
623 break;
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;
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 struct cmd_token **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]->arg, "h", 1) == 0)
773 type = OSPF_DEBUG_HELLO;
774 else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0)
775 type = OSPF_DEBUG_DB_DESC;
776 else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0)
777 type = OSPF_DEBUG_LS_REQ;
778 else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0)
779 type = OSPF_DEBUG_LS_UPD;
780 else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0)
781 type = OSPF_DEBUG_LS_ACK;
782 else if (strncmp (argv[arg_base + 0]->arg, "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]->arg, "s", 1) == 0)
793 flag = OSPF_DEBUG_SEND;
794 else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0)
795 flag = OSPF_DEBUG_RECV;
796 else if (strncmp (argv[arg_base + 1]->arg, "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]->arg, "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 /*
818 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
819 * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
820 * "Debugging functions\n"
821 * "OSPF information\n"
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 * "Packet sent\n"
830 * "Packet received\n"
831 * "Detail Information\n"
832 *
833 * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
834 * "Debugging functions\n"
835 * "OSPF information\n"
836 * "OSPF packets\n"
837 * "OSPF Hello\n"
838 * "OSPF Database Description\n"
839 * "OSPF Link State Request\n"
840 * "OSPF Link State Update\n"
841 * "OSPF Link State Acknowledgment\n"
842 * "OSPF all packets\n"
843 * "Packet sent\n"
844 * "Packet received\n"
845 * "Detail information\n"
846 *
847 */
848 DEFUN (debug_ospf_packet,
849 debug_ospf_packet_all_cmd,
850 "debug ospf packet <hello|dd|ls-request|ls-update|ls-ack|all>",
851 DEBUG_STR
852 OSPF_STR
853 "OSPF packets\n"
854 "OSPF Hello\n"
855 "OSPF Database Description\n"
856 "OSPF Link State Request\n"
857 "OSPF Link State Update\n"
858 "OSPF Link State Acknowledgment\n"
859 "OSPF all packets\n")
860 {
861 return (debug_ospf_packet_common(vty, 0, argc, argv));
862 }
863
864
865
866 /*
867 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
868 * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
869 * "Debugging functions\n"
870 * "OSPF information\n"
871 * "Instance ID\n"
872 * "OSPF packets\n"
873 * "OSPF Hello\n"
874 * "OSPF Database Description\n"
875 * "OSPF Link State Request\n"
876 * "OSPF Link State Update\n"
877 * "OSPF Link State Acknowledgment\n"
878 * "OSPF all packets\n"
879 * "Packet sent\n"
880 * "Packet received\n"
881 * "Detail information\n"
882 *
883 * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
884 * "Debugging functions\n"
885 * "OSPF information\n"
886 * "Instance ID\n"
887 * "OSPF packets\n"
888 * "OSPF Hello\n"
889 * "OSPF Database Description\n"
890 * "OSPF Link State Request\n"
891 * "OSPF Link State Update\n"
892 * "OSPF Link State Acknowledgment\n"
893 * "OSPF all packets\n"
894 * "Packet sent\n"
895 * "Packet received\n"
896 * "Detail Information\n"
897 *
898 */
899 DEFUN (debug_ospf_instance_packet,
900 debug_ospf_instance_packet_all_cmd,
901 "debug ospf (1-65535) packet <hello|dd|ls-request|ls-update|ls-ack|all>",
902 DEBUG_STR
903 OSPF_STR
904 "Instance ID\n"
905 "OSPF packets\n"
906 "OSPF Hello\n"
907 "OSPF Database Description\n"
908 "OSPF Link State Request\n"
909 "OSPF Link State Update\n"
910 "OSPF Link State Acknowledgment\n"
911 "OSPF all packets\n")
912 {
913 u_short instance = 0;
914
915 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
916 if (!ospf_lookup_instance (instance))
917 return CMD_SUCCESS;
918
919 return (debug_ospf_packet_common(vty, 1, argc, argv));
920 }
921
922
923
924 static int
925 no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc,
926 struct cmd_token **argv)
927 {
928 int type = 0;
929 int flag = 0;
930 int i;
931
932 assert (argc > arg_base + 0);
933
934 /* Check packet type. */
935 if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0)
936 type = OSPF_DEBUG_HELLO;
937 else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0)
938 type = OSPF_DEBUG_DB_DESC;
939 else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0)
940 type = OSPF_DEBUG_LS_REQ;
941 else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0)
942 type = OSPF_DEBUG_LS_UPD;
943 else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0)
944 type = OSPF_DEBUG_LS_ACK;
945 else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0)
946 type = OSPF_DEBUG_ALL;
947
948 /* Default, both send and recv. */
949 if (argc == arg_base + 1)
950 flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL ;
951
952 /* send or recv. */
953 if (argc == arg_base + 2)
954 {
955 if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0)
956 flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL;
957 else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0)
958 flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
959 else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0)
960 flag = OSPF_DEBUG_DETAIL | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
961 }
962
963 /* detail. */
964 if (argc == arg_base + 3)
965 if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0)
966 flag = OSPF_DEBUG_DETAIL;
967
968 for (i = 0; i < 5; i++)
969 if (type & (0x01 << i))
970 {
971 if (vty->node == CONFIG_NODE)
972 DEBUG_PACKET_OFF (i, flag);
973 else
974 TERM_DEBUG_PACKET_OFF (i, flag);
975 }
976
977 #ifdef DEBUG
978 /*
979 for (i = 0; i < 5; i++)
980 zlog_debug ("flag[%d] = %d", i, ospf_debug_packet[i]);
981 */
982 #endif /* DEBUG */
983
984 return CMD_SUCCESS;
985 }
986
987 /*
988 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
989 * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
990 * NO_STR
991 * "Debugging functions\n"
992 * "OSPF information\n"
993 * "OSPF packets\n"
994 * "OSPF Hello\n"
995 * "OSPF Database Description\n"
996 * "OSPF Link State Request\n"
997 * "OSPF Link State Update\n"
998 * "OSPF Link State Acknowledgment\n"
999 * "OSPF all packets\n"
1000 * "Packet sent\n"
1001 * "Packet received\n"
1002 * "Detail Information\n"
1003 *
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 */
1020 DEFUN (no_debug_ospf_packet,
1021 no_debug_ospf_packet_all_cmd,
1022 "no debug ospf packet <hello|dd|ls-request|ls-update|ls-ack|all>",
1023 NO_STR
1024 DEBUG_STR
1025 OSPF_STR
1026 "OSPF packets\n"
1027 "OSPF Hello\n"
1028 "OSPF Database Description\n"
1029 "OSPF Link State Request\n"
1030 "OSPF Link State Update\n"
1031 "OSPF Link State Acknowledgment\n"
1032 "OSPF all packets\n")
1033 {
1034 return no_debug_ospf_packet_common(vty, 0, argc, argv);
1035 }
1036
1037
1038
1039 /*
1040 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1041 * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
1042 * NO_STR
1043 * "Debugging functions\n"
1044 * "OSPF information\n"
1045 * "Instance ID\n"
1046 * "OSPF packets\n"
1047 * "OSPF Hello\n"
1048 * "OSPF Database Description\n"
1049 * "OSPF Link State Request\n"
1050 * "OSPF Link State Update\n"
1051 * "OSPF Link State Acknowledgment\n"
1052 * "OSPF all packets\n"
1053 * "Packet sent\n"
1054 * "Packet received\n"
1055 * "Detail Information\n"
1056 *
1057 * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
1058 * NO_STR
1059 * "Debugging functions\n"
1060 * "OSPF information\n"
1061 * "Instance ID\n"
1062 * "OSPF packets\n"
1063 * "OSPF Hello\n"
1064 * "OSPF Database Description\n"
1065 * "OSPF Link State Request\n"
1066 * "OSPF Link State Update\n"
1067 * "OSPF Link State Acknowledgment\n"
1068 * "OSPF all packets\n"
1069 * "Packet sent\n"
1070 * "Packet received\n"
1071 * "Detail Information\n"
1072 *
1073 */
1074 DEFUN (no_debug_ospf_instance_packet,
1075 no_debug_ospf_instance_packet_all_cmd,
1076 "no debug ospf (1-65535) packet <hello|dd|ls-request|ls-update|ls-ack|all>",
1077 NO_STR
1078 DEBUG_STR
1079 OSPF_STR
1080 "Instance ID\n"
1081 "OSPF packets\n"
1082 "OSPF Hello\n"
1083 "OSPF Database Description\n"
1084 "OSPF Link State Request\n"
1085 "OSPF Link State Update\n"
1086 "OSPF Link State Acknowledgment\n"
1087 "OSPF all packets\n")
1088 {
1089 u_short instance = 0;
1090
1091 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1092 if (!ospf_lookup_instance (instance))
1093 return CMD_SUCCESS;
1094
1095 return (no_debug_ospf_packet_common(vty, 1, argc, argv));
1096 }
1097
1098
1099
1100
1101 static int
1102 debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1103 {
1104 if (vty->node == CONFIG_NODE)
1105 {
1106 if (argc == arg_base + 0)
1107 DEBUG_ON (ism, ISM);
1108 else if (argc == arg_base + 1)
1109 {
1110 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1111 DEBUG_ON (ism, ISM_STATUS);
1112 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1113 DEBUG_ON (ism, ISM_EVENTS);
1114 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1115 DEBUG_ON (ism, ISM_TIMERS);
1116 }
1117
1118 return CMD_SUCCESS;
1119 }
1120
1121 /* ENABLE_NODE. */
1122 if (argc == arg_base + 0)
1123 TERM_DEBUG_ON (ism, ISM);
1124 else if (argc == arg_base + 1)
1125 {
1126 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1127 TERM_DEBUG_ON (ism, ISM_STATUS);
1128 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1129 TERM_DEBUG_ON (ism, ISM_EVENTS);
1130 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1131 TERM_DEBUG_ON (ism, ISM_TIMERS);
1132 }
1133
1134 return CMD_SUCCESS;
1135 }
1136
1137 /*
1138 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1139 * "debug ospf ism (status|events|timers)",
1140 * DEBUG_STR
1141 * OSPF_STR
1142 * "OSPF Interface State Machine\n"
1143 * "ISM Status Information\n"
1144 * "ISM Event Information\n"
1145 * "ISM TImer Information\n"
1146 *
1147 */
1148 DEFUN (debug_ospf_ism,
1149 debug_ospf_ism_cmd,
1150 "debug ospf ism",
1151 DEBUG_STR
1152 OSPF_STR
1153 "OSPF Interface State Machine\n")
1154 {
1155 return debug_ospf_ism_common(vty, 0, argc, argv);
1156 }
1157
1158
1159 /*
1160 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1161 * "debug ospf <1-65535> ism (status|events|timers)",
1162 * DEBUG_STR
1163 * OSPF_STR
1164 * "Instance ID\n"
1165 * "OSPF Interface State Machine\n"
1166 * "ISM Status Information\n"
1167 * "ISM Event Information\n"
1168 * "ISM TImer Information\n"
1169 *
1170 */
1171 DEFUN (debug_ospf_instance_ism,
1172 debug_ospf_instance_ism_cmd,
1173 "debug ospf (1-65535) ism",
1174 DEBUG_STR
1175 OSPF_STR
1176 "Instance ID\n"
1177 "OSPF Interface State Machine\n")
1178 {
1179 u_short instance = 0;
1180
1181 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1182 if (!ospf_lookup_instance (instance))
1183 return CMD_SUCCESS;
1184
1185 return debug_ospf_ism_common(vty, 1, argc, argv);
1186 }
1187
1188
1189 static int
1190 no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc,
1191 struct cmd_token **argv)
1192 {
1193 if (vty->node == CONFIG_NODE)
1194 {
1195 if (argc == arg_base + 0)
1196 DEBUG_OFF (ism, ISM);
1197 else if (argc == arg_base + 1)
1198 {
1199 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1200 DEBUG_OFF (ism, ISM_STATUS);
1201 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1202 DEBUG_OFF (ism, ISM_EVENTS);
1203 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1204 DEBUG_OFF (ism, ISM_TIMERS);
1205 }
1206 return CMD_SUCCESS;
1207 }
1208
1209 /* ENABLE_NODE. */
1210 if (argc == arg_base + 0)
1211 TERM_DEBUG_OFF (ism, ISM);
1212 else if (argc == arg_base + 1)
1213 {
1214 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1215 TERM_DEBUG_OFF (ism, ISM_STATUS);
1216 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1217 TERM_DEBUG_OFF (ism, ISM_EVENTS);
1218 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1219 TERM_DEBUG_OFF (ism, ISM_TIMERS);
1220 }
1221
1222 return CMD_SUCCESS;
1223 }
1224
1225 /*
1226 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1227 * "no debug ospf ism (status|events|timers)",
1228 * NO_STR
1229 * "Debugging functions\n"
1230 * "OSPF information\n"
1231 * "OSPF Interface State Machine\n"
1232 * "ISM Status Information\n"
1233 * "ISM Event Information\n"
1234 * "ISM Timer Information\n"
1235 *
1236 */
1237 DEFUN (no_debug_ospf_ism,
1238 no_debug_ospf_ism_cmd,
1239 "no debug ospf ism",
1240 NO_STR
1241 DEBUG_STR
1242 OSPF_STR
1243 "OSPF Interface State Machine")
1244 {
1245 return no_debug_ospf_ism_common(vty, 0, argc, argv);
1246 }
1247
1248
1249 /*
1250 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1251 * "no debug ospf <1-65535> ism (status|events|timers)",
1252 * NO_STR
1253 * "Debugging functions\n"
1254 * "OSPF information\n"
1255 * "Instance ID\n"
1256 * "OSPF Interface State Machine\n"
1257 * "ISM Status Information\n"
1258 * "ISM Event Information\n"
1259 * "ISM Timer Information\n"
1260 *
1261 */
1262 DEFUN (no_debug_ospf_instance_ism,
1263 no_debug_ospf_instance_ism_cmd,
1264 "no debug ospf (1-65535) ism",
1265 NO_STR
1266 DEBUG_STR
1267 OSPF_STR
1268 "Instance ID\n"
1269 "OSPF Interface State Machine")
1270 {
1271 u_short instance = 0;
1272
1273 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1274 if (!ospf_lookup_instance (instance))
1275 return CMD_SUCCESS;
1276
1277 return no_debug_ospf_ism_common(vty, 1, argc, argv);
1278 }
1279
1280
1281 static int
1282 debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1283 {
1284 if (vty->node == CONFIG_NODE)
1285 {
1286 if (argc == arg_base + 0)
1287 DEBUG_ON (nsm, NSM);
1288 else if (argc == arg_base + 1)
1289 {
1290 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1291 DEBUG_ON (nsm, NSM_STATUS);
1292 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1293 DEBUG_ON (nsm, NSM_EVENTS);
1294 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1295 DEBUG_ON (nsm, NSM_TIMERS);
1296 }
1297
1298 return CMD_SUCCESS;
1299 }
1300
1301 /* ENABLE_NODE. */
1302 if (argc == arg_base + 0)
1303 TERM_DEBUG_ON (nsm, NSM);
1304 else if (argc == arg_base + 1)
1305 {
1306 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1307 TERM_DEBUG_ON (nsm, NSM_STATUS);
1308 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1309 TERM_DEBUG_ON (nsm, NSM_EVENTS);
1310 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1311 TERM_DEBUG_ON (nsm, NSM_TIMERS);
1312 }
1313
1314 return CMD_SUCCESS;
1315 }
1316
1317 /*
1318 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1319 * "debug ospf nsm (status|events|timers)",
1320 * DEBUG_STR
1321 * OSPF_STR
1322 * "OSPF Neighbor State Machine\n"
1323 * "NSM Status Information\n"
1324 * "NSM Event Information\n"
1325 * "NSM Timer Information\n"
1326 *
1327 */
1328 DEFUN (debug_ospf_nsm,
1329 debug_ospf_nsm_cmd,
1330 "debug ospf nsm",
1331 DEBUG_STR
1332 OSPF_STR
1333 "OSPF Neighbor State Machine\n")
1334 {
1335 return debug_ospf_nsm_common (vty, 0, argc, argv);
1336 }
1337
1338
1339 /*
1340 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1341 * "debug ospf <1-65535> nsm (status|events|timers)",
1342 * DEBUG_STR
1343 * OSPF_STR
1344 * "Instance ID\n"
1345 * "OSPF Neighbor State Machine\n"
1346 * "NSM Status Information\n"
1347 * "NSM Event Information\n"
1348 * "NSM Timer Information\n"
1349 *
1350 */
1351 DEFUN (debug_ospf_instance_nsm,
1352 debug_ospf_instance_nsm_cmd,
1353 "debug ospf (1-65535) nsm",
1354 DEBUG_STR
1355 OSPF_STR
1356 "Instance ID\n"
1357 "OSPF Neighbor State Machine\n")
1358 {
1359 u_short instance = 0;
1360
1361 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1362 if (!ospf_lookup_instance (instance))
1363 return CMD_SUCCESS;
1364
1365 return debug_ospf_nsm_common (vty, 1, argc, argv);
1366 }
1367
1368
1369 static int
1370 no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1371 {
1372 if (vty->node == CONFIG_NODE)
1373 {
1374 if (argc == arg_base + 0)
1375 DEBUG_OFF (nsm, NSM);
1376 else if (argc == arg_base + 1)
1377 {
1378 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1379 DEBUG_OFF (nsm, NSM_STATUS);
1380 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1381 DEBUG_OFF (nsm, NSM_EVENTS);
1382 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1383 DEBUG_OFF (nsm, NSM_TIMERS);
1384 }
1385
1386 return CMD_SUCCESS;
1387 }
1388
1389 /* ENABLE_NODE. */
1390 if (argc == arg_base + 0)
1391 TERM_DEBUG_OFF (nsm, NSM);
1392 else if (argc == arg_base + 1)
1393 {
1394 if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
1395 TERM_DEBUG_OFF (nsm, NSM_STATUS);
1396 else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
1397 TERM_DEBUG_OFF (nsm, NSM_EVENTS);
1398 else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
1399 TERM_DEBUG_OFF (nsm, NSM_TIMERS);
1400 }
1401
1402 return CMD_SUCCESS;
1403 }
1404
1405 /*
1406 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1407 * "no debug ospf nsm (status|events|timers)",
1408 * NO_STR
1409 * "Debugging functions\n"
1410 * "OSPF information\n"
1411 * "OSPF Interface State Machine\n"
1412 * "NSM Status Information\n"
1413 * "NSM Event Information\n"
1414 * "NSM Timer Information\n"
1415 *
1416 */
1417 DEFUN (no_debug_ospf_nsm,
1418 no_debug_ospf_nsm_cmd,
1419 "no debug ospf nsm",
1420 NO_STR
1421 DEBUG_STR
1422 OSPF_STR
1423 "OSPF Neighbor State Machine")
1424 {
1425 return no_debug_ospf_nsm_common(vty, 0, argc, argv);
1426 }
1427
1428
1429 /*
1430 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
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 DEFUN (no_debug_ospf_instance_nsm,
1443 no_debug_ospf_instance_nsm_cmd,
1444 "no debug ospf (1-65535) nsm",
1445 NO_STR
1446 DEBUG_STR
1447 OSPF_STR
1448 "Instance ID\n"
1449 "OSPF Neighbor State Machine")
1450 {
1451 u_short instance = 0;
1452
1453 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1454 if (!ospf_lookup_instance (instance))
1455 return CMD_SUCCESS;
1456
1457 return no_debug_ospf_nsm_common(vty, 1, argc, argv);
1458 }
1459
1460
1461
1462 static int
1463 debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1464 {
1465 if (vty->node == CONFIG_NODE)
1466 {
1467 if (argc == arg_base + 0)
1468 DEBUG_ON (lsa, LSA);
1469 else if (argc == arg_base + 1)
1470 {
1471 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
1472 DEBUG_ON (lsa, LSA_GENERATE);
1473 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
1474 DEBUG_ON (lsa, LSA_FLOODING);
1475 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1476 DEBUG_ON (lsa, LSA_INSTALL);
1477 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1478 DEBUG_ON (lsa, LSA_REFRESH);
1479 }
1480
1481 return CMD_SUCCESS;
1482 }
1483
1484 /* ENABLE_NODE. */
1485 if (argc == arg_base + 0)
1486 TERM_DEBUG_ON (lsa, LSA);
1487 else if (argc == arg_base + 1)
1488 {
1489 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
1490 TERM_DEBUG_ON (lsa, LSA_GENERATE);
1491 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
1492 TERM_DEBUG_ON (lsa, LSA_FLOODING);
1493 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1494 TERM_DEBUG_ON (lsa, LSA_INSTALL);
1495 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1496 TERM_DEBUG_ON (lsa, LSA_REFRESH);
1497 }
1498
1499 return CMD_SUCCESS;
1500 }
1501
1502 /*
1503 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1504 * "debug ospf lsa (generate|flooding|install|refresh)",
1505 * DEBUG_STR
1506 * OSPF_STR
1507 * "OSPF Link State Advertisement\n"
1508 * "LSA Generation\n"
1509 * "LSA Flooding\n"
1510 * "LSA Install/Delete\n"
1511 * "LSA Refresh\n"
1512 *
1513 */
1514 DEFUN (debug_ospf_lsa,
1515 debug_ospf_lsa_cmd,
1516 "debug ospf lsa",
1517 DEBUG_STR
1518 OSPF_STR
1519 "OSPF Link State Advertisement\n")
1520 {
1521 return debug_ospf_lsa_common(vty, 0, argc, argv);
1522 }
1523
1524
1525 /*
1526 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1527 * "debug ospf <1-65535> lsa (generate|flooding|install|refresh)",
1528 * DEBUG_STR
1529 * OSPF_STR
1530 * "Instance ID\n"
1531 * "OSPF Link State Advertisement\n"
1532 * "LSA Generation\n"
1533 * "LSA Flooding\n"
1534 * "LSA Install/Delete\n"
1535 * "LSA Refresh\n"
1536 *
1537 */
1538 DEFUN (debug_ospf_instance_lsa,
1539 debug_ospf_instance_lsa_cmd,
1540 "debug ospf (1-65535) lsa",
1541 DEBUG_STR
1542 OSPF_STR
1543 "Instance ID\n"
1544 "OSPF Link State Advertisement\n")
1545 {
1546 u_short instance = 0;
1547
1548 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1549 if (!ospf_lookup_instance (instance))
1550 return CMD_SUCCESS;
1551
1552 return debug_ospf_lsa_common(vty, 1, argc, argv);
1553 }
1554
1555
1556 static int
1557 no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1558 {
1559 if (vty->node == CONFIG_NODE)
1560 {
1561 if (argc == arg_base + 0)
1562 DEBUG_OFF (lsa, LSA);
1563 else if (argc == arg_base + 1)
1564 {
1565 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
1566 DEBUG_OFF (lsa, LSA_GENERATE);
1567 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
1568 DEBUG_OFF (lsa, LSA_FLOODING);
1569 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1570 DEBUG_OFF (lsa, LSA_INSTALL);
1571 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1572 DEBUG_OFF (lsa, LSA_REFRESH);
1573 }
1574
1575 return CMD_SUCCESS;
1576 }
1577
1578 /* ENABLE_NODE. */
1579 if (argc == arg_base + 0)
1580 TERM_DEBUG_OFF (lsa, LSA);
1581 else if (argc == arg_base + 1)
1582 {
1583 if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0)
1584 TERM_DEBUG_OFF (lsa, LSA_GENERATE);
1585 else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0)
1586 TERM_DEBUG_OFF (lsa, LSA_FLOODING);
1587 else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1588 TERM_DEBUG_OFF (lsa, LSA_INSTALL);
1589 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1590 TERM_DEBUG_OFF (lsa, LSA_REFRESH);
1591 }
1592
1593 return CMD_SUCCESS;
1594 }
1595
1596 /*
1597 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1598 * "no debug ospf lsa (generate|flooding|install|refresh)",
1599 * NO_STR
1600 * DEBUG_STR
1601 * OSPF_STR
1602 * "OSPF Link State Advertisement\n"
1603 * "LSA Generation\n"
1604 * "LSA Flooding\n"
1605 * "LSA Install/Delete\n"
1606 * "LSA Refres\n"
1607 *
1608 */
1609 DEFUN (no_debug_ospf_lsa,
1610 no_debug_ospf_lsa_cmd,
1611 "no debug ospf lsa",
1612 NO_STR
1613 DEBUG_STR
1614 OSPF_STR
1615 "OSPF Link State Advertisement\n")
1616 {
1617 return no_debug_ospf_lsa_common (vty, 0, argc, argv);
1618 }
1619
1620
1621 /*
1622 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1623 * "no debug ospf <1-65535> lsa (generate|flooding|install|refresh)",
1624 * NO_STR
1625 * DEBUG_STR
1626 * OSPF_STR
1627 * "Instance ID\n"
1628 * "OSPF Link State Advertisement\n"
1629 * "LSA Generation\n"
1630 * "LSA Flooding\n"
1631 * "LSA Install/Delete\n"
1632 * "LSA Refres\n"
1633 *
1634 */
1635 DEFUN (no_debug_ospf_instance_lsa,
1636 no_debug_ospf_instance_lsa_cmd,
1637 "no debug ospf (1-65535) lsa",
1638 NO_STR
1639 DEBUG_STR
1640 OSPF_STR
1641 "Instance ID\n"
1642 "OSPF Link State Advertisement\n")
1643 {
1644 u_short instance = 0;
1645
1646 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1647 if (!ospf_lookup_instance (instance))
1648 return CMD_SUCCESS;
1649
1650 return no_debug_ospf_lsa_common (vty, 1, argc, argv);
1651 }
1652
1653
1654
1655 static int
1656 debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
1657 {
1658 if (vty->node == CONFIG_NODE)
1659 {
1660 if (argc == arg_base + 0)
1661 DEBUG_ON (zebra, ZEBRA);
1662 else if (argc == arg_base + 1)
1663 {
1664 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1665 DEBUG_ON (zebra, ZEBRA_INTERFACE);
1666 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1667 DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1668 }
1669
1670 return CMD_SUCCESS;
1671 }
1672
1673 /* ENABLE_NODE. */
1674 if (argc == arg_base + 0)
1675 TERM_DEBUG_ON (zebra, ZEBRA);
1676 else if (argc == arg_base + 1)
1677 {
1678 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1679 TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE);
1680 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1681 TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
1682 }
1683
1684 return CMD_SUCCESS;
1685 }
1686
1687 /*
1688 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1689 * "debug ospf zebra (interface|redistribute)",
1690 * DEBUG_STR
1691 * OSPF_STR
1692 * "OSPF Zebra information\n"
1693 * "Zebra interface\n"
1694 * "Zebra redistribute\n"
1695 *
1696 */
1697 DEFUN (debug_ospf_zebra,
1698 debug_ospf_zebra_cmd,
1699 "debug ospf zebra",
1700 DEBUG_STR
1701 OSPF_STR
1702 "OSPF Zebra information\n")
1703 {
1704 return debug_ospf_zebra_common(vty, 0, argc, argv);
1705 }
1706
1707
1708 /*
1709 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1710 * "debug ospf <1-65535> zebra (interface|redistribute)",
1711 * DEBUG_STR
1712 * OSPF_STR
1713 * "Instance ID\n"
1714 * "OSPF Zebra information\n"
1715 * "Zebra interface\n"
1716 * "Zebra redistribute\n"
1717 *
1718 */
1719 DEFUN (debug_ospf_instance_zebra,
1720 debug_ospf_instance_zebra_cmd,
1721 "debug ospf (1-65535) zebra",
1722 DEBUG_STR
1723 OSPF_STR
1724 "Instance ID\n"
1725 "OSPF Zebra information\n")
1726 {
1727 u_short instance = 0;
1728
1729 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1730 if (!ospf_lookup_instance (instance))
1731 return CMD_SUCCESS;
1732
1733 return debug_ospf_zebra_common(vty, 1, argc, argv);
1734 }
1735
1736
1737 static int
1738 no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc,
1739 struct cmd_token **argv)
1740 {
1741 if (vty->node == CONFIG_NODE)
1742 {
1743 if (argc == arg_base + 0)
1744 DEBUG_OFF (zebra, ZEBRA);
1745 else if (argc == arg_base + 1)
1746 {
1747 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1748 DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1749 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1750 DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1751 }
1752
1753 return CMD_SUCCESS;
1754 }
1755
1756 /* ENABLE_NODE. */
1757 if (argc == arg_base + 0)
1758 TERM_DEBUG_OFF (zebra, ZEBRA);
1759 else if (argc == arg_base + 1)
1760 {
1761 if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0)
1762 TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
1763 else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0)
1764 TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
1765 }
1766
1767 return CMD_SUCCESS;
1768 }
1769
1770 /*
1771 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1772 * "no debug ospf zebra (interface|redistribute)",
1773 * NO_STR
1774 * DEBUG_STR
1775 * OSPF_STR
1776 * "OSPF Zebra information\n"
1777 * "Zebra interface\n"
1778 * "Zebra redistribute\n"
1779 *
1780 */
1781 DEFUN (no_debug_ospf_zebra,
1782 no_debug_ospf_zebra_cmd,
1783 "no debug ospf zebra",
1784 NO_STR
1785 DEBUG_STR
1786 OSPF_STR
1787 "OSPF Zebra information\n")
1788 {
1789 return no_debug_ospf_zebra_common(vty, 0, argc, argv);
1790 }
1791
1792
1793 /*
1794 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1795 * "no debug ospf <1-65535> zebra (interface|redistribute)",
1796 * NO_STR
1797 * DEBUG_STR
1798 * OSPF_STR
1799 * "Instance ID\n"
1800 * "OSPF Zebra information\n"
1801 * "Zebra interface\n"
1802 * "Zebra redistribute\n"
1803 *
1804 */
1805 DEFUN (no_debug_ospf_instance_zebra,
1806 no_debug_ospf_instance_zebra_cmd,
1807 "no debug ospf (1-65535) zebra",
1808 NO_STR
1809 DEBUG_STR
1810 OSPF_STR
1811 "Instance ID\n"
1812 "OSPF Zebra information\n")
1813 {
1814 u_short instance = 0;
1815
1816 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1817 if (!ospf_lookup_instance (instance))
1818 return CMD_SUCCESS;
1819
1820 return no_debug_ospf_zebra_common(vty, 1, argc, argv);
1821 }
1822
1823
1824
1825 DEFUN (debug_ospf_event,
1826 debug_ospf_event_cmd,
1827 "debug ospf event",
1828 DEBUG_STR
1829 OSPF_STR
1830 "OSPF event information\n")
1831 {
1832 if (vty->node == CONFIG_NODE)
1833 CONF_DEBUG_ON (event, EVENT);
1834 TERM_DEBUG_ON (event, EVENT);
1835 return CMD_SUCCESS;
1836 }
1837
1838 DEFUN (no_debug_ospf_event,
1839 no_debug_ospf_event_cmd,
1840 "no debug ospf event",
1841 NO_STR
1842 DEBUG_STR
1843 OSPF_STR
1844 "OSPF event information\n")
1845 {
1846 if (vty->node == CONFIG_NODE)
1847 CONF_DEBUG_OFF (event, EVENT);
1848 TERM_DEBUG_OFF (event, EVENT);
1849 return CMD_SUCCESS;
1850 }
1851
1852 DEFUN (debug_ospf_instance_event,
1853 debug_ospf_instance_event_cmd,
1854 "debug ospf (1-65535) event",
1855 DEBUG_STR
1856 OSPF_STR
1857 "Instance ID\n"
1858 "OSPF event information\n")
1859 {
1860 u_short instance = 0;
1861
1862 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1863 if (!ospf_lookup_instance (instance))
1864 return CMD_SUCCESS;
1865
1866 if (vty->node == CONFIG_NODE)
1867 CONF_DEBUG_ON (event, EVENT);
1868 TERM_DEBUG_ON (event, EVENT);
1869 return CMD_SUCCESS;
1870 }
1871
1872 DEFUN (no_debug_ospf_instance_event,
1873 no_debug_ospf_instance_event_cmd,
1874 "no debug ospf (1-65535) event",
1875 NO_STR
1876 DEBUG_STR
1877 OSPF_STR
1878 "Instance ID\n"
1879 "OSPF event information\n")
1880 {
1881 u_short instance = 0;
1882
1883 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1884 if (!ospf_lookup_instance (instance))
1885 return CMD_SUCCESS;
1886
1887 if (vty->node == CONFIG_NODE)
1888 CONF_DEBUG_OFF (event, EVENT);
1889 TERM_DEBUG_OFF (event, EVENT);
1890 return CMD_SUCCESS;
1891 }
1892
1893 DEFUN (debug_ospf_nssa,
1894 debug_ospf_nssa_cmd,
1895 "debug ospf nssa",
1896 DEBUG_STR
1897 OSPF_STR
1898 "OSPF nssa information\n")
1899 {
1900 if (vty->node == CONFIG_NODE)
1901 CONF_DEBUG_ON (nssa, NSSA);
1902 TERM_DEBUG_ON (nssa, NSSA);
1903 return CMD_SUCCESS;
1904 }
1905
1906 DEFUN (no_debug_ospf_nssa,
1907 no_debug_ospf_nssa_cmd,
1908 "no debug ospf nssa",
1909 NO_STR
1910 DEBUG_STR
1911 OSPF_STR
1912 "OSPF nssa information\n")
1913 {
1914 if (vty->node == CONFIG_NODE)
1915 CONF_DEBUG_OFF (nssa, NSSA);
1916 TERM_DEBUG_OFF (nssa, NSSA);
1917 return CMD_SUCCESS;
1918 }
1919
1920 DEFUN (debug_ospf_instance_nssa,
1921 debug_ospf_instance_nssa_cmd,
1922 "debug ospf (1-65535) nssa",
1923 DEBUG_STR
1924 OSPF_STR
1925 "Instance ID\n"
1926 "OSPF nssa information\n")
1927 {
1928 u_short instance = 0;
1929
1930 VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
1931 if (!ospf_lookup_instance (instance))
1932 return CMD_SUCCESS;
1933
1934 if (vty->node == CONFIG_NODE)
1935 CONF_DEBUG_ON (nssa, NSSA);
1936 TERM_DEBUG_ON (nssa, NSSA);
1937 return CMD_SUCCESS;
1938 }
1939
1940 DEFUN (no_debug_ospf_instance_nssa,
1941 no_debug_ospf_instance_nssa_cmd,
1942 "no debug ospf (1-65535) nssa",
1943 NO_STR
1944 DEBUG_STR
1945 OSPF_STR
1946 "Instance ID\n"
1947 "OSPF nssa information\n")
1948 {
1949 u_short instance = 0;
1950
1951 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
1952 if (!ospf_lookup_instance (instance))
1953 return CMD_SUCCESS;
1954
1955 if (vty->node == CONFIG_NODE)
1956 CONF_DEBUG_OFF (nssa, NSSA);
1957 TERM_DEBUG_OFF (nssa, NSSA);
1958 return CMD_SUCCESS;
1959 }
1960
1961 DEFUN (debug_ospf_te,
1962 debug_ospf_te_cmd,
1963 "debug ospf te",
1964 DEBUG_STR
1965 OSPF_STR
1966 "OSPF-TE information\n")
1967 {
1968 if (vty->node == CONFIG_NODE)
1969 CONF_DEBUG_ON (te, TE);
1970 TERM_DEBUG_ON (te, TE);
1971 return CMD_SUCCESS;
1972 }
1973
1974 DEFUN (no_debug_ospf_te,
1975 no_debug_ospf_te_cmd,
1976 "no debug ospf te",
1977 NO_STR
1978 DEBUG_STR
1979 OSPF_STR
1980 "OSPF-TE information\n")
1981 {
1982 if (vty->node == CONFIG_NODE)
1983 CONF_DEBUG_OFF (te, TE);
1984 TERM_DEBUG_OFF (te, TE);
1985 return CMD_SUCCESS;
1986 }
1987
1988 DEFUN (no_debug_ospf,
1989 no_debug_ospf_cmd,
1990 "no debug ospf",
1991 NO_STR
1992 DEBUG_STR
1993 OSPF_STR)
1994 {
1995 int flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
1996 int i;
1997
1998 if (vty->node == CONFIG_NODE)
1999 {
2000 CONF_DEBUG_OFF (event, EVENT);
2001 CONF_DEBUG_OFF (nssa, NSSA);
2002 DEBUG_OFF (ism, ISM_EVENTS);
2003 DEBUG_OFF (ism, ISM_STATUS);
2004 DEBUG_OFF (ism, ISM_TIMERS);
2005 DEBUG_OFF (lsa, LSA);
2006 DEBUG_OFF (lsa, LSA_FLOODING);
2007 DEBUG_OFF (lsa, LSA_GENERATE);
2008 DEBUG_OFF (lsa, LSA_INSTALL);
2009 DEBUG_OFF (lsa, LSA_REFRESH);
2010 DEBUG_OFF (nsm, NSM);
2011 DEBUG_OFF (nsm, NSM_EVENTS);
2012 DEBUG_OFF (nsm, NSM_STATUS);
2013 DEBUG_OFF (nsm, NSM_TIMERS);
2014 DEBUG_OFF (zebra, ZEBRA);
2015 DEBUG_OFF (zebra, ZEBRA_INTERFACE);
2016 DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
2017
2018 for (i = 0; i < 5; i++)
2019 DEBUG_PACKET_OFF (i, flag);
2020 }
2021
2022 for (i = 0; i < 5; i++)
2023 TERM_DEBUG_PACKET_OFF (i, flag);
2024
2025 TERM_DEBUG_OFF (event, EVENT);
2026 TERM_DEBUG_OFF (ism, ISM);
2027 TERM_DEBUG_OFF (ism, ISM_EVENTS);
2028 TERM_DEBUG_OFF (ism, ISM_STATUS);
2029 TERM_DEBUG_OFF (ism, ISM_TIMERS);
2030 TERM_DEBUG_OFF (lsa, LSA);
2031 TERM_DEBUG_OFF (lsa, LSA_FLOODING);
2032 TERM_DEBUG_OFF (lsa, LSA_GENERATE);
2033 TERM_DEBUG_OFF (lsa, LSA_INSTALL);
2034 TERM_DEBUG_OFF (lsa, LSA_REFRESH);
2035 TERM_DEBUG_OFF (nsm, NSM);
2036 TERM_DEBUG_OFF (nsm, NSM_EVENTS);
2037 TERM_DEBUG_OFF (nsm, NSM_STATUS);
2038 TERM_DEBUG_OFF (nsm, NSM_TIMERS);
2039 TERM_DEBUG_OFF (nssa, NSSA);
2040 TERM_DEBUG_OFF (zebra, ZEBRA);
2041 TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
2042 TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
2043
2044 return CMD_SUCCESS;
2045 }
2046
2047 static int
2048 show_debugging_ospf_common (struct vty *vty, struct ospf *ospf)
2049 {
2050 int i;
2051
2052 if (ospf->instance)
2053 vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
2054 VTY_NEWLINE, VTY_NEWLINE);
2055
2056 vty_out (vty, "OSPF debugging status:%s", VTY_NEWLINE);
2057
2058 /* Show debug status for events. */
2059 if (IS_DEBUG_OSPF(event,EVENT))
2060 vty_out (vty, " OSPF event debugging is on%s", VTY_NEWLINE);
2061
2062 /* Show debug status for ISM. */
2063 if (IS_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
2064 vty_out (vty, " OSPF ISM debugging is on%s", VTY_NEWLINE);
2065 else
2066 {
2067 if (IS_DEBUG_OSPF (ism, ISM_STATUS))
2068 vty_out (vty, " OSPF ISM status debugging is on%s", VTY_NEWLINE);
2069 if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
2070 vty_out (vty, " OSPF ISM event debugging is on%s", VTY_NEWLINE);
2071 if (IS_DEBUG_OSPF (ism, ISM_TIMERS))
2072 vty_out (vty, " OSPF ISM timer debugging is on%s", VTY_NEWLINE);
2073 }
2074
2075 /* Show debug status for NSM. */
2076 if (IS_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
2077 vty_out (vty, " OSPF NSM debugging is on%s", VTY_NEWLINE);
2078 else
2079 {
2080 if (IS_DEBUG_OSPF (nsm, NSM_STATUS))
2081 vty_out (vty, " OSPF NSM status debugging is on%s", VTY_NEWLINE);
2082 if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
2083 vty_out (vty, " OSPF NSM event debugging is on%s", VTY_NEWLINE);
2084 if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
2085 vty_out (vty, " OSPF NSM timer debugging is on%s", VTY_NEWLINE);
2086 }
2087
2088 /* Show debug status for OSPF Packets. */
2089 for (i = 0; i < 5; i++)
2090 if (IS_DEBUG_OSPF_PACKET (i, SEND) && IS_DEBUG_OSPF_PACKET (i, RECV))
2091 {
2092 vty_out (vty, " OSPF packet %s%s debugging is on%s",
2093 LOOKUP (ospf_packet_type_str, i + 1),
2094 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
2095 VTY_NEWLINE);
2096 }
2097 else
2098 {
2099 if (IS_DEBUG_OSPF_PACKET (i, SEND))
2100 vty_out (vty, " OSPF packet %s send%s debugging is on%s",
2101 LOOKUP (ospf_packet_type_str, i + 1),
2102 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
2103 VTY_NEWLINE);
2104 if (IS_DEBUG_OSPF_PACKET (i, RECV))
2105 vty_out (vty, " OSPF packet %s receive%s debugging is on%s",
2106 LOOKUP (ospf_packet_type_str, i + 1),
2107 IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
2108 VTY_NEWLINE);
2109 }
2110
2111 /* Show debug status for OSPF LSAs. */
2112 if (IS_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
2113 vty_out (vty, " OSPF LSA debugging is on%s", VTY_NEWLINE);
2114 else
2115 {
2116 if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
2117 vty_out (vty, " OSPF LSA generation debugging is on%s", VTY_NEWLINE);
2118 if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
2119 vty_out (vty, " OSPF LSA flooding debugging is on%s", VTY_NEWLINE);
2120 if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
2121 vty_out (vty, " OSPF LSA install debugging is on%s", VTY_NEWLINE);
2122 if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
2123 vty_out (vty, " OSPF LSA refresh debugging is on%s", VTY_NEWLINE);
2124 }
2125
2126 /* Show debug status for Zebra. */
2127 if (IS_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
2128 vty_out (vty, " OSPF Zebra debugging is on%s", VTY_NEWLINE);
2129 else
2130 {
2131 if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
2132 vty_out (vty, " OSPF Zebra interface debugging is on%s", VTY_NEWLINE);
2133 if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
2134 vty_out (vty, " OSPF Zebra redistribute debugging is on%s", VTY_NEWLINE);
2135 }
2136
2137 /* Show debug status for NSSA. */
2138 if (IS_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
2139 vty_out (vty, " OSPF NSSA debugging is on%s", VTY_NEWLINE);
2140
2141 vty_out (vty, "%s", VTY_NEWLINE);
2142
2143 return CMD_SUCCESS;
2144 }
2145
2146 DEFUN (show_debugging_ospf,
2147 show_debugging_ospf_cmd,
2148 "show debugging ospf",
2149 SHOW_STR
2150 DEBUG_STR
2151 OSPF_STR)
2152 {
2153 struct ospf *ospf;
2154
2155 if ((ospf = ospf_lookup()) == NULL)
2156 return CMD_SUCCESS;
2157
2158 return show_debugging_ospf_common(vty, ospf);
2159 }
2160
2161 DEFUN (show_debugging_ospf_instance,
2162 show_debugging_ospf_instance_cmd,
2163 "show debugging ospf (1-65535)",
2164 SHOW_STR
2165 DEBUG_STR
2166 OSPF_STR
2167 "Instance ID\n")
2168 {
2169 struct ospf *ospf;
2170 u_short instance = 0;
2171
2172 VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
2173 if ((ospf = ospf_lookup_instance (instance)) == NULL )
2174 return CMD_SUCCESS;
2175
2176 return show_debugging_ospf_common(vty, ospf);
2177 }
2178
2179 /* Debug node. */
2180 static struct cmd_node debug_node =
2181 {
2182 DEBUG_NODE,
2183 "",
2184 1 /* VTYSH */
2185 };
2186
2187 static int
2188 config_write_debug (struct vty *vty)
2189 {
2190 int write = 0;
2191 int i, r;
2192
2193 const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
2194 const char *detail_str[] = {"", " send", " recv", "", " detail",
2195 " send detail", " recv detail", " detail"};
2196
2197 struct ospf *ospf;
2198 char str[16];
2199 memset (str, 0, 16);
2200
2201 if ((ospf = ospf_lookup()) == NULL)
2202 return CMD_SUCCESS;
2203
2204 if (ospf->instance)
2205 sprintf(str, " %d", ospf->instance);
2206
2207 /* debug ospf ism (status|events|timers). */
2208 if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
2209 vty_out (vty, "debug ospf%s ism%s", str, VTY_NEWLINE);
2210 else
2211 {
2212 if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
2213 vty_out (vty, "debug ospf%s ism status%s", str, VTY_NEWLINE);
2214 if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
2215 vty_out (vty, "debug ospf%s ism event%s", str, VTY_NEWLINE);
2216 if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
2217 vty_out (vty, "debug ospf%s ism timer%s", str, VTY_NEWLINE);
2218 }
2219
2220 /* debug ospf nsm (status|events|timers). */
2221 if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
2222 vty_out (vty, "debug ospf%s nsm%s", str, VTY_NEWLINE);
2223 else
2224 {
2225 if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
2226 vty_out (vty, "debug ospf%s nsm status%s", str, VTY_NEWLINE);
2227 if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
2228 vty_out (vty, "debug ospf%s nsm event%s", str, VTY_NEWLINE);
2229 if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
2230 vty_out (vty, "debug ospf%s nsm timer%s", str, VTY_NEWLINE);
2231 }
2232
2233 /* debug ospf lsa (generate|flooding|install|refresh). */
2234 if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
2235 vty_out (vty, "debug ospf%s lsa%s", str, VTY_NEWLINE);
2236 else
2237 {
2238 if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
2239 vty_out (vty, "debug ospf%s lsa generate%s", str, VTY_NEWLINE);
2240 if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
2241 vty_out (vty, "debug ospf%s lsa flooding%s", str, VTY_NEWLINE);
2242 if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
2243 vty_out (vty, "debug ospf%s lsa install%s", str, VTY_NEWLINE);
2244 if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
2245 vty_out (vty, "debug ospf%s lsa refresh%s", str, VTY_NEWLINE);
2246
2247 write = 1;
2248 }
2249
2250 /* debug ospf zebra (interface|redistribute). */
2251 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
2252 vty_out (vty, "debug ospf%s zebra%s", str, VTY_NEWLINE);
2253 else
2254 {
2255 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
2256 vty_out (vty, "debug ospf%s zebra interface%s", str, VTY_NEWLINE);
2257 if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
2258 vty_out (vty, "debug ospf%s zebra redistribute%s", str, VTY_NEWLINE);
2259
2260 write = 1;
2261 }
2262
2263 /* debug ospf event. */
2264 if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
2265 {
2266 vty_out (vty, "debug ospf%s event%s", str, VTY_NEWLINE);
2267 write = 1;
2268 }
2269
2270 /* debug ospf nssa. */
2271 if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
2272 {
2273 vty_out (vty, "debug ospf%s nssa%s", str, VTY_NEWLINE);
2274 write = 1;
2275 }
2276
2277 /* debug ospf packet all detail. */
2278 r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
2279 for (i = 0; i < 5; i++)
2280 r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
2281 if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
2282 {
2283 vty_out (vty, "debug ospf%s packet all detail%s", str, VTY_NEWLINE);
2284 return 1;
2285 }
2286
2287 /* debug ospf packet all. */
2288 r = OSPF_DEBUG_SEND_RECV;
2289 for (i = 0; i < 5; i++)
2290 r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
2291 if (r == OSPF_DEBUG_SEND_RECV)
2292 {
2293 vty_out (vty, "debug ospf%s packet all%s", str, VTY_NEWLINE);
2294 for (i = 0; i < 5; i++)
2295 if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
2296 vty_out (vty, "debug ospf%s packet %s detail%s", str,
2297 type_str[i],
2298 VTY_NEWLINE);
2299 return 1;
2300 }
2301
2302 /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
2303 (send|recv) (detail). */
2304 for (i = 0; i < 5; i++)
2305 {
2306 if (conf_debug_ospf_packet[i] == 0)
2307 continue;
2308
2309 vty_out (vty, "debug ospf%s packet %s%s%s", str,
2310 type_str[i], detail_str[conf_debug_ospf_packet[i]],
2311 VTY_NEWLINE);
2312 write = 1;
2313 }
2314
2315 return write;
2316 }
2317
2318 /* Initialize debug commands. */
2319 void
2320 debug_init ()
2321 {
2322 install_node (&debug_node, config_write_debug);
2323
2324 install_element (ENABLE_NODE, &show_debugging_ospf_cmd);
2325 install_element (ENABLE_NODE, &debug_ospf_packet_all_cmd);
2326 install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
2327 install_element (ENABLE_NODE, &debug_ospf_nsm_cmd);
2328 install_element (ENABLE_NODE, &debug_ospf_lsa_cmd);
2329 install_element (ENABLE_NODE, &debug_ospf_zebra_cmd);
2330 install_element (ENABLE_NODE, &debug_ospf_event_cmd);
2331 install_element (ENABLE_NODE, &debug_ospf_nssa_cmd);
2332 install_element (ENABLE_NODE, &debug_ospf_te_cmd);
2333 install_element (ENABLE_NODE, &no_debug_ospf_packet_all_cmd);
2334 install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
2335 install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd);
2336 install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd);
2337 install_element (ENABLE_NODE, &no_debug_ospf_zebra_cmd);
2338 install_element (ENABLE_NODE, &no_debug_ospf_event_cmd);
2339 install_element (ENABLE_NODE, &no_debug_ospf_nssa_cmd);
2340 install_element (ENABLE_NODE, &no_debug_ospf_te_cmd);
2341
2342 install_element (ENABLE_NODE, &show_debugging_ospf_instance_cmd);
2343 install_element (ENABLE_NODE, &debug_ospf_instance_packet_all_cmd);
2344 install_element (ENABLE_NODE, &debug_ospf_instance_ism_cmd);
2345 install_element (ENABLE_NODE, &debug_ospf_instance_nsm_cmd);
2346 install_element (ENABLE_NODE, &debug_ospf_instance_lsa_cmd);
2347 install_element (ENABLE_NODE, &debug_ospf_instance_zebra_cmd);
2348 install_element (ENABLE_NODE, &debug_ospf_instance_event_cmd);
2349 install_element (ENABLE_NODE, &debug_ospf_instance_nssa_cmd);
2350 install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_all_cmd);
2351 install_element (ENABLE_NODE, &no_debug_ospf_instance_ism_cmd);
2352 install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd);
2353 install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd);
2354 install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd);
2355 install_element (ENABLE_NODE, &no_debug_ospf_instance_event_cmd);
2356 install_element (ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd);
2357 install_element (ENABLE_NODE, &no_debug_ospf_cmd);
2358
2359 install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd);
2360 install_element (CONFIG_NODE, &debug_ospf_ism_cmd);
2361 install_element (CONFIG_NODE, &debug_ospf_nsm_cmd);
2362 install_element (CONFIG_NODE, &debug_ospf_lsa_cmd);
2363 install_element (CONFIG_NODE, &debug_ospf_zebra_cmd);
2364 install_element (CONFIG_NODE, &debug_ospf_event_cmd);
2365 install_element (CONFIG_NODE, &debug_ospf_nssa_cmd);
2366 install_element (CONFIG_NODE, &debug_ospf_te_cmd);
2367 install_element (CONFIG_NODE, &no_debug_ospf_packet_all_cmd);
2368 install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
2369 install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd);
2370 install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd);
2371 install_element (CONFIG_NODE, &no_debug_ospf_zebra_cmd);
2372 install_element (CONFIG_NODE, &no_debug_ospf_event_cmd);
2373 install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd);
2374 install_element (CONFIG_NODE, &no_debug_ospf_te_cmd);
2375
2376 install_element (CONFIG_NODE, &debug_ospf_instance_packet_all_cmd);
2377 install_element (CONFIG_NODE, &debug_ospf_instance_ism_cmd);
2378 install_element (CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
2379 install_element (CONFIG_NODE, &debug_ospf_instance_lsa_cmd);
2380 install_element (CONFIG_NODE, &debug_ospf_instance_zebra_cmd);
2381 install_element (CONFIG_NODE, &debug_ospf_instance_event_cmd);
2382 install_element (CONFIG_NODE, &debug_ospf_instance_nssa_cmd);
2383 install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_all_cmd);
2384 install_element (CONFIG_NODE, &no_debug_ospf_instance_ism_cmd);
2385 install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd);
2386 install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd);
2387 install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd);
2388 install_element (CONFIG_NODE, &no_debug_ospf_instance_event_cmd);
2389 install_element (CONFIG_NODE, &no_debug_ospf_instance_nssa_cmd);
2390 install_element (CONFIG_NODE, &no_debug_ospf_cmd);
2391 }