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