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