1 /* 2 * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning 11 * features or use of this software display the following acknowledgement: 12 * ``This product includes software developed by the University of California, 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu) 22 */ 23 24 #include <sys/cdefs.h> 25 #ifndef lint 26 __RCSID("$NetBSD: print-ospf.c,v 1.6 2015/03/31 21:59:35 christos Exp $"); 27 #endif 28 29 #define NETDISSECT_REWORKED 30 #ifdef HAVE_CONFIG_H 31 #include "config.h" 32 #endif 33 34 #include <tcpdump-stdinc.h> 35 36 #include "interface.h" 37 #include "addrtoname.h" 38 #include "extract.h" 39 #include "gmpls.h" 40 41 #include "ospf.h" 42 43 static const char tstr[] = " [|ospf2]"; 44 45 static const struct tok ospf_option_values[] = { 46 { OSPF_OPTION_T, "MultiTopology" }, /* draft-ietf-ospf-mt-09 */ 47 { OSPF_OPTION_E, "External" }, 48 { OSPF_OPTION_MC, "Multicast" }, 49 { OSPF_OPTION_NP, "NSSA" }, 50 { OSPF_OPTION_L, "LLS" }, 51 { OSPF_OPTION_DC, "Demand Circuit" }, 52 { OSPF_OPTION_O, "Opaque" }, 53 { OSPF_OPTION_DN, "Up/Down" }, 54 { 0, NULL } 55 }; 56 57 static const struct tok ospf_authtype_values[] = { 58 { OSPF_AUTH_NONE, "none" }, 59 { OSPF_AUTH_SIMPLE, "simple" }, 60 { OSPF_AUTH_MD5, "MD5" }, 61 { 0, NULL } 62 }; 63 64 static const struct tok ospf_rla_flag_values[] = { 65 { RLA_FLAG_B, "ABR" }, 66 { RLA_FLAG_E, "ASBR" }, 67 { RLA_FLAG_W1, "Virtual" }, 68 { RLA_FLAG_W2, "W2" }, 69 { 0, NULL } 70 }; 71 72 static const struct tok type2str[] = { 73 { OSPF_TYPE_UMD, "UMD" }, 74 { OSPF_TYPE_HELLO, "Hello" }, 75 { OSPF_TYPE_DD, "Database Description" }, 76 { OSPF_TYPE_LS_REQ, "LS-Request" }, 77 { OSPF_TYPE_LS_UPDATE, "LS-Update" }, 78 { OSPF_TYPE_LS_ACK, "LS-Ack" }, 79 { 0, NULL } 80 }; 81 82 static const struct tok lsa_values[] = { 83 { LS_TYPE_ROUTER, "Router" }, 84 { LS_TYPE_NETWORK, "Network" }, 85 { LS_TYPE_SUM_IP, "Summary" }, 86 { LS_TYPE_SUM_ABR, "ASBR Summary" }, 87 { LS_TYPE_ASE, "External" }, 88 { LS_TYPE_GROUP, "Multicast Group" }, 89 { LS_TYPE_NSSA, "NSSA" }, 90 { LS_TYPE_OPAQUE_LL, "Link Local Opaque" }, 91 { LS_TYPE_OPAQUE_AL, "Area Local Opaque" }, 92 { LS_TYPE_OPAQUE_DW, "Domain Wide Opaque" }, 93 { 0, NULL } 94 }; 95 96 static const struct tok ospf_dd_flag_values[] = { 97 { OSPF_DB_INIT, "Init" }, 98 { OSPF_DB_MORE, "More" }, 99 { OSPF_DB_MASTER, "Master" }, 100 { OSPF_DB_RESYNC, "OOBResync" }, 101 { 0, NULL } 102 }; 103 104 static const struct tok lsa_opaque_values[] = { 105 { LS_OPAQUE_TYPE_TE, "Traffic Engineering" }, 106 { LS_OPAQUE_TYPE_GRACE, "Graceful restart" }, 107 { LS_OPAQUE_TYPE_RI, "Router Information" }, 108 { 0, NULL } 109 }; 110 111 static const struct tok lsa_opaque_te_tlv_values[] = { 112 { LS_OPAQUE_TE_TLV_ROUTER, "Router Address" }, 113 { LS_OPAQUE_TE_TLV_LINK, "Link" }, 114 { 0, NULL } 115 }; 116 117 static const struct tok lsa_opaque_te_link_tlv_subtlv_values[] = { 118 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE, "Link Type" }, 119 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID, "Link ID" }, 120 { LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP, "Local Interface IP address" }, 121 { LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP, "Remote Interface IP address" }, 122 { LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC, "Traffic Engineering Metric" }, 123 { LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW, "Maximum Bandwidth" }, 124 { LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW, "Maximum Reservable Bandwidth" }, 125 { LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW, "Unreserved Bandwidth" }, 126 { LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP, "Administrative Group" }, 127 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID, "Link Local/Remote Identifier" }, 128 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE, "Link Protection Type" }, 129 { LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR, "Interface Switching Capability" }, 130 { LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP, "Shared Risk Link Group" }, 131 { LS_OPAQUE_TE_LINK_SUBTLV_BW_CONSTRAINTS, "Bandwidth Constraints" }, 132 { 0, NULL } 133 }; 134 135 static const struct tok lsa_opaque_grace_tlv_values[] = { 136 { LS_OPAQUE_GRACE_TLV_PERIOD, "Grace Period" }, 137 { LS_OPAQUE_GRACE_TLV_REASON, "Graceful restart Reason" }, 138 { LS_OPAQUE_GRACE_TLV_INT_ADDRESS, "IPv4 interface address" }, 139 { 0, NULL } 140 }; 141 142 static const struct tok lsa_opaque_grace_tlv_reason_values[] = { 143 { LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN, "Unknown" }, 144 { LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART, "Software Restart" }, 145 { LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE, "Software Reload/Upgrade" }, 146 { LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH, "Control Processor Switch" }, 147 { 0, NULL } 148 }; 149 150 static const struct tok lsa_opaque_te_tlv_link_type_sub_tlv_values[] = { 151 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP, "Point-to-point" }, 152 { LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA, "Multi-Access" }, 153 { 0, NULL } 154 }; 155 156 static const struct tok lsa_opaque_ri_tlv_values[] = { 157 { LS_OPAQUE_RI_TLV_CAP, "Router Capabilities" }, 158 { 0, NULL } 159 }; 160 161 static const struct tok lsa_opaque_ri_tlv_cap_values[] = { 162 { 1, "Reserved" }, 163 { 2, "Reserved" }, 164 { 4, "Reserved" }, 165 { 8, "Reserved" }, 166 { 16, "graceful restart capable" }, 167 { 32, "graceful restart helper" }, 168 { 64, "Stub router support" }, 169 { 128, "Traffic engineering" }, 170 { 256, "p2p over LAN" }, 171 { 512, "path computation server" }, 172 { 0, NULL } 173 }; 174 175 static const struct tok ospf_lls_tlv_values[] = { 176 { OSPF_LLS_EO, "Extended Options" }, 177 { OSPF_LLS_MD5, "MD5 Authentication" }, 178 { 0, NULL } 179 }; 180 181 static const struct tok ospf_lls_eo_options[] = { 182 { OSPF_LLS_EO_LR, "LSDB resync" }, 183 { OSPF_LLS_EO_RS, "Restart" }, 184 { 0, NULL } 185 }; 186 187 int 188 ospf_print_grace_lsa(netdissect_options *ndo, 189 const uint8_t *tptr, u_int ls_length) 190 { 191 u_int tlv_type, tlv_length; 192 193 194 while (ls_length > 0) { 195 ND_TCHECK2(*tptr, 4); 196 if (ls_length < 4) { 197 ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); 198 return -1; 199 } 200 tlv_type = EXTRACT_16BITS(tptr); 201 tlv_length = EXTRACT_16BITS(tptr+2); 202 tptr+=4; 203 ls_length-=4; 204 205 ND_PRINT((ndo, "\n\t %s TLV (%u), length %u, value: ", 206 tok2str(lsa_opaque_grace_tlv_values,"unknown",tlv_type), 207 tlv_type, 208 tlv_length)); 209 210 if (tlv_length > ls_length) { 211 ND_PRINT((ndo, "\n\t Bogus length %u > %u", tlv_length, 212 ls_length)); 213 return -1; 214 } 215 216 /* Infinite loop protection. */ 217 if (tlv_type == 0 || tlv_length ==0) { 218 return -1; 219 } 220 221 ND_TCHECK2(*tptr, tlv_length); 222 switch(tlv_type) { 223 224 case LS_OPAQUE_GRACE_TLV_PERIOD: 225 if (tlv_length != 4) { 226 ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length)); 227 return -1; 228 } 229 ND_PRINT((ndo, "%us", EXTRACT_32BITS(tptr))); 230 break; 231 232 case LS_OPAQUE_GRACE_TLV_REASON: 233 if (tlv_length != 1) { 234 ND_PRINT((ndo, "\n\t Bogus length %u != 1", tlv_length)); 235 return -1; 236 } 237 ND_PRINT((ndo, "%s (%u)", 238 tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", *tptr), 239 *tptr)); 240 break; 241 242 case LS_OPAQUE_GRACE_TLV_INT_ADDRESS: 243 if (tlv_length != 4) { 244 ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length)); 245 return -1; 246 } 247 ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr))); 248 break; 249 250 default: 251 if (ndo->ndo_vflag <= 1) { 252 if (!print_unknown_data(ndo, tptr, "\n\t ", tlv_length)) 253 return -1; 254 } 255 break; 256 257 } 258 /* in OSPF everything has to be 32-bit aligned, including TLVs */ 259 if (tlv_length%4 != 0) 260 tlv_length+=4-(tlv_length%4); 261 ls_length-=tlv_length; 262 tptr+=tlv_length; 263 } 264 265 return 0; 266 trunc: 267 return -1; 268 } 269 270 int 271 ospf_print_te_lsa(netdissect_options *ndo, 272 const uint8_t *tptr, u_int ls_length) 273 { 274 u_int tlv_type, tlv_length, subtlv_type, subtlv_length; 275 u_int priority_level, te_class, count_srlg; 276 union { /* int to float conversion buffer for several subTLVs */ 277 float f; 278 uint32_t i; 279 } bw; 280 281 while (ls_length != 0) { 282 ND_TCHECK2(*tptr, 4); 283 if (ls_length < 4) { 284 ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); 285 return -1; 286 } 287 tlv_type = EXTRACT_16BITS(tptr); 288 tlv_length = EXTRACT_16BITS(tptr+2); 289 tptr+=4; 290 ls_length-=4; 291 292 ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u", 293 tok2str(lsa_opaque_te_tlv_values,"unknown",tlv_type), 294 tlv_type, 295 tlv_length)); 296 297 if (tlv_length > ls_length) { 298 ND_PRINT((ndo, "\n\t Bogus length %u > %u", tlv_length, 299 ls_length)); 300 return -1; 301 } 302 303 /* Infinite loop protection. */ 304 if (tlv_type == 0 || tlv_length ==0) { 305 return -1; 306 } 307 308 switch(tlv_type) { 309 case LS_OPAQUE_TE_TLV_LINK: 310 while (tlv_length >= sizeof(subtlv_type) + sizeof(subtlv_length)) { 311 if (tlv_length < 4) { 312 ND_PRINT((ndo, "\n\t Remaining TLV length %u < 4", 313 tlv_length)); 314 return -1; 315 } 316 ND_TCHECK2(*tptr, 4); 317 subtlv_type = EXTRACT_16BITS(tptr); 318 subtlv_length = EXTRACT_16BITS(tptr+2); 319 tptr+=4; 320 tlv_length-=4; 321 322 ND_PRINT((ndo, "\n\t %s subTLV (%u), length: %u", 323 tok2str(lsa_opaque_te_link_tlv_subtlv_values,"unknown",subtlv_type), 324 subtlv_type, 325 subtlv_length)); 326 327 ND_TCHECK2(*tptr, subtlv_length); 328 switch(subtlv_type) { 329 case LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP: 330 ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr))); 331 break; 332 case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID: 333 case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID: 334 ND_PRINT((ndo, ", %s (0x%08x)", 335 ipaddr_string(ndo, tptr), 336 EXTRACT_32BITS(tptr))); 337 if (subtlv_length == 8) /* rfc4203 */ 338 ND_PRINT((ndo, ", %s (0x%08x)", 339 ipaddr_string(ndo, tptr+4), 340 EXTRACT_32BITS(tptr + 4))); 341 break; 342 case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP: 343 case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP: 344 ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr))); 345 break; 346 case LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW: 347 case LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW: 348 bw.i = EXTRACT_32BITS(tptr); 349 ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000)); 350 break; 351 case LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW: 352 for (te_class = 0; te_class < 8; te_class++) { 353 bw.i = EXTRACT_32BITS(tptr+te_class*4); 354 ND_PRINT((ndo, "\n\t\tTE-Class %u: %.3f Mbps", 355 te_class, 356 bw.f * 8 / 1000000)); 357 } 358 break; 359 case LS_OPAQUE_TE_LINK_SUBTLV_BW_CONSTRAINTS: 360 ND_PRINT((ndo, "\n\t\tBandwidth Constraints Model ID: %s (%u)", 361 tok2str(diffserv_te_bc_values, "unknown", *tptr), 362 *tptr)); 363 /* decode BCs until the subTLV ends */ 364 for (te_class = 0; te_class < (subtlv_length-4)/4; te_class++) { 365 bw.i = EXTRACT_32BITS(tptr+4+te_class*4); 366 ND_PRINT((ndo, "\n\t\t Bandwidth constraint CT%u: %.3f Mbps", 367 te_class, 368 bw.f * 8 / 1000000)); 369 } 370 break; 371 case LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC: 372 ND_PRINT((ndo, ", Metric %u", EXTRACT_32BITS(tptr))); 373 break; 374 case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE: 375 ND_PRINT((ndo, ", %s, Priority %u", 376 bittok2str(gmpls_link_prot_values, "none", *tptr), 377 *(tptr + 1))); 378 break; 379 case LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR: 380 ND_PRINT((ndo, "\n\t\tInterface Switching Capability: %s", 381 tok2str(gmpls_switch_cap_values, "Unknown", *(tptr)))); 382 ND_PRINT((ndo, "\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:", 383 tok2str(gmpls_encoding_values, "Unknown", *(tptr + 1)))); 384 for (priority_level = 0; priority_level < 8; priority_level++) { 385 bw.i = EXTRACT_32BITS(tptr+4+(priority_level*4)); 386 ND_PRINT((ndo, "\n\t\t priority level %d: %.3f Mbps", 387 priority_level, 388 bw.f * 8 / 1000000)); 389 } 390 break; 391 case LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE: 392 ND_PRINT((ndo, ", %s (%u)", 393 tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",*tptr), 394 *tptr)); 395 break; 396 397 case LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP: 398 count_srlg = subtlv_length / 4; 399 if (count_srlg != 0) 400 ND_PRINT((ndo, "\n\t\t Shared risk group: ")); 401 while (count_srlg > 0) { 402 bw.i = EXTRACT_32BITS(tptr); 403 ND_PRINT((ndo, "%d", bw.i)); 404 tptr+=4; 405 count_srlg--; 406 if (count_srlg > 0) 407 ND_PRINT((ndo, ", ")); 408 } 409 break; 410 411 default: 412 if (ndo->ndo_vflag <= 1) { 413 if (!print_unknown_data(ndo, tptr, "\n\t\t", subtlv_length)) 414 return -1; 415 } 416 break; 417 } 418 /* in OSPF everything has to be 32-bit aligned, including subTLVs */ 419 if (subtlv_length%4 != 0) 420 subtlv_length+=4-(subtlv_length%4); 421 422 tlv_length-=subtlv_length; 423 tptr+=subtlv_length; 424 425 } 426 break; 427 428 case LS_OPAQUE_TE_TLV_ROUTER: 429 if (tlv_length < 4) { 430 ND_PRINT((ndo, "\n\t TLV length %u < 4", tlv_length)); 431 return -1; 432 } 433 ND_TCHECK2(*tptr, 4); 434 ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr))); 435 break; 436 437 default: 438 if (ndo->ndo_vflag <= 1) { 439 if (!print_unknown_data(ndo, tptr, "\n\t ", tlv_length)) 440 return -1; 441 } 442 break; 443 } 444 /* in OSPF everything has to be 32-bit aligned, including TLVs */ 445 if (tlv_length%4 != 0) 446 tlv_length+=4-(tlv_length%4); 447 ls_length-=tlv_length; 448 tptr+=tlv_length; 449 } 450 return 0; 451 trunc: 452 return -1; 453 } 454 455 static int 456 ospf_print_lshdr(netdissect_options *ndo, 457 register const struct lsa_hdr *lshp) 458 { 459 u_int ls_length; 460 461 ND_TCHECK(lshp->ls_length); 462 ls_length = EXTRACT_16BITS(&lshp->ls_length); 463 if (ls_length < sizeof(struct lsa_hdr)) { 464 ND_PRINT((ndo, "\n\t Bogus length %u < header (%lu)", ls_length, 465 (unsigned long)sizeof(struct lsa_hdr))); 466 return(-1); 467 } 468 469 ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */ 470 ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", 471 ipaddr_string(ndo, &lshp->ls_router), 472 EXTRACT_32BITS(&lshp->ls_seq), 473 EXTRACT_16BITS(&lshp->ls_age), 474 ls_length - (u_int)sizeof(struct lsa_hdr))); 475 476 ND_TCHECK(lshp->ls_type); /* XXX - ls_length check checked this */ 477 switch (lshp->ls_type) { 478 /* the LSA header for opaque LSAs was slightly changed */ 479 case LS_TYPE_OPAQUE_LL: 480 case LS_TYPE_OPAQUE_AL: 481 case LS_TYPE_OPAQUE_DW: 482 ND_PRINT((ndo, "\n\t %s LSA (%d), Opaque-Type %s LSA (%u), Opaque-ID %u", 483 tok2str(lsa_values,"unknown",lshp->ls_type), 484 lshp->ls_type, 485 486 tok2str(lsa_opaque_values, 487 "unknown", 488 *(&lshp->un_lsa_id.opaque_field.opaque_type)), 489 *(&lshp->un_lsa_id.opaque_field.opaque_type), 490 EXTRACT_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id) 491 492 )); 493 break; 494 495 /* all other LSA types use regular style LSA headers */ 496 default: 497 ND_PRINT((ndo, "\n\t %s LSA (%d), LSA-ID: %s", 498 tok2str(lsa_values,"unknown",lshp->ls_type), 499 lshp->ls_type, 500 ipaddr_string(ndo, &lshp->un_lsa_id.lsa_id))); 501 break; 502 } 503 504 ND_TCHECK(lshp->ls_options); /* XXX - ls_length check checked this */ 505 ND_PRINT((ndo, "\n\t Options: [%s]", bittok2str(ospf_option_values, "none", lshp->ls_options))); 506 507 return (ls_length); 508 trunc: 509 return (-1); 510 } 511 512 /* draft-ietf-ospf-mt-09 */ 513 static const struct tok ospf_topology_values[] = { 514 { 0, "default " }, 515 { 1, "multicast " }, 516 { 2, "management " }, 517 { 0, NULL } 518 }; 519 520 /* 521 * Print all the per-topology metrics. 522 */ 523 static void 524 ospf_print_tos_metrics(netdissect_options *ndo, 525 const union un_tos *tos) 526 { 527 int metric_count; 528 int toscount; 529 530 toscount = tos->link.link_tos_count+1; 531 metric_count = 0; 532 533 /* 534 * All but the first metric contain a valid topology id. 535 */ 536 while (toscount) { 537 ND_PRINT((ndo, "\n\t\ttopology %s(%u), metric %u", 538 tok2str(ospf_topology_values, "", 539 metric_count ? tos->metrics.tos_type : 0), 540 metric_count ? tos->metrics.tos_type : 0, 541 EXTRACT_16BITS(&tos->metrics.tos_metric))); 542 metric_count++; 543 tos++; 544 toscount--; 545 } 546 } 547 548 /* 549 * Print a single link state advertisement. If truncated or if LSA length 550 * field is less than the length of the LSA header, return NULl, else 551 * return pointer to data past end of LSA. 552 */ 553 static const uint8_t * 554 ospf_print_lsa(netdissect_options *ndo, 555 register const struct lsa *lsap) 556 { 557 register const uint8_t *ls_end; 558 register const struct rlalink *rlp; 559 register const struct in_addr *ap; 560 register const struct aslametric *almp; 561 register const struct mcla *mcp; 562 register const uint32_t *lp; 563 register int j, tlv_type, tlv_length, topology; 564 register int ls_length; 565 const uint8_t *tptr; 566 567 tptr = (uint8_t *)lsap->lsa_un.un_unknown; /* squelch compiler warnings */ 568 ls_length = ospf_print_lshdr(ndo, &lsap->ls_hdr); 569 if (ls_length == -1) 570 return(NULL); 571 ls_end = (uint8_t *)lsap + ls_length; 572 ls_length -= sizeof(struct lsa_hdr); 573 574 switch (lsap->ls_hdr.ls_type) { 575 576 case LS_TYPE_ROUTER: 577 ND_TCHECK(lsap->lsa_un.un_rla.rla_flags); 578 ND_PRINT((ndo, "\n\t Router LSA Options: [%s]", 579 bittok2str(ospf_rla_flag_values, "none", lsap->lsa_un.un_rla.rla_flags))); 580 581 ND_TCHECK(lsap->lsa_un.un_rla.rla_count); 582 j = EXTRACT_16BITS(&lsap->lsa_un.un_rla.rla_count); 583 ND_TCHECK(lsap->lsa_un.un_rla.rla_link); 584 rlp = lsap->lsa_un.un_rla.rla_link; 585 while (j--) { 586 ND_TCHECK(*rlp); 587 switch (rlp->un_tos.link.link_type) { 588 589 case RLA_TYPE_VIRTUAL: 590 ND_PRINT((ndo, "\n\t Virtual Link: Neighbor Router-ID: %s, Interface Address: %s", 591 ipaddr_string(ndo, &rlp->link_id), 592 ipaddr_string(ndo, &rlp->link_data))); 593 break; 594 595 case RLA_TYPE_ROUTER: 596 ND_PRINT((ndo, "\n\t Neighbor Router-ID: %s, Interface Address: %s", 597 ipaddr_string(ndo, &rlp->link_id), 598 ipaddr_string(ndo, &rlp->link_data))); 599 break; 600 601 case RLA_TYPE_TRANSIT: 602 ND_PRINT((ndo, "\n\t Neighbor Network-ID: %s, Interface Address: %s", 603 ipaddr_string(ndo, &rlp->link_id), 604 ipaddr_string(ndo, &rlp->link_data))); 605 break; 606 607 case RLA_TYPE_STUB: 608 ND_PRINT((ndo, "\n\t Stub Network: %s, Mask: %s", 609 ipaddr_string(ndo, &rlp->link_id), 610 ipaddr_string(ndo, &rlp->link_data))); 611 break; 612 613 default: 614 ND_PRINT((ndo, "\n\t Unknown Router Link Type (%u)", 615 rlp->un_tos.link.link_type)); 616 return (ls_end); 617 } 618 619 ospf_print_tos_metrics(ndo, &rlp->un_tos); 620 621 rlp = (struct rlalink *)((u_char *)(rlp + 1) + 622 ((rlp->un_tos.link.link_tos_count) * sizeof(union un_tos))); 623 } 624 break; 625 626 case LS_TYPE_NETWORK: 627 ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); 628 ND_PRINT((ndo, "\n\t Mask %s\n\t Connected Routers:", 629 ipaddr_string(ndo, &lsap->lsa_un.un_nla.nla_mask))); 630 ap = lsap->lsa_un.un_nla.nla_router; 631 while ((u_char *)ap < ls_end) { 632 ND_TCHECK(*ap); 633 ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap))); 634 ++ap; 635 } 636 break; 637 638 case LS_TYPE_SUM_IP: 639 ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); 640 ND_PRINT((ndo, "\n\t Mask %s", 641 ipaddr_string(ndo, &lsap->lsa_un.un_sla.sla_mask))); 642 ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric); 643 lp = lsap->lsa_un.un_sla.sla_tosmetric; 644 while ((u_char *)lp < ls_end) { 645 register uint32_t ul; 646 647 ND_TCHECK(*lp); 648 ul = EXTRACT_32BITS(lp); 649 topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; 650 ND_PRINT((ndo, "\n\t\ttopology %s(%u) metric %d", 651 tok2str(ospf_topology_values, "", topology), 652 topology, 653 ul & SLA_MASK_METRIC)); 654 ++lp; 655 } 656 break; 657 658 case LS_TYPE_SUM_ABR: 659 ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric); 660 lp = lsap->lsa_un.un_sla.sla_tosmetric; 661 while ((u_char *)lp < ls_end) { 662 register uint32_t ul; 663 664 ND_TCHECK(*lp); 665 ul = EXTRACT_32BITS(lp); 666 topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; 667 ND_PRINT((ndo, "\n\t\ttopology %s(%u) metric %d", 668 tok2str(ospf_topology_values, "", topology), 669 topology, 670 ul & SLA_MASK_METRIC)); 671 ++lp; 672 } 673 break; 674 675 case LS_TYPE_ASE: 676 case LS_TYPE_NSSA: /* fall through - those LSAs share the same format */ 677 ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); 678 ND_PRINT((ndo, "\n\t Mask %s", 679 ipaddr_string(ndo, &lsap->lsa_un.un_asla.asla_mask))); 680 681 ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric); 682 almp = lsap->lsa_un.un_asla.asla_metric; 683 while ((u_char *)almp < ls_end) { 684 register uint32_t ul; 685 686 ND_TCHECK(almp->asla_tosmetric); 687 ul = EXTRACT_32BITS(&almp->asla_tosmetric); 688 topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS); 689 ND_PRINT((ndo, "\n\t\ttopology %s(%u), type %d, metric", 690 tok2str(ospf_topology_values, "", topology), 691 topology, 692 (ul & ASLA_FLAG_EXTERNAL) ? 2 : 1)); 693 if ((ul & ASLA_MASK_METRIC) == 0xffffff) 694 ND_PRINT((ndo, " infinite")); 695 else 696 ND_PRINT((ndo, " %d", (ul & ASLA_MASK_METRIC))); 697 698 ND_TCHECK(almp->asla_forward); 699 if (almp->asla_forward.s_addr) { 700 ND_PRINT((ndo, ", forward %s", ipaddr_string(ndo, &almp->asla_forward))); 701 } 702 ND_TCHECK(almp->asla_tag); 703 if (almp->asla_tag.s_addr) { 704 ND_PRINT((ndo, ", tag %s", ipaddr_string(ndo, &almp->asla_tag))); 705 } 706 ++almp; 707 } 708 break; 709 710 case LS_TYPE_GROUP: 711 /* Multicast extensions as of 23 July 1991 */ 712 mcp = lsap->lsa_un.un_mcla; 713 while ((u_char *)mcp < ls_end) { 714 ND_TCHECK(mcp->mcla_vid); 715 switch (EXTRACT_32BITS(&mcp->mcla_vtype)) { 716 717 case MCLA_VERTEX_ROUTER: 718 ND_PRINT((ndo, "\n\t Router Router-ID %s", 719 ipaddr_string(ndo, &mcp->mcla_vid))); 720 break; 721 722 case MCLA_VERTEX_NETWORK: 723 ND_PRINT((ndo, "\n\t Network Designated Router %s", 724 ipaddr_string(ndo, &mcp->mcla_vid))); 725 break; 726 727 default: 728 ND_PRINT((ndo, "\n\t unknown VertexType (%u)", 729 EXTRACT_32BITS(&mcp->mcla_vtype))); 730 break; 731 } 732 ++mcp; 733 } 734 break; 735 736 case LS_TYPE_OPAQUE_LL: /* fall through */ 737 case LS_TYPE_OPAQUE_AL: 738 case LS_TYPE_OPAQUE_DW: 739 740 switch (*(&lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) { 741 case LS_OPAQUE_TYPE_RI: 742 tptr = (uint8_t *)(&lsap->lsa_un.un_ri_tlv.type); 743 744 while (ls_length != 0) { 745 ND_TCHECK2(*tptr, 4); 746 if (ls_length < 4) { 747 ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); 748 return(ls_end); 749 } 750 tlv_type = EXTRACT_16BITS(tptr); 751 tlv_length = EXTRACT_16BITS(tptr+2); 752 tptr+=4; 753 ls_length-=4; 754 755 ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u, value: ", 756 tok2str(lsa_opaque_ri_tlv_values,"unknown",tlv_type), 757 tlv_type, 758 tlv_length)); 759 760 if (tlv_length > ls_length) { 761 ND_PRINT((ndo, "\n\t Bogus length %u > %u", tlv_length, 762 ls_length)); 763 return(ls_end); 764 } 765 ND_TCHECK2(*tptr, tlv_length); 766 switch(tlv_type) { 767 768 case LS_OPAQUE_RI_TLV_CAP: 769 if (tlv_length != 4) { 770 ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length)); 771 return(ls_end); 772 } 773 ND_PRINT((ndo, "Capabilities: %s", 774 bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_32BITS(tptr)))); 775 break; 776 default: 777 if (ndo->ndo_vflag <= 1) { 778 if (!print_unknown_data(ndo, tptr, "\n\t ", tlv_length)) 779 return(ls_end); 780 } 781 break; 782 783 } 784 tptr+=tlv_length; 785 ls_length-=tlv_length; 786 } 787 break; 788 789 case LS_OPAQUE_TYPE_GRACE: 790 if (ospf_print_grace_lsa(ndo, (uint8_t *)(&lsap->lsa_un.un_grace_tlv.type), 791 ls_length) == -1) { 792 return(ls_end); 793 } 794 break; 795 796 case LS_OPAQUE_TYPE_TE: 797 if (ospf_print_te_lsa(ndo, (uint8_t *)(&lsap->lsa_un.un_te_lsa_tlv.type), 798 ls_length) == -1) { 799 return(ls_end); 800 } 801 break; 802 803 default: 804 if (ndo->ndo_vflag <= 1) { 805 if (!print_unknown_data(ndo, (uint8_t *)lsap->lsa_un.un_unknown, 806 "\n\t ", ls_length)) 807 return(ls_end); 808 } 809 break; 810 } 811 } 812 813 /* do we want to see an additionally hexdump ? */ 814 if (ndo->ndo_vflag> 1) 815 if (!print_unknown_data(ndo, (uint8_t *)lsap->lsa_un.un_unknown, 816 "\n\t ", ls_length)) { 817 return(ls_end); 818 } 819 820 return (ls_end); 821 trunc: 822 return (NULL); 823 } 824 825 static int 826 ospf_decode_lls(netdissect_options *ndo, 827 register const struct ospfhdr *op, register u_int length) 828 { 829 register const u_char *dptr; 830 register const u_char *dataend; 831 register u_int length2; 832 register uint16_t lls_type, lls_len; 833 register uint32_t lls_flags; 834 835 switch (op->ospf_type) { 836 837 case OSPF_TYPE_HELLO: 838 if (!(op->ospf_hello.hello_options & OSPF_OPTION_L)) 839 return (0); 840 break; 841 842 case OSPF_TYPE_DD: 843 if (!(op->ospf_db.db_options & OSPF_OPTION_L)) 844 return (0); 845 break; 846 847 default: 848 return (0); 849 } 850 851 /* dig deeper if LLS data is available; see RFC4813 */ 852 length2 = EXTRACT_16BITS(&op->ospf_len); 853 dptr = (u_char *)op + length2; 854 dataend = (u_char *)op + length; 855 856 if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { 857 dptr = dptr + op->ospf_authdata[3]; 858 length2 += op->ospf_authdata[3]; 859 } 860 if (length2 >= length) { 861 ND_PRINT((ndo, "\n\t[LLS truncated]")); 862 return (1); 863 } 864 ND_TCHECK2(*dptr, 2); 865 ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int)EXTRACT_16BITS(dptr))); 866 867 dptr += 2; 868 ND_TCHECK2(*dptr, 2); 869 length2 = EXTRACT_16BITS(dptr); 870 ND_PRINT((ndo, ", length: %u", length2)); 871 872 dptr += 2; 873 ND_TCHECK(*dptr); 874 while (dptr < dataend) { 875 ND_TCHECK2(*dptr, 2); 876 lls_type = EXTRACT_16BITS(dptr); 877 ND_PRINT((ndo, "\n\t %s (%u)", 878 tok2str(ospf_lls_tlv_values,"Unknown TLV",lls_type), 879 lls_type)); 880 dptr += 2; 881 ND_TCHECK2(*dptr, 2); 882 lls_len = EXTRACT_16BITS(dptr); 883 ND_PRINT((ndo, ", length: %u", lls_len)); 884 dptr += 2; 885 switch (lls_type) { 886 887 case OSPF_LLS_EO: 888 if (lls_len != 4) { 889 ND_PRINT((ndo, " [should be 4]")); 890 lls_len = 4; 891 } 892 ND_TCHECK2(*dptr, 4); 893 lls_flags = EXTRACT_32BITS(dptr); 894 ND_PRINT((ndo, "\n\t Options: 0x%08x [%s]", lls_flags, 895 bittok2str(ospf_lls_eo_options, "?", lls_flags))); 896 897 break; 898 899 case OSPF_LLS_MD5: 900 if (lls_len != 20) { 901 ND_PRINT((ndo, " [should be 20]")); 902 lls_len = 20; 903 } 904 ND_TCHECK2(*dptr, 4); 905 ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_32BITS(dptr))); 906 break; 907 } 908 909 dptr += lls_len; 910 } 911 912 return (0); 913 trunc: 914 return (1); 915 } 916 917 static int 918 ospf_decode_v2(netdissect_options *ndo, 919 register const struct ospfhdr *op, register const u_char *dataend) 920 { 921 register const struct in_addr *ap; 922 register const struct lsr *lsrp; 923 register const struct lsa_hdr *lshp; 924 register const struct lsa *lsap; 925 register uint32_t lsa_count,lsa_count_max; 926 927 switch (op->ospf_type) { 928 929 case OSPF_TYPE_UMD: 930 /* 931 * Rob Coltun's special monitoring packets; 932 * do nothing 933 */ 934 break; 935 936 case OSPF_TYPE_HELLO: 937 ND_PRINT((ndo, "\n\tOptions [%s]", 938 bittok2str(ospf_option_values,"none",op->ospf_hello.hello_options))); 939 940 ND_TCHECK(op->ospf_hello.hello_deadint); 941 ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u", 942 EXTRACT_16BITS(&op->ospf_hello.hello_helloint), 943 EXTRACT_32BITS(&op->ospf_hello.hello_deadint), 944 ipaddr_string(ndo, &op->ospf_hello.hello_mask), 945 op->ospf_hello.hello_priority)); 946 947 ND_TCHECK(op->ospf_hello.hello_dr); 948 if (op->ospf_hello.hello_dr.s_addr != 0) 949 ND_PRINT((ndo, "\n\t Designated Router %s", 950 ipaddr_string(ndo, &op->ospf_hello.hello_dr))); 951 952 ND_TCHECK(op->ospf_hello.hello_bdr); 953 if (op->ospf_hello.hello_bdr.s_addr != 0) 954 ND_PRINT((ndo, ", Backup Designated Router %s", 955 ipaddr_string(ndo, &op->ospf_hello.hello_bdr))); 956 957 ap = op->ospf_hello.hello_neighbor; 958 if ((u_char *)ap < dataend) 959 ND_PRINT((ndo, "\n\t Neighbor List:")); 960 while ((u_char *)ap < dataend) { 961 ND_TCHECK(*ap); 962 ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap))); 963 ++ap; 964 } 965 break; /* HELLO */ 966 967 case OSPF_TYPE_DD: 968 ND_TCHECK(op->ospf_db.db_options); 969 ND_PRINT((ndo, "\n\tOptions [%s]", 970 bittok2str(ospf_option_values, "none", op->ospf_db.db_options))); 971 ND_TCHECK(op->ospf_db.db_flags); 972 ND_PRINT((ndo, ", DD Flags [%s]", 973 bittok2str(ospf_dd_flag_values, "none", op->ospf_db.db_flags))); 974 ND_TCHECK(op->ospf_db.db_ifmtu); 975 if (op->ospf_db.db_ifmtu) { 976 ND_PRINT((ndo, ", MTU: %u", EXTRACT_16BITS(&op->ospf_db.db_ifmtu))); 977 } 978 ND_TCHECK(op->ospf_db.db_seq); 979 ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_32BITS(&op->ospf_db.db_seq))); 980 981 /* Print all the LS adv's */ 982 lshp = op->ospf_db.db_lshdr; 983 while (((u_char *)lshp < dataend) && ospf_print_lshdr(ndo, lshp) != -1) { 984 ++lshp; 985 } 986 break; 987 988 case OSPF_TYPE_LS_REQ: 989 lsrp = op->ospf_lsr; 990 while ((u_char *)lsrp < dataend) { 991 ND_TCHECK(*lsrp); 992 993 ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)", 994 ipaddr_string(ndo, &lsrp->ls_router), 995 tok2str(lsa_values,"unknown",EXTRACT_32BITS(lsrp->ls_type)), 996 EXTRACT_32BITS(&lsrp->ls_type))); 997 998 switch (EXTRACT_32BITS(lsrp->ls_type)) { 999 /* the LSA header for opaque LSAs was slightly changed */ 1000 case LS_TYPE_OPAQUE_LL: 1001 case LS_TYPE_OPAQUE_AL: 1002 case LS_TYPE_OPAQUE_DW: 1003 ND_PRINT((ndo, ", Opaque-Type: %s LSA (%u), Opaque-ID: %u", 1004 tok2str(lsa_opaque_values, "unknown",lsrp->un_ls_stateid.opaque_field.opaque_type), 1005 lsrp->un_ls_stateid.opaque_field.opaque_type, 1006 EXTRACT_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id))); 1007 break; 1008 default: 1009 ND_PRINT((ndo, ", LSA-ID: %s", 1010 ipaddr_string(ndo, &lsrp->un_ls_stateid.ls_stateid))); 1011 break; 1012 } 1013 1014 ++lsrp; 1015 } 1016 break; 1017 1018 case OSPF_TYPE_LS_UPDATE: 1019 lsap = op->ospf_lsu.lsu_lsa; 1020 ND_TCHECK(op->ospf_lsu.lsu_count); 1021 lsa_count_max = EXTRACT_32BITS(&op->ospf_lsu.lsu_count); 1022 ND_PRINT((ndo, ", %d LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max))); 1023 for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) { 1024 ND_PRINT((ndo, "\n\t LSA #%u", lsa_count)); 1025 lsap = (const struct lsa *)ospf_print_lsa(ndo, lsap); 1026 if (lsap == NULL) 1027 goto trunc; 1028 } 1029 break; 1030 1031 case OSPF_TYPE_LS_ACK: 1032 lshp = op->ospf_lsa.lsa_lshdr; 1033 while (ospf_print_lshdr(ndo, lshp) != -1) { 1034 ++lshp; 1035 } 1036 break; 1037 1038 default: 1039 break; 1040 } 1041 return (0); 1042 trunc: 1043 return (1); 1044 } 1045 1046 void 1047 ospf_print(netdissect_options *ndo, 1048 register const u_char *bp, register u_int length, 1049 const u_char *bp2 _U_) 1050 { 1051 register const struct ospfhdr *op; 1052 register const u_char *dataend; 1053 register const char *cp; 1054 1055 op = (struct ospfhdr *)bp; 1056 1057 /* XXX Before we do anything else, strip off the MD5 trailer */ 1058 ND_TCHECK(op->ospf_authtype); 1059 if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { 1060 length -= OSPF_AUTH_MD5_LEN; 1061 ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN; 1062 } 1063 1064 /* If the type is valid translate it, or just print the type */ 1065 /* value. If it's not valid, say so and return */ 1066 ND_TCHECK(op->ospf_type); 1067 cp = tok2str(type2str, "unknown LS-type", op->ospf_type); 1068 ND_PRINT((ndo, "OSPFv%u, %s, length %u", op->ospf_version, cp, length)); 1069 if (*cp == 'u') 1070 return; 1071 1072 if (!ndo->ndo_vflag) { /* non verbose - so lets bail out here */ 1073 return; 1074 } 1075 1076 ND_TCHECK(op->ospf_len); 1077 if (length != EXTRACT_16BITS(&op->ospf_len)) { 1078 ND_PRINT((ndo, " [len %d]", EXTRACT_16BITS(&op->ospf_len))); 1079 } 1080 1081 if (length > EXTRACT_16BITS(&op->ospf_len)) { 1082 dataend = bp + EXTRACT_16BITS(&op->ospf_len); 1083 } else { 1084 dataend = bp + length; 1085 } 1086 1087 ND_TCHECK(op->ospf_routerid); 1088 ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf_routerid))); 1089 1090 ND_TCHECK(op->ospf_areaid); 1091 if (op->ospf_areaid.s_addr != 0) 1092 ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf_areaid))); 1093 else 1094 ND_PRINT((ndo, ", Backbone Area")); 1095 1096 if (ndo->ndo_vflag) { 1097 /* Print authentication data (should we really do this?) */ 1098 ND_TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata)); 1099 1100 ND_PRINT((ndo, ", Authentication Type: %s (%u)", 1101 tok2str(ospf_authtype_values, "unknown", EXTRACT_16BITS(&op->ospf_authtype)), 1102 EXTRACT_16BITS(&op->ospf_authtype))); 1103 1104 switch (EXTRACT_16BITS(&op->ospf_authtype)) { 1105 1106 case OSPF_AUTH_NONE: 1107 break; 1108 1109 case OSPF_AUTH_SIMPLE: 1110 ND_PRINT((ndo, "\n\tSimple text password: ")); 1111 safeputs(ndo, op->ospf_authdata, OSPF_AUTH_SIMPLE_LEN); 1112 break; 1113 1114 case OSPF_AUTH_MD5: 1115 ND_PRINT((ndo, "\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x", 1116 *((op->ospf_authdata) + 2), 1117 *((op->ospf_authdata) + 3), 1118 EXTRACT_32BITS((op->ospf_authdata) + 4))); 1119 break; 1120 1121 default: 1122 return; 1123 } 1124 } 1125 /* Do rest according to version. */ 1126 switch (op->ospf_version) { 1127 1128 case 2: 1129 /* ospf version 2 */ 1130 if (ospf_decode_v2(ndo, op, dataend)) 1131 goto trunc; 1132 if (length > EXTRACT_16BITS(&op->ospf_len)) { 1133 if (ospf_decode_lls(ndo, op, length)) 1134 goto trunc; 1135 } 1136 break; 1137 1138 default: 1139 ND_PRINT((ndo, " ospf [version %d]", op->ospf_version)); 1140 break; 1141 } /* end switch on version */ 1142 1143 return; 1144 trunc: 1145 ND_PRINT((ndo, "%s", tstr)); 1146 } 1147