(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-pim.c) |
| |
| 600 | | | dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { |
| 601 | | | int offset = 0; |
| 602 | | | guint8 pim_typever; |
| 603 | | | guint length, pim_length; |
| 604 | | | guint16 pim_cksum, computed_cksum; |
| 605 | | | vec_t cksum_vec[4]; |
| 606 | | | guint32 phdr[2]; |
| 607 | | | const char *typestr; |
| 608 | | | proto_tree *pim_tree = NULL; |
| 609 | | | proto_item *ti; |
| 610 | | | proto_tree *pimopt_tree = NULL; |
| 611 | | | proto_item *tiopt; |
| 612 | | | |
| 613 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 614 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "PIM"); |
| 615 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 616 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 617 | | | |
| 618 | | | pim_typever = tvb_get_guint8(tvb, 0); |
| 619 | | | |
| 620 | | | switch (PIM_VER(pim_typever)) { |
| 621 | | | case 2: |
| 622 | | | typestr = val_to_str(PIM_TYPE(pim_typever), type2vals, "Unknown (%u)"); |
| 623 | | | break; |
| 624 | | | case 1: |
| 625 | | | default: |
| 626 | | | typestr = "Unknown"; |
| 627 | | | break; |
| 628 | | | } |
| 629 | | | |
| 630 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) { |
| 631 | | | col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "PIMv%d", |
| 632 | | | PIM_VER(pim_typever)); |
| 633 | | | } |
| 634 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 635 | | | col_add_str(pinfo->cinfo, COL_INFO, typestr); |
| 636 | | | |
| 637 | | | if (tree) { |
| 638 | | | ti = proto_tree_add_item(tree, proto_pim, tvb, offset, -1, FALSE); |
| 639 | | | pim_tree = proto_item_add_subtree(ti, ett_pim); |
| 640 | | | |
| 641 | | | proto_tree_add_uint(pim_tree, hf_pim_version, tvb, offset, 1, |
| 642 | | | PIM_VER(pim_typever)); |
| 643 | | | proto_tree_add_uint(pim_tree, hf_pim_type, tvb, offset, 1, |
| 644 | | | PIM_TYPE(pim_typever)); |
| 645 | | | |
| 646 | | | pim_cksum = tvb_get_ntohs(tvb, offset + 2); |
| 647 | | | length = tvb_length(tvb); |
| 648 | | | if (PIM_VER(pim_typever) == 2) { |
| 649 | | | |
| 650 | | | |
| 651 | | | |
| 652 | | | |
| 653 | | | |
| 654 | | | if (PIM_TYPE(pim_typever) == 1) { |
| 655 | | | |
| 656 | | | |
| 657 | | | |
| 658 | | | |
| 659 | | | |
| 660 | | | |
| 661 | | | pim_length = 8; |
| 662 | | | col_set_writable(pinfo->cinfo, FALSE); |
| 663 | | | } else { |
| 664 | | | |
| 665 | | | |
| 666 | | | |
| 667 | | | pim_length = tvb_reported_length(tvb); |
| 668 | | | } |
| 669 | | | } else { |
| 670 | | | |
| 671 | | | |
| 672 | | | |
| 673 | | | |
| 674 | | | pim_length = 0; |
| 675 | | | } |
| 676 | | | if (!pinfo->fragmented && length >= pim_length) { |
| 677 | | | |
| 678 | | | |
| 679 | | | |
| 680 | | | |
| 681 | | | |
| 682 | | | switch (pinfo->src.type) { |
| 683 | | | case AT_IPv4: |
| 684 | | | cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, pim_length); |
| 685 | | | cksum_vec[0].len = pim_length; |
| 686 | | | computed_cksum = in_cksum(&cksum_vec[0], 1); |
| 687 | | | break; |
| 688 | | | case AT_IPv6: |
| 689 | | | |
| 690 | | | cksum_vec[0].ptr = pinfo->src.data; |
| 691 | | | cksum_vec[0].len = pinfo->src.len; |
| 692 | | | cksum_vec[1].ptr = pinfo->dst.data; |
| 693 | | | cksum_vec[1].len = pinfo->dst.len; |
| 694 | | | cksum_vec[2].ptr = (const guint8 *)&phdr; |
| 695 | | | phdr[0] = g_htonl(pim_length);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
349 | #define g_htonl(val) (GUINT32_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
196 | #define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
229 | # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
203 | # define GUINT32_SWAP_LE_BE_IA32(val) \ |
204 | (__extension__ \ |
205 | ({ register guint32 __v, __x = ((guint32) (val)); \ |
206 | if (__builtin_constant_p (__x)) \ |
207 | __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ |
208 | else \ |
209 | __asm__ ("bswap %0" \ |
210 | : "=r" (__v) \ |
211 | : "0" (__x)); \ |
212 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
147 | #define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ |
148 | (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ |
149 | (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ |
150 | (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ |
151 | (((guint32) (val) & (guint32) 0xff000000U) >> 24))) |
| |
|
| 696 | | | phdr[1] = g_htonl(IP_PROTO_PIM);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
349 | #define g_htonl(val) (GUINT32_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
196 | #define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
229 | # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
203 | # define GUINT32_SWAP_LE_BE_IA32(val) \ |
204 | (__extension__ \ |
205 | ({ register guint32 __v, __x = ((guint32) (val)); \ |
206 | if (__builtin_constant_p (__x)) \ |
207 | __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ |
208 | else \ |
209 | __asm__ ("bswap %0" \ |
210 | : "=r" (__v) \ |
211 | : "0" (__x)); \ |
212 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
147 | #define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ |
148 | (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ |
149 | (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ |
150 | (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ |
151 | (((guint32) (val) & (guint32) 0xff000000U) >> 24))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ipproto.h |
| |
152 | #define IP_PROTO_PIM 103 /* Protocol Independent Mcast */ |
| |
|
| 697 | | | cksum_vec[2].len = 8; |
| 698 | | | cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, pim_length); |
| 699 | | | cksum_vec[3].len = pim_length; |
| 700 | | | computed_cksum = in_cksum(&cksum_vec[0], 4); |
| 701 | | | break; |
| 702 | | | default: |
| 703 | | | |
| 704 | | | computed_cksum = 0; |
| 705 | | | DISSECTOR_ASSERT_NOT_REACHED();
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
131 | #define DISSECTOR_ASSERT_NOT_REACHED() \ |
132 | (REPORT_DISSECTOR_BUG( \ |
133 | ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \ |
134 | __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 706 | | | break; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 707 | | | } |
| 708 | | | |
| 709 | | | if (computed_cksum == 0) { |
| 710 | | | proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb, |
| 711 | | | offset + 2, 2, pim_cksum, |
| 712 | | | "Checksum: 0x%04x [correct]", |
| 713 | | | pim_cksum); |
| 714 | | | } else { |
| 715 | | | proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb, |
| 716 | | | offset + 2, 2, pim_cksum, |
| 717 | | | "Checksum: 0x%04x [incorrect, should be 0x%04x]", |
| 718 | | | pim_cksum, in_cksum_shouldbe(pim_cksum, computed_cksum)); |
| 719 | | | } |
| 720 | | | } else { |
| 721 | | | proto_tree_add_uint(pim_tree, hf_pim_cksum, tvb, |
| 722 | | | offset + 2, 2, pim_cksum); |
| 723 | | | } |
| 724 | | | |
| 725 | | | offset += 4; |
| 726 | | | |
| 727 | | | if (tvb_reported_length_remaining(tvb, offset) > 0) { |
| 728 | | | tiopt = proto_tree_add_text(pim_tree, tvb, offset, -1, |
| 729 | | | "PIM parameters"); |
| 730 | | | pimopt_tree = proto_item_add_subtree(tiopt, ett_pim); |
| 731 | | | } else |
| 732 | | | goto done; |
| 733 | | | |
| 734 | | | if (PIM_VER(pim_typever) != 2) |
| 735 | | | goto done; |
| 736 | | | |
| 737 | | | |
| 738 | | | switch (PIM_TYPE(pim_typever)) { |
| 739 | | | case 0: |
| 740 | | | { |
| 741 | | | while (tvb_reported_length_remaining(tvb, offset) >= 2) { |
| 742 | | | guint16 hello_opt, opt_len; |
| 743 | | | guint16 holdtime; |
| 744 | | | guint16 lan_delay; |
| 745 | | | guint16 override_interval; |
| 746 | | | guint32 priority; |
| 747 | | | guint32 opt_value = 0; |
| 748 | | | |
| 749 | | | hello_opt = tvb_get_ntohs(tvb, offset); |
| 750 | | | opt_len = tvb_get_ntohs(tvb, offset + 2); |
| 751 | | | |
| 752 | | | if(opt_len == 2) |
| 753 | | | opt_value = tvb_get_ntohs(tvb, offset + 4); |
| 754 | | | if(opt_len == 4) |
| 755 | | | opt_value = tvb_get_ntohl(tvb, offset + 4); |
| 756 | | | |
| 757 | | | switch(hello_opt) { |
| 758 | | | case 1: |
| 759 | | | holdtime = opt_value; |
| 760 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 761 | | | "Holdtime (%u): %us %s", hello_opt, holdtime, |
| 762 | | | holdtime == 0xffff ? " (infty)" : ""); |
| 763 | | | break; |
| 764 | | | case 2: |
| 765 | | | |
| 766 | | | |
| 767 | | | |
| 768 | | | |
| 769 | | | |
| 770 | | | |
| 771 | | | |
| 772 | | | |
| 773 | | | |
| 774 | | | { |
| 775 | | | proto_tree *sub_tree = NULL; |
| 776 | | | proto_item *landelay_option; |
| 777 | | | |
| 778 | | | landelay_option = proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 779 | | | "LAN Prune Delay (%u)", hello_opt); |
| 780 | | | sub_tree = proto_item_add_subtree(landelay_option, ett_pim); |
| 781 | | | |
| 782 | | | lan_delay = (opt_value & 0x7fff0000) >> 16; |
| 783 | | | override_interval = opt_value & 0x0000ffff; |
| 784 | | | proto_tree_add_text(sub_tree, tvb, offset + 4, 1, |
| 785 | | | "T bit is %s", |
| 786 | | | (opt_value & 0x80000000) ? "set" : "not set"); |
| 787 | | | proto_tree_add_text(sub_tree, tvb, offset + 4, 2, |
| 788 | | | "LAN Delay: %ums", lan_delay); |
| 789 | | | proto_tree_add_text(sub_tree, tvb, offset + 6, 2, |
| 790 | | | "Override Interval: %ums", override_interval); |
| 791 | | | break; |
| 792 | | | } |
| 793 | | | case 19: |
| 794 | | | priority = opt_value; |
| 795 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 796 | | | "DR Priority (%u): %u", hello_opt, priority); |
| 797 | | | break; |
| 798 | | | case 20: |
| 799 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 800 | | | "Generation ID (%u): %d", hello_opt, opt_value); |
| 801 | | | break; |
| 802 | | | |
| 803 | | | case 24: |
| 804 | | | case 65001: |
| 805 | | | { |
| 806 | | | int i; |
| 807 | | | proto_tree *sub_tree = NULL; |
| 808 | | | proto_item *addrlist_option; |
| 809 | | | |
| 810 | | | addrlist_option = proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 811 | | | "%sAddress List (%u)", |
| 812 | | | hello_opt == 65001 ? "old " : "", |
| 813 | | | hello_opt); |
| 814 | | | sub_tree = proto_item_add_subtree(addrlist_option, ett_pim); |
| 815 | | | |
| 816 | | | for (i = offset + 4; i < offset + 4 + opt_len; ) { |
| 817 | | | int advance; |
| 818 | | | const char *s; |
| 819 | | | |
| 820 | | | s = dissect_pim_addr(tvb, i, pimv2_unicast, &advance); |
| 821 | | | if (s == NULL) |
| 822 | | | break; |
| 823 | | | proto_tree_add_text(sub_tree, tvb, offset, |
| 824 | | | advance, "Address: %s", s); |
| 825 | | | i += advance; |
| 826 | | | } |
| 827 | | | break; |
| 828 | | | } |
| 829 | | | default: |
| 830 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, |
| 831 | | | "Unknown option (%u), length: %u, value: 0x%x", |
| 832 | | | hello_opt, opt_len, opt_value); |
| 833 | | | break; |
| 834 | | | } |
| 835 | | | offset += 4 + opt_len; |
| 836 | | | } |
| 837 | | | break; |
| 838 | | | } |
| 839 | | | |
| 840 | | | case 1: |
| 841 | | | { |
| 842 | | | guint32 flags; |
| 843 | | | guint8 v_hl; |
| 844 | | | tvbuff_t *next_tvb; |
| 845 | | | proto_tree *flag_tree = NULL; |
| 846 | | | proto_item *tiflag; |
| 847 | | | |
| 848 | | | flags = tvb_get_ntohl(tvb, offset); |
| 849 | | | tiflag = proto_tree_add_text(pimopt_tree, tvb, offset, 4, |
| 850 | | | "Flags: 0x%08x", flags); |
| 851 | | | flag_tree = proto_item_add_subtree(tiflag, ett_pim); |
| 852 | | | proto_tree_add_text(flag_tree, tvb, offset, 1, "%s", |
| 853 | | | decode_boolean_bitfield(flags, 0x80000000, 32, |
| 854 | | | "Border", "Not border")); |
| 855 | | | proto_tree_add_text(flag_tree, tvb, offset, 1, "%s", |
| 856 | | | decode_boolean_bitfield(flags, 0x40000000, 32, |
| 857 | | | "Null-Register", "Not Null-Register")); |
| 858 | | | offset += 4; |
| 859 | | | |
| 860 | | | |
| 861 | | | |
| 862 | | | |
| 863 | | | next_tvb = tvb_new_subset(tvb, offset, -1, -1); |
| 864 | | | |
| 865 | | | |
| 866 | | | |
| 867 | | | |
| 868 | | | v_hl = tvb_get_guint8(tvb, offset); |
| 869 | | | switch((v_hl & 0xf0) >> 4) { |
| 870 | | | case 0: |
| 871 | | | |
| 872 | | | |
| 873 | | | |
| 874 | | | if (pinfo->src.type == AT_IPv4) { |
| 875 | | | proto_tree_add_text(pimopt_tree, tvb, offset, -1, |
| 876 | | | "IPv4 dummy "); |
| 877 | | | proto_tree_add_text(pimopt_tree, tvb, offset + 12, 4, |
| 878 | | | "Source: %s", |
| 879 | | | ip_to_str(tvb_get_ptr(tvb, offset + 12, 4))); |
| 880 | | | proto_tree_add_text(pimopt_tree, tvb, offset + 16, 4, |
| 881 | | | "Group: %s", |
| 882 | | | ip_to_str(tvb_get_ptr(tvb, offset + 16, 4))); |
| 883 | | | } else if (pinfo->src.type == AT_IPv6) { |
| 884 | | | struct ip6_hdr ip6_hdr; |
| 885 | | | tvb_memcpy(tvb, (guint8 *)&ip6_hdr, offset, |
| 886 | | | sizeof ip6_hdr); |
| 887 | | | proto_tree_add_text(pimopt_tree, tvb, offset, -1, |
| 888 | | | "IPv6 dummy "); |
| 889 | | | proto_tree_add_text(pimopt_tree, tvb, |
| 890 | | | offset + offsetof(struct ip6_hdr, ip6_src), 16,
x /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/include/stddef.h |
| |
411 | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) |
| |
|
| 891 | | | "Source: %s", |
| 892 | | | ip6_to_str(&ip6_hdr.ip6_src)); |
| 893 | | | proto_tree_add_text(pimopt_tree, tvb, |
| 894 | | | offset + offsetof(struct ip6_hdr, ip6_dst), 16,
x /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/include/stddef.h |
| |
411 | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) |
| |
|
| 895 | | | "Group: %s", |
| 896 | | | ip6_to_str(&ip6_hdr.ip6_dst)); |
| 897 | | | } else |
| 898 | | | proto_tree_add_text(pimopt_tree, tvb, offset, -1, |
| 899 | | | "Dummy for an unknown protocol"); |
| 900 | | | break; |
| 901 | | | case 4: |
| 902 | | | #if 0 |
| 903 | | | call_dissector(ip_handle, next_tvb, pinfo, tree); |
| 904 | | | #else |
| 905 | | | call_dissector(ip_handle, next_tvb, pinfo, pimopt_tree); |
| 906 | | | #endif |
| 907 | | | break; |
| 908 | | | case 6: |
| 909 | | | #if 0 |
| 910 | | | call_dissector(ipv6_handle, next_tvb, pinfo, tree); |
| 911 | | | #else |
| 912 | | | call_dissector(ipv6_handle, next_tvb, pinfo, pimopt_tree); |
| 913 | | | #endif |
| 914 | | | break; |
| 915 | | | default: |
| 916 | | | proto_tree_add_text(pimopt_tree, tvb, offset, -1, |
| 917 | | | "Unknown IP version %d", (v_hl & 0xf0) >> 4); |
| 918 | | | break; |
| 919 | | | } |
| 920 | | | break; |
| 921 | | | } |
| 922 | | | |
| 923 | | | case 2: |
| 924 | | | { |
| 925 | | | int advance; |
| 926 | | | const char *s; |
| 927 | | | |
| 928 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 929 | | | if (s == NULL) |
| 930 | | | break; |
| 931 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "Group: %s", s); |
| 932 | | | offset += advance; |
| 933 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 934 | | | if (s == NULL) |
| 935 | | | break; |
| 936 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "Source: %s", s); |
| 937 | | | break; |
| 938 | | | } |
| 939 | | | |
| 940 | | | case 3: |
| 941 | | | case 6: |
| 942 | | | case 7: |
| 943 | | | { |
| 944 | | | int advance; |
| 945 | | | int off; |
| 946 | | | const char *s; |
| 947 | | | int ngroup, i, njoin, nprune, j; |
| 948 | | | guint16 holdtime; |
| 949 | | | proto_tree *grouptree = NULL; |
| 950 | | | proto_item *tigroup; |
| 951 | | | proto_tree *subtree = NULL; |
| 952 | | | proto_item *tisub; |
| 953 | | | |
| 954 | | | if (PIM_TYPE(pim_typever) != 7) { |
| 955 | | | |
| 956 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 957 | | | if (s == NULL) |
| 958 | | | break; |
| 959 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 960 | | | "Upstream-neighbor: %s", s); |
| 961 | | | offset += advance; |
| 962 | | | } |
| 963 | | | |
| 964 | | | offset += 1; |
| 965 | | | |
| 966 | | | ngroup = tvb_get_guint8(tvb, offset); |
| 967 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 968 | | | "Groups: %u", ngroup); |
| 969 | | | offset += 1; |
| 970 | | | |
| 971 | | | if (PIM_TYPE(pim_typever) != 7) { |
| 972 | | | |
| 973 | | | holdtime = tvb_get_ntohs(tvb, offset); |
| 974 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 2, |
| 975 | | | "Holdtime: %u%s", holdtime, |
| 976 | | | holdtime == 0xffff ? " (infty)" : ""); |
| 977 | | | } |
| 978 | | | offset += 2; |
| 979 | | | |
| 980 | | | for (i = 0; i < ngroup; i++) { |
| 981 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 982 | | | if (s == NULL) |
| 983 | | | goto breakbreak3; |
| 984 | | | tigroup = proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 985 | | | "Group %d: %s", i, s); |
| 986 | | | grouptree = proto_item_add_subtree(tigroup, ett_pim); |
| 987 | | | offset += advance; |
| 988 | | | |
| 989 | | | njoin = tvb_get_ntohs(tvb, offset); |
| 990 | | | nprune = tvb_get_ntohs(tvb, offset + 2); |
| 991 | | | |
| 992 | | | tisub = proto_tree_add_text(grouptree, tvb, offset, 2, |
| 993 | | | "Join: %d", njoin); |
| 994 | | | subtree = proto_item_add_subtree(tisub, ett_pim); |
| 995 | | | off = offset + 4; |
| 996 | | | for (j = 0; j < njoin; j++) { |
| 997 | | | s = dissect_pim_addr(tvb, off, pimv2_source, |
| 998 | | | &advance); |
| 999 | | | if (s == NULL) |
| 1000 | | | goto breakbreak3; |
| 1001 | | | proto_tree_add_text(subtree, tvb, off, advance, |
| 1002 | | | "IP address: %s", s); |
| 1003 | | | off += advance; |
| 1004 | | | } |
| 1005 | | | |
| 1006 | | | tisub = proto_tree_add_text(grouptree, tvb, offset + 2, 2, |
| 1007 | | | "Prune: %d", nprune); |
| 1008 | | | subtree = proto_item_add_subtree(tisub, ett_pim); |
| 1009 | | | for (j = 0; j < nprune; j++) { |
| 1010 | | | s = dissect_pim_addr(tvb, off, pimv2_source, |
| 1011 | | | &advance); |
| 1012 | | | if (s == NULL) |
| 1013 | | | goto breakbreak3; |
| 1014 | | | proto_tree_add_text(subtree, tvb, off, advance, |
| 1015 | | | "IP address: %s", s); |
| 1016 | | | off += advance; |
| 1017 | | | } |
| 1018 | | | offset = off; |
| 1019 | | | } |
| 1020 | | | breakbreak3: |
| 1021 | | | break; |
| 1022 | | | } |
| 1023 | | | |
| 1024 | | | case 4: |
| 1025 | | | { |
| 1026 | | | const char *s; |
| 1027 | | | int advance; |
| 1028 | | | int i, j; |
| 1029 | | | int frpcnt; |
| 1030 | | | guint16 holdtime; |
| 1031 | | | proto_tree *grouptree = NULL; |
| 1032 | | | proto_item *tigroup; |
| 1033 | | | |
| 1034 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 2, |
| 1035 | | | "Fragment tag: 0x%04x", tvb_get_ntohs(tvb, offset)); |
| 1036 | | | offset += 2; |
| 1037 | | | |
| 1038 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1039 | | | "Hash mask len: %u", tvb_get_guint8(tvb, offset)); |
| 1040 | | | offset += 1; |
| 1041 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1042 | | | "BSR priority: %u", tvb_get_guint8(tvb, offset)); |
| 1043 | | | offset += 1; |
| 1044 | | | |
| 1045 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1046 | | | if (s == NULL) |
| 1047 | | | break; |
| 1048 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "BSR: %s", s); |
| 1049 | | | offset += advance; |
| 1050 | | | |
| 1051 | | | for (i = 0; tvb_reported_length_remaining(tvb, offset) > 0; i++) { |
| 1052 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 1053 | | | if (s == NULL) |
| 1054 | | | goto breakbreak4; |
| 1055 | | | tigroup = proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 1056 | | | "Group %d: %s", i, s); |
| 1057 | | | grouptree = proto_item_add_subtree(tigroup, ett_pim); |
| 1058 | | | offset += advance; |
| 1059 | | | |
| 1060 | | | proto_tree_add_text(grouptree, tvb, offset, 1, |
| 1061 | | | "RP count: %u", tvb_get_guint8(tvb, offset)); |
| 1062 | | | offset += 1; |
| 1063 | | | frpcnt = tvb_get_guint8(tvb, offset); |
| 1064 | | | proto_tree_add_text(grouptree, tvb, offset, 1, |
| 1065 | | | "FRP count: %u", frpcnt); |
| 1066 | | | offset += 3; |
| 1067 | | | |
| 1068 | | | for (j = 0; j < frpcnt; j++) { |
| 1069 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1070 | | | if (s == NULL) |
| 1071 | | | goto breakbreak4; |
| 1072 | | | proto_tree_add_text(grouptree, tvb, offset, advance, |
| 1073 | | | "RP %d: %s", j, s); |
| 1074 | | | offset += advance; |
| 1075 | | | |
| 1076 | | | holdtime = tvb_get_ntohs(tvb, offset); |
| 1077 | | | proto_tree_add_text(grouptree, tvb, offset, 2, |
| 1078 | | | "Holdtime: %u%s", holdtime, |
| 1079 | | | holdtime == 0xffff ? " (infty)" : ""); |
| 1080 | | | offset += 2; |
| 1081 | | | proto_tree_add_text(grouptree, tvb, offset, 1, |
| 1082 | | | "Priority: %u", tvb_get_guint8(tvb, offset)); |
| 1083 | | | offset += 2; |
| 1084 | | | } |
| 1085 | | | } |
| 1086 | | | |
| 1087 | | | breakbreak4: |
| 1088 | | | break; |
| 1089 | | | } |
| 1090 | | | |
| 1091 | | | case 5: |
| 1092 | | | { |
| 1093 | | | const char *s; |
| 1094 | | | int advance; |
| 1095 | | | |
| 1096 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 1097 | | | if (s == NULL) |
| 1098 | | | break; |
| 1099 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "Group: %s", s); |
| 1100 | | | offset += advance; |
| 1101 | | | |
| 1102 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1103 | | | if (s == NULL) |
| 1104 | | | break; |
| 1105 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "Source: %s", s); |
| 1106 | | | offset += advance; |
| 1107 | | | |
| 1108 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, "%s", |
| 1109 | | | decode_boolean_bitfield(tvb_get_guint8(tvb, offset), 0x80, 8, |
| 1110 | | | "RP Tree", "Not RP Tree")); |
| 1111 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4, "Preference: %u", |
| 1112 | | | tvb_get_ntohl(tvb, offset) & 0x7fffffff); |
| 1113 | | | offset += 4; |
| 1114 | | | |
| 1115 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4, "Metric: %u", |
| 1116 | | | tvb_get_ntohl(tvb, offset)); |
| 1117 | | | |
| 1118 | | | break; |
| 1119 | | | } |
| 1120 | | | |
| 1121 | | | case 8: |
| 1122 | | | { |
| 1123 | | | const char *s; |
| 1124 | | | int advance; |
| 1125 | | | int pfxcnt; |
| 1126 | | | guint16 holdtime; |
| 1127 | | | int i; |
| 1128 | | | |
| 1129 | | | pfxcnt = tvb_get_guint8(tvb, offset); |
| 1130 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1131 | | | "Prefix-count: %u", pfxcnt); |
| 1132 | | | offset += 1; |
| 1133 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1134 | | | "Priority: %u", tvb_get_guint8(tvb, offset)); |
| 1135 | | | offset += 1; |
| 1136 | | | holdtime = tvb_get_ntohs(tvb, offset); |
| 1137 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 2, |
| 1138 | | | "Holdtime: %u%s", holdtime, |
| 1139 | | | holdtime == 0xffff ? " (infty)" : ""); |
| 1140 | | | offset += 2; |
| 1141 | | | |
| 1142 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1143 | | | if (s == NULL) |
| 1144 | | | break; |
| 1145 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, "RP: %s", s); |
| 1146 | | | offset += advance; |
| 1147 | | | |
| 1148 | | | for (i = 0; i < pfxcnt; i++) { |
| 1149 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 1150 | | | if (s == NULL) |
| 1151 | | | goto breakbreak8; |
| 1152 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 1153 | | | "Group %d: %s", i, s); |
| 1154 | | | offset += advance; |
| 1155 | | | } |
| 1156 | | | breakbreak8: |
| 1157 | | | break; |
| 1158 | | | } |
| 1159 | | | |
| 1160 | | | case 9: |
| 1161 | | | { |
| 1162 | | | const char *s; |
| 1163 | | | int advance; |
| 1164 | | | |
| 1165 | | | s = dissect_pim_addr(tvb, offset, pimv2_group, &advance); |
| 1166 | | | if (s == NULL) |
| 1167 | | | break; |
| 1168 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 1169 | | | "Group: %s", s); |
| 1170 | | | offset += advance; |
| 1171 | | | |
| 1172 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1173 | | | if (s == NULL) |
| 1174 | | | break; |
| 1175 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 1176 | | | "Source: %s", s); |
| 1177 | | | offset += advance; |
| 1178 | | | |
| 1179 | | | s = dissect_pim_addr(tvb, offset, pimv2_unicast, &advance); |
| 1180 | | | if (s == NULL) |
| 1181 | | | break; |
| 1182 | | | proto_tree_add_text(pimopt_tree, tvb, offset, advance, |
| 1183 | | | "Originator: %s", s); |
| 1184 | | | offset += advance; |
| 1185 | | | |
| 1186 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, "Rendezvous Point Tree %s", |
| 1187 | | | decode_boolean_bitfield(tvb_get_guint8(tvb, offset), 1, 1, |
| 1188 | | | "set", "clear")); |
| 1189 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4, |
| 1190 | | | "Metric Preference: %u", tvb_get_ntohl(tvb, offset) & 0x7FFFFFFF); |
| 1191 | | | offset += 4; |
| 1192 | | | |
| 1193 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 4, |
| 1194 | | | "Metric: %u", tvb_get_ntohl(tvb, offset)); |
| 1195 | | | offset += 4; |
| 1196 | | | |
| 1197 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1198 | | | "Masklen: %u", tvb_get_guint8(tvb, offset)); |
| 1199 | | | offset += 1; |
| 1200 | | | |
| 1201 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1202 | | | "TTL: %u", tvb_get_guint8(tvb, offset)); |
| 1203 | | | offset += 1; |
| 1204 | | | |
| 1205 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, "Prune indicator %s", |
| 1206 | | | decode_boolean_bitfield(tvb_get_guint8(tvb, offset), 0x80, 8, |
| 1207 | | | "set", "clear")); |
| 1208 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, "Prune now %s", |
| 1209 | | | decode_boolean_bitfield(tvb_get_guint8(tvb, offset), 0x40, 8, |
| 1210 | | | "set", "clear")); |
| 1211 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, "Assert override %s", |
| 1212 | | | decode_boolean_bitfield(tvb_get_guint8(tvb, offset), 0x20, 8, |
| 1213 | | | "set", "clear")); |
| 1214 | | | offset += 1; |
| 1215 | | | |
| 1216 | | | proto_tree_add_text(pimopt_tree, tvb, offset, 1, |
| 1217 | | | "Interval: %u", tvb_get_guint8(tvb, offset)); |
| 1218 | | | offset += 1; |
| 1219 | | | |
| 1220 | | | break; |
| 1221 | | | } |
| 1222 | | | |
| 1223 | | | default: |
| 1224 | | | break; |
| 1225 | | | } |
| 1226 | | | } |
| 1227 | | | done:; |
| 1228 | | | } |
| |