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