ospf_dump.c 45 KB

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