Annotation of embedaddon/quagga/ospfd/ospf_dump.c, revision 1.1
1.1 ! misho 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: /* Configuration debug option variables. */
! 119: unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
! 120: unsigned long conf_debug_ospf_event = 0;
! 121: unsigned long conf_debug_ospf_ism = 0;
! 122: unsigned long conf_debug_ospf_nsm = 0;
! 123: unsigned long conf_debug_ospf_lsa = 0;
! 124: unsigned long conf_debug_ospf_zebra = 0;
! 125: unsigned long conf_debug_ospf_nssa = 0;
! 126:
! 127: /* Enable debug option variables -- valid only session. */
! 128: unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
! 129: unsigned long term_debug_ospf_event = 0;
! 130: unsigned long term_debug_ospf_ism = 0;
! 131: unsigned long term_debug_ospf_nsm = 0;
! 132: unsigned long term_debug_ospf_lsa = 0;
! 133: unsigned long term_debug_ospf_zebra = 0;
! 134: unsigned long term_debug_ospf_nssa = 0;
! 135:
! 136:
! 137:
! 138: const char *
! 139: ospf_redist_string(u_int route_type)
! 140: {
! 141: return (route_type == ZEBRA_ROUTE_MAX) ?
! 142: "Default" : zebra_route_string(route_type);
! 143: }
! 144:
! 145: #define OSPF_AREA_STRING_MAXLEN 16
! 146: const char *
! 147: ospf_area_name_string (struct ospf_area *area)
! 148: {
! 149: static char buf[OSPF_AREA_STRING_MAXLEN] = "";
! 150: u_int32_t area_id;
! 151:
! 152: if (!area)
! 153: return "-";
! 154:
! 155: area_id = ntohl (area->area_id.s_addr);
! 156: snprintf (buf, OSPF_AREA_STRING_MAXLEN, "%d.%d.%d.%d",
! 157: (area_id >> 24) & 0xff, (area_id >> 16) & 0xff,
! 158: (area_id >> 8) & 0xff, area_id & 0xff);
! 159: return buf;
! 160: }
! 161:
! 162: #define OSPF_AREA_DESC_STRING_MAXLEN 23
! 163: const char *
! 164: ospf_area_desc_string (struct ospf_area *area)
! 165: {
! 166: static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = "";
! 167: u_char type;
! 168:
! 169: if (!area)
! 170: return "(incomplete)";
! 171:
! 172: type = area->external_routing;
! 173: switch (type)
! 174: {
! 175: case OSPF_AREA_NSSA:
! 176: snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [NSSA]",
! 177: ospf_area_name_string (area));
! 178: break;
! 179: case OSPF_AREA_STUB:
! 180: snprintf (buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [Stub]",
! 181: ospf_area_name_string (area));
! 182: break;
! 183: default:
! 184: return ospf_area_name_string (area);
! 185: }
! 186:
! 187: return buf;
! 188: }
! 189:
! 190: #define OSPF_IF_STRING_MAXLEN 40
! 191: const char *
! 192: ospf_if_name_string (struct ospf_interface *oi)
! 193: {
! 194: static char buf[OSPF_IF_STRING_MAXLEN] = "";
! 195: u_int32_t ifaddr;
! 196:
! 197: if (!oi)
! 198: return "inactive";
! 199:
! 200: if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
! 201: return oi->ifp->name;
! 202:
! 203: ifaddr = ntohl (oi->address->u.prefix4.s_addr);
! 204: snprintf (buf, OSPF_IF_STRING_MAXLEN,
! 205: "%s:%d.%d.%d.%d", oi->ifp->name,
! 206: (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff,
! 207: (ifaddr >> 8) & 0xff, ifaddr & 0xff);
! 208: return buf;
! 209: }
! 210:
! 211:
! 212: void
! 213: ospf_nbr_state_message (struct ospf_neighbor *nbr, char *buf, size_t size)
! 214: {
! 215: int state;
! 216: struct ospf_interface *oi = nbr->oi;
! 217:
! 218: if (IPV4_ADDR_SAME (&DR (oi), &nbr->address.u.prefix4))
! 219: state = ISM_DR;
! 220: else if (IPV4_ADDR_SAME (&BDR (oi), &nbr->address.u.prefix4))
! 221: state = ISM_Backup;
! 222: else
! 223: state = ISM_DROther;
! 224:
! 225: memset (buf, 0, size);
! 226:
! 227: snprintf (buf, size, "%s/%s",
! 228: LOOKUP (ospf_nsm_state_msg, nbr->state),
! 229: LOOKUP (ospf_ism_state_msg, state));
! 230: }
! 231:
! 232: const char *
! 233: ospf_timeval_dump (struct timeval *t, char *buf, size_t size)
! 234: {
! 235: /* Making formatted timer strings. */
! 236: #define MINUTE_IN_SECONDS 60
! 237: #define HOUR_IN_SECONDS (60*MINUTE_IN_SECONDS)
! 238: #define DAY_IN_SECONDS (24*HOUR_IN_SECONDS)
! 239: #define WEEK_IN_SECONDS (7*DAY_IN_SECONDS)
! 240: unsigned long w, d, h, m, s, ms;
! 241:
! 242: if (!t)
! 243: return "inactive";
! 244:
! 245: w = d = h = m = s = ms = 0;
! 246: memset (buf, 0, size);
! 247:
! 248: ms = t->tv_usec / 1000;
! 249:
! 250: if (ms >= 1000)
! 251: {
! 252: t->tv_sec += ms / 1000;
! 253: ms %= 1000;
! 254: }
! 255:
! 256: if (t->tv_sec > WEEK_IN_SECONDS)
! 257: {
! 258: w = t->tv_sec / WEEK_IN_SECONDS;
! 259: t->tv_sec -= w * WEEK_IN_SECONDS;
! 260: }
! 261:
! 262: if (t->tv_sec > DAY_IN_SECONDS)
! 263: {
! 264: d = t->tv_sec / DAY_IN_SECONDS;
! 265: t->tv_sec -= d * DAY_IN_SECONDS;
! 266: }
! 267:
! 268: if (t->tv_sec >= HOUR_IN_SECONDS)
! 269: {
! 270: h = t->tv_sec / HOUR_IN_SECONDS;
! 271: t->tv_sec -= h * HOUR_IN_SECONDS;
! 272: }
! 273:
! 274: if (t->tv_sec >= MINUTE_IN_SECONDS)
! 275: {
! 276: m = t->tv_sec / MINUTE_IN_SECONDS;
! 277: t->tv_sec -= m * MINUTE_IN_SECONDS;
! 278: }
! 279:
! 280: if (w > 99)
! 281: snprintf (buf, size, "%ldw%1ldd", w, d);
! 282: else if (w)
! 283: snprintf (buf, size, "%ldw%1ldd%02ldh", w, d, h);
! 284: else if (d)
! 285: snprintf (buf, size, "%1ldd%02ldh%02ldm", d, h, m);
! 286: else if (h)
! 287: snprintf (buf, size, "%ldh%02ldm%02lds", h, m, t->tv_sec);
! 288: else if (m)
! 289: snprintf (buf, size, "%ldm%02lds", m, t->tv_sec);
! 290: else
! 291: snprintf (buf, size, "%ld.%03lds", t->tv_sec, ms);
! 292:
! 293: return buf;
! 294: }
! 295:
! 296: const char *
! 297: ospf_timer_dump (struct thread *t, char *buf, size_t size)
! 298: {
! 299: struct timeval result;
! 300: if (!t)
! 301: return "inactive";
! 302:
! 303: result = tv_sub (t->u.sands, recent_relative_time());
! 304: return ospf_timeval_dump (&result, buf, size);
! 305: }
! 306:
! 307: #define OSPF_OPTION_STR_MAXLEN 24
! 308:
! 309: char *
! 310: ospf_options_dump (u_char options)
! 311: {
! 312: static char buf[OSPF_OPTION_STR_MAXLEN];
! 313:
! 314: snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|*",
! 315: (options & OSPF_OPTION_O) ? "O" : "-",
! 316: (options & OSPF_OPTION_DC) ? "DC" : "-",
! 317: (options & OSPF_OPTION_EA) ? "EA" : "-",
! 318: (options & OSPF_OPTION_NP) ? "N/P" : "-",
! 319: (options & OSPF_OPTION_MC) ? "MC" : "-",
! 320: (options & OSPF_OPTION_E) ? "E" : "-");
! 321:
! 322: return buf;
! 323: }
! 324:
! 325: static void
! 326: ospf_packet_hello_dump (struct stream *s, u_int16_t length)
! 327: {
! 328: struct ospf_hello *hello;
! 329: int i;
! 330:
! 331: hello = (struct ospf_hello *) STREAM_PNT (s);
! 332:
! 333: zlog_debug ("Hello");
! 334: zlog_debug (" NetworkMask %s", inet_ntoa (hello->network_mask));
! 335: zlog_debug (" HelloInterval %d", ntohs (hello->hello_interval));
! 336: zlog_debug (" Options %d (%s)", hello->options,
! 337: ospf_options_dump (hello->options));
! 338: zlog_debug (" RtrPriority %d", hello->priority);
! 339: zlog_debug (" RtrDeadInterval %ld", (u_long)ntohl (hello->dead_interval));
! 340: zlog_debug (" DRouter %s", inet_ntoa (hello->d_router));
! 341: zlog_debug (" BDRouter %s", inet_ntoa (hello->bd_router));
! 342:
! 343: length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE;
! 344: zlog_debug (" # Neighbors %d", length / 4);
! 345: for (i = 0; length > 0; i++, length -= sizeof (struct in_addr))
! 346: zlog_debug (" Neighbor %s", inet_ntoa (hello->neighbors[i]));
! 347: }
! 348:
! 349: static char *
! 350: ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
! 351: {
! 352: memset (buf, 0, size);
! 353:
! 354: snprintf (buf, size, "%s|%s|%s",
! 355: (flags & OSPF_DD_FLAG_I) ? "I" : "-",
! 356: (flags & OSPF_DD_FLAG_M) ? "M" : "-",
! 357: (flags & OSPF_DD_FLAG_MS) ? "MS" : "-");
! 358:
! 359: return buf;
! 360: }
! 361:
! 362: void
! 363: ospf_lsa_header_dump (struct lsa_header *lsah)
! 364: {
! 365: const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
! 366:
! 367: zlog_debug (" LSA Header");
! 368: zlog_debug (" LS age %d", ntohs (lsah->ls_age));
! 369: zlog_debug (" Options %d (%s)", lsah->options,
! 370: ospf_options_dump (lsah->options));
! 371: zlog_debug (" LS type %d (%s)", lsah->type,
! 372: (lsah->type ? lsah_type : "unknown type"));
! 373: zlog_debug (" Link State ID %s", inet_ntoa (lsah->id));
! 374: zlog_debug (" Advertising Router %s", inet_ntoa (lsah->adv_router));
! 375: zlog_debug (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
! 376: zlog_debug (" LS checksum 0x%x", ntohs (lsah->checksum));
! 377: zlog_debug (" length %d", ntohs (lsah->length));
! 378: }
! 379:
! 380: static char *
! 381: ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size)
! 382: {
! 383: memset (buf, 0, size);
! 384:
! 385: snprintf (buf, size, "%s|%s|%s",
! 386: (flags & ROUTER_LSA_VIRTUAL) ? "V" : "-",
! 387: (flags & ROUTER_LSA_EXTERNAL) ? "E" : "-",
! 388: (flags & ROUTER_LSA_BORDER) ? "B" : "-");
! 389:
! 390: return buf;
! 391: }
! 392:
! 393: static void
! 394: ospf_router_lsa_dump (struct stream *s, u_int16_t length)
! 395: {
! 396: char buf[BUFSIZ];
! 397: struct router_lsa *rl;
! 398: int i, len;
! 399:
! 400: rl = (struct router_lsa *) STREAM_PNT (s);
! 401:
! 402: zlog_debug (" Router-LSA");
! 403: zlog_debug (" flags %s",
! 404: ospf_router_lsa_flags_dump (rl->flags, buf, BUFSIZ));
! 405: zlog_debug (" # links %d", ntohs (rl->links));
! 406:
! 407: len = ntohs (rl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
! 408: for (i = 0; len > 0; i++)
! 409: {
! 410: zlog_debug (" Link ID %s", inet_ntoa (rl->link[i].link_id));
! 411: zlog_debug (" Link Data %s", inet_ntoa (rl->link[i].link_data));
! 412: zlog_debug (" Type %d", (u_char) rl->link[i].type);
! 413: zlog_debug (" TOS %d", (u_char) rl->link[i].tos);
! 414: zlog_debug (" metric %d", ntohs (rl->link[i].metric));
! 415:
! 416: len -= 12;
! 417: }
! 418: }
! 419:
! 420: static void
! 421: ospf_network_lsa_dump (struct stream *s, u_int16_t length)
! 422: {
! 423: struct network_lsa *nl;
! 424: int i, cnt;
! 425:
! 426: nl = (struct network_lsa *) STREAM_PNT (s);
! 427: cnt = (ntohs (nl->header.length) - (OSPF_LSA_HEADER_SIZE + 4)) / 4;
! 428:
! 429: zlog_debug (" Network-LSA");
! 430: /*
! 431: zlog_debug ("LSA total size %d", ntohs (nl->header.length));
! 432: zlog_debug ("Network-LSA size %d",
! 433: ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE);
! 434: */
! 435: zlog_debug (" Network Mask %s", inet_ntoa (nl->mask));
! 436: zlog_debug (" # Attached Routers %d", cnt);
! 437: for (i = 0; i < cnt; i++)
! 438: zlog_debug (" Attached Router %s", inet_ntoa (nl->routers[i]));
! 439: }
! 440:
! 441: static void
! 442: ospf_summary_lsa_dump (struct stream *s, u_int16_t length)
! 443: {
! 444: struct summary_lsa *sl;
! 445: int size;
! 446: int i;
! 447:
! 448: sl = (struct summary_lsa *) STREAM_PNT (s);
! 449:
! 450: zlog_debug (" Summary-LSA");
! 451: zlog_debug (" Network Mask %s", inet_ntoa (sl->mask));
! 452:
! 453: size = ntohs (sl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
! 454: for (i = 0; size > 0; size -= 4, i++)
! 455: zlog_debug (" TOS=%d metric %d", sl->tos,
! 456: GET_METRIC (sl->metric));
! 457: }
! 458:
! 459: static void
! 460: ospf_as_external_lsa_dump (struct stream *s, u_int16_t length)
! 461: {
! 462: struct as_external_lsa *al;
! 463: int size;
! 464: int i;
! 465:
! 466: al = (struct as_external_lsa *) STREAM_PNT (s);
! 467: zlog_debug (" %s", ospf_lsa_type_msg[al->header.type].str);
! 468: zlog_debug (" Network Mask %s", inet_ntoa (al->mask));
! 469:
! 470: size = ntohs (al->header.length) - OSPF_LSA_HEADER_SIZE -4;
! 471: for (i = 0; size > 0; size -= 12, i++)
! 472: {
! 473: zlog_debug (" bit %s TOS=%d metric %d",
! 474: IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
! 475: al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
! 476: zlog_debug (" Forwarding address %s", inet_ntoa (al->e[i].fwd_addr));
! 477: zlog_debug (" External Route Tag %d", al->e[i].route_tag);
! 478: }
! 479: }
! 480:
! 481: static void
! 482: ospf_lsa_header_list_dump (struct stream *s, u_int16_t length)
! 483: {
! 484: struct lsa_header *lsa;
! 485:
! 486: zlog_debug (" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE);
! 487:
! 488: /* LSA Headers. */
! 489: while (length > 0)
! 490: {
! 491: lsa = (struct lsa_header *) STREAM_PNT (s);
! 492: ospf_lsa_header_dump (lsa);
! 493:
! 494: stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
! 495: length -= OSPF_LSA_HEADER_SIZE;
! 496: }
! 497: }
! 498:
! 499: static void
! 500: ospf_packet_db_desc_dump (struct stream *s, u_int16_t length)
! 501: {
! 502: struct ospf_db_desc *dd;
! 503: char dd_flags[8];
! 504:
! 505: u_int32_t gp;
! 506:
! 507: gp = stream_get_getp (s);
! 508: dd = (struct ospf_db_desc *) STREAM_PNT (s);
! 509:
! 510: zlog_debug ("Database Description");
! 511: zlog_debug (" Interface MTU %d", ntohs (dd->mtu));
! 512: zlog_debug (" Options %d (%s)", dd->options,
! 513: ospf_options_dump (dd->options));
! 514: zlog_debug (" Flags %d (%s)", dd->flags,
! 515: ospf_dd_flags_dump (dd->flags, dd_flags, sizeof dd_flags));
! 516: zlog_debug (" Sequence Number 0x%08lx", (u_long)ntohl (dd->dd_seqnum));
! 517:
! 518: length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
! 519:
! 520: stream_forward_getp (s, OSPF_DB_DESC_MIN_SIZE);
! 521:
! 522: ospf_lsa_header_list_dump (s, length);
! 523:
! 524: stream_set_getp (s, gp);
! 525: }
! 526:
! 527: static void
! 528: ospf_packet_ls_req_dump (struct stream *s, u_int16_t length)
! 529: {
! 530: u_int32_t sp;
! 531: u_int32_t ls_type;
! 532: struct in_addr ls_id;
! 533: struct in_addr adv_router;
! 534:
! 535: sp = stream_get_getp (s);
! 536:
! 537: length -= OSPF_HEADER_SIZE;
! 538:
! 539: zlog_debug ("Link State Request");
! 540: zlog_debug (" # Requests %d", length / 12);
! 541:
! 542: for (; length > 0; length -= 12)
! 543: {
! 544: ls_type = stream_getl (s);
! 545: ls_id.s_addr = stream_get_ipv4 (s);
! 546: adv_router.s_addr = stream_get_ipv4 (s);
! 547:
! 548: zlog_debug (" LS type %d", ls_type);
! 549: zlog_debug (" Link State ID %s", inet_ntoa (ls_id));
! 550: zlog_debug (" Advertising Router %s",
! 551: inet_ntoa (adv_router));
! 552: }
! 553:
! 554: stream_set_getp (s, sp);
! 555: }
! 556:
! 557: static void
! 558: ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length)
! 559: {
! 560: u_int32_t sp;
! 561: struct lsa_header *lsa;
! 562: int lsa_len;
! 563: u_int32_t count;
! 564:
! 565: length -= OSPF_HEADER_SIZE;
! 566:
! 567: sp = stream_get_getp (s);
! 568:
! 569: count = stream_getl (s);
! 570: length -= 4;
! 571:
! 572: zlog_debug ("Link State Update");
! 573: zlog_debug (" # LSAs %d", count);
! 574:
! 575: while (length > 0 && count > 0)
! 576: {
! 577: if (length < OSPF_HEADER_SIZE || length % 4 != 0)
! 578: {
! 579: zlog_debug (" Remaining %d bytes; Incorrect length.", length);
! 580: break;
! 581: }
! 582:
! 583: lsa = (struct lsa_header *) STREAM_PNT (s);
! 584: lsa_len = ntohs (lsa->length);
! 585: ospf_lsa_header_dump (lsa);
! 586:
! 587: switch (lsa->type)
! 588: {
! 589: case OSPF_ROUTER_LSA:
! 590: ospf_router_lsa_dump (s, length);
! 591: break;
! 592: case OSPF_NETWORK_LSA:
! 593: ospf_network_lsa_dump (s, length);
! 594: break;
! 595: case OSPF_SUMMARY_LSA:
! 596: case OSPF_ASBR_SUMMARY_LSA:
! 597: ospf_summary_lsa_dump (s, length);
! 598: break;
! 599: case OSPF_AS_EXTERNAL_LSA:
! 600: ospf_as_external_lsa_dump (s, length);
! 601: break;
! 602: case OSPF_AS_NSSA_LSA:
! 603: ospf_as_external_lsa_dump (s, length);
! 604: break;
! 605: #ifdef HAVE_OPAQUE_LSA
! 606: case OSPF_OPAQUE_LINK_LSA:
! 607: case OSPF_OPAQUE_AREA_LSA:
! 608: case OSPF_OPAQUE_AS_LSA:
! 609: ospf_opaque_lsa_dump (s, length);
! 610: break;
! 611: #endif /* HAVE_OPAQUE_LSA */
! 612: default:
! 613: break;
! 614: }
! 615:
! 616: stream_forward_getp (s, lsa_len);
! 617: length -= lsa_len;
! 618: count--;
! 619: }
! 620:
! 621: stream_set_getp (s, sp);
! 622: }
! 623:
! 624: static void
! 625: ospf_packet_ls_ack_dump (struct stream *s, u_int16_t length)
! 626: {
! 627: u_int32_t sp;
! 628:
! 629: length -= OSPF_HEADER_SIZE;
! 630: sp = stream_get_getp (s);
! 631:
! 632: zlog_debug ("Link State Acknowledgment");
! 633: ospf_lsa_header_list_dump (s, length);
! 634:
! 635: stream_set_getp (s, sp);
! 636: }
! 637:
! 638: /* Expects header to be in host order */
! 639: void
! 640: ospf_ip_header_dump (struct ip *iph)
! 641: {
! 642: /* IP Header dump. */
! 643: zlog_debug ("ip_v %d", iph->ip_v);
! 644: zlog_debug ("ip_hl %d", iph->ip_hl);
! 645: zlog_debug ("ip_tos %d", iph->ip_tos);
! 646: zlog_debug ("ip_len %d", iph->ip_len);
! 647: zlog_debug ("ip_id %u", (u_int32_t) iph->ip_id);
! 648: zlog_debug ("ip_off %u", (u_int32_t) iph->ip_off);
! 649: zlog_debug ("ip_ttl %d", iph->ip_ttl);
! 650: zlog_debug ("ip_p %d", iph->ip_p);
! 651: zlog_debug ("ip_sum 0x%x", (u_int32_t) iph->ip_sum);
! 652: zlog_debug ("ip_src %s", inet_ntoa (iph->ip_src));
! 653: zlog_debug ("ip_dst %s", inet_ntoa (iph->ip_dst));
! 654: }
! 655:
! 656: static void
! 657: ospf_header_dump (struct ospf_header *ospfh)
! 658: {
! 659: char buf[9];
! 660:
! 661: zlog_debug ("Header");
! 662: zlog_debug (" Version %d", ospfh->version);
! 663: zlog_debug (" Type %d (%s)", ospfh->type,
! 664: ospf_packet_type_str[ospfh->type]);
! 665: zlog_debug (" Packet Len %d", ntohs (ospfh->length));
! 666: zlog_debug (" Router ID %s", inet_ntoa (ospfh->router_id));
! 667: zlog_debug (" Area ID %s", inet_ntoa (ospfh->area_id));
! 668: zlog_debug (" Checksum 0x%x", ntohs (ospfh->checksum));
! 669: zlog_debug (" AuType %d", ntohs (ospfh->auth_type));
! 670:
! 671: switch (ntohs (ospfh->auth_type))
! 672: {
! 673: case OSPF_AUTH_NULL:
! 674: break;
! 675: case OSPF_AUTH_SIMPLE:
! 676: memset (buf, 0, 9);
! 677: strncpy (buf, (char *) ospfh->u.auth_data, 8);
! 678: zlog_debug (" Simple Password %s", buf);
! 679: break;
! 680: case OSPF_AUTH_CRYPTOGRAPHIC:
! 681: zlog_debug (" Cryptographic Authentication");
! 682: zlog_debug (" Key ID %d", ospfh->u.crypt.key_id);
! 683: zlog_debug (" Auth Data Len %d", ospfh->u.crypt.auth_data_len);
! 684: zlog_debug (" Sequence number %ld",
! 685: (u_long)ntohl (ospfh->u.crypt.crypt_seqnum));
! 686: break;
! 687: default:
! 688: zlog_debug ("* This is not supported authentication type");
! 689: break;
! 690: }
! 691:
! 692: }
! 693:
! 694: void
! 695: ospf_packet_dump (struct stream *s)
! 696: {
! 697: struct ospf_header *ospfh;
! 698: unsigned long gp;
! 699:
! 700: /* Preserve pointer. */
! 701: gp = stream_get_getp (s);
! 702:
! 703: /* OSPF Header dump. */
! 704: ospfh = (struct ospf_header *) STREAM_PNT (s);
! 705:
! 706: /* Until detail flag is set, return. */
! 707: if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL))
! 708: return;
! 709:
! 710: /* Show OSPF header detail. */
! 711: ospf_header_dump (ospfh);
! 712: stream_forward_getp (s, OSPF_HEADER_SIZE);
! 713:
! 714: switch (ospfh->type)
! 715: {
! 716: case OSPF_MSG_HELLO:
! 717: ospf_packet_hello_dump (s, ntohs (ospfh->length));
! 718: break;
! 719: case OSPF_MSG_DB_DESC:
! 720: ospf_packet_db_desc_dump (s, ntohs (ospfh->length));
! 721: break;
! 722: case OSPF_MSG_LS_REQ:
! 723: ospf_packet_ls_req_dump (s, ntohs (ospfh->length));
! 724: break;
! 725: case OSPF_MSG_LS_UPD:
! 726: ospf_packet_ls_upd_dump (s, ntohs (ospfh->length));
! 727: break;
! 728: case OSPF_MSG_LS_ACK:
! 729: ospf_packet_ls_ack_dump (s, ntohs (ospfh->length));
! 730: break;
! 731: default:
! 732: break;
! 733: }
! 734:
! 735: stream_set_getp (s, gp);
! 736: }
! 737:
! 738:
! 739: /*
! 740: [no] debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)
! 741: [send|recv [detail]]
! 742: */
! 743: DEFUN (debug_ospf_packet,
! 744: debug_ospf_packet_all_cmd,
! 745: "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)",
! 746: DEBUG_STR
! 747: OSPF_STR
! 748: "OSPF packets\n"
! 749: "OSPF Hello\n"
! 750: "OSPF Database Description\n"
! 751: "OSPF Link State Request\n"
! 752: "OSPF Link State Update\n"
! 753: "OSPF Link State Acknowledgment\n"
! 754: "OSPF all packets\n")
! 755: {
! 756: int type = 0;
! 757: int flag = 0;
! 758: int i;
! 759:
! 760: assert (argc > 0);
! 761:
! 762: /* Check packet type. */
! 763: if (strncmp (argv[0], "h", 1) == 0)
! 764: type = OSPF_DEBUG_HELLO;
! 765: else if (strncmp (argv[0], "d", 1) == 0)
! 766: type = OSPF_DEBUG_DB_DESC;
! 767: else if (strncmp (argv[0], "ls-r", 4) == 0)
! 768: type = OSPF_DEBUG_LS_REQ;
! 769: else if (strncmp (argv[0], "ls-u", 4) == 0)
! 770: type = OSPF_DEBUG_LS_UPD;
! 771: else if (strncmp (argv[0], "ls-a", 4) == 0)
! 772: type = OSPF_DEBUG_LS_ACK;
! 773: else if (strncmp (argv[0], "a", 1) == 0)
! 774: type = OSPF_DEBUG_ALL;
! 775:
! 776: /* Default, both send and recv. */
! 777: if (argc == 1)
! 778: flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV;
! 779:
! 780: /* send or recv. */
! 781: if (argc >= 2)
! 782: {
! 783: if (strncmp (argv[1], "s", 1) == 0)
! 784: flag = OSPF_DEBUG_SEND;
! 785: else if (strncmp (argv[1], "r", 1) == 0)
! 786: flag = OSPF_DEBUG_RECV;
! 787: else if (strncmp (argv[1], "d", 1) == 0)
! 788: flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
! 789: }
! 790:
! 791: /* detail. */
! 792: if (argc == 3)
! 793: if (strncmp (argv[2], "d", 1) == 0)
! 794: flag |= OSPF_DEBUG_DETAIL;
! 795:
! 796: for (i = 0; i < 5; i++)
! 797: if (type & (0x01 << i))
! 798: {
! 799: if (vty->node == CONFIG_NODE)
! 800: DEBUG_PACKET_ON (i, flag);
! 801: else
! 802: TERM_DEBUG_PACKET_ON (i, flag);
! 803: }
! 804:
! 805: return CMD_SUCCESS;
! 806: }
! 807:
! 808: ALIAS (debug_ospf_packet,
! 809: debug_ospf_packet_send_recv_cmd,
! 810: "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
! 811: "Debugging functions\n"
! 812: "OSPF information\n"
! 813: "OSPF packets\n"
! 814: "OSPF Hello\n"
! 815: "OSPF Database Description\n"
! 816: "OSPF Link State Request\n"
! 817: "OSPF Link State Update\n"
! 818: "OSPF Link State Acknowledgment\n"
! 819: "OSPF all packets\n"
! 820: "Packet sent\n"
! 821: "Packet received\n"
! 822: "Detail information\n")
! 823:
! 824: ALIAS (debug_ospf_packet,
! 825: debug_ospf_packet_send_recv_detail_cmd,
! 826: "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
! 827: "Debugging functions\n"
! 828: "OSPF information\n"
! 829: "OSPF packets\n"
! 830: "OSPF Hello\n"
! 831: "OSPF Database Description\n"
! 832: "OSPF Link State Request\n"
! 833: "OSPF Link State Update\n"
! 834: "OSPF Link State Acknowledgment\n"
! 835: "OSPF all packets\n"
! 836: "Packet sent\n"
! 837: "Packet received\n"
! 838: "Detail Information\n")
! 839:
! 840:
! 841: DEFUN (no_debug_ospf_packet,
! 842: no_debug_ospf_packet_all_cmd,
! 843: "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)",
! 844: NO_STR
! 845: DEBUG_STR
! 846: OSPF_STR
! 847: "OSPF packets\n"
! 848: "OSPF Hello\n"
! 849: "OSPF Database Description\n"
! 850: "OSPF Link State Request\n"
! 851: "OSPF Link State Update\n"
! 852: "OSPF Link State Acknowledgment\n"
! 853: "OSPF all packets\n")
! 854: {
! 855: int type = 0;
! 856: int flag = 0;
! 857: int i;
! 858:
! 859: assert (argc > 0);
! 860:
! 861: /* Check packet type. */
! 862: if (strncmp (argv[0], "h", 1) == 0)
! 863: type = OSPF_DEBUG_HELLO;
! 864: else if (strncmp (argv[0], "d", 1) == 0)
! 865: type = OSPF_DEBUG_DB_DESC;
! 866: else if (strncmp (argv[0], "ls-r", 4) == 0)
! 867: type = OSPF_DEBUG_LS_REQ;
! 868: else if (strncmp (argv[0], "ls-u", 4) == 0)
! 869: type = OSPF_DEBUG_LS_UPD;
! 870: else if (strncmp (argv[0], "ls-a", 4) == 0)
! 871: type = OSPF_DEBUG_LS_ACK;
! 872: else if (strncmp (argv[0], "a", 1) == 0)
! 873: type = OSPF_DEBUG_ALL;
! 874:
! 875: /* Default, both send and recv. */
! 876: if (argc == 1)
! 877: flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL ;
! 878:
! 879: /* send or recv. */
! 880: if (argc == 2)
! 881: {
! 882: if (strncmp (argv[1], "s", 1) == 0)
! 883: flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL;
! 884: else if (strncmp (argv[1], "r", 1) == 0)
! 885: flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
! 886: else if (strncmp (argv[1], "d", 1) == 0)
! 887: flag = OSPF_DEBUG_DETAIL;
! 888: }
! 889:
! 890: /* detail. */
! 891: if (argc == 3)
! 892: if (strncmp (argv[2], "d", 1) == 0)
! 893: flag = OSPF_DEBUG_DETAIL;
! 894:
! 895: for (i = 0; i < 5; i++)
! 896: if (type & (0x01 << i))
! 897: {
! 898: if (vty->node == CONFIG_NODE)
! 899: DEBUG_PACKET_OFF (i, flag);
! 900: else
! 901: TERM_DEBUG_PACKET_OFF (i, flag);
! 902: }
! 903:
! 904: #ifdef DEBUG
! 905: /*
! 906: for (i = 0; i < 5; i++)
! 907: zlog_debug ("flag[%d] = %d", i, ospf_debug_packet[i]);
! 908: */
! 909: #endif /* DEBUG */
! 910:
! 911: return CMD_SUCCESS;
! 912: }
! 913:
! 914: ALIAS (no_debug_ospf_packet,
! 915: no_debug_ospf_packet_send_recv_cmd,
! 916: "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
! 917: NO_STR
! 918: "Debugging functions\n"
! 919: "OSPF information\n"
! 920: "OSPF packets\n"
! 921: "OSPF Hello\n"
! 922: "OSPF Database Description\n"
! 923: "OSPF Link State Request\n"
! 924: "OSPF Link State Update\n"
! 925: "OSPF Link State Acknowledgment\n"
! 926: "OSPF all packets\n"
! 927: "Packet sent\n"
! 928: "Packet received\n"
! 929: "Detail Information\n")
! 930:
! 931: ALIAS (no_debug_ospf_packet,
! 932: no_debug_ospf_packet_send_recv_detail_cmd,
! 933: "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
! 934: NO_STR
! 935: "Debugging functions\n"
! 936: "OSPF information\n"
! 937: "OSPF packets\n"
! 938: "OSPF Hello\n"
! 939: "OSPF Database Description\n"
! 940: "OSPF Link State Request\n"
! 941: "OSPF Link State Update\n"
! 942: "OSPF Link State Acknowledgment\n"
! 943: "OSPF all packets\n"
! 944: "Packet sent\n"
! 945: "Packet received\n"
! 946: "Detail Information\n")
! 947:
! 948:
! 949: DEFUN (debug_ospf_ism,
! 950: debug_ospf_ism_cmd,
! 951: "debug ospf ism",
! 952: DEBUG_STR
! 953: OSPF_STR
! 954: "OSPF Interface State Machine\n")
! 955: {
! 956: if (vty->node == CONFIG_NODE)
! 957: {
! 958: if (argc == 0)
! 959: DEBUG_ON (ism, ISM);
! 960: else if (argc == 1)
! 961: {
! 962: if (strncmp (argv[0], "s", 1) == 0)
! 963: DEBUG_ON (ism, ISM_STATUS);
! 964: else if (strncmp (argv[0], "e", 1) == 0)
! 965: DEBUG_ON (ism, ISM_EVENTS);
! 966: else if (strncmp (argv[0], "t", 1) == 0)
! 967: DEBUG_ON (ism, ISM_TIMERS);
! 968: }
! 969:
! 970: return CMD_SUCCESS;
! 971: }
! 972:
! 973: /* ENABLE_NODE. */
! 974: if (argc == 0)
! 975: TERM_DEBUG_ON (ism, ISM);
! 976: else if (argc == 1)
! 977: {
! 978: if (strncmp (argv[0], "s", 1) == 0)
! 979: TERM_DEBUG_ON (ism, ISM_STATUS);
! 980: else if (strncmp (argv[0], "e", 1) == 0)
! 981: TERM_DEBUG_ON (ism, ISM_EVENTS);
! 982: else if (strncmp (argv[0], "t", 1) == 0)
! 983: TERM_DEBUG_ON (ism, ISM_TIMERS);
! 984: }
! 985:
! 986: return CMD_SUCCESS;
! 987: }
! 988:
! 989: ALIAS (debug_ospf_ism,
! 990: debug_ospf_ism_sub_cmd,
! 991: "debug ospf ism (status|events|timers)",
! 992: DEBUG_STR
! 993: OSPF_STR
! 994: "OSPF Interface State Machine\n"
! 995: "ISM Status Information\n"
! 996: "ISM Event Information\n"
! 997: "ISM TImer Information\n")
! 998:
! 999: DEFUN (no_debug_ospf_ism,
! 1000: no_debug_ospf_ism_cmd,
! 1001: "no debug ospf ism",
! 1002: NO_STR
! 1003: DEBUG_STR
! 1004: OSPF_STR
! 1005: "OSPF Interface State Machine")
! 1006: {
! 1007: if (vty->node == CONFIG_NODE)
! 1008: {
! 1009: if (argc == 0)
! 1010: DEBUG_OFF (ism, ISM);
! 1011: else if (argc == 1)
! 1012: {
! 1013: if (strncmp (argv[0], "s", 1) == 0)
! 1014: DEBUG_OFF (ism, ISM_STATUS);
! 1015: else if (strncmp (argv[0], "e", 1) == 0)
! 1016: DEBUG_OFF (ism, ISM_EVENTS);
! 1017: else if (strncmp (argv[0], "t", 1) == 0)
! 1018: DEBUG_OFF (ism, ISM_TIMERS);
! 1019: }
! 1020: return CMD_SUCCESS;
! 1021: }
! 1022:
! 1023: /* ENABLE_NODE. */
! 1024: if (argc == 0)
! 1025: TERM_DEBUG_OFF (ism, ISM);
! 1026: else if (argc == 1)
! 1027: {
! 1028: if (strncmp (argv[0], "s", 1) == 0)
! 1029: TERM_DEBUG_OFF (ism, ISM_STATUS);
! 1030: else if (strncmp (argv[0], "e", 1) == 0)
! 1031: TERM_DEBUG_OFF (ism, ISM_EVENTS);
! 1032: else if (strncmp (argv[0], "t", 1) == 0)
! 1033: TERM_DEBUG_OFF (ism, ISM_TIMERS);
! 1034: }
! 1035:
! 1036: return CMD_SUCCESS;
! 1037: }
! 1038:
! 1039: ALIAS (no_debug_ospf_ism,
! 1040: no_debug_ospf_ism_sub_cmd,
! 1041: "no debug ospf ism (status|events|timers)",
! 1042: NO_STR
! 1043: "Debugging functions\n"
! 1044: "OSPF information\n"
! 1045: "OSPF Interface State Machine\n"
! 1046: "ISM Status Information\n"
! 1047: "ISM Event Information\n"
! 1048: "ISM Timer Information\n")
! 1049:
! 1050:
! 1051: DEFUN (debug_ospf_nsm,
! 1052: debug_ospf_nsm_cmd,
! 1053: "debug ospf nsm",
! 1054: DEBUG_STR
! 1055: OSPF_STR
! 1056: "OSPF Neighbor State Machine\n")
! 1057: {
! 1058: if (vty->node == CONFIG_NODE)
! 1059: {
! 1060: if (argc == 0)
! 1061: DEBUG_ON (nsm, NSM);
! 1062: else if (argc == 1)
! 1063: {
! 1064: if (strncmp (argv[0], "s", 1) == 0)
! 1065: DEBUG_ON (nsm, NSM_STATUS);
! 1066: else if (strncmp (argv[0], "e", 1) == 0)
! 1067: DEBUG_ON (nsm, NSM_EVENTS);
! 1068: else if (strncmp (argv[0], "t", 1) == 0)
! 1069: DEBUG_ON (nsm, NSM_TIMERS);
! 1070: }
! 1071:
! 1072: return CMD_SUCCESS;
! 1073: }
! 1074:
! 1075: /* ENABLE_NODE. */
! 1076: if (argc == 0)
! 1077: TERM_DEBUG_ON (nsm, NSM);
! 1078: else if (argc == 1)
! 1079: {
! 1080: if (strncmp (argv[0], "s", 1) == 0)
! 1081: TERM_DEBUG_ON (nsm, NSM_STATUS);
! 1082: else if (strncmp (argv[0], "e", 1) == 0)
! 1083: TERM_DEBUG_ON (nsm, NSM_EVENTS);
! 1084: else if (strncmp (argv[0], "t", 1) == 0)
! 1085: TERM_DEBUG_ON (nsm, NSM_TIMERS);
! 1086: }
! 1087:
! 1088: return CMD_SUCCESS;
! 1089: }
! 1090:
! 1091: ALIAS (debug_ospf_nsm,
! 1092: debug_ospf_nsm_sub_cmd,
! 1093: "debug ospf nsm (status|events|timers)",
! 1094: DEBUG_STR
! 1095: OSPF_STR
! 1096: "OSPF Neighbor State Machine\n"
! 1097: "NSM Status Information\n"
! 1098: "NSM Event Information\n"
! 1099: "NSM Timer Information\n")
! 1100:
! 1101: DEFUN (no_debug_ospf_nsm,
! 1102: no_debug_ospf_nsm_cmd,
! 1103: "no debug ospf nsm",
! 1104: NO_STR
! 1105: DEBUG_STR
! 1106: OSPF_STR
! 1107: "OSPF Neighbor State Machine")
! 1108: {
! 1109: if (vty->node == CONFIG_NODE)
! 1110: {
! 1111: if (argc == 0)
! 1112: DEBUG_OFF (nsm, NSM);
! 1113: else if (argc == 1)
! 1114: {
! 1115: if (strncmp (argv[0], "s", 1) == 0)
! 1116: DEBUG_OFF (nsm, NSM_STATUS);
! 1117: else if (strncmp (argv[0], "e", 1) == 0)
! 1118: DEBUG_OFF (nsm, NSM_EVENTS);
! 1119: else if (strncmp (argv[0], "t", 1) == 0)
! 1120: DEBUG_OFF (nsm, NSM_TIMERS);
! 1121: }
! 1122:
! 1123: return CMD_SUCCESS;
! 1124: }
! 1125:
! 1126: /* ENABLE_NODE. */
! 1127: if (argc == 0)
! 1128: TERM_DEBUG_OFF (nsm, NSM);
! 1129: else if (argc == 1)
! 1130: {
! 1131: if (strncmp (argv[0], "s", 1) == 0)
! 1132: TERM_DEBUG_OFF (nsm, NSM_STATUS);
! 1133: else if (strncmp (argv[0], "e", 1) == 0)
! 1134: TERM_DEBUG_OFF (nsm, NSM_EVENTS);
! 1135: else if (strncmp (argv[0], "t", 1) == 0)
! 1136: TERM_DEBUG_OFF (nsm, NSM_TIMERS);
! 1137: }
! 1138:
! 1139: return CMD_SUCCESS;
! 1140: }
! 1141:
! 1142: ALIAS (no_debug_ospf_nsm,
! 1143: no_debug_ospf_nsm_sub_cmd,
! 1144: "no debug ospf nsm (status|events|timers)",
! 1145: NO_STR
! 1146: "Debugging functions\n"
! 1147: "OSPF information\n"
! 1148: "OSPF Interface State Machine\n"
! 1149: "NSM Status Information\n"
! 1150: "NSM Event Information\n"
! 1151: "NSM Timer Information\n")
! 1152:
! 1153:
! 1154: DEFUN (debug_ospf_lsa,
! 1155: debug_ospf_lsa_cmd,
! 1156: "debug ospf lsa",
! 1157: DEBUG_STR
! 1158: OSPF_STR
! 1159: "OSPF Link State Advertisement\n")
! 1160: {
! 1161: if (vty->node == CONFIG_NODE)
! 1162: {
! 1163: if (argc == 0)
! 1164: DEBUG_ON (lsa, LSA);
! 1165: else if (argc == 1)
! 1166: {
! 1167: if (strncmp (argv[0], "g", 1) == 0)
! 1168: DEBUG_ON (lsa, LSA_GENERATE);
! 1169: else if (strncmp (argv[0], "f", 1) == 0)
! 1170: DEBUG_ON (lsa, LSA_FLOODING);
! 1171: else if (strncmp (argv[0], "i", 1) == 0)
! 1172: DEBUG_ON (lsa, LSA_INSTALL);
! 1173: else if (strncmp (argv[0], "r", 1) == 0)
! 1174: DEBUG_ON (lsa, LSA_REFRESH);
! 1175: }
! 1176:
! 1177: return CMD_SUCCESS;
! 1178: }
! 1179:
! 1180: /* ENABLE_NODE. */
! 1181: if (argc == 0)
! 1182: TERM_DEBUG_ON (lsa, LSA);
! 1183: else if (argc == 1)
! 1184: {
! 1185: if (strncmp (argv[0], "g", 1) == 0)
! 1186: TERM_DEBUG_ON (lsa, LSA_GENERATE);
! 1187: else if (strncmp (argv[0], "f", 1) == 0)
! 1188: TERM_DEBUG_ON (lsa, LSA_FLOODING);
! 1189: else if (strncmp (argv[0], "i", 1) == 0)
! 1190: TERM_DEBUG_ON (lsa, LSA_INSTALL);
! 1191: else if (strncmp (argv[0], "r", 1) == 0)
! 1192: TERM_DEBUG_ON (lsa, LSA_REFRESH);
! 1193: }
! 1194:
! 1195: return CMD_SUCCESS;
! 1196: }
! 1197:
! 1198: ALIAS (debug_ospf_lsa,
! 1199: debug_ospf_lsa_sub_cmd,
! 1200: "debug ospf lsa (generate|flooding|install|refresh)",
! 1201: DEBUG_STR
! 1202: OSPF_STR
! 1203: "OSPF Link State Advertisement\n"
! 1204: "LSA Generation\n"
! 1205: "LSA Flooding\n"
! 1206: "LSA Install/Delete\n"
! 1207: "LSA Refresh\n")
! 1208:
! 1209: DEFUN (no_debug_ospf_lsa,
! 1210: no_debug_ospf_lsa_cmd,
! 1211: "no debug ospf lsa",
! 1212: NO_STR
! 1213: DEBUG_STR
! 1214: OSPF_STR
! 1215: "OSPF Link State Advertisement\n")
! 1216: {
! 1217: if (vty->node == CONFIG_NODE)
! 1218: {
! 1219: if (argc == 0)
! 1220: DEBUG_OFF (lsa, LSA);
! 1221: else if (argc == 1)
! 1222: {
! 1223: if (strncmp (argv[0], "g", 1) == 0)
! 1224: DEBUG_OFF (lsa, LSA_GENERATE);
! 1225: else if (strncmp (argv[0], "f", 1) == 0)
! 1226: DEBUG_OFF (lsa, LSA_FLOODING);
! 1227: else if (strncmp (argv[0], "i", 1) == 0)
! 1228: DEBUG_OFF (lsa, LSA_INSTALL);
! 1229: else if (strncmp (argv[0], "r", 1) == 0)
! 1230: DEBUG_OFF (lsa, LSA_REFRESH);
! 1231: }
! 1232:
! 1233: return CMD_SUCCESS;
! 1234: }
! 1235:
! 1236: /* ENABLE_NODE. */
! 1237: if (argc == 0)
! 1238: TERM_DEBUG_OFF (lsa, LSA);
! 1239: else if (argc == 1)
! 1240: {
! 1241: if (strncmp (argv[0], "g", 1) == 0)
! 1242: TERM_DEBUG_OFF (lsa, LSA_GENERATE);
! 1243: else if (strncmp (argv[0], "f", 1) == 0)
! 1244: TERM_DEBUG_OFF (lsa, LSA_FLOODING);
! 1245: else if (strncmp (argv[0], "i", 1) == 0)
! 1246: TERM_DEBUG_OFF (lsa, LSA_INSTALL);
! 1247: else if (strncmp (argv[0], "r", 1) == 0)
! 1248: TERM_DEBUG_OFF (lsa, LSA_REFRESH);
! 1249: }
! 1250:
! 1251: return CMD_SUCCESS;
! 1252: }
! 1253:
! 1254: ALIAS (no_debug_ospf_lsa,
! 1255: no_debug_ospf_lsa_sub_cmd,
! 1256: "no debug ospf lsa (generate|flooding|install|refresh)",
! 1257: NO_STR
! 1258: DEBUG_STR
! 1259: OSPF_STR
! 1260: "OSPF Link State Advertisement\n"
! 1261: "LSA Generation\n"
! 1262: "LSA Flooding\n"
! 1263: "LSA Install/Delete\n"
! 1264: "LSA Refres\n")
! 1265:
! 1266:
! 1267: DEFUN (debug_ospf_zebra,
! 1268: debug_ospf_zebra_cmd,
! 1269: "debug ospf zebra",
! 1270: DEBUG_STR
! 1271: OSPF_STR
! 1272: "OSPF Zebra information\n")
! 1273: {
! 1274: if (vty->node == CONFIG_NODE)
! 1275: {
! 1276: if (argc == 0)
! 1277: DEBUG_ON (zebra, ZEBRA);
! 1278: else if (argc == 1)
! 1279: {
! 1280: if (strncmp (argv[0], "i", 1) == 0)
! 1281: DEBUG_ON (zebra, ZEBRA_INTERFACE);
! 1282: else if (strncmp (argv[0], "r", 1) == 0)
! 1283: DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
! 1284: }
! 1285:
! 1286: return CMD_SUCCESS;
! 1287: }
! 1288:
! 1289: /* ENABLE_NODE. */
! 1290: if (argc == 0)
! 1291: TERM_DEBUG_ON (zebra, ZEBRA);
! 1292: else if (argc == 1)
! 1293: {
! 1294: if (strncmp (argv[0], "i", 1) == 0)
! 1295: TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE);
! 1296: else if (strncmp (argv[0], "r", 1) == 0)
! 1297: TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE);
! 1298: }
! 1299:
! 1300: return CMD_SUCCESS;
! 1301: }
! 1302:
! 1303: ALIAS (debug_ospf_zebra,
! 1304: debug_ospf_zebra_sub_cmd,
! 1305: "debug ospf zebra (interface|redistribute)",
! 1306: DEBUG_STR
! 1307: OSPF_STR
! 1308: "OSPF Zebra information\n"
! 1309: "Zebra interface\n"
! 1310: "Zebra redistribute\n")
! 1311:
! 1312: DEFUN (no_debug_ospf_zebra,
! 1313: no_debug_ospf_zebra_cmd,
! 1314: "no debug ospf zebra",
! 1315: NO_STR
! 1316: DEBUG_STR
! 1317: OSPF_STR
! 1318: "OSPF Zebra information\n")
! 1319: {
! 1320: if (vty->node == CONFIG_NODE)
! 1321: {
! 1322: if (argc == 0)
! 1323: DEBUG_OFF (zebra, ZEBRA);
! 1324: else if (argc == 1)
! 1325: {
! 1326: if (strncmp (argv[0], "i", 1) == 0)
! 1327: DEBUG_OFF (zebra, ZEBRA_INTERFACE);
! 1328: else if (strncmp (argv[0], "r", 1) == 0)
! 1329: DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
! 1330: }
! 1331:
! 1332: return CMD_SUCCESS;
! 1333: }
! 1334:
! 1335: /* ENABLE_NODE. */
! 1336: if (argc == 0)
! 1337: TERM_DEBUG_OFF (zebra, ZEBRA);
! 1338: else if (argc == 1)
! 1339: {
! 1340: if (strncmp (argv[0], "i", 1) == 0)
! 1341: TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE);
! 1342: else if (strncmp (argv[0], "r", 1) == 0)
! 1343: TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE);
! 1344: }
! 1345:
! 1346: return CMD_SUCCESS;
! 1347: }
! 1348:
! 1349: ALIAS (no_debug_ospf_zebra,
! 1350: no_debug_ospf_zebra_sub_cmd,
! 1351: "no debug ospf zebra (interface|redistribute)",
! 1352: NO_STR
! 1353: DEBUG_STR
! 1354: OSPF_STR
! 1355: "OSPF Zebra information\n"
! 1356: "Zebra interface\n"
! 1357: "Zebra redistribute\n")
! 1358:
! 1359: DEFUN (debug_ospf_event,
! 1360: debug_ospf_event_cmd,
! 1361: "debug ospf event",
! 1362: DEBUG_STR
! 1363: OSPF_STR
! 1364: "OSPF event information\n")
! 1365: {
! 1366: if (vty->node == CONFIG_NODE)
! 1367: CONF_DEBUG_ON (event, EVENT);
! 1368: TERM_DEBUG_ON (event, EVENT);
! 1369: return CMD_SUCCESS;
! 1370: }
! 1371:
! 1372: DEFUN (no_debug_ospf_event,
! 1373: no_debug_ospf_event_cmd,
! 1374: "no debug ospf event",
! 1375: NO_STR
! 1376: DEBUG_STR
! 1377: OSPF_STR
! 1378: "OSPF event information\n")
! 1379: {
! 1380: if (vty->node == CONFIG_NODE)
! 1381: CONF_DEBUG_OFF (event, EVENT);
! 1382: TERM_DEBUG_OFF (event, EVENT);
! 1383: return CMD_SUCCESS;
! 1384: }
! 1385:
! 1386: DEFUN (debug_ospf_nssa,
! 1387: debug_ospf_nssa_cmd,
! 1388: "debug ospf nssa",
! 1389: DEBUG_STR
! 1390: OSPF_STR
! 1391: "OSPF nssa information\n")
! 1392: {
! 1393: if (vty->node == CONFIG_NODE)
! 1394: CONF_DEBUG_ON (nssa, NSSA);
! 1395: TERM_DEBUG_ON (nssa, NSSA);
! 1396: return CMD_SUCCESS;
! 1397: }
! 1398:
! 1399: DEFUN (no_debug_ospf_nssa,
! 1400: no_debug_ospf_nssa_cmd,
! 1401: "no debug ospf nssa",
! 1402: NO_STR
! 1403: DEBUG_STR
! 1404: OSPF_STR
! 1405: "OSPF nssa information\n")
! 1406: {
! 1407: if (vty->node == CONFIG_NODE)
! 1408: CONF_DEBUG_OFF (nssa, NSSA);
! 1409: TERM_DEBUG_OFF (nssa, NSSA);
! 1410: return CMD_SUCCESS;
! 1411: }
! 1412:
! 1413:
! 1414: DEFUN (show_debugging_ospf,
! 1415: show_debugging_ospf_cmd,
! 1416: "show debugging ospf",
! 1417: SHOW_STR
! 1418: DEBUG_STR
! 1419: OSPF_STR)
! 1420: {
! 1421: int i;
! 1422:
! 1423: vty_out (vty, "OSPF debugging status:%s", VTY_NEWLINE);
! 1424:
! 1425: /* Show debug status for events. */
! 1426: if (IS_DEBUG_OSPF(event,EVENT))
! 1427: vty_out (vty, " OSPF event debugging is on%s", VTY_NEWLINE);
! 1428:
! 1429: /* Show debug status for ISM. */
! 1430: if (IS_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
! 1431: vty_out (vty, " OSPF ISM debugging is on%s", VTY_NEWLINE);
! 1432: else
! 1433: {
! 1434: if (IS_DEBUG_OSPF (ism, ISM_STATUS))
! 1435: vty_out (vty, " OSPF ISM status debugging is on%s", VTY_NEWLINE);
! 1436: if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
! 1437: vty_out (vty, " OSPF ISM event debugging is on%s", VTY_NEWLINE);
! 1438: if (IS_DEBUG_OSPF (ism, ISM_TIMERS))
! 1439: vty_out (vty, " OSPF ISM timer debugging is on%s", VTY_NEWLINE);
! 1440: }
! 1441:
! 1442: /* Show debug status for NSM. */
! 1443: if (IS_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
! 1444: vty_out (vty, " OSPF NSM debugging is on%s", VTY_NEWLINE);
! 1445: else
! 1446: {
! 1447: if (IS_DEBUG_OSPF (nsm, NSM_STATUS))
! 1448: vty_out (vty, " OSPF NSM status debugging is on%s", VTY_NEWLINE);
! 1449: if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
! 1450: vty_out (vty, " OSPF NSM event debugging is on%s", VTY_NEWLINE);
! 1451: if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
! 1452: vty_out (vty, " OSPF NSM timer debugging is on%s", VTY_NEWLINE);
! 1453: }
! 1454:
! 1455: /* Show debug status for OSPF Packets. */
! 1456: for (i = 0; i < 5; i++)
! 1457: if (IS_DEBUG_OSPF_PACKET (i, SEND) && IS_DEBUG_OSPF_PACKET (i, RECV))
! 1458: {
! 1459: vty_out (vty, " OSPF packet %s%s debugging is on%s",
! 1460: ospf_packet_type_str[i + 1],
! 1461: IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
! 1462: VTY_NEWLINE);
! 1463: }
! 1464: else
! 1465: {
! 1466: if (IS_DEBUG_OSPF_PACKET (i, SEND))
! 1467: vty_out (vty, " OSPF packet %s send%s debugging is on%s",
! 1468: ospf_packet_type_str[i + 1],
! 1469: IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
! 1470: VTY_NEWLINE);
! 1471: if (IS_DEBUG_OSPF_PACKET (i, RECV))
! 1472: vty_out (vty, " OSPF packet %s receive%s debugging is on%s",
! 1473: ospf_packet_type_str[i + 1],
! 1474: IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
! 1475: VTY_NEWLINE);
! 1476: }
! 1477:
! 1478: /* Show debug status for OSPF LSAs. */
! 1479: if (IS_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
! 1480: vty_out (vty, " OSPF LSA debugging is on%s", VTY_NEWLINE);
! 1481: else
! 1482: {
! 1483: if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
! 1484: vty_out (vty, " OSPF LSA generation debugging is on%s", VTY_NEWLINE);
! 1485: if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
! 1486: vty_out (vty, " OSPF LSA flooding debugging is on%s", VTY_NEWLINE);
! 1487: if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
! 1488: vty_out (vty, " OSPF LSA install debugging is on%s", VTY_NEWLINE);
! 1489: if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
! 1490: vty_out (vty, " OSPF LSA refresh debugging is on%s", VTY_NEWLINE);
! 1491: }
! 1492:
! 1493: /* Show debug status for Zebra. */
! 1494: if (IS_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
! 1495: vty_out (vty, " OSPF Zebra debugging is on%s", VTY_NEWLINE);
! 1496: else
! 1497: {
! 1498: if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
! 1499: vty_out (vty, " OSPF Zebra interface debugging is on%s", VTY_NEWLINE);
! 1500: if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
! 1501: vty_out (vty, " OSPF Zebra redistribute debugging is on%s", VTY_NEWLINE);
! 1502: }
! 1503:
! 1504: /* Show debug status for NSSA. */
! 1505: if (IS_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
! 1506: vty_out (vty, " OSPF NSSA debugging is on%s", VTY_NEWLINE);
! 1507:
! 1508: return CMD_SUCCESS;
! 1509: }
! 1510:
! 1511: /* Debug node. */
! 1512: static struct cmd_node debug_node =
! 1513: {
! 1514: DEBUG_NODE,
! 1515: "",
! 1516: 1 /* VTYSH */
! 1517: };
! 1518:
! 1519: static int
! 1520: config_write_debug (struct vty *vty)
! 1521: {
! 1522: int write = 0;
! 1523: int i, r;
! 1524:
! 1525: const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
! 1526: const char *detail_str[] = {"", " send", " recv", "", " detail",
! 1527: " send detail", " recv detail", " detail"};
! 1528:
! 1529: /* debug ospf ism (status|events|timers). */
! 1530: if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
! 1531: vty_out (vty, "debug ospf ism%s", VTY_NEWLINE);
! 1532: else
! 1533: {
! 1534: if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
! 1535: vty_out (vty, "debug ospf ism status%s", VTY_NEWLINE);
! 1536: if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
! 1537: vty_out (vty, "debug ospf ism event%s", VTY_NEWLINE);
! 1538: if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
! 1539: vty_out (vty, "debug ospf ism timer%s", VTY_NEWLINE);
! 1540: }
! 1541:
! 1542: /* debug ospf nsm (status|events|timers). */
! 1543: if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
! 1544: vty_out (vty, "debug ospf nsm%s", VTY_NEWLINE);
! 1545: else
! 1546: {
! 1547: if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
! 1548: vty_out (vty, "debug ospf nsm status%s", VTY_NEWLINE);
! 1549: if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
! 1550: vty_out (vty, "debug ospf nsm event%s", VTY_NEWLINE);
! 1551: if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
! 1552: vty_out (vty, "debug ospf nsm timer%s", VTY_NEWLINE);
! 1553: }
! 1554:
! 1555: /* debug ospf lsa (generate|flooding|install|refresh). */
! 1556: if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
! 1557: vty_out (vty, "debug ospf lsa%s", VTY_NEWLINE);
! 1558: else
! 1559: {
! 1560: if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
! 1561: vty_out (vty, "debug ospf lsa generate%s", VTY_NEWLINE);
! 1562: if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
! 1563: vty_out (vty, "debug ospf lsa flooding%s", VTY_NEWLINE);
! 1564: if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
! 1565: vty_out (vty, "debug ospf lsa install%s", VTY_NEWLINE);
! 1566: if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
! 1567: vty_out (vty, "debug ospf lsa refresh%s", VTY_NEWLINE);
! 1568:
! 1569: write = 1;
! 1570: }
! 1571:
! 1572: /* debug ospf zebra (interface|redistribute). */
! 1573: if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
! 1574: vty_out (vty, "debug ospf zebra%s", VTY_NEWLINE);
! 1575: else
! 1576: {
! 1577: if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
! 1578: vty_out (vty, "debug ospf zebra interface%s", VTY_NEWLINE);
! 1579: if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
! 1580: vty_out (vty, "debug ospf zebra redistribute%s", VTY_NEWLINE);
! 1581:
! 1582: write = 1;
! 1583: }
! 1584:
! 1585: /* debug ospf event. */
! 1586: if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
! 1587: {
! 1588: vty_out (vty, "debug ospf event%s", VTY_NEWLINE);
! 1589: write = 1;
! 1590: }
! 1591:
! 1592: /* debug ospf nssa. */
! 1593: if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
! 1594: {
! 1595: vty_out (vty, "debug ospf nssa%s", VTY_NEWLINE);
! 1596: write = 1;
! 1597: }
! 1598:
! 1599: /* debug ospf packet all detail. */
! 1600: r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
! 1601: for (i = 0; i < 5; i++)
! 1602: r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
! 1603: if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
! 1604: {
! 1605: vty_out (vty, "debug ospf packet all detail%s", VTY_NEWLINE);
! 1606: return 1;
! 1607: }
! 1608:
! 1609: /* debug ospf packet all. */
! 1610: r = OSPF_DEBUG_SEND_RECV;
! 1611: for (i = 0; i < 5; i++)
! 1612: r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
! 1613: if (r == OSPF_DEBUG_SEND_RECV)
! 1614: {
! 1615: vty_out (vty, "debug ospf packet all%s", VTY_NEWLINE);
! 1616: for (i = 0; i < 5; i++)
! 1617: if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
! 1618: vty_out (vty, "debug ospf packet %s detail%s",
! 1619: type_str[i],
! 1620: VTY_NEWLINE);
! 1621: return 1;
! 1622: }
! 1623:
! 1624: /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
! 1625: (send|recv) (detail). */
! 1626: for (i = 0; i < 5; i++)
! 1627: {
! 1628: if (conf_debug_ospf_packet[i] == 0)
! 1629: continue;
! 1630:
! 1631: vty_out (vty, "debug ospf packet %s%s%s",
! 1632: type_str[i], detail_str[conf_debug_ospf_packet[i]],
! 1633: VTY_NEWLINE);
! 1634: write = 1;
! 1635: }
! 1636:
! 1637: return write;
! 1638: }
! 1639:
! 1640: /* Initialize debug commands. */
! 1641: void
! 1642: debug_init ()
! 1643: {
! 1644: install_node (&debug_node, config_write_debug);
! 1645:
! 1646: install_element (ENABLE_NODE, &show_debugging_ospf_cmd);
! 1647: install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_detail_cmd);
! 1648: install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_cmd);
! 1649: install_element (ENABLE_NODE, &debug_ospf_packet_all_cmd);
! 1650: install_element (ENABLE_NODE, &debug_ospf_ism_sub_cmd);
! 1651: install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
! 1652: install_element (ENABLE_NODE, &debug_ospf_nsm_sub_cmd);
! 1653: install_element (ENABLE_NODE, &debug_ospf_nsm_cmd);
! 1654: install_element (ENABLE_NODE, &debug_ospf_lsa_sub_cmd);
! 1655: install_element (ENABLE_NODE, &debug_ospf_lsa_cmd);
! 1656: install_element (ENABLE_NODE, &debug_ospf_zebra_sub_cmd);
! 1657: install_element (ENABLE_NODE, &debug_ospf_zebra_cmd);
! 1658: install_element (ENABLE_NODE, &debug_ospf_event_cmd);
! 1659: install_element (ENABLE_NODE, &debug_ospf_nssa_cmd);
! 1660: install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_detail_cmd);
! 1661: install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_cmd);
! 1662: install_element (ENABLE_NODE, &no_debug_ospf_packet_all_cmd);
! 1663: install_element (ENABLE_NODE, &no_debug_ospf_ism_sub_cmd);
! 1664: install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
! 1665: install_element (ENABLE_NODE, &no_debug_ospf_nsm_sub_cmd);
! 1666: install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd);
! 1667: install_element (ENABLE_NODE, &no_debug_ospf_lsa_sub_cmd);
! 1668: install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd);
! 1669: install_element (ENABLE_NODE, &no_debug_ospf_zebra_sub_cmd);
! 1670: install_element (ENABLE_NODE, &no_debug_ospf_zebra_cmd);
! 1671: install_element (ENABLE_NODE, &no_debug_ospf_event_cmd);
! 1672: install_element (ENABLE_NODE, &no_debug_ospf_nssa_cmd);
! 1673:
! 1674: install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_detail_cmd);
! 1675: install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_cmd);
! 1676: install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd);
! 1677: install_element (CONFIG_NODE, &debug_ospf_ism_sub_cmd);
! 1678: install_element (CONFIG_NODE, &debug_ospf_ism_cmd);
! 1679: install_element (CONFIG_NODE, &debug_ospf_nsm_sub_cmd);
! 1680: install_element (CONFIG_NODE, &debug_ospf_nsm_cmd);
! 1681: install_element (CONFIG_NODE, &debug_ospf_lsa_sub_cmd);
! 1682: install_element (CONFIG_NODE, &debug_ospf_lsa_cmd);
! 1683: install_element (CONFIG_NODE, &debug_ospf_zebra_sub_cmd);
! 1684: install_element (CONFIG_NODE, &debug_ospf_zebra_cmd);
! 1685: install_element (CONFIG_NODE, &debug_ospf_event_cmd);
! 1686: install_element (CONFIG_NODE, &debug_ospf_nssa_cmd);
! 1687: install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_detail_cmd);
! 1688: install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_cmd);
! 1689: install_element (CONFIG_NODE, &no_debug_ospf_packet_all_cmd);
! 1690: install_element (CONFIG_NODE, &no_debug_ospf_ism_sub_cmd);
! 1691: install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
! 1692: install_element (CONFIG_NODE, &no_debug_ospf_nsm_sub_cmd);
! 1693: install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd);
! 1694: install_element (CONFIG_NODE, &no_debug_ospf_lsa_sub_cmd);
! 1695: install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd);
! 1696: install_element (CONFIG_NODE, &no_debug_ospf_zebra_sub_cmd);
! 1697: install_element (CONFIG_NODE, &no_debug_ospf_zebra_cmd);
! 1698: install_element (CONFIG_NODE, &no_debug_ospf_event_cmd);
! 1699: install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd);
! 1700: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>