(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c) |
| |
| 212 | | | dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 213 | | | { |
| 214 | | | guint16 protocol_identifier; |
| 215 | | | guint8 protocol_version_identifier; |
| 216 | | | guint8 bpdu_type; |
| 217 | | | guint8 flags; |
| 218 | | | guint16 root_identifier_bridge_priority; |
| 219 | | | guint16 root_identifier_system_id_extension = 0; |
| 220 | | | const guint8 *root_identifier_mac; |
| 221 | | | gchar *root_identifier_mac_str; |
| 222 | | | guint32 root_path_cost; |
| 223 | | | guint16 bridge_identifier_bridge_priority; |
| 224 | | | guint16 bridge_identifier_system_id_extension = 0; |
| 225 | | | const guint8 *bridge_identifier_mac; |
| 226 | | | gchar *bridge_identifier_mac_str; |
| 227 | | | guint16 port_identifier; |
| 228 | | | double message_age; |
| 229 | | | double max_age; |
| 230 | | | double hello_time; |
| 231 | | | double forward_delay; |
| 232 | | | guint8 version_1_length; |
| 233 | | | guint16 version_3_length; |
| 234 | | | guint8 config_format_selector; |
| 235 | | | guint16 cist_bridge_identifier_bridge_priority; |
| 236 | | | guint16 cist_bridge_identifier_system_id_extension = 0; |
| 237 | | | const guint8 *cist_bridge_identifier_mac; |
| 238 | | | gchar *cist_bridge_identifier_mac_str; |
| 239 | | | guint16 msti_mstid; |
| 240 | | | guint32 msti_regional_root_mstid, msti_regional_root_priority; |
| 241 | | | const guint8 *msti_regional_root_mac; |
| 242 | | | gchar *msti_regional_root_mac_str; |
| 243 | | | guint16 msti_bridge_identifier_priority, msti_port_identifier_priority; |
| 244 | | | const guint8 *msti_bridge_identifier_mac; |
| 245 | | | gchar *msti_bridge_identifier_mac_str; |
| 246 | | | int total_msti_length, offset, msti, msti_format; |
| 247 262 |  | | [ Lines 247 to 262 omitted. ] |
| 263 | | | |
| 264 | | | |
| 265 | | | |
| 266 | | | |
| 267 | | | |
| 268 | | | |
| 269 | | | |
| 270 | | | |
| 271 | | | |
| 272 | | | |
| 273 | | | if (pinfo->dl_dst.type == AT_ETHER) { |
| 274 | | | const guint8 *dstaddr; |
| 275 | | | |
| 276 | | | dstaddr = pinfo->dl_dst.data; |
| 277 | | | if(dstaddr[0] == 0x01 && dstaddr[1] == 0x80 && |
| 278 | | | dstaddr[2] == 0xC2 && dstaddr[3] == 0x00 && |
| 279 | | | dstaddr[4] == 0x00 && ((dstaddr[5] & 0xF0) == 0x20)) { |
Unreachable Call
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 280 | | | |
| 281 | | | protocol_identifier = tvb_get_ntohs(tvb, BPDU_IDENTIFIER); |
| 282 | | | |
| 283 | | | switch (dstaddr[5]) { |
| 284 | | | |
| 285 | | | case 0x20: |
| 286 | | | |
| 287 | | | call_dissector(gmrp_handle, tvb, pinfo, tree); |
| 288 | | | return; |
| 289 | | | |
| 290 | | | case 0x21: |
| 291 | | | |
| 292 | | | call_dissector(gvrp_handle, tvb, pinfo, tree); |
| 293 | | | return; |
| 294 | | | } |
| 295 | | | |
| 296 | | | pinfo->current_proto = "GARP"; |
| 297 | | | |
| 298 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) { |
| 299 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "GARP"); |
| 300 | | | |
| 301 | | | } |
| 302 | | | |
| 303 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 304 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 305 | | | "Unknown GARP application (0x%02X)", |
| 306 | | | dstaddr[5]); |
| 307 | | | } |
| 308 | | | |
| 309 | | | return; |
| 310 | | | } |
| 311 | | | } |
| 312 | | | |
| 313 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) { |
| 314 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "STP"); |
| 315 | | | } |
| 316 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 317 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 318 | | | } |
| 319 | | | |
| 320 | | | bpdu_type = tvb_get_guint8(tvb, BPDU_TYPE); |
| 321 | | | |
| 322 | | | protocol_version_identifier = tvb_get_guint8(tvb, BPDU_VERSION_IDENTIFIER); |
| 323 | | | |
| 324 | | | switch (bpdu_type) { |
| 325 | | | |
| 326 | | | case BPDU_TYPE_CONF: |
| 327 | | | case BPDU_TYPE_RST: |
| 328 | | | flags = tvb_get_guint8(tvb, BPDU_FLAGS); |
| 329 | | | root_identifier_bridge_priority = tvb_get_ntohs(tvb,BPDU_ROOT_IDENTIFIER); |
| 330 | | | if (bpdu_use_system_id_extensions ) { |
| 331 | | | root_identifier_system_id_extension = root_identifier_bridge_priority & 0x0fff; |
| 332 | | | root_identifier_bridge_priority &= 0xf000; |
| 333 | | | } |
| 334 | | | root_identifier_mac = tvb_get_ptr(tvb, BPDU_ROOT_IDENTIFIER + 2, 6); |
| 335 | | | root_identifier_mac_str = ether_to_str(root_identifier_mac); |
| 336 | | | root_path_cost = tvb_get_ntohl(tvb, BPDU_ROOT_PATH_COST); |
| 337 | | | port_identifier = tvb_get_ntohs(tvb, BPDU_PORT_IDENTIFIER); |
| 338 | | | break; |
| 339 | | | |
| 340 | | | default: |
| 341 | | | |
| 342 | | | flags = 0; |
| 343 | | | root_identifier_bridge_priority = 0; |
| 344 | | | root_identifier_mac = NULL; |
| 345 | | | root_identifier_mac_str = NULL; |
| 346 | | | root_path_cost = 0; |
| 347 | | | port_identifier = 0; |
| 348 | | | break; |
| 349 | | | } |
| 350 | | | |
| 351 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 352 | | | switch (bpdu_type) { |
| 353 | | | |
| 354 | | | case BPDU_TYPE_CONF: |
| 355 | | | if (bpdu_use_system_id_extensions ) { |
| 356 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 357 | | | "Conf. %sRoot = %d/%d/%s Cost = %d Port = 0x%04x", |
| 358 | | | flags & 0x1 ? "TC + " : "", |
| 359 | | | root_identifier_bridge_priority, |
| 360 | | | root_identifier_system_id_extension, |
| 361 | | | root_identifier_mac_str, |
| 362 | | | root_path_cost, port_identifier); |
| 363 | | | } else { |
| 364 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 365 | | | "Conf. %sRoot = %d/%s Cost = %d Port = 0x%04x", |
| 366 | | | flags & 0x1 ? "TC + " : "", |
| 367 | | | root_identifier_bridge_priority, root_identifier_mac_str, |
| 368 | | | root_path_cost, port_identifier); |
| 369 | | | } |
| 370 | | | break; |
| 371 | | | |
| 372 | | | case BPDU_TYPE_TOPOLOGY_CHANGE:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
171 | #define BPDU_TYPE_TOPOLOGY_CHANGE 0x80 /* STP TCN (Topology change notify) BPDU */ |
| |
|
| 373 | | | col_set_str(pinfo->cinfo, COL_INFO, "Topology Change Notification"); |
| 374 | | | break; |
| 375 | | | |
| 376 | | | case BPDU_TYPE_RST: |
| 377 | | | if (bpdu_use_system_id_extensions ) { |
| 378 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 379 | | | "%cST. %sRoot = %d/%d/%s Cost = %d Port = 0x%04x", |
| 380 | | | protocol_version_identifier == 3 ? 'M':'R', |
| 381 | | | flags & 0x1 ? "TC + " : "", |
| 382 | | | root_identifier_bridge_priority, |
| 383 | | | root_identifier_system_id_extension, |
| 384 | | | root_identifier_mac_str, |
| 385 | | | root_path_cost, port_identifier); |
| 386 | | | } else { |
| 387 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 388 | | | "%cST. %sRoot = %d/%s Cost = %d Port = 0x%04x", |
| 389 | | | protocol_version_identifier == 3 ? 'M':'R', |
| 390 | | | flags & 0x1 ? "TC + " : "", |
| 391 | | | root_identifier_bridge_priority, root_identifier_mac_str, |
| 392 | | | root_path_cost, port_identifier); |
| 393 | | | } |
| 394 | | | break; |
| 395 | | | |
| 396 | | | default: |
| 397 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown BPDU type (%u)", bpdu_type); |
| 398 | | | break; |
| 399 | | | } |
| 400 | | | } |
| 401 | | | |
| 402 | | | if (tree) { |
| 403 | | | bpdu_item = proto_tree_add_protocol_format(tree, proto_bpdu, tvb, 0, -1, |
| 404 | | | "Spanning Tree Protocol"); |
| 405 | | | bpdu_tree = proto_item_add_subtree(bpdu_item, ett_bpdu); |
| 406 | | | |
| 407 | | | protocol_identifier = tvb_get_ntohs(tvb, BPDU_IDENTIFIER); |
| 408 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_proto_id, tvb, BPDU_IDENTIFIER, 2, |
| 409 | | | protocol_identifier); |
| 410 | | | |
| 411 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_version_id, tvb, |
| 412 | | | BPDU_VERSION_IDENTIFIER, 1, |
| 413 | | | protocol_version_identifier); |
| 414 | | | switch (protocol_version_identifier) { |
| 415 | | | |
| 416 | | | case 0: |
| 417 | | | break; |
| 418 | | | |
| 419 | | | case 2: |
| 420 | | | case 3: |
| 421 | | | break; |
| 422 | | | |
| 423 | | | default: |
| 424 | | | proto_tree_add_text(bpdu_tree, tvb, BPDU_VERSION_IDENTIFIER, 1, |
| 425 | | | " (Warning: this version of Wireshark only knows about versions 0, 2 & 3)"); |
| 426 | | | break; |
| 427 | | | } |
| 428 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_type, tvb, BPDU_TYPE, 1, bpdu_type); |
| 429 | | | |
| 430 | | | if (bpdu_type == BPDU_TYPE_TOPOLOGY_CHANGE) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
171 | #define BPDU_TYPE_TOPOLOGY_CHANGE 0x80 /* STP TCN (Topology change notify) BPDU */ |
| |
|
| 431 | | | set_actual_length(tvb, TC_BPDU_SIZE); |
| 432 | | | return; |
| 433 | | | } |
| 434 | | | |
| 435 | | | if (bpdu_type != BPDU_TYPE_CONF && bpdu_type != BPDU_TYPE_RST) { |
| 436 | | | |
| 437 | | | proto_tree_add_text(bpdu_tree, tvb, BPDU_TYPE + 1, -1, |
| 438 | | | "Unknown BPDU type data"); |
| 439 | | | return; |
| 440 | | | } |
| 441 | | | |
| 442 | | | bridge_identifier_bridge_priority = tvb_get_ntohs(tvb, BPDU_BRIDGE_IDENTIFIER); |
| 443 | | | if (bpdu_use_system_id_extensions ) { |
| 444 | | | bridge_identifier_system_id_extension = bridge_identifier_bridge_priority & 0x0fff; |
| 445 | | | bridge_identifier_bridge_priority &= 0xf000; |
| 446 | | | } |
| 447 | | | bridge_identifier_mac = tvb_get_ptr(tvb, BPDU_BRIDGE_IDENTIFIER + 2, 6); |
| 448 | | | bridge_identifier_mac_str = ether_to_str(bridge_identifier_mac); |
| 449 | | | |
| 450 | | | flags_item = proto_tree_add_uint(bpdu_tree, hf_bpdu_flags, tvb, |
| 451 | | | BPDU_FLAGS, 1, flags); |
| 452 | | | flags_tree = proto_item_add_subtree(flags_item, ett_bpdu_flags); |
| 453 | | | sep = initial_sep; |
| 454 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TCACK, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 455 | | | "%sTopology Change Acknowledgment"); |
| 456 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tcack, tvb, |
| 457 | | | BPDU_FLAGS, 1, flags); |
| 458 | | | if (bpdu_type == BPDU_TYPE_RST) { |
| 459 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_AGREEMENT, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 460 | | | "%sAgreement"); |
| 461 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_agreement, tvb, |
| 462 | | | BPDU_FLAGS, 1, flags); |
| 463 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_FORWARDING, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 464 | | | "%sForwarding"); |
| 465 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_forwarding, tvb, |
| 466 | | | BPDU_FLAGS, 1, flags); |
| 467 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_LEARNING, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 468 | | | "%sLearning"); |
| 469 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_learning, tvb, |
| 470 | | | BPDU_FLAGS, 1, flags); |
| 471 | | | if (flags_item) { |
| 472 | | | guint8 port_role; |
| 473 | | | |
| 474 | | | port_role = (flags & BPDU_FLAGS_PORT_ROLE_MASK) >> BPDU_FLAGS_PORT_ROLE_SHIFT; |
| 475 | | | proto_item_append_text(flags_item, "%sPort Role: %s", sep, |
| 476 | | | val_to_str(port_role, role_vals, |
| 477 | | | "Unknown (%u)")); |
| 478 | | | } |
| 479 | | | sep = cont_sep; |
| 480 | | | proto_tree_add_uint(flags_tree, hf_bpdu_flags_port_role, tvb, |
| 481 | | | BPDU_FLAGS, 1, flags); |
| 482 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_PROPOSAL, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 483 | | | "%sProposal"); |
| 484 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_proposal, tvb, |
| 485 | | | BPDU_FLAGS, 1, flags); |
| 486 | | | } |
| 487 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TC, flags_item,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 488 | | | "%sTopology Change"); |
| 489 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tc, tvb, |
| 490 | | | BPDU_FLAGS, 1, flags); |
| 491 | | | if (sep != initial_sep) { |
| 492 | | | |
| 493 | | | proto_item_append_text(flags_item, ")"); |
| 494 | | | } |
| 495 | | | |
| 496 | | | |
| 497 | | | |
| 498 | | | |
| 499 | | | if (bpdu_use_system_id_extensions) { |
| 500 | | | root_id_item = proto_tree_add_text(bpdu_tree, tvb, |
| 501 | | | BPDU_ROOT_IDENTIFIER, 8, |
| 502 | | | "Root Identifier: %d / %d / %s", |
| 503 | | | root_identifier_bridge_priority, |
| 504 | | | root_identifier_system_id_extension, |
| 505 | | | root_identifier_mac_str); |
| 506 | | | root_id_tree = proto_item_add_subtree(root_id_item, ett_root_id); |
| 507 | | | proto_tree_add_uint(root_id_tree, hf_bpdu_root_prio, tvb, |
| 508 | | | BPDU_ROOT_IDENTIFIER , 1, |
| 509 | | | root_identifier_bridge_priority); |
| 510 | | | proto_tree_add_uint(root_id_tree, hf_bpdu_root_sys_id_ext, tvb, |
| 511 | | | BPDU_ROOT_IDENTIFIER , 2, |
| 512 | | | root_identifier_system_id_extension); |
| 513 | | | proto_tree_add_ether_format_value(root_id_tree, hf_bpdu_root_mac, |
| 514 | | | tvb, BPDU_ROOT_IDENTIFIER + 2, 6, |
| 515 | | | root_identifier_mac, |
| 516 | | | "%s", root_identifier_mac_str); |
| 517 | | | } else { |
| 518 | | | root_id_item = proto_tree_add_text(bpdu_tree, tvb, |
| 519 | | | BPDU_ROOT_IDENTIFIER, 8, |
| 520 | | | "Root Identifier: %d / %s", |
| 521 | | | root_identifier_bridge_priority, |
| 522 | | | root_identifier_mac_str); |
| 523 | | | root_id_tree = proto_item_add_subtree(root_id_item, ett_root_id); |
| 524 | | | proto_tree_add_uint(root_id_tree, hf_bpdu_root_prio, tvb, |
| 525 | | | BPDU_ROOT_IDENTIFIER , 2, |
| 526 | | | root_identifier_bridge_priority); |
| 527 | | | proto_tree_add_ether_format_value(root_id_tree, hf_bpdu_root_mac, |
| 528 | | | tvb, BPDU_ROOT_IDENTIFIER + 2, 6, |
| 529 | | | root_identifier_mac, |
| 530 | | | "%s", root_identifier_mac_str); |
| 531 | | | } |
| 532 | | | |
| 533 | | | |
| 534 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_root_cost, tvb, |
| 535 | | | BPDU_ROOT_PATH_COST, 4, root_path_cost); |
| 536 | | | |
| 537 | | | |
| 538 | | | |
| 539 | | | |
| 540 | | | if (bpdu_use_system_id_extensions) { |
| 541 | | | bridge_id_item = proto_tree_add_text(bpdu_tree, tvb, |
| 542 | | | BPDU_BRIDGE_IDENTIFIER, 8, |
| 543 | | | "Bridge Identifier: %d / %d / %s", |
| 544 | | | bridge_identifier_bridge_priority, |
| 545 | | | bridge_identifier_system_id_extension, |
| 546 | | | bridge_identifier_mac_str); |
| 547 | | | bridge_id_tree = proto_item_add_subtree(bridge_id_item, ett_bridge_id); |
| 548 | | | proto_tree_add_uint(bridge_id_tree, hf_bpdu_bridge_prio, tvb, |
| 549 | | | BPDU_BRIDGE_IDENTIFIER , 1, |
| 550 | | | bridge_identifier_bridge_priority); |
| 551 | | | proto_tree_add_uint(bridge_id_tree, hf_bpdu_bridge_sys_id_ext, tvb, |
| 552 | | | BPDU_BRIDGE_IDENTIFIER , 2, |
| 553 | | | bridge_identifier_system_id_extension); |
| 554 | | | proto_tree_add_ether_format_value(bridge_id_tree, hf_bpdu_bridge_mac, |
| 555 | | | tvb, BPDU_BRIDGE_IDENTIFIER + 2, 6, |
| 556 | | | bridge_identifier_mac, |
| 557 | | | "%s", bridge_identifier_mac_str); |
| 558 | | | } else { |
| 559 | | | bridge_id_item = proto_tree_add_text(bpdu_tree, tvb, |
| 560 | | | BPDU_BRIDGE_IDENTIFIER, 8, |
| 561 | | | "Bridge Identifier: %d / %s", |
| 562 | | | bridge_identifier_bridge_priority, |
| 563 | | | bridge_identifier_mac_str); |
| 564 | | | bridge_id_tree = proto_item_add_subtree(bridge_id_item, ett_bridge_id); |
| 565 | | | proto_tree_add_uint(bridge_id_tree, hf_bpdu_bridge_prio, tvb, |
| 566 | | | BPDU_BRIDGE_IDENTIFIER , 2, |
| 567 | | | bridge_identifier_bridge_priority); |
| 568 | | | proto_tree_add_ether_format_value(bridge_id_tree, hf_bpdu_bridge_mac, |
| 569 | | | tvb, BPDU_BRIDGE_IDENTIFIER + 2, 6, |
| 570 | | | bridge_identifier_mac, |
| 571 | | | "%s", bridge_identifier_mac_str); |
| 572 | | | } |
| 573 | | | |
| 574 | | | |
| 575 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_port_id, tvb, |
| 576 | | | BPDU_PORT_IDENTIFIER, 2, port_identifier); |
| 577 | | | message_age = tvb_get_ntohs(tvb, BPDU_MESSAGE_AGE) / 256.0; |
| 578 | | | proto_tree_add_double(bpdu_tree, hf_bpdu_msg_age, tvb, BPDU_MESSAGE_AGE, 2, |
| 579 | | | message_age); |
| 580 | | | max_age = tvb_get_ntohs(tvb, BPDU_MAX_AGE) / 256.0; |
| 581 | | | proto_tree_add_double(bpdu_tree, hf_bpdu_max_age, tvb, BPDU_MAX_AGE, 2, |
| 582 | | | max_age); |
| 583 | | | hello_time = tvb_get_ntohs(tvb, BPDU_HELLO_TIME) / 256.0; |
| 584 | | | proto_tree_add_double(bpdu_tree, hf_bpdu_hello_time, tvb, |
| 585 | | | BPDU_HELLO_TIME, 2, hello_time); |
| 586 | | | forward_delay = tvb_get_ntohs(tvb, BPDU_FORWARD_DELAY) / 256.0; |
| 587 | | | proto_tree_add_double(bpdu_tree, hf_bpdu_forward_delay, tvb, |
| 588 | | | BPDU_FORWARD_DELAY, 2, forward_delay); |
| 589 | | | |
| 590 | | | if (bpdu_type == BPDU_TYPE_CONF) { |
| 591 | | | |
| 592 | | | set_actual_length(tvb, CONF_BPDU_SIZE); |
| 593 | | | return; |
| 594 | | | } |
| 595 | | | |
| 596 | | | |
| 597 | | | version_1_length = tvb_get_guint8(tvb, BPDU_VERSION_1_LENGTH); |
| 598 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_version_1_length, tvb, |
| 599 | | | BPDU_VERSION_1_LENGTH, 1, version_1_length); |
| 600 | | | |
| 601 | | | if (protocol_version_identifier >= 3 && version_1_length == 0 && |
| 602 | | | tvb_reported_length(tvb) >= 102) { |
| 603 | | | |
| 604 | | | |
| 605 | | | |
| 606 | | | |
| 607 | | | |
| 608 | | | |
| 609 | | | version_3_length = tvb_get_ntohs(tvb, BPDU_VERSION_3_LENGTH); |
| 610 | | | proto_tree_add_uint(bpdu_tree, hf_bpdu_version_3_length, tvb, |
| 611 | | | BPDU_VERSION_3_LENGTH, 2, version_3_length); |
| 612 | | | |
| 613 | | | |
| 614 | | | |
| 615 | | | |
| 616 | | | |
| 617 | | | |
| 618 | | | |
| 619 | | | |
| 620 | | | |
| 621 | | | config_format_selector = tvb_get_guint8(tvb, BPDU_MST_CONFIG_FORMAT_SELECTOR); |
| 622 | | | if (version_3_length != 0) { |
| 623 | | | msti_format = MSTI_FORMAT_IEEE_8021S; |
| 624 | | | if (version_3_length >= VERSION_3_STATIC_LENGTH) { |
| 625 | | | total_msti_length = version_3_length - VERSION_3_STATIC_LENGTH; |
| 626 | | | } else { |
| 627 | | | |
| 628 | | | |
| 629 | | | |
| 630 | | | |
| 631 | | | |
| 632 | | | |
| 633 | | | |
| 634 | | | |
| 635 | | | |
| 636 | | | |
| 637 | | | |
| 638 | | | |
| 639 | | | |
| 640 | | | |
| 641 | | | |
| 642 | | | |
| 643 | | | |
| 644 | | | |
| 645 | | | |
| 646 | | | |
| 647 | | | |
| 648 | | | |
| 649 | | | |
| 650 | | | total_msti_length = version_3_length * MSTI_MESSAGE_SIZE; |
| 651 | | | } |
| 652 | | | } else { |
| 653 | | | if (tvb_reported_length(tvb) == (guint)config_format_selector + MST_BPDU_SIZE + 1 ) { |
| 654 | | | msti_format = MSTI_FORMAT_ALTERNATIVE; |
| 655 | | | total_msti_length = config_format_selector - VERSION_3_STATIC_LENGTH; |
| 656 | | | } else { |
| 657 | | | |
| 658 | | | |
| 659 | | | |
| 660 | | | |
| 661 | | | msti_format = MSTI_FORMAT_UNKNOWN; |
| 662 | | | total_msti_length = 0; |
| 663 | | | } |
| 664 | | | |
| 665 | | | } |
| 666 | | | set_actual_length(tvb, BPDU_MSTI + total_msti_length); |
| 667 | | | |
| 668 | | | mstp_item = proto_tree_add_text(bpdu_tree, tvb, BPDU_VERSION_3_LENGTH, |
| 669 | | | -1, "MST Extension"); |
| 670 | | | mstp_tree = proto_item_add_subtree(mstp_item, ett_mstp); |
| 671 | | | |
| 672 | | | proto_tree_add_item(mstp_tree, hf_bpdu_mst_config_format_selector, tvb, |
| 673 | | | BPDU_MST_CONFIG_FORMAT_SELECTOR, 1, FALSE); |
| 674 | | | proto_tree_add_item(mstp_tree, hf_bpdu_mst_config_name, tvb, |
| 675 | | | BPDU_MST_CONFIG_NAME, 32, FALSE); |
| 676 | | | |
| 677 | | | proto_tree_add_item(mstp_tree, hf_bpdu_mst_config_revision_level, tvb, |
| 678 | | | BPDU_MST_CONFIG_REVISION_LEVEL, 2, FALSE); |
| 679 | | | proto_tree_add_item(mstp_tree, hf_bpdu_mst_config_digest, tvb, |
| 680 | | | BPDU_MST_CONFIG_DIGEST, 16, FALSE); |
| 681 | | | |
| 682 | | | switch(msti_format) { |
| 683 | | | |
| 684 | | | case MSTI_FORMAT_IEEE_8021S: |
| 685 | | | proto_tree_add_item(mstp_tree, hf_bpdu_cist_internal_root_path_cost, tvb, |
| 686 | | | BPDU_CIST_INTERNAL_ROOT_PATH_COST, 4, FALSE); |
| 687 | | | |
| 688 | | | cist_bridge_identifier_bridge_priority = tvb_get_ntohs(tvb,BPDU_CIST_BRIDGE_IDENTIFIER); |
| 689 | | | cist_bridge_identifier_mac = tvb_get_ptr(tvb, BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6); |
| 690 | | | cist_bridge_identifier_mac_str = ether_to_str(cist_bridge_identifier_mac); |
| 691 | | | |
| 692 | | | |
| 693 | | | |
| 694 | | | |
| 695 | | | if (bpdu_use_system_id_extensions ) { |
| 696 | | | cist_bridge_identifier_system_id_extension = cist_bridge_identifier_bridge_priority & 0x0fff; |
| 697 | | | cist_bridge_identifier_bridge_priority &= 0xf000; |
| 698 | | | |
| 699 | | | cist_bridge_id_item = proto_tree_add_text(mstp_tree, tvb, |
| 700 | | | BPDU_CIST_BRIDGE_IDENTIFIER, 8, |
| 701 | | | "CIST Bridge Identifier: %d / %d / %s", |
| 702 | | | cist_bridge_identifier_bridge_priority, |
| 703 | | | cist_bridge_identifier_system_id_extension, |
| 704 | | | cist_bridge_identifier_mac_str); |
| 705 | | | cist_bridge_id_tree = proto_item_add_subtree(cist_bridge_id_item, ett_cist_bridge_id); |
| 706 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_prio, tvb, |
| 707 | | | BPDU_CIST_BRIDGE_IDENTIFIER , 1, |
| 708 | | | cist_bridge_identifier_bridge_priority); |
| 709 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_sys_id_ext, tvb, |
| 710 | | | BPDU_CIST_BRIDGE_IDENTIFIER , 2, |
| 711 | | | cist_bridge_identifier_system_id_extension); |
| 712 | | | proto_tree_add_ether_format_value(cist_bridge_id_tree, hf_bpdu_cist_bridge_mac, |
| 713 | | | tvb, BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6, |
| 714 | | | cist_bridge_identifier_mac, |
| 715 | | | "%s", cist_bridge_identifier_mac_str); |
| 716 | | | } else { |
| 717 | | | cist_bridge_id_item = proto_tree_add_text(mstp_tree, tvb, |
| 718 | | | BPDU_CIST_BRIDGE_IDENTIFIER, 8, |
| 719 | | | "CIST Bridge Identifier: %d / %s", |
| 720 | | | cist_bridge_identifier_bridge_priority, |
| 721 | | | cist_bridge_identifier_mac_str); |
| 722 | | | cist_bridge_id_tree = proto_item_add_subtree(cist_bridge_id_item, ett_cist_bridge_id); |
| 723 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_prio, tvb, |
| 724 | | | BPDU_CIST_BRIDGE_IDENTIFIER , 2, |
| 725 | | | cist_bridge_identifier_bridge_priority); |
| 726 | | | proto_tree_add_ether_format_value(cist_bridge_id_tree, hf_bpdu_cist_bridge_mac, |
| 727 | | | tvb, BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6, |
| 728 | | | cist_bridge_identifier_mac, |
| 729 | | | "%s", cist_bridge_identifier_mac_str); |
| 730 | | | } |
| 731 | | | |
| 732 | | | |
| 733 | | | break; |
| 734 | | | |
| 735 | | | case MSTI_FORMAT_ALTERNATIVE: |
| 736 | | | cist_bridge_identifier_bridge_priority = tvb_get_ntohs(tvb,ALT_BPDU_CIST_BRIDGE_IDENTIFIER); |
| 737 | | | cist_bridge_identifier_mac = tvb_get_ptr(tvb, ALT_BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6); |
| 738 | | | cist_bridge_identifier_mac_str = ether_to_str(cist_bridge_identifier_mac); |
| 739 | | | |
| 740 | | | |
| 741 | | | |
| 742 | | | |
| 743 | | | if (bpdu_use_system_id_extensions ) { |
| 744 | | | cist_bridge_identifier_system_id_extension = cist_bridge_identifier_bridge_priority & 0x0fff; |
| 745 | | | cist_bridge_identifier_bridge_priority &= 0xf000; |
| 746 | | | |
| 747 | | | cist_bridge_id_item = proto_tree_add_text(mstp_tree, tvb, |
| 748 | | | ALT_BPDU_CIST_BRIDGE_IDENTIFIER, 8, |
| 749 | | | "CIST Bridge Identifier: %d / %d / %s", |
| 750 | | | cist_bridge_identifier_bridge_priority, |
| 751 | | | cist_bridge_identifier_system_id_extension, |
| 752 | | | cist_bridge_identifier_mac_str); |
| 753 | | | cist_bridge_id_tree = proto_item_add_subtree(cist_bridge_id_item, ett_cist_bridge_id); |
| 754 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_prio, tvb, |
| 755 | | | ALT_BPDU_CIST_BRIDGE_IDENTIFIER , 1, |
| 756 | | | cist_bridge_identifier_bridge_priority); |
| 757 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_sys_id_ext, tvb, |
| 758 | | | ALT_BPDU_CIST_BRIDGE_IDENTIFIER , 2, |
| 759 | | | cist_bridge_identifier_system_id_extension); |
| 760 | | | proto_tree_add_ether_format_value(cist_bridge_id_tree, hf_bpdu_cist_bridge_mac, |
| 761 | | | tvb, ALT_BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6, |
| 762 | | | cist_bridge_identifier_mac, |
| 763 | | | "%s", cist_bridge_identifier_mac_str); |
| 764 | | | } else { |
| 765 | | | cist_bridge_id_item = proto_tree_add_text(mstp_tree, tvb, |
| 766 | | | ALT_BPDU_CIST_BRIDGE_IDENTIFIER, 8, |
| 767 | | | "CIST Bridge Identifier: %d / %s", |
| 768 | | | cist_bridge_identifier_bridge_priority, |
| 769 | | | cist_bridge_identifier_mac_str); |
| 770 | | | cist_bridge_id_tree = proto_item_add_subtree(cist_bridge_id_item, ett_cist_bridge_id); |
| 771 | | | proto_tree_add_uint(cist_bridge_id_tree, hf_bpdu_cist_bridge_prio, tvb, |
| 772 | | | ALT_BPDU_CIST_BRIDGE_IDENTIFIER , 2, |
| 773 | | | cist_bridge_identifier_bridge_priority); |
| 774 | | | proto_tree_add_ether_format_value(cist_bridge_id_tree, hf_bpdu_cist_bridge_mac, |
| 775 | | | tvb, ALT_BPDU_CIST_BRIDGE_IDENTIFIER + 2, 6, |
| 776 | | | cist_bridge_identifier_mac, |
| 777 | | | "%s", cist_bridge_identifier_mac_str); |
| 778 | | | } |
| 779 | | | |
| 780 | | | |
| 781 | | | proto_tree_add_item(mstp_tree, hf_bpdu_cist_internal_root_path_cost, tvb, |
| 782 | | | ALT_BPDU_CIST_INTERNAL_ROOT_PATH_COST, 4, FALSE); |
| 783 | | | |
| 784 | | | break; |
| 785 | | | } |
| 786 | | | |
| 787 | | | proto_tree_add_item(mstp_tree, hf_bpdu_cist_remaining_hops, tvb, |
| 788 | | | BPDU_CIST_REMAINING_HOPS, 1, FALSE); |
| 789 | | | |
| 790 | | | offset = BPDU_MSTI; |
| 791 | | | msti = 1; |
| 792 | | | while (total_msti_length > 0) { |
| 793 | | | switch(msti_format) { |
| 794 | | | |
| 795 | | | case MSTI_FORMAT_IEEE_8021S: |
| 796 | | | msti_regional_root_mstid = tvb_get_guint8(tvb, offset+ MSTI_REGIONAL_ROOT); |
| 797 | | | msti_regional_root_priority = (msti_regional_root_mstid &0xf0) << 8; |
| 798 | | | msti_regional_root_mstid = ((msti_regional_root_mstid & 0x0f) << 8) + |
| 799 | | | tvb_get_guint8(tvb, offset+ MSTI_REGIONAL_ROOT+1); |
| 800 | | | msti_regional_root_mac = tvb_get_ptr(tvb, offset+ MSTI_REGIONAL_ROOT + 2, 6); |
| 801 | | | msti_regional_root_mac_str = ether_to_str(msti_regional_root_mac); |
| 802 | | | |
| 803 | | | msti_item = proto_tree_add_text(mstp_tree, tvb, offset, 16, |
| 804 | | | "MSTID %d, Regional Root Identifier %d / %s", |
| 805 | | | msti_regional_root_mstid, |
| 806 | | | msti_regional_root_priority, |
| 807 | | | msti_regional_root_mac_str); |
| 808 | | | msti_tree = proto_item_add_subtree(msti_item, ett_msti); |
| 809 | | | |
| 810 | | | |
| 811 | | | flags = tvb_get_guint8(tvb, offset+MSTI_FLAGS); |
| 812 | | | flags_item = proto_tree_add_uint(msti_tree, hf_bpdu_msti_flags, tvb, |
| 813 | | | offset+MSTI_FLAGS, 1, flags); |
| 814 | | | flags_tree = proto_item_add_subtree(flags_item, ett_bpdu_flags); |
| 815 | | | |
| 816 | | | sep = initial_sep; |
| 817 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TCACK, flags_item, "%sMaster");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 818 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tcack, tvb, |
| 819 | | | offset+MSTI_FLAGS, 1, flags); |
| 820 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_AGREEMENT, flags_item, "%sAgreement");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 821 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_agreement, tvb, |
| 822 | | | offset+MSTI_FLAGS, 1, flags); |
| 823 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_FORWARDING, flags_item, "%sForwarding");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 824 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_forwarding, tvb, |
| 825 | | | offset+MSTI_FLAGS, 1, flags); |
| 826 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_LEARNING, flags_item, "%sLearning");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 827 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_learning, tvb, |
| 828 | | | offset+MSTI_FLAGS, 1, flags); |
| 829 | | | if (flags_item) { |
| 830 | | | guint8 port_role; |
| 831 | | | port_role = (flags & BPDU_FLAGS_PORT_ROLE_MASK) >> BPDU_FLAGS_PORT_ROLE_SHIFT; |
| 832 | | | proto_item_append_text(flags_item, "%sPort Role: %s", sep, |
| 833 | | | val_to_str(port_role, role_vals, |
| 834 | | | "Unknown (%u)")); |
| 835 | | | } |
| 836 | | | proto_tree_add_uint(flags_tree, hf_bpdu_flags_port_role, tvb, |
| 837 | | | offset+MSTI_FLAGS, 1, flags); |
| 838 | | | sep = cont_sep; |
| 839 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_PROPOSAL, flags_item, "%sProposal");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 840 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_proposal, tvb, |
| 841 | | | offset+MSTI_FLAGS, 1, flags); |
| 842 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TC, flags_item, "%sTopology Change");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 843 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tc, tvb, |
| 844 | | | offset+MSTI_FLAGS, 1, flags); |
| 845 | | | if (sep != initial_sep) { |
| 846 | | | proto_item_append_text(flags_item, ")"); |
| 847 | | | } |
| 848 | | | |
| 849 | | | |
| 850 | | | hidden_item = proto_tree_add_ether(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, |
| 851 | | | offset + MSTI_REGIONAL_ROOT + 2, 6, |
| 852 | | | msti_regional_root_mac); |
| 853 | | | PROTO_ITEM_SET_HIDDEN(hidden_item);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 854 | | | proto_tree_add_text(msti_tree, tvb, offset + MSTI_REGIONAL_ROOT, 8, |
| 855 | | | "MSTID %d, priority %d Root Identifier %s", |
| 856 | | | msti_regional_root_mstid, |
| 857 | | | msti_regional_root_priority, |
| 858 | | | msti_regional_root_mac_str); |
| 859 | | | |
| 860 | | | |
| 861 | | | proto_tree_add_item(msti_tree, hf_bpdu_msti_internal_root_path_cost, tvb, |
| 862 | | | offset+MSTI_INTERNAL_ROOT_PATH_COST, 4, FALSE); |
| 863 | | | |
| 864 | | | msti_bridge_identifier_priority = tvb_get_guint8(tvb, offset+MSTI_BRIDGE_IDENTIFIER_PRIORITY) >> 4; |
| 865 | | | msti_port_identifier_priority = tvb_get_guint8(tvb, offset+MSTI_PORT_IDENTIFIER_PRIORITY) >> 4; |
| 866 | | | |
| 867 | | | proto_tree_add_uint(msti_tree, hf_bpdu_msti_bridge_identifier_priority, tvb, |
| 868 | | | offset+MSTI_BRIDGE_IDENTIFIER_PRIORITY, 1, |
| 869 | | | msti_bridge_identifier_priority); |
| 870 | | | proto_tree_add_uint(msti_tree, hf_bpdu_msti_port_identifier_priority, tvb, |
| 871 | | | offset+MSTI_PORT_IDENTIFIER_PRIORITY, 1, |
| 872 | | | msti_port_identifier_priority); |
| 873 | | | |
| 874 | | | proto_tree_add_item(msti_tree, hf_bpdu_msti_remaining_hops, tvb, |
| 875 | | | offset + MSTI_REMAINING_HOPS, 1, FALSE); |
| 876 | | | |
| 877 | | | total_msti_length -= MSTI_MESSAGE_SIZE; |
| 878 | | | offset += MSTI_MESSAGE_SIZE; |
| 879 | | | break; |
| 880 | | | |
| 881 | | | case MSTI_FORMAT_ALTERNATIVE: |
| 882 | | | msti_regional_root_mstid = tvb_get_guint8(tvb, offset+ ALT_MSTI_REGIONAL_ROOT); |
| 883 | | | msti_regional_root_priority = (msti_regional_root_mstid &0xf0) << 8; |
| 884 | | | msti_regional_root_mstid = ((msti_regional_root_mstid & 0x0f) << 8) + |
| 885 | | | tvb_get_guint8(tvb, offset+ ALT_MSTI_REGIONAL_ROOT+1); |
| 886 | | | msti_regional_root_mac = tvb_get_ptr(tvb, offset+ ALT_MSTI_REGIONAL_ROOT + 2, 6); |
| 887 | | | msti_regional_root_mac_str = ether_to_str(msti_regional_root_mac); |
| 888 | | | |
| 889 | | | msti_item = proto_tree_add_text(mstp_tree, tvb, offset, 16, |
| 890 | | | "MSTID %d, Regional Root Identifier %d / %s", |
| 891 | | | msti_regional_root_mstid, |
| 892 | | | msti_regional_root_priority, |
| 893 | | | msti_regional_root_mac_str); |
| 894 | | | msti_tree = proto_item_add_subtree(msti_item, ett_msti); |
| 895 | | | |
| 896 | | | msti_mstid = tvb_get_ntohs(tvb, offset+ ALT_MSTI_MSTID); |
| 897 | | | proto_tree_add_text(msti_tree, tvb, offset+ALT_MSTI_MSTID, 2, |
| 898 | | | "MSTID: %d", msti_mstid); |
| 899 | | | |
| 900 | | | |
| 901 | | | flags = tvb_get_guint8(tvb, offset+ALT_MSTI_FLAGS); |
| 902 | | | flags_item = proto_tree_add_uint(msti_tree, hf_bpdu_msti_flags, tvb, |
| 903 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 904 | | | flags_tree = proto_item_add_subtree(flags_item, ett_bpdu_flags); |
| 905 | | | |
| 906 | | | sep = initial_sep; |
| 907 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TCACK, flags_item, "%sMaster");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 908 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tcack, tvb, |
| 909 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 910 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_AGREEMENT, flags_item, "%sAgreement");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 911 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_agreement, tvb, |
| 912 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 913 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_FORWARDING, flags_item, "%sForwarding");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 914 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_forwarding, tvb, |
| 915 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 916 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_LEARNING, flags_item, "%sLearning");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 917 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_learning, tvb, |
| 918 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 919 | | | if (flags_item) { |
| 920 | | | guint8 port_role; |
| 921 | | | port_role = (flags & BPDU_FLAGS_PORT_ROLE_MASK) >> BPDU_FLAGS_PORT_ROLE_SHIFT; |
| 922 | | | proto_item_append_text(flags_item, "%sPort Role: %s", sep, |
| 923 | | | val_to_str(port_role, role_vals, |
| 924 | | | "Unknown (%u)")); |
| 925 | | | } |
| 926 | | | proto_tree_add_uint(flags_tree, hf_bpdu_flags_port_role, tvb, |
| 927 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 928 | | | sep = cont_sep; |
| 929 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_PROPOSAL, flags_item, "%sProposal");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 930 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_proposal, tvb, |
| 931 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 932 | | | APPEND_BOOLEAN_FLAG(flags & BPDU_FLAGS_TC, flags_item, "%sTopology Change");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bpdu.c |
| |
204 | #define APPEND_BOOLEAN_FLAG(flag, item, string) \ |
205 | if(flag){ \ |
206 | if(item) \ |
207 | proto_item_append_text(item, string, sep); \ |
208 | sep = cont_sep; \ |
209 | } |
| |
|
| 933 | | | proto_tree_add_boolean(flags_tree, hf_bpdu_flags_tc, tvb, |
| 934 | | | offset+ALT_MSTI_FLAGS, 1, flags); |
| 935 | | | if (sep != initial_sep) { |
| 936 | | | proto_item_append_text(flags_item, ")"); |
| 937 | | | } |
| 938 | | | |
| 939 | | | |
| 940 | | | hidden_item = proto_tree_add_ether(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, |
| 941 | | | offset + ALT_MSTI_REGIONAL_ROOT + 2, 6, |
| 942 | | | msti_regional_root_mac); |
| 943 | | | PROTO_ITEM_SET_HIDDEN(hidden_item);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 944 | | | proto_tree_add_text(msti_tree, tvb, offset + ALT_MSTI_REGIONAL_ROOT, 8, |
| 945 | | | "MSTI Regional Root Identifier: %d / %d / %s", |
| 946 | | | msti_regional_root_mstid, |
| 947 | | | msti_regional_root_priority, |
| 948 | | | msti_regional_root_mac_str); |
| 949 | | | |
| 950 | | | |
| 951 | | | proto_tree_add_item(msti_tree, hf_bpdu_msti_internal_root_path_cost, tvb, |
| 952 | | | offset+ALT_MSTI_INTERNAL_ROOT_PATH_COST, 4, FALSE); |
| 953 | | | |
| 954 | | | msti_bridge_identifier_priority = tvb_get_ntohs(tvb, offset+ALT_MSTI_BRIDGE_IDENTIFIER); |
| 955 | | | msti_bridge_identifier_mac = tvb_get_ptr(tvb, offset+ALT_MSTI_BRIDGE_IDENTIFIER + 2, 6); |
| 956 | | | msti_bridge_identifier_mac_str = ether_to_str(msti_bridge_identifier_mac); |
| 957 | | | proto_tree_add_text(msti_tree, tvb, offset+ALT_MSTI_BRIDGE_IDENTIFIER, 8, |
| 958 | | | "MSTI Bridge Identifier: %d / %d / %s", |
| 959 | | | msti_bridge_identifier_priority & 0x0fff, |
| 960 | | | msti_bridge_identifier_priority & 0xf000, |
| 961 | | | msti_bridge_identifier_mac_str); |
| 962 | | | |
| 963 | | | msti_port_identifier_priority = tvb_get_ntohs(tvb, offset+ALT_MSTI_PORT_IDENTIFIER); |
| 964 | | | proto_tree_add_uint(msti_tree, hf_bpdu_msti_port_id, tvb, |
| 965 | | | offset+ALT_MSTI_PORT_IDENTIFIER, 2, msti_port_identifier_priority); |
| 966 | | | |
| 967 | | | proto_tree_add_item(msti_tree, hf_bpdu_msti_remaining_hops, tvb, |
| 968 | | | offset + ALT_MSTI_REMAINING_HOPS, 1, FALSE); |
| 969 | | | |
| 970 | | | total_msti_length -= ALT_MSTI_MESSAGE_SIZE; |
| 971 | | | offset += ALT_MSTI_MESSAGE_SIZE; |
| 972 | | | break; |
| 973 | | | |
| 974 | | | } |
| 975 | | | msti++; |
| 976 | | | } |
| 977 | | | } |
| 978 | | | } |
| 979 | | | } |
| |