1 /* 2 * Copyright (c) 1998-2006 The TCPDUMP project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that: (1) source code 6 * distributions retain the above copyright notice and this paragraph 7 * in its entirety, and (2) distributions including binary code include 8 * the above copyright notice and this paragraph in its entirety in 9 * the documentation or other materials provided with the distribution. 10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 * FOR A PARTICULAR PURPOSE. 14 * 15 * Support for the IEEE Connectivity Fault Management Protocols as per 802.1ag. 16 * 17 * Original code by Hannes Gredler (hannes@juniper.net) 18 */ 19 20 #include <sys/cdefs.h> 21 #ifndef lint 22 __RCSID("$NetBSD: print-cfm.c,v 1.6 2015/03/31 21:59:35 christos Exp $"); 23 #endif 24 25 #define NETDISSECT_REWORKED 26 #ifdef HAVE_CONFIG_H 27 #include "config.h" 28 #endif 29 30 #include <tcpdump-stdinc.h> 31 32 #include <stdio.h> 33 34 #include "interface.h" 35 #include "extract.h" 36 #include "ether.h" 37 #include "addrtoname.h" 38 #include "oui.h" 39 #include "af.h" 40 41 struct cfm_common_header_t { 42 uint8_t mdlevel_version; 43 uint8_t opcode; 44 uint8_t flags; 45 uint8_t first_tlv_offset; 46 }; 47 48 #define CFM_VERSION 0 49 #define CFM_EXTRACT_VERSION(x) (((x)&0x1f)) 50 #define CFM_EXTRACT_MD_LEVEL(x) (((x)&0xe0)>>5) 51 52 #define CFM_OPCODE_CCM 1 53 #define CFM_OPCODE_LBR 2 54 #define CFM_OPCODE_LBM 3 55 #define CFM_OPCODE_LTR 4 56 #define CFM_OPCODE_LTM 5 57 58 static const struct tok cfm_opcode_values[] = { 59 { CFM_OPCODE_CCM, "Continouity Check Message"}, 60 { CFM_OPCODE_LBR, "Loopback Reply"}, 61 { CFM_OPCODE_LBM, "Loopback Message"}, 62 { CFM_OPCODE_LTR, "Linktrace Reply"}, 63 { CFM_OPCODE_LTM, "Linktrace Message"}, 64 { 0, NULL} 65 }; 66 67 /* 68 * Message Formats. 69 */ 70 struct cfm_ccm_t { 71 uint8_t sequence[4]; 72 uint8_t ma_epi[2]; 73 uint8_t md_nameformat; 74 uint8_t md_namelength; 75 uint8_t md_name[46]; /* md name and short ma name */ 76 uint8_t reserved_itu[16]; 77 uint8_t reserved[6]; 78 }; 79 80 /* 81 * Timer Bases for the CCM Interval field. 82 * Expressed in units of seconds. 83 */ 84 const float ccm_interval_base[8] = {0, 0.003333, 0.01, 0.1, 1, 10, 60, 600}; 85 #define CCM_INTERVAL_MIN_MULTIPLIER 3.25 86 #define CCM_INTERVAL_MAX_MULTIPLIER 3.5 87 88 #define CFM_CCM_RDI_FLAG 0x80 89 #define CFM_EXTRACT_CCM_INTERVAL(x) (((x)&0x07)) 90 91 #define CFM_CCM_MD_FORMAT_8021 0 92 #define CFM_CCM_MD_FORMAT_NONE 1 93 #define CFM_CCM_MD_FORMAT_DNS 2 94 #define CFM_CCM_MD_FORMAT_MAC 3 95 #define CFM_CCM_MD_FORMAT_CHAR 4 96 97 static const struct tok cfm_md_nameformat_values[] = { 98 { CFM_CCM_MD_FORMAT_8021, "IEEE 802.1"}, 99 { CFM_CCM_MD_FORMAT_NONE, "No MD Name present"}, 100 { CFM_CCM_MD_FORMAT_DNS, "DNS string"}, 101 { CFM_CCM_MD_FORMAT_MAC, "MAC + 16Bit Integer"}, 102 { CFM_CCM_MD_FORMAT_CHAR, "Character string"}, 103 { 0, NULL} 104 }; 105 106 #define CFM_CCM_MA_FORMAT_8021 0 107 #define CFM_CCM_MA_FORMAT_VID 1 108 #define CFM_CCM_MA_FORMAT_CHAR 2 109 #define CFM_CCM_MA_FORMAT_INT 3 110 #define CFM_CCM_MA_FORMAT_VPN 4 111 112 static const struct tok cfm_ma_nameformat_values[] = { 113 { CFM_CCM_MA_FORMAT_8021, "IEEE 802.1"}, 114 { CFM_CCM_MA_FORMAT_VID, "Primary VID"}, 115 { CFM_CCM_MA_FORMAT_CHAR, "Character string"}, 116 { CFM_CCM_MA_FORMAT_INT, "16Bit Integer"}, 117 { CFM_CCM_MA_FORMAT_VPN, "RFC2685 VPN-ID"}, 118 { 0, NULL} 119 }; 120 121 struct cfm_lbm_t { 122 uint8_t transaction_id[4]; 123 uint8_t reserved[4]; 124 }; 125 126 struct cfm_ltm_t { 127 uint8_t transaction_id[4]; 128 uint8_t egress_id[8]; 129 uint8_t ttl; 130 uint8_t original_mac[ETHER_ADDR_LEN]; 131 uint8_t target_mac[ETHER_ADDR_LEN]; 132 uint8_t reserved[3]; 133 }; 134 135 static const struct tok cfm_ltm_flag_values[] = { 136 { 0x80, "Use Forwarding-DB only"}, 137 { 0, NULL} 138 }; 139 140 struct cfm_ltr_t { 141 uint8_t transaction_id[4]; 142 uint8_t last_egress_id[8]; 143 uint8_t next_egress_id[8]; 144 uint8_t ttl; 145 uint8_t replay_action; 146 uint8_t reserved[6]; 147 }; 148 149 static const struct tok cfm_ltr_flag_values[] = { 150 { 0x80, "UseFDB Only"}, 151 { 0x40, "FwdYes"}, 152 { 0x20, "Terminal MEP"}, 153 { 0, NULL} 154 }; 155 156 static const struct tok cfm_ltr_replay_action_values[] = { 157 { 1, "Exact Match"}, 158 { 2, "Filtering DB"}, 159 { 3, "MIP CCM DB"}, 160 { 0, NULL} 161 }; 162 163 164 #define CFM_TLV_END 0 165 #define CFM_TLV_SENDER_ID 1 166 #define CFM_TLV_PORT_STATUS 2 167 #define CFM_TLV_INTERFACE_STATUS 3 168 #define CFM_TLV_DATA 4 169 #define CFM_TLV_REPLY_INGRESS 5 170 #define CFM_TLV_REPLY_EGRESS 6 171 #define CFM_TLV_PRIVATE 31 172 173 static const struct tok cfm_tlv_values[] = { 174 { CFM_TLV_END, "End"}, 175 { CFM_TLV_SENDER_ID, "Sender ID"}, 176 { CFM_TLV_PORT_STATUS, "Port status"}, 177 { CFM_TLV_INTERFACE_STATUS, "Interface status"}, 178 { CFM_TLV_DATA, "Data"}, 179 { CFM_TLV_REPLY_INGRESS, "Reply Ingress"}, 180 { CFM_TLV_REPLY_EGRESS, "Reply Egress"}, 181 { CFM_TLV_PRIVATE, "Organization Specific"}, 182 { 0, NULL} 183 }; 184 185 /* 186 * TLVs 187 */ 188 189 struct cfm_tlv_header_t { 190 uint8_t type; 191 uint8_t length[2]; 192 }; 193 194 /* FIXME define TLV formats */ 195 196 static const struct tok cfm_tlv_port_status_values[] = { 197 { 1, "Blocked"}, 198 { 2, "Up"}, 199 { 0, NULL} 200 }; 201 202 static const struct tok cfm_tlv_interface_status_values[] = { 203 { 1, "Up"}, 204 { 2, "Down"}, 205 { 3, "Testing"}, 206 { 5, "Dormant"}, 207 { 6, "not present"}, 208 { 7, "lower Layer down"}, 209 { 0, NULL} 210 }; 211 212 #define CFM_CHASSIS_ID_CHASSIS_COMPONENT 1 213 #define CFM_CHASSIS_ID_INTERFACE_ALIAS 2 214 #define CFM_CHASSIS_ID_PORT_COMPONENT 3 215 #define CFM_CHASSIS_ID_MAC_ADDRESS 4 216 #define CFM_CHASSIS_ID_NETWORK_ADDRESS 5 217 #define CFM_CHASSIS_ID_INTERFACE_NAME 6 218 #define CFM_CHASSIS_ID_LOCAL 7 219 220 static const struct tok cfm_tlv_senderid_chassisid_values[] = { 221 { 0, "Reserved"}, 222 { CFM_CHASSIS_ID_CHASSIS_COMPONENT, "Chassis component"}, 223 { CFM_CHASSIS_ID_INTERFACE_ALIAS, "Interface alias"}, 224 { CFM_CHASSIS_ID_PORT_COMPONENT, "Port component"}, 225 { CFM_CHASSIS_ID_MAC_ADDRESS, "MAC address"}, 226 { CFM_CHASSIS_ID_NETWORK_ADDRESS, "Network address"}, 227 { CFM_CHASSIS_ID_INTERFACE_NAME, "Interface name"}, 228 { CFM_CHASSIS_ID_LOCAL, "Locally assigned"}, 229 { 0, NULL} 230 }; 231 232 233 static int 234 cfm_mgmt_addr_print(netdissect_options *ndo, 235 register const u_char *tptr) 236 { 237 u_int mgmt_addr_type; 238 u_int hexdump = FALSE; 239 240 /* 241 * Altough AFIs are tpically 2 octects wide, 242 * 802.1ab specifies that this field width 243 * is only once octet 244 */ 245 mgmt_addr_type = *tptr; 246 ND_PRINT((ndo, "\n\t Management Address Type %s (%u)", 247 tok2str(af_values, "Unknown", mgmt_addr_type), 248 mgmt_addr_type)); 249 250 /* 251 * Resolve the passed in Address. 252 */ 253 switch(mgmt_addr_type) { 254 case AFNUM_INET: 255 ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr + 1))); 256 break; 257 258 #ifdef INET6 259 case AFNUM_INET6: 260 ND_PRINT((ndo, ", %s", ip6addr_string(ndo, tptr + 1))); 261 break; 262 #endif 263 264 default: 265 hexdump = TRUE; 266 break; 267 } 268 269 return hexdump; 270 } 271 272 /* 273 * The egress-ID string is a 16-Bit string plus a MAC address. 274 */ 275 static const char * 276 cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr) 277 { 278 static char egress_id_buffer[80]; 279 280 snprintf(egress_id_buffer, sizeof(egress_id_buffer), 281 "MAC 0x%4x-%s", 282 EXTRACT_16BITS(tptr), 283 etheraddr_string(ndo, tptr+2)); 284 285 return egress_id_buffer; 286 } 287 288 void 289 cfm_print(netdissect_options *ndo, 290 register const u_char *pptr, register u_int length) 291 { 292 const struct cfm_common_header_t *cfm_common_header; 293 const struct cfm_tlv_header_t *cfm_tlv_header; 294 const uint8_t *tptr, *tlv_ptr, *ma_name, *ma_nameformat, *ma_namelength; 295 u_int hexdump, tlen, cfm_tlv_len, cfm_tlv_type, ccm_interval; 296 297 298 union { 299 const struct cfm_ccm_t *cfm_ccm; 300 const struct cfm_lbm_t *cfm_lbm; 301 const struct cfm_ltm_t *cfm_ltm; 302 const struct cfm_ltr_t *cfm_ltr; 303 } msg_ptr; 304 305 tptr=pptr; 306 cfm_common_header = (const struct cfm_common_header_t *)pptr; 307 ND_TCHECK(*cfm_common_header); 308 309 /* 310 * Sanity checking of the header. 311 */ 312 if (CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version) != CFM_VERSION) { 313 ND_PRINT((ndo, "CFMv%u not supported, length %u", 314 CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version), length)); 315 return; 316 } 317 318 ND_PRINT((ndo, "CFMv%u %s, MD Level %u, length %u", 319 CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version), 320 tok2str(cfm_opcode_values, "unknown (%u)", cfm_common_header->opcode), 321 CFM_EXTRACT_MD_LEVEL(cfm_common_header->mdlevel_version), 322 length)); 323 324 /* 325 * In non-verbose mode just print the opcode and md-level. 326 */ 327 if (ndo->ndo_vflag < 1) { 328 return; 329 } 330 331 ND_PRINT((ndo, "\n\tFirst TLV offset %u", cfm_common_header->first_tlv_offset)); 332 333 tptr += sizeof(const struct cfm_common_header_t); 334 tlen = length - sizeof(struct cfm_common_header_t); 335 336 switch (cfm_common_header->opcode) { 337 case CFM_OPCODE_CCM: 338 msg_ptr.cfm_ccm = (const struct cfm_ccm_t *)tptr; 339 340 ccm_interval = CFM_EXTRACT_CCM_INTERVAL(cfm_common_header->flags); 341 ND_PRINT((ndo, ", Flags [CCM Interval %u%s]", 342 ccm_interval, 343 cfm_common_header->flags & CFM_CCM_RDI_FLAG ? 344 ", RDI" : "")); 345 346 /* 347 * Resolve the CCM interval field. 348 */ 349 if (ccm_interval) { 350 ND_PRINT((ndo, "\n\t CCM Interval %.3fs" 351 ", min CCM Lifetime %.3fs, max CCM Lifetime %.3fs", 352 ccm_interval_base[ccm_interval], 353 ccm_interval_base[ccm_interval] * CCM_INTERVAL_MIN_MULTIPLIER, 354 ccm_interval_base[ccm_interval] * CCM_INTERVAL_MAX_MULTIPLIER)); 355 } 356 357 ND_PRINT((ndo, "\n\t Sequence Number 0x%08x, MA-End-Point-ID 0x%04x", 358 EXTRACT_32BITS(msg_ptr.cfm_ccm->sequence), 359 EXTRACT_16BITS(msg_ptr.cfm_ccm->ma_epi))); 360 361 362 /* 363 * Resolve the MD fields. 364 */ 365 ND_PRINT((ndo, "\n\t MD Name Format %s (%u), MD Name length %u", 366 tok2str(cfm_md_nameformat_values, "Unknown", 367 msg_ptr.cfm_ccm->md_nameformat), 368 msg_ptr.cfm_ccm->md_nameformat, 369 msg_ptr.cfm_ccm->md_namelength)); 370 371 if (msg_ptr.cfm_ccm->md_nameformat != CFM_CCM_MD_FORMAT_NONE) { 372 ND_PRINT((ndo, "\n\t MD Name: ")); 373 switch (msg_ptr.cfm_ccm->md_nameformat) { 374 case CFM_CCM_MD_FORMAT_DNS: 375 case CFM_CCM_MD_FORMAT_CHAR: 376 safeputs(ndo, msg_ptr.cfm_ccm->md_name, msg_ptr.cfm_ccm->md_namelength); 377 break; 378 379 case CFM_CCM_MD_FORMAT_MAC: 380 ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo, 381 msg_ptr.cfm_ccm->md_name))); 382 break; 383 384 /* FIXME add printers for those MD formats - hexdump for now */ 385 case CFM_CCM_MA_FORMAT_8021: 386 default: 387 print_unknown_data(ndo, msg_ptr.cfm_ccm->md_name, "\n\t ", 388 msg_ptr.cfm_ccm->md_namelength); 389 } 390 } 391 392 393 /* 394 * Resolve the MA fields. 395 */ 396 ma_nameformat = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength; 397 ma_namelength = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength + 1; 398 ma_name = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength + 2; 399 400 ND_PRINT((ndo, "\n\t MA Name-Format %s (%u), MA name length %u", 401 tok2str(cfm_ma_nameformat_values, "Unknown", 402 *ma_nameformat), 403 *ma_nameformat, 404 *ma_namelength)); 405 406 ND_PRINT((ndo, "\n\t MA Name: ")); 407 switch (*ma_nameformat) { 408 case CFM_CCM_MA_FORMAT_CHAR: 409 safeputs(ndo, ma_name, *ma_namelength); 410 break; 411 412 /* FIXME add printers for those MA formats - hexdump for now */ 413 case CFM_CCM_MA_FORMAT_8021: 414 case CFM_CCM_MA_FORMAT_VID: 415 case CFM_CCM_MA_FORMAT_INT: 416 case CFM_CCM_MA_FORMAT_VPN: 417 default: 418 print_unknown_data(ndo, ma_name, "\n\t ", *ma_namelength); 419 } 420 break; 421 422 case CFM_OPCODE_LTM: 423 msg_ptr.cfm_ltm = (const struct cfm_ltm_t *)tptr; 424 425 ND_PRINT((ndo, ", Flags [%s]", 426 bittok2str(cfm_ltm_flag_values, "none", cfm_common_header->flags))); 427 428 ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Egress-ID %s, ttl %u", 429 EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id), 430 cfm_egress_id_string(ndo, msg_ptr.cfm_ltm->egress_id), 431 msg_ptr.cfm_ltm->ttl)); 432 433 ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s", 434 etheraddr_string(ndo, msg_ptr.cfm_ltm->original_mac), 435 etheraddr_string(ndo, msg_ptr.cfm_ltm->target_mac))); 436 break; 437 438 case CFM_OPCODE_LTR: 439 msg_ptr.cfm_ltr = (const struct cfm_ltr_t *)tptr; 440 441 ND_PRINT((ndo, ", Flags [%s]", 442 bittok2str(cfm_ltr_flag_values, "none", cfm_common_header->flags))); 443 444 ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Last-Egress-ID %s", 445 EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id), 446 cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->last_egress_id))); 447 448 ND_PRINT((ndo, "\n\t Next-Egress-ID %s, ttl %u", 449 cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->next_egress_id), 450 msg_ptr.cfm_ltr->ttl)); 451 452 ND_PRINT((ndo, "\n\t Replay-Action %s (%u)", 453 tok2str(cfm_ltr_replay_action_values, 454 "Unknown", 455 msg_ptr.cfm_ltr->replay_action), 456 msg_ptr.cfm_ltr->replay_action)); 457 break; 458 459 /* 460 * No message decoder yet. 461 * Hexdump everything up until the start of the TLVs 462 */ 463 case CFM_OPCODE_LBR: 464 case CFM_OPCODE_LBM: 465 default: 466 if (tlen > cfm_common_header->first_tlv_offset) { 467 print_unknown_data(ndo, tptr, "\n\t ", 468 tlen - cfm_common_header->first_tlv_offset); 469 } 470 break; 471 } 472 473 /* 474 * Sanity check for not walking off. 475 */ 476 if (tlen <= cfm_common_header->first_tlv_offset) { 477 return; 478 } 479 480 tptr += cfm_common_header->first_tlv_offset; 481 tlen -= cfm_common_header->first_tlv_offset; 482 483 while (tlen > 0) { 484 cfm_tlv_header = (const struct cfm_tlv_header_t *)tptr; 485 486 /* Enough to read the tlv type ? */ 487 ND_TCHECK2(*tptr, 1); 488 cfm_tlv_type=cfm_tlv_header->type; 489 490 if (cfm_tlv_type != CFM_TLV_END) { 491 /* did we capture enough for fully decoding the object header ? */ 492 ND_TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t)); 493 cfm_tlv_len=EXTRACT_16BITS(&cfm_tlv_header->length); 494 } else { 495 cfm_tlv_len = 0; 496 } 497 498 ND_PRINT((ndo, "\n\t%s TLV (0x%02x), length %u", 499 tok2str(cfm_tlv_values, "Unknown", cfm_tlv_type), 500 cfm_tlv_type, 501 cfm_tlv_len)); 502 503 /* sanity check for not walking off and infinite loop check. */ 504 if ((cfm_tlv_type != CFM_TLV_END) && 505 ((cfm_tlv_len + sizeof(struct cfm_tlv_header_t) > tlen) || 506 (!cfm_tlv_len))) { 507 print_unknown_data(ndo, tptr, "\n\t ", tlen); 508 return; 509 } 510 511 tptr += sizeof(struct cfm_tlv_header_t); 512 tlen -= sizeof(struct cfm_tlv_header_t); 513 tlv_ptr = tptr; 514 515 /* did we capture enough for fully decoding the object ? */ 516 if (cfm_tlv_type != CFM_TLV_END) { 517 ND_TCHECK2(*tptr, cfm_tlv_len); 518 } 519 hexdump = FALSE; 520 521 switch(cfm_tlv_type) { 522 case CFM_TLV_END: 523 /* we are done - bail out */ 524 return; 525 526 case CFM_TLV_PORT_STATUS: 527 ND_PRINT((ndo, ", Status: %s (%u)", 528 tok2str(cfm_tlv_port_status_values, "Unknown", *tptr), 529 *tptr)); 530 break; 531 532 case CFM_TLV_INTERFACE_STATUS: 533 ND_PRINT((ndo, ", Status: %s (%u)", 534 tok2str(cfm_tlv_interface_status_values, "Unknown", *tptr), 535 *tptr)); 536 break; 537 538 case CFM_TLV_PRIVATE: 539 ND_PRINT((ndo, ", Vendor: %s (%u), Sub-Type %u", 540 tok2str(oui_values,"Unknown", EXTRACT_24BITS(tptr)), 541 EXTRACT_24BITS(tptr), 542 *(tptr + 3))); 543 hexdump = TRUE; 544 break; 545 546 case CFM_TLV_SENDER_ID: 547 { 548 u_int chassis_id_type, chassis_id_length; 549 u_int mgmt_addr_length; 550 551 /* 552 * Check if there is a Chassis-ID. 553 */ 554 chassis_id_length = *tptr; 555 if (chassis_id_length > tlen) { 556 hexdump = TRUE; 557 break; 558 } 559 560 tptr++; 561 tlen--; 562 563 if (chassis_id_length) { 564 chassis_id_type = *tptr; 565 ND_PRINT((ndo, "\n\t Chassis-ID Type %s (%u), Chassis-ID length %u", 566 tok2str(cfm_tlv_senderid_chassisid_values, 567 "Unknown", 568 chassis_id_type), 569 chassis_id_type, 570 chassis_id_length)); 571 572 switch (chassis_id_type) { 573 case CFM_CHASSIS_ID_MAC_ADDRESS: 574 ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo, tptr + 1))); 575 break; 576 577 case CFM_CHASSIS_ID_NETWORK_ADDRESS: 578 hexdump |= cfm_mgmt_addr_print(ndo, tptr); 579 break; 580 581 case CFM_CHASSIS_ID_INTERFACE_NAME: /* fall through */ 582 case CFM_CHASSIS_ID_INTERFACE_ALIAS: 583 case CFM_CHASSIS_ID_LOCAL: 584 case CFM_CHASSIS_ID_CHASSIS_COMPONENT: 585 case CFM_CHASSIS_ID_PORT_COMPONENT: 586 safeputs(ndo, tptr + 1, chassis_id_length); 587 break; 588 589 default: 590 hexdump = TRUE; 591 break; 592 } 593 } 594 595 tptr += chassis_id_length; 596 tlen -= chassis_id_length; 597 598 /* 599 * Check if there is a Management Address. 600 */ 601 mgmt_addr_length = *tptr; 602 if (mgmt_addr_length > tlen) { 603 hexdump = TRUE; 604 break; 605 } 606 607 tptr++; 608 tlen--; 609 610 if (mgmt_addr_length) { 611 hexdump |= cfm_mgmt_addr_print(ndo, tptr); 612 } 613 614 tptr += mgmt_addr_length; 615 tlen -= mgmt_addr_length; 616 617 } 618 break; 619 620 /* 621 * FIXME those are the defined TLVs that lack a decoder 622 * you are welcome to contribute code ;-) 623 */ 624 625 case CFM_TLV_DATA: 626 case CFM_TLV_REPLY_INGRESS: 627 case CFM_TLV_REPLY_EGRESS: 628 default: 629 hexdump = TRUE; 630 break; 631 } 632 /* do we want to see an additional hexdump ? */ 633 if (hexdump || ndo->ndo_vflag > 1) 634 print_unknown_data(ndo, tlv_ptr, "\n\t ", cfm_tlv_len); 635 636 tptr+=cfm_tlv_len; 637 tlen-=cfm_tlv_len; 638 } 639 return; 640 trunc: 641 ND_PRINT((ndo, "\n\t\t packet exceeded snapshot")); 642 } 643