diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-24 21:59:51 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-25 13:15:11 +0000 |
commit | dcfea6a06ddf7adeafc8613efe74310251201789 (patch) | |
tree | 04c70020bc89a90670634230a5be0560af7c9c3e /epan/dissectors | |
parent | 479ab3bcdc8d79b27bfc99fcde073457f72126ac (diff) |
create_dissector_handle -> new_create_dissector_handle
This finalizes the transformation for dissectors.
Change-Id: Ie5986b72bb69a6e8779ca3f5e20a80357c9e6fea
Reviewed-on: https://code.wireshark.org/review/12122
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
32 files changed, 348 insertions, 326 deletions
diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index 8f3d4b7012..4fe2a68f36 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -698,8 +698,8 @@ dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) ATP protocol cf. inside appletalk chap. 9 desegmentation from packet-ieee80211.c */ -static void -dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *atp_tree = NULL; proto_item *ti; proto_tree *atp_info_tree; @@ -819,7 +819,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { } if (aspinfo.release) - return; + return tvb_captured_length(tvb); save_fragmented = pinfo->fragmented; @@ -888,7 +888,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(data_handle, new_tvb, pinfo, tree); } pinfo->fragmented = save_fragmented; - return; + return tvb_captured_length(tvb); } /* ----------------------------- @@ -2097,7 +2097,7 @@ proto_reg_handoff_atalk(void) dissector_add_uint("ddp.type", DDP_NBP, nbp_handle); dissector_add_for_decode_as("udp.port", nbp_handle); - atp_handle = create_dissector_handle(dissect_atp, proto_atp); + atp_handle = new_create_dissector_handle(dissect_atp, proto_atp); dissector_add_uint("ddp.type", DDP_ATP, atp_handle); asp_handle = new_create_dissector_handle(dissect_asp, proto_asp); diff --git a/epan/dissectors/packet-capwap.c b/epan/dissectors/packet-capwap.c index 1ee2463f66..d5f45ee532 100644 --- a/epan/dissectors/packet-capwap.c +++ b/epan/dissectors/packet-capwap.c @@ -3293,8 +3293,8 @@ dissect_capwap_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void return offset; } -static void -dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *capwap_data_tree; @@ -3323,7 +3323,7 @@ dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (type_header == 1) { next_tvb = tvb_new_subset_remaining (tvb, offset); call_dissector(dtls_handle, next_tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* CAPWAP Header */ @@ -3336,7 +3336,7 @@ dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint len_rem = tvb_reported_length_remaining(tvb, offset); if (len_rem <= 0) - return; + return offset; pinfo->fragmented = TRUE; @@ -3355,7 +3355,7 @@ dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(data_handle, next_tvb, pinfo, tree); col_append_fstr(pinfo->cinfo, COL_INFO, " (Fragment ID: %u, Fragment Offset: %u)", fragment_id, fragment_offset); - return; + return tvb_captured_length(tvb); } else { @@ -3395,7 +3395,8 @@ dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } pinfo->fragmented = save_fragmented; - } + return tvb_captured_length(tvb); +} void proto_register_capwap_control(void) @@ -5799,7 +5800,7 @@ proto_reg_handoff_capwap(void) if (!inited) { capwap_control_handle = new_create_dissector_handle(dissect_capwap_control, proto_capwap_control); - capwap_data_handle = create_dissector_handle(dissect_capwap_data, proto_capwap_data); + capwap_data_handle = new_create_dissector_handle(dissect_capwap_data, proto_capwap_data); dtls_handle = find_dissector("dtls"); ieee8023_handle = find_dissector("eth_withoutfcs"); ieee80211_handle = find_dissector("wlan_withoutfcs"); diff --git a/epan/dissectors/packet-cisco-marker.c b/epan/dissectors/packet-cisco-marker.c index 56dbc3e3ab..cbeac239d6 100644 --- a/epan/dissectors/packet-cisco-marker.c +++ b/epan/dissectors/packet-cisco-marker.c @@ -114,8 +114,8 @@ static header_field_info cisco_erspan_tail CISCO_ERSPAN_MARKER_HFI_INIT = static gint ett_marker = -1; -static void -dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *marker_tree; proto_item *ti; @@ -161,6 +161,7 @@ dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(marker_tree, &cisco_erspan_tail, tvb, offset, 4, ENC_LITTLE_ENDIAN); } + return tvb_captured_length(tvb); } @@ -202,7 +203,7 @@ proto_register_erpsan_marker(void) proto_register_fields(proto_marker, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); - marker_handle = create_dissector_handle(dissect_marker, proto_marker); + marker_handle = new_create_dissector_handle(dissect_marker, proto_marker); } void diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index ad6ab5892f..e0f86b291d 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -120,8 +120,8 @@ static const guint8* get_unquoted_string(tvbuff_t *tvb, gint offset, /**********************************************************************/ -static void -dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *cups_tree = NULL; proto_tree *ptype_subtree = NULL; @@ -169,7 +169,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) - return; /* end of packet */ + return offset; /* end of packet */ offset = next_offset; state = get_hex_uint(tvb, offset, &next_offset); @@ -180,12 +180,12 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) - return; /* end of packet */ + return offset; /* end of packet */ offset = next_offset; str = get_unquoted_string(tvb, offset, &next_offset, &len); if (str == NULL) - return; /* separator/terminator not found */ + return offset; /* separator/terminator not found */ proto_tree_add_string(cups_tree, hf_cups_uri, tvb, offset, len, str); col_add_fstr(pinfo->cinfo, COL_INFO, "%.*s (%s)", @@ -193,36 +193,38 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; if (!cups_tree) - return; + return offset; if (!skip_space(tvb, offset, &next_offset)) - return; /* end of packet */ + return offset; /* end of packet */ offset = next_offset; str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) - return; /* separator/terminator not found */ + return offset; /* separator/terminator not found */ proto_tree_add_string(cups_tree, hf_cups_location, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) - return; /* end of packet */ + return offset; /* end of packet */ offset = next_offset; str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) - return; /* separator/terminator not found */ + return offset; /* separator/terminator not found */ proto_tree_add_string(cups_tree, hf_cups_information, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) - return; /* end of packet */ + return offset; /* end of packet */ offset = next_offset; str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) - return; /* separator/terminator not found */ + return offset; /* separator/terminator not found */ proto_tree_add_string(cups_tree, hf_cups_make_model, tvb, offset+1, len, str); + + return next_offset; } static guint @@ -402,7 +404,7 @@ proto_reg_handoff_cups(void) { dissector_handle_t cups_handle; - cups_handle = create_dissector_handle(dissect_cups, proto_cups); + cups_handle = new_create_dissector_handle(dissect_cups, proto_cups); dissector_add_uint("udp.port", UDP_PORT_CUPS, cups_handle); } diff --git a/epan/dissectors/packet-dect.c b/epan/dissectors/packet-dect.c index 0f49243db5..a35d22f6e7 100644 --- a/epan/dissectors/packet-dect.c +++ b/epan/dissectors/packet-dect.c @@ -1944,8 +1944,8 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba, /*offset+=2;*/ } -static void -dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti =NULL; proto_item *typeti =NULL; @@ -1969,7 +1969,7 @@ dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(pkt_len<=DECT_PACKET_INFO_LEN) { col_set_str(pinfo->cinfo, COL_INFO, "No Data"); - return; + return tvb_captured_length(tvb); } ti=proto_tree_add_item(tree, proto_dect, tvb, 0, -1, ENC_NA); @@ -2021,6 +2021,7 @@ dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(typeti, " Unknown Packet"); break; } + return tvb_captured_length(tvb); } void @@ -2589,7 +2590,7 @@ proto_reg_handoff_dect(void) { dissector_handle_t dect_handle; - dect_handle = create_dissector_handle(dissect_dect, proto_dect); + dect_handle = new_create_dissector_handle(dissect_dect, proto_dect); dissector_add_uint("ethertype", ETHERTYPE_DECT , dect_handle); } diff --git a/epan/dissectors/packet-elcom.c b/epan/dissectors/packet-elcom.c index 83c90e641c..99eae2a57d 100644 --- a/epan/dissectors/packet-elcom.c +++ b/epan/dissectors/packet-elcom.c @@ -403,8 +403,8 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of * It seems to me that invalid fields should just add an expert item * or cause a "Malformed" exception. */ -static void -dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gboolean is_request, length_ok; proto_tree *elcom_tree; @@ -416,7 +416,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that there's enough data */ if (tvb_captured_length(tvb) < 3) - return; + return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "ELCOM"); col_clear(pinfo->cinfo, COL_INFO); @@ -437,12 +437,12 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* starting after elcom_len and elcom_msg_type, initiator + responder + userdata fields must be there */ - if (tvb_captured_length_remaining(tvb, 3+TOTAL_LEN+TOTAL_LEN+3) < 0) return; + if (tvb_captured_length_remaining(tvb, 3+TOTAL_LEN+TOTAL_LEN+3) < 0) return 2; /* check also that those field lengths are valid */ - if (tvb_get_guint8(tvb, 3) != LOWADR_LEN) return; - if (tvb_get_guint8(tvb, 3+1+LOWADR_LEN) != SUFFIX_LEN) return; - if (tvb_get_guint8(tvb, 3+TOTAL_LEN) != LOWADR_LEN) return; - if (tvb_get_guint8(tvb, 3+1+TOTAL_LEN+LOWADR_LEN) != SUFFIX_LEN) return; + if (tvb_get_guint8(tvb, 3) != LOWADR_LEN) return 2; + if (tvb_get_guint8(tvb, 3+1+LOWADR_LEN) != SUFFIX_LEN) return 2; + if (tvb_get_guint8(tvb, 3+TOTAL_LEN) != LOWADR_LEN) return 2; + if (tvb_get_guint8(tvb, 3+1+TOTAL_LEN+LOWADR_LEN) != SUFFIX_LEN) return 2; /* finally believe that there is valid suffix */ suffix = tvb_get_string_enc(wmem_packet_scope(), tvb, 3+2+LOWADR_LEN, 2, ENC_ASCII); @@ -472,7 +472,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (!tree) - return; + return tvb_captured_length(tvb); ti = proto_tree_add_item(tree, proto_elcom, tvb, offset, -1, ENC_NA); elcom_tree = proto_item_add_subtree(ti, ett_elcom); @@ -496,7 +496,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset++; if (tvb_reported_length_remaining(tvb, offset) <= 0) - return; + return offset; switch (elcom_msg_type) { case P_CONRQ: @@ -514,7 +514,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_elcom_initiator_port, hf_elcom_initiator_suff); if (tvb_reported_length_remaining(tvb, offset) <= 0) - return; + return offset; ti = proto_tree_add_item(elcom_tree, hf_elcom_responder, tvb, offset, TOTAL_LEN, ENC_NA); offset = dissect_lower_address(ti, ett_elcom_responder, tvb, offset, @@ -523,7 +523,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_elcom_responder_port, hf_elcom_responder_suff); if (tvb_reported_length_remaining(tvb, offset) <= 0) - return; + return offset; /* Rest of the payload is USER-DATA, 0..82 bytes */ ti = proto_tree_add_item(elcom_tree, hf_elcom_userdata, tvb, offset, -1, ENC_NA); @@ -560,6 +560,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* We should not get here, but if we do, show what is left over: */ proto_tree_add_item(elcom_tree, hf_elcom_strangeleftover, tvb, offset, -1, ENC_NA); } + return tvb_captured_length(tvb); } void @@ -759,7 +760,7 @@ proto_reg_handoff_elcom(void) { dissector_handle_t elcom_handle; - elcom_handle = create_dissector_handle(dissect_elcom, proto_elcom); + elcom_handle = new_create_dissector_handle(dissect_elcom, proto_elcom); dissector_add_uint("tcp.port", TCP_PORT_ELCOM, elcom_handle); } diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c index 1a2fa2a9bd..6805414fb9 100644 --- a/epan/dissectors/packet-fip.c +++ b/epan/dissectors/packet-fip.c @@ -339,8 +339,8 @@ fip_desc_fc4f(tvbuff_t *tvb, proto_tree *tree, proto_item *item) } } -static void -dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint op; guint sub; @@ -361,10 +361,9 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!tvb_bytes_exist(tvb, 0, FIP_HEADER_LEN)) { col_set_str(pinfo->cinfo, COL_INFO, "[packet too short]"); - if (tree) - proto_tree_add_protocol_format(tree, proto_fip, tvb, 0, + proto_tree_add_protocol_format(tree, proto_fip, tvb, 0, -1, "FIP [packet too short]"); - return; + return tvb_captured_length(tvb); } op = tvb_get_ntohs(tvb, 2); @@ -544,6 +543,7 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + return tvb_captured_length(tvb); } void @@ -825,7 +825,7 @@ proto_reg_handoff_fip(void) { dissector_handle_t fip_handle; - fip_handle = create_dissector_handle(dissect_fip, proto_fip); + fip_handle = new_create_dissector_handle(dissect_fip, proto_fip); dissector_add_uint("ethertype", ETHERTYPE_FIP, fip_handle); fc_handle = find_dissector("fc"); } diff --git a/epan/dissectors/packet-gsmtap.c b/epan/dissectors/packet-gsmtap.c index 739a0b53d2..ac6ca5b3e0 100644 --- a/epan/dissectors/packet-gsmtap.c +++ b/epan/dissectors/packet-gsmtap.c @@ -464,8 +464,8 @@ handle_tetra(int channel _U_, tvbuff_t *payload_tvb _U_, packet_info *pinfo _U_, } /* dissect a GSMTAP header and hand payload off to respective dissector */ -static void -dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int sub_handle, rrc_sub_handle = 0, len, offset = 0; proto_item *ti; @@ -502,7 +502,7 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Some GSMTAP types are completely unrelated to the Um air interface */ if (dissector_try_uint(gsmtap_dissector_table, type, payload_tvb, pinfo, tree)) - return; + return tvb_captured_length(tvb); if (arfcn & GSMTAP_ARFCN_F_UPLINK) { col_append_str(pinfo->cinfo, COL_RES_NET_SRC, "MS"); @@ -654,7 +654,7 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case GSMTAP_TYPE_TETRA_I1: handle_tetra(tvb_get_guint8(tvb, offset+12), payload_tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); case GSMTAP_TYPE_WMX_BURST: switch (sub_type) { case GSMTAP_BURST_CDMA_CODE: @@ -715,6 +715,7 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else if (sub_handles[sub_handle] != NULL) call_dissector(sub_handles[sub_handle], payload_tvb, pinfo, tree); /* TODO: warn user that the WiMAX plugin must be enabled for some types */ + return tvb_captured_length(tvb); } static const true_false_string sacch_l1h_fpc_mode_vals = { @@ -867,7 +868,7 @@ proto_reg_handoff_gsmtap(void) rrc_sub_handles[GSMTAP_RRC_SUB_ToTargetRNC_Container] = find_dissector("rrc.s_to_trnc_cont"); rrc_sub_handles[GSMTAP_RRC_SUB_TargetRNC_ToSourceRNC_Container] = find_dissector("rrc.t_to_srnc_cont"); - gsmtap_handle = create_dissector_handle(dissect_gsmtap, proto_gsmtap); + gsmtap_handle = new_create_dissector_handle(dissect_gsmtap, proto_gsmtap); dissector_add_uint("udp.port", GSMTAP_UDP_PORT, gsmtap_handle); } diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 02e2d9384c..a9316a5ca4 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -2012,8 +2012,8 @@ ip_try_dissect(gboolean heur_first, tvbuff_t *tvb, packet_info *pinfo, return FALSE; } -static void -dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { proto_tree *ip_tree, *field_tree = NULL; proto_item *ti, *tf; @@ -2033,7 +2033,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item = NULL, *ttl_item; proto_tree *checksum_tree; guint16 ttl; - + int bit_offset; tree = parent_tree; iph = (ws_ip *)wmem_alloc(wmem_packet_scope(), sizeof(ws_ip)); @@ -2052,7 +2052,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) col_add_fstr(pinfo->cinfo, COL_INFO, "Bogus IPv4 version (%u, must be 4)", hi_nibble(iph->ip_v_hl)); expert_add_info_format(pinfo, tf, &ei_ip_bogus_ip_version, "Bogus IPv4 version"); - return; + return tvb_captured_length(tvb); } /* if IP is not referenced from any filters we don't need to worry about @@ -2073,7 +2073,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen/4, "%u bytes (bogus, must be at least %u)", hlen, IPH_MIN_LEN); - return; + return tvb_captured_length(tvb); } proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen/4, @@ -2145,7 +2145,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) iph->ip_len, hlen); expert_add_info(pinfo, tf, &ei_ip_bogus_ip_length); /* Can't dissect any further */ - return; + return tvb_captured_length(tvb); } } else { /* @@ -2164,13 +2164,12 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_uint(ip_tree, hf_ip_id, tvb, offset + 4, 2, iph->ip_id); iph->ip_off = tvb_get_ntohs(tvb, offset + 6); - if (tree) { - int bit_offset = (offset + 6) * 8; + bit_offset = (offset + 6) * 8; - flags = (iph->ip_off & (IP_RF | IP_DF | IP_MF)) >> IP_OFFSET_WIDTH; - tf = proto_tree_add_uint(ip_tree, hf_ip_flags, tvb, offset + 6, 1, flags); - field_tree = proto_item_add_subtree(tf, ett_ip_off); - if (ip_security_flag) { + flags = (iph->ip_off & (IP_RF | IP_DF | IP_MF)) >> IP_OFFSET_WIDTH; + tf = proto_tree_add_uint(ip_tree, hf_ip_flags, tvb, offset + 6, 1, flags); + field_tree = proto_item_add_subtree(tf, ett_ip_off); + if (ip_security_flag) { proto_item *sf; sf = proto_tree_add_bits_item(field_tree, hf_ip_flags_sf, tvb, @@ -2179,21 +2178,21 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item_append_text(tf, " (Evil packet!)"); expert_add_info(pinfo, sf, &ei_ip_evil_packet); } - } else { + } else { proto_tree_add_bits_item(field_tree, hf_ip_flags_rf, tvb, bit_offset + 0, 1, ENC_LITTLE_ENDIAN); - } - if (iph->ip_off & IP_DF) - proto_item_append_text(tf, " (Don't Fragment)"); - proto_tree_add_bits_item(field_tree, hf_ip_flags_df, tvb, bit_offset + 1, + } + if (iph->ip_off & IP_DF) + proto_item_append_text(tf, " (Don't Fragment)"); + + proto_tree_add_bits_item(field_tree, hf_ip_flags_df, tvb, bit_offset + 1, 1, ENC_BIG_ENDIAN); - if (iph->ip_off & IP_MF) + if (iph->ip_off & IP_MF) proto_item_append_text(tf, " (More Fragments)"); - proto_tree_add_bits_item(field_tree, hf_ip_flags_mf, tvb, bit_offset + 2, + proto_tree_add_bits_item(field_tree, hf_ip_flags_mf, tvb, bit_offset + 2, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ip_tree, hf_ip_frag_offset, tvb, offset + 6, 2, + proto_tree_add_uint(ip_tree, hf_ip_frag_offset, tvb, offset + 6, 2, (iph->ip_off & IP_OFFSET)*8); - } iph->ip_ttl = tvb_get_guint8(tvb, offset + 8); if (tree) { @@ -2472,7 +2471,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree); pinfo->fragmented = save_fragmented; - return; + return tvb_captured_length(tvb); } if (tvb_reported_length(next_tvb) > 0) { @@ -2493,6 +2492,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } pinfo->fragmented = save_fragmented; + return tvb_captured_length(tvb); } static int @@ -2505,7 +2505,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) version = tvb_get_guint8(tvb, 0) >> 4; if(version == 4){ - dissect_ip_v4(tvb, pinfo, tree); + dissect_ip_v4(tvb, pinfo, tree, data); return tvb_captured_length(tvb); } if(version == 6){ @@ -2613,7 +2613,7 @@ dissect_ip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data return FALSE; } - dissect_ip_v4(tvb, pinfo, tree); + dissect_ip_v4(tvb, pinfo, tree, data); return TRUE; } @@ -3187,7 +3187,7 @@ proto_reg_handoff_ip(void) ip_handle = find_dissector("ip"); ipv6_handle = find_dissector("ipv6"); data_handle = find_dissector("data"); - ipv4_handle = create_dissector_handle(dissect_ip_v4, proto_ip); + ipv4_handle = new_create_dissector_handle(dissect_ip_v4, proto_ip); dissector_add_uint("ethertype", ETHERTYPE_IP, ipv4_handle); dissector_add_uint("erf.types.type", ERF_TYPE_IPV4, ip_handle); diff --git a/epan/dissectors/packet-ipmi-trace.c b/epan/dissectors/packet-ipmi-trace.c index 7ae312e27d..2a2fcb378e 100644 --- a/epan/dissectors/packet-ipmi-trace.c +++ b/epan/dissectors/packet-ipmi-trace.c @@ -275,8 +275,8 @@ dissect_ipmb_state_notify(tvbuff_t * tvb, proto_tree * tree) bits_chn_state_info, ENC_LITTLE_ENDIAN); } -static void -dissect_ipmi_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipmi_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint block_type, chn_num, data_type, tmp; tvbuff_t * next_tvb; @@ -284,7 +284,7 @@ dissect_ipmi_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_captured_length(tvb) < 11) { /* TODO: add expert info */ call_dissector(data_dissector_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* get first byte */ @@ -421,6 +421,7 @@ dissect_ipmi_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { call_dissector(data_dissector_handle, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -448,7 +449,7 @@ proto_reg_handoff_ipmi_trace(void) { dissector_handle_t ipmi_trace_handle; - ipmi_trace_handle = create_dissector_handle(dissect_ipmi_trace, + ipmi_trace_handle = new_create_dissector_handle(dissect_ipmi_trace, proto_ipmi_trace); data_dissector_handle = find_dissector("data"); diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index 0058655f40..1656d0f978 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -137,18 +137,6 @@ static int hf_msg_sigchar = -1; static dissector_handle_t data_handle; -static void -dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -static void -dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -static void -dissect_serialization(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -static void -dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - #define UDP_PORT_IPX 213 /* RFC 1234 */ #define IPX_HEADER_LEN 30 /* It's *always* 30 bytes */ @@ -599,8 +587,8 @@ spx_datastream(guint8 type) #define SPX_HEADER_LEN 12 #define SPX2_HEADER_LEN 14 -static void -dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *spx_tree; proto_item *ti; @@ -824,7 +812,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(spx_tree, hf_spx_rexmt_data, tvb, hdr_len, -1, ENC_NA); } } - return; + return tvb_captured_length(tvb); } if (tvb_reported_length_remaining(tvb, hdr_len) > 0) { @@ -861,22 +849,23 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (dissector_try_uint_new(spx_socket_dissector_table, low_socket, next_tvb, pinfo, tree, FALSE, &spx_infox)) { - return; + return tvb_captured_length(tvb); } if (dissector_try_uint_new(spx_socket_dissector_table, high_socket, next_tvb, pinfo, tree, FALSE, &spx_infox)) { - return; + return tvb_captured_length(tvb); } call_dissector(data_handle, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } /* ================================================================= */ /* IPX Message */ /* ================================================================= */ -static void -dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *msg_tree; proto_item *ti; @@ -899,6 +888,7 @@ dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(msg_tree, hf_msg_conn, tvb, 0, 1, conn_number); proto_tree_add_uint(msg_tree, hf_msg_sigchar, tvb, 1, 1, sig_char); } + return tvb_captured_length(tvb); } @@ -911,8 +901,8 @@ static const value_string ipxrip_packet_vals[] = { { 0, NULL} }; -static void -dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *rip_tree; proto_item *ti, *hidden_item; @@ -965,13 +955,14 @@ dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } /* ================================================================= */ /* IPX Serialization */ /* ================================================================= */ -static void -dissect_serialization(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_serialization(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ser_tree = NULL; proto_item *ti; @@ -989,6 +980,7 @@ dissect_serialization(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_bytes_to_str(wmem_packet_scope(), tvb, 0, 6)); proto_tree_add_item(ser_tree, hf_serial_number, tvb, 0, 6, ENC_NA); + return tvb_captured_length(tvb); } /* @@ -1612,21 +1604,21 @@ proto_reg_handoff_ipx(void) dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IPX, ipx_handle); dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_NOVELL_EC, ipx_handle); - spx_handle = create_dissector_handle(dissect_spx, proto_spx); + spx_handle = new_create_dissector_handle(dissect_spx, proto_spx); dissector_add_uint("ipx.packet_type", IPX_PACKET_TYPE_SPX, spx_handle); ipxsap_handle = find_dissector("ipxsap"); dissector_add_uint("ipx.socket", IPX_SOCKET_SAP, ipxsap_handle); - ipxrip_handle = create_dissector_handle(dissect_ipxrip, proto_ipxrip); + ipxrip_handle = new_create_dissector_handle(dissect_ipxrip, proto_ipxrip); dissector_add_uint("ipx.socket", IPX_SOCKET_IPXRIP, ipxrip_handle); - serialization_handle = create_dissector_handle(dissect_serialization, + serialization_handle = new_create_dissector_handle(dissect_serialization, proto_serialization); dissector_add_uint("ipx.socket", IPX_SOCKET_SERIALIZATION, serialization_handle); - ipxmsg_handle = create_dissector_handle(dissect_ipxmsg, proto_ipxmsg); + ipxmsg_handle = new_create_dissector_handle(dissect_ipxmsg, proto_ipxmsg); dissector_add_uint("ipx.socket", IPX_SOCKET_IPX_MESSAGE, ipxmsg_handle); dissector_add_uint("ipx.socket", IPX_SOCKET_IPX_MESSAGE1, ipxmsg_handle); diff --git a/epan/dissectors/packet-itdm.c b/epan/dissectors/packet-itdm.c index 77f65ebff1..84bc943e91 100644 --- a/epan/dissectors/packet-itdm.c +++ b/epan/dissectors/packet-itdm.c @@ -356,15 +356,15 @@ dissect_itdm_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, next_tvb, pinfo, tree); } -static void -dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 flowid; /* ZZZ for now, 125 usec mode and I-TDM control protocol * need to add 1ms mode */ if (tvb_captured_length(tvb) < 18) - return; + return 0; /* See if this packet is a data flow or the I-TDM control flow. */ flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET); @@ -376,6 +376,7 @@ dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_itdm_control(tvb, pinfo, tree); else dissect_itdm_125usec(tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -465,7 +466,7 @@ proto_reg_handoff_itdm(void) static guint ItdmMPLSLabel; if (!Initialized) { - itdm_handle = create_dissector_handle( dissect_itdm, proto_itdm ); + itdm_handle = new_create_dissector_handle( dissect_itdm, proto_itdm ); data_handle = find_dissector("data"); Initialized=TRUE; } else { diff --git a/epan/dissectors/packet-juniper.c b/epan/dissectors/packet-juniper.c index 61ff761fda..e328c9f83d 100644 --- a/epan/dissectors/packet-juniper.c +++ b/epan/dissectors/packet-juniper.c @@ -606,8 +606,8 @@ dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } /* MLFR dissector */ -static void -dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree* juniper_subtree; @@ -630,7 +630,7 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; @@ -708,13 +708,14 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); + return tvb_captured_length(tvb); } /* MLPPP dissector */ -static void -dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree* juniper_subtree; @@ -737,7 +738,7 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; @@ -782,12 +783,13 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); + return tvb_captured_length(tvb); } /* PPPoE dissector */ -static void -dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset; @@ -805,17 +807,18 @@ dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ETHER, offset); + return tvb_captured_length(tvb); } /* Ethernet dissector */ -static void -dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset; @@ -833,17 +836,18 @@ dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ETHER, offset); + return tvb_captured_length(tvb); } /* PPP dissector */ -static void -dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset; @@ -861,17 +865,18 @@ dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_PPP, offset+2); + return tvb_captured_length(tvb); } /* Frame-Relay dissector */ -static void -dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset; @@ -889,17 +894,18 @@ dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_FRELAY, offset); + return tvb_captured_length(tvb); } /* C-HDLC dissector */ -static void -dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset = 0; @@ -915,12 +921,13 @@ dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_CHDLC, offset); + return tvb_captured_length(tvb); } @@ -1081,7 +1088,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 } -static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { +static int dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { proto_tree* juniper_subtree; guint offset = 0; @@ -1098,7 +1105,7 @@ static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; @@ -1110,9 +1117,10 @@ static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); + return tvb_captured_length(tvb); } -static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { +static int dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { proto_tree* juniper_subtree; guint offset = 0; @@ -1128,7 +1136,7 @@ static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; @@ -1138,11 +1146,12 @@ static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr * empty header before payload starts. */ dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_IP, offset+18); + return tvb_captured_length(tvb); } /* Wrapper for Juniper service PIC coookie dissector */ -static void -dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree* juniper_subtree; guint offset = 0; @@ -1158,7 +1167,7 @@ dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if (bytes_processed == -1) - return; + return 4; else offset+=bytes_processed; @@ -1170,6 +1179,7 @@ dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_IP, offset); + return tvb_captured_length(tvb); } /* list of Juniper supported PPP proto IDs */ @@ -1431,16 +1441,16 @@ proto_reg_handoff_juniper(void) juniper_atm2_handle = new_create_dissector_handle(dissect_juniper_atm2, proto_juniper); juniper_atm1_handle = new_create_dissector_handle(dissect_juniper_atm1, proto_juniper); - juniper_pppoe_handle = create_dissector_handle(dissect_juniper_pppoe, proto_juniper); - juniper_mlppp_handle = create_dissector_handle(dissect_juniper_mlppp, proto_juniper); - juniper_mlfr_handle = create_dissector_handle(dissect_juniper_mlfr, proto_juniper); - juniper_ether_handle = create_dissector_handle(dissect_juniper_ether, proto_juniper); - juniper_ppp_handle = create_dissector_handle(dissect_juniper_ppp, proto_juniper); - juniper_frelay_handle = create_dissector_handle(dissect_juniper_frelay, proto_juniper); - juniper_chdlc_handle = create_dissector_handle(dissect_juniper_chdlc, proto_juniper); - juniper_ggsn_handle = create_dissector_handle(dissect_juniper_ggsn, proto_juniper); - juniper_vp_handle = create_dissector_handle(dissect_juniper_vp, proto_juniper); - juniper_svcs_handle = create_dissector_handle(dissect_juniper_svcs, proto_juniper); + juniper_pppoe_handle = new_create_dissector_handle(dissect_juniper_pppoe, proto_juniper); + juniper_mlppp_handle = new_create_dissector_handle(dissect_juniper_mlppp, proto_juniper); + juniper_mlfr_handle = new_create_dissector_handle(dissect_juniper_mlfr, proto_juniper); + juniper_ether_handle = new_create_dissector_handle(dissect_juniper_ether, proto_juniper); + juniper_ppp_handle = new_create_dissector_handle(dissect_juniper_ppp, proto_juniper); + juniper_frelay_handle = new_create_dissector_handle(dissect_juniper_frelay, proto_juniper); + juniper_chdlc_handle = new_create_dissector_handle(dissect_juniper_chdlc, proto_juniper); + juniper_ggsn_handle = new_create_dissector_handle(dissect_juniper_ggsn, proto_juniper); + juniper_vp_handle = new_create_dissector_handle(dissect_juniper_vp, proto_juniper); + juniper_svcs_handle = new_create_dissector_handle(dissect_juniper_svcs, proto_juniper); dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ATM2, juniper_atm2_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ATM1, juniper_atm1_handle); diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index a359a7acf1..a3314bed05 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -3619,8 +3619,8 @@ dissect_lldp_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree /* Dissect LLDP packets */ -static void -dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *lldp_tree = NULL; @@ -3647,8 +3647,7 @@ dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (rtnValue < 0) { col_set_str(pinfo->cinfo, COL_INFO, "Invalid Chassis ID TLV"); - - return; + return tvb_captured_length(tvb); } offset += rtnValue; @@ -3661,8 +3660,7 @@ dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (rtnValue < 0) { col_set_str(pinfo->cinfo, COL_INFO, "Invalid Port ID TLV"); - - return; + return tvb_captured_length(tvb); } offset += rtnValue; @@ -3675,8 +3673,7 @@ dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (rtnValue < 0) { col_set_str(pinfo->cinfo, COL_INFO, "Invalid Time-to-Live TLV"); - - return; + return tvb_captured_length(tvb); } offset += rtnValue; @@ -3736,6 +3733,7 @@ dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += rtnValue; } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -5059,7 +5057,7 @@ proto_reg_handoff_lldp(void) { dissector_handle_t lldp_handle; - lldp_handle = create_dissector_handle(dissect_lldp,proto_lldp); + lldp_handle = new_create_dissector_handle(dissect_lldp,proto_lldp); dissector_add_uint("ethertype", ETHERTYPE_LLDP, lldp_handle); } diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index 8960abde42..5180a7cad4 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -245,15 +245,15 @@ decode_mpls_label(tvbuff_t *tvb, int offset, /* * FF: PW Associated Channel Header dissection as per RFC 4385. */ -static void -dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; guint channel_type; if (tvb_reported_length_remaining(tvb, 0) < 4) { proto_tree_add_expert(tree, pinfo, &ei_mpls_pw_ach_error_processing_message, tvb, 0, -1); - return; + return tvb_captured_length(tvb); } channel_type = tvb_get_ntohs(tvb, 2); @@ -297,6 +297,7 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) XXX - Perhaps a new dissector function that combines both is preferred.*/ dissect_bfd_mep(next_tvb, tree, 0); } + return tvb_captured_length(tvb); } gboolean @@ -325,18 +326,18 @@ dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* * FF: Generic/Preferred PW MPLS Control Word dissection as per RFC 4385. */ -static void -dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; if (tvb_reported_length_remaining(tvb, 0) < 4) { proto_tree_add_expert(tree, pinfo, &ei_mpls_pw_mcw_error_processing_message, tvb, 0, -1); - return; + return tvb_captured_length(tvb); } if ( dissect_try_cw_first_nibble( tvb, pinfo, tree )) - return; + return tvb_captured_length(tvb); if (tree) { proto_tree *mpls_pw_mcw_tree; @@ -355,6 +356,7 @@ dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_tvb = tvb_new_subset_remaining(tvb, 4); call_dissector(dissector_data, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } static int @@ -647,7 +649,7 @@ proto_reg_handoff_mpls(void) dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_MPLS, mpls_handle); dissector_add_uint("udp.port", UDP_PORT_MPLS_OVER_UDP, mpls_handle); - mpls_pwcw_handle = create_dissector_handle( dissect_pw_mcw, proto_pw_mcw ); + mpls_pwcw_handle = new_create_dissector_handle( dissect_pw_mcw, proto_pw_mcw ); dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_pwcw_handle ); dissector_data = find_dissector("data"); @@ -655,7 +657,7 @@ proto_reg_handoff_mpls(void) dissector_ip = find_dissector("ip"); dissector_pw_eth_heuristic = find_dissector("pw_eth_heuristic"); - dissector_pw_ach = create_dissector_handle(dissect_pw_ach, proto_pw_ach ); + dissector_pw_ach = new_create_dissector_handle(dissect_pw_ach, proto_pw_ach ); } /* * Editor modelines diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c index 48c155c214..02eba9bfd2 100644 --- a/epan/dissectors/packet-netbios.c +++ b/epan/dissectors/packet-netbios.c @@ -1076,8 +1076,8 @@ dissect_netbios_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle,tvb, pinfo, tree); } -static void -dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *netb_tree = NULL; proto_item *ti; @@ -1107,7 +1107,7 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* print bad packet */ col_set_str( pinfo->cinfo, COL_INFO, "Bad packet, no 0xEFFF marker"); - return; /* this is an unknown packet, no marker */ + return 3; /* this is an unknown packet, no marker */ } } @@ -1237,6 +1237,7 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } pinfo->fragmented = save_fragmented; } + return tvb_captured_length(tvb); } static void @@ -1483,7 +1484,7 @@ proto_reg_handoff_netbios(void) { dissector_handle_t netbios_handle; - netbios_handle = create_dissector_handle(dissect_netbios, + netbios_handle = new_create_dissector_handle(dissect_netbios, proto_netbios); dissector_add_uint("llc.dsap", SAP_NETBIOS, netbios_handle); data_handle = find_dissector("data"); diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 84f872c5a5..158557bf68 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1847,8 +1847,8 @@ static const value_string fileid_type_names[] = { { 0, NULL} }; -static void -dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { int offset = 0; guint32 version; @@ -1882,20 +1882,20 @@ dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, prot break; default: { /* unknown version */ - return; + return 1; } } if (auth_type != 0) { /* unknown authentication type */ - return; + return 2; } if (fsid_type != 0) { /* unknown authentication type */ - return; + return 3; } { @@ -1973,9 +1973,10 @@ dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, prot default: { proto_item_append_text(fileid_item, ": unknown"); /* unknown fileid type */ - return; + return offset; } } + return tvb_captured_length(tvb); } @@ -1983,29 +1984,30 @@ dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, prot * Dissect GlusterFS/NFS NFSv3 File Handle - glusterfs-3.3+ * The filehandle is alway 32 bytes and first 4 bytes of ident ":OGL" */ -static void -dissect_fhandle_data_GLUSTER(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_GLUSTER(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint16 offset=0; guint16 fhlen; char *ident; if (!tree) - return; + return tvb_captured_length(tvb); fhlen = tvb_reported_length(tvb); if (fhlen != 36) - return; + return tvb_captured_length(tvb); ident = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 4, ENC_ASCII); if (strncmp(":OGL", ident, 4)) - return; + return 4; offset += 4; proto_tree_add_item(tree, hf_nfs_fh_exportid, tvb, offset, 16, ENC_NA); offset += 16; proto_tree_add_item(tree, hf_nfs_fh_gfid, tvb, offset, 16, ENC_NA); - /*offset += 16;*/ + offset += 16; + return offset; } /* @@ -2030,8 +2032,8 @@ static const value_string dcache_handle_types[] = { { 0, NULL } }; -static void -dissect_fhandle_data_DCACHE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_DCACHE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { int offset = 0; guint32 version; @@ -2039,28 +2041,28 @@ dissect_fhandle_data_DCACHE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *t guint8 obj_len; if (!tree) - return; + return tvb_captured_length(tvb); version = (tvb_get_ntohl(tvb, offset) & DCACHE_VERSION_MASK) >> 24; magic = (tvb_get_ntohl(tvb, offset) & DCACHE_MAGIC_MASK); if ((version != 1) || (magic != DCACHE_MAGIC)) { /* unknown file handle */ - return; + return 0; } - obj_len = tvb_get_guint8(tvb, offset + 16); - proto_tree_add_item(tree, hf_nfs_fh_version, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_nfs_fh_generation, tvb, offset+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_nfs_fh_dc_exportid, tvb, offset+8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_nfs_fh_dc_handle_type, tvb, offset+15, 1, ENC_BIG_ENDIAN); + obj_len = tvb_get_guint8(tvb, offset + 16); proto_tree_add_item(tree, hf_nfs_fh_dc_opaque, tvb, offset + 17, obj_len, ENC_NA); + return tvb_captured_length(tvb); } /* Dissect EMC Celerra or VNX NFSv3/v4 File Handle */ -static void -dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint16 offset = 0; guint16 fhlen; @@ -2079,7 +2081,7 @@ dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tr proto_tree *obj_tree; if (!tree) - return; + return tvb_captured_length(tvb); obj_item = proto_tree_add_item(tree, hf_nfs_fh_obj, tvb, offset+0, 16, ENC_NA ); obj_tree = proto_item_add_subtree(obj_item, ett_nfs_fh_obj); @@ -2113,7 +2115,7 @@ dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tr */ if (!tree) - return; + return tvb_captured_length(tvb); /* "Named Attribute ID" or "Object ID" (bytes 0 thru 3) */ obj_id = tvb_get_letohl(tvb, offset+0); @@ -2156,6 +2158,7 @@ dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tr "Change the 'Decode NFS file handles as' pref to the correct type or 'Unknown'.", fhlen); } + return tvb_captured_length(tvb); } @@ -13765,7 +13768,7 @@ proto_reg_handoff_nfs(void) fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_NEW, proto_nfs_knfsd_new); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_NEW, proto_nfs_knfsd_new); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3); @@ -13777,13 +13780,13 @@ proto_reg_handoff_nfs(void) fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_CELERRA_VNX, proto_nfs_celerra_vnx); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_CELERRA_VNX, proto_nfs_celerra_vnx); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_GLUSTER, proto_nfs_gluster); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_GLUSTER, proto_nfs_gluster); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_DCACHE, proto_nfs_dcache); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_DCACHE, proto_nfs_dcache); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown); diff --git a/epan/dissectors/packet-omapi.c b/epan/dissectors/packet-omapi.c index b9151d7a94..1e9c8f646b 100644 --- a/epan/dissectors/packet-omapi.c +++ b/epan/dissectors/packet-omapi.c @@ -101,8 +101,8 @@ static const value_string omapi_opcode_vals[] = { { 0, NULL } }; -static void -dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *omapi_tree; @@ -112,6 +112,9 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 msglength; guint32 objlength; + /* Payload too small for OMAPI */ + if (tvb_reported_length_remaining(tvb, 0) < 8) + return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMAPI"); @@ -121,13 +124,7 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) omapi_tree = proto_item_add_subtree(ti, ett_omapi); cursor = ptvcursor_new(omapi_tree, tvb, 0); - if (tvb_reported_length_remaining(tvb, 0) < 8) - { - /* Payload too small for OMAPI */ - ptvcursor_free(cursor); - DISSECTOR_ASSERT_NOT_REACHED(); - } - else if (tvb_reported_length_remaining(tvb, 0) < 24) + if (tvb_reported_length_remaining(tvb, 0) < 24) { /* This is a startup message */ ptvcursor_add(cursor, hf_omapi_version, 4, ENC_BIG_ENDIAN); @@ -137,7 +134,7 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ti, ", Status message"); ptvcursor_free(cursor); - return; + return 8; } else if ( !(tvb_get_ntohl(tvb, 8) || tvb_get_ntohl(tvb, 12)) ) { @@ -222,6 +219,7 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } ptvcursor_free(cursor); + return tvb_captured_length(tvb); } void @@ -319,7 +317,7 @@ proto_reg_handoff_omapi(void) { dissector_handle_t omapi_handle; - omapi_handle = create_dissector_handle(dissect_omapi, proto_omapi); + omapi_handle = new_create_dissector_handle(dissect_omapi, proto_omapi); dissector_add_uint("tcp.port", OMAPI_PORT, omapi_handle); } diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c index 29caa62b36..2f9f0904af 100644 --- a/epan/dissectors/packet-ospf.c +++ b/epan/dissectors/packet-ospf.c @@ -1038,8 +1038,8 @@ ospf_has_at_block(tvbuff_t *tvb, int offset, guint8 packet_type, guint8 version) return 0; } -static void -dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ospf_tree = NULL; proto_item *ti, *ti_sum, *hidden_item; @@ -1115,7 +1115,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Quit at this point if it's an unknown OSPF version. */ if(version != OSPF_VERSION_2 && version != OSPF_VERSION_3) { - return; + return 12; } length = tvb_captured_length(tvb); @@ -1276,6 +1276,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ospf_authentication_trailer(tvb, ospflen + crypto_len, ospf_tree); } + return tvb_captured_length(tvb); } static int @@ -3791,7 +3792,7 @@ proto_reg_handoff_ospf(void) { dissector_handle_t ospf_handle; - ospf_handle = create_dissector_handle(dissect_ospf, proto_ospf); + ospf_handle = new_create_dissector_handle(dissect_ospf, proto_ospf); dissector_add_uint("ip.proto", IP_PROTO_OSPF, ospf_handle); data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-pagp.c b/epan/dissectors/packet-pagp.c index af69587ffe..80020bb1d8 100644 --- a/epan/dissectors/packet-pagp.c +++ b/epan/dissectors/packet-pagp.c @@ -147,8 +147,8 @@ static const true_false_string automode = { }; /* Code to actually dissect the PAGP packets */ -static void -dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 raw_word; guint16 num_tlvs; @@ -207,7 +207,7 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(pagp_tree, hf_pagp_flush_transaction_id, tvb, PAGP_FLUSH_TRANSACTION_ID, 4, raw_word); - return; + return tvb_captured_length(tvb); } /* Info PDU */ @@ -283,12 +283,12 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ( len == 0 ) { expert_add_info_format(pinfo, len_item, &ei_pagp_tlv_length, "Unknown data - TLV len=0"); - return; + return offset; } if ( tvb_reported_length_remaining(tvb, offset) < len ) { expert_add_info_format(pinfo, len_item, &ei_pagp_tlv_length, "TLV length too large"); - return; + return offset; } switch (tlv) { @@ -311,6 +311,7 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += len; } + return tvb_captured_length(tvb); } @@ -491,7 +492,7 @@ proto_reg_handoff_pagp(void) { dissector_handle_t pagp_handle; - pagp_handle = create_dissector_handle(dissect_pagp, proto_pagp); + pagp_handle = new_create_dissector_handle(dissect_pagp, proto_pagp); dissector_add_uint("llc.cisco_pid", 0x0104, pagp_handle); } diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c index 0f3f9b769c..804d01d8c5 100644 --- a/epan/dissectors/packet-pgm.c +++ b/epan/dissectors/packet-pgm.c @@ -801,8 +801,8 @@ decode_pgm_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, /* * dissect_pgm - The dissector for Pragmatic General Multicast */ -static void -dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint16 pgmhdr_sport; guint16 pgmhdr_dport; @@ -821,14 +821,11 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean isdata = FALSE; guint pgmlen, reportedlen; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGM"); + if (tvb_reported_length_remaining(tvb, 0) < 18) + return 0; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGM"); col_clear(pinfo->cinfo, COL_INFO); - if (tvb_reported_length_remaining(tvb, 0) < 18) { - col_set_str(pinfo->cinfo, COL_INFO, - "Packet too small"); - return; - } pinfo->srcport = pgmhdr_sport = tvb_get_ntohs(tvb, 0); pinfo->destport = pgmhdr_dport = tvb_get_ntohs(tvb, 2); @@ -870,7 +867,7 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } break; default: - return; + return 20; } { @@ -970,7 +967,7 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: expert_add_info(pinfo, ti, &ei_address_format_invalid); ptvcursor_free(cursor); - return; + return tvb_captured_length(tvb); } break; case PGM_RDATA_PCKT: @@ -1024,7 +1021,7 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: expert_add_info(pinfo, ti, &ei_address_format_invalid); ptvcursor_free(cursor); - return; + return tvb_captured_length(tvb); } break; case PGM_POLL_PCKT: @@ -1084,6 +1081,7 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ptvcursor_free(cursor); } + return tvb_captured_length(tvb); } /* Register all the bits needed with the filtering engine */ @@ -1450,7 +1448,7 @@ proto_reg_handoff_pgm(void) static guint old_udp_encap_mcast_port; if (! initialized) { - pgm_handle = create_dissector_handle(dissect_pgm, proto_pgm); + pgm_handle = new_create_dissector_handle(dissect_pgm, proto_pgm); dissector_add_for_decode_as("udp.port", pgm_handle); dissector_add_uint("ip.proto", IP_PROTO_PGM, pgm_handle); data_handle = find_dissector("data"); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 882e31ebb0..8c0b0d9190 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -4455,8 +4455,8 @@ static const value_string iphc_crtp_cs_flags[] = { /* * 0x61 Packets: Full IP/UDP Header */ -static void -dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *fh_tree = NULL, *info_tree; proto_item *ti = NULL; @@ -4503,14 +4503,14 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_expert_format(fh_tree, pinfo, &ei_iphc_crtp_ip_version, tvb, 3, -1, "IP version is %u: the only supported version is 4", ip_version); - return; + return 1; } if (next_protocol != IP_PROTO_UDP) { proto_tree_add_expert_format(fh_tree, pinfo, &ei_iphc_crtp_next_protocol, tvb, 3, -1, "Next protocol is %s (%u): the only supported protocol is UDP", ipprotostr(next_protocol), next_protocol); - return; + return 1; } /* context id and sequence fields */ @@ -4562,6 +4562,7 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) info_tree)) { call_dissector_only(data_handle, next_tvb, pinfo, info_tree, NULL); } + return tvb_captured_length(tvb); } /* @@ -4920,8 +4921,8 @@ remove_escape_chars(tvbuff_t *tvb, packet_info *pinfo, int offset, int length) * HDLC-like asynchronous framing byte stream, and have to * break the byte stream into frames and remove escapes. */ -static void -dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) +static int +dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) { proto_item *ti; proto_tree *bs_tree = NULL; @@ -4960,7 +4961,7 @@ dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) add_new_data_source(pinfo, ppp_tvb, "PPP Fragment"); call_dissector(data_handle, ppp_tvb, pinfo, tree); } - return; + return tvb_captured_length(tvb); } if (offset != 0) { /* @@ -4998,7 +4999,7 @@ dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) add_new_data_source(pinfo, ppp_tvb, "PPP Fragment"); call_dissector(data_handle, ppp_tvb, pinfo, tree); } - return; + return tvb_captured_length(tvb); } data_offset = offset + 1; /* skip starting frame delimiter */ @@ -5040,6 +5041,7 @@ dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) } offset = end_offset; } + return tvb_captured_length(tvb); } /* @@ -5067,7 +5069,7 @@ dissect_ppp_usb( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if ((tvb_memeql(tvb, 0, buf2, sizeof(buf2)) == 0) || (tvb_memeql(tvb, 0, buf1, sizeof(buf1)) == 0)) { - dissect_ppp_raw_hdlc(tvb, pinfo, tree); + dissect_ppp_raw_hdlc(tvb, pinfo, tree, data); } else if ((tvb_memeql(tvb, 0, &buf1[1], sizeof(buf1) - 1) == 0) || (tvb_memeql(tvb, 0, &buf2[1], sizeof(buf2) - 1) == 0)) { /* It's missing the 0x7e framing character. What TODO? @@ -5122,7 +5124,7 @@ proto_reg_handoff_ppp_raw_hdlc(void) { dissector_handle_t ppp_raw_hdlc_handle; - ppp_raw_hdlc_handle = create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp); + ppp_raw_hdlc_handle = new_create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp); dissector_add_uint("gre.proto", ETHERTYPE_CDMA2000_A10_UBS, ppp_raw_hdlc_handle); dissector_add_uint("gre.proto", ETHERTYPE_3GPP2, ppp_raw_hdlc_handle); @@ -5220,8 +5222,8 @@ dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * RFC 1994 * Handles CHAP just as a protocol field */ -static void -dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *fh_tree = NULL; @@ -5251,7 +5253,7 @@ dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (length < 4) { proto_tree_add_uint_format_value(fh_tree, hf_chap_length, tvb, 2, 2, length, "%u (invalid, must be >= 4)", length); - return; + return 4; } proto_item_set_len(ti, length); if (tree) { @@ -5282,7 +5284,7 @@ dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint_format_value(field_tree, hf_chap_value_size, tvb, offset, 1, value_size, "%d byte%s (invalid, must be <= %u)", value_size, plurality(value_size, "", "s"), length); - return; + return offset; } proto_tree_add_item(field_tree, hf_chap_value_size, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -5300,7 +5302,6 @@ dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Find name in remaining bytes */ if (length > 0) { - tvb_ensure_bytes_exist(tvb, offset, length); proto_tree_add_item(field_tree, hf_chap_name, tvb, offset, length, ENC_ASCII|ENC_NA); name_offset = offset; @@ -5339,6 +5340,7 @@ dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(fh_tree, hf_chap_stuff, tvb, offset, length, ENC_NA); break; } + return tvb_captured_length(tvb); } /* @@ -6610,7 +6612,7 @@ proto_register_chap(void) void proto_reg_handoff_chap(void) { - dissector_handle_t chap_handle = create_dissector_handle(dissect_chap, + dissector_handle_t chap_handle = new_create_dissector_handle(dissect_chap, proto_chap); dissector_add_uint("ppp.protocol", PPP_CHAP, chap_handle); @@ -6871,7 +6873,7 @@ proto_reg_handoff_iphc_crtp(void) dissector_handle_t cudp8_handle; dissector_handle_t cs_handle; - fh_handle = create_dissector_handle(dissect_iphc_crtp_fh, proto_iphc_crtp); + fh_handle = new_create_dissector_handle(dissect_iphc_crtp_fh, proto_iphc_crtp); dissector_add_uint("ppp.protocol", PPP_RTP_FH, fh_handle); cudp16_handle = new_create_dissector_handle(dissect_iphc_crtp_cudp16, proto_iphc_crtp_cudp16); diff --git a/epan/dissectors/packet-prp.c b/epan/dissectors/packet-prp.c index 3afce6e677..46281d7cd6 100644 --- a/epan/dissectors/packet-prp.c +++ b/epan/dissectors/packet-prp.c @@ -72,8 +72,8 @@ static gboolean prp_enable_dissector = FALSE; /* Code to actually dissect the packets */ -static void -dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *prp_tree; @@ -86,17 +86,12 @@ dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, pr guint trailer_start; guint trailer_length; - if (!tree) - return; - trailer_start = 0; trailer_length = 0; length = tvb_reported_length(tvb); if(length < 14) - { - return; - } + return 0; if(ETHERTYPE_VLAN == tvb_get_ntohs(tvb, 12)) /* tagged frame */ { @@ -107,6 +102,9 @@ dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, pr offset = 14; } + if (!tree) + return tvb_captured_length(tvb); + /* search for PRP-0 trailer */ /* If the frame is > 64 bytes, the PRP-0 trailer is always at the end. */ /* If the frame is <= 64 bytes, the PRP-0 trailer may be anywhere (before the padding) */ @@ -187,6 +185,7 @@ dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, pr tvb, trailer_start+4, 2, ENC_BIG_ENDIAN); } } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -253,7 +252,7 @@ void proto_reg_handoff_prp(void) if (!prefs_initialized) { dissector_handle_t prp_redundancy_control_trailer_handle; - prp_redundancy_control_trailer_handle = create_dissector_handle(dissect_prp_redundancy_control_trailer, proto_prp); + prp_redundancy_control_trailer_handle = new_create_dissector_handle(dissect_prp_redundancy_control_trailer, proto_prp); register_postdissector(prp_redundancy_control_trailer_handle); prefs_initialized = TRUE; diff --git a/epan/dissectors/packet-pw-atm.c b/epan/dissectors/packet-pw-atm.c index 0bfb7da652..31c7d462de 100644 --- a/epan/dissectors/packet-pw-atm.c +++ b/epan/dissectors/packet-pw-atm.c @@ -506,8 +506,8 @@ too_small_packet_or_notpw(tvbuff_t * tvb * * This dissector is written according to the latter consideration. */ -static void -dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int +dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { const char * proto_name_column; const char * proto_name_tree = NULL; @@ -518,7 +518,7 @@ dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_name_column = &shortname_11_or_aal5_pdu[0]; if (too_small_packet_or_notpw(tvb, pinfo, tree, proto_11_or_aal5_pdu, proto_name_column)) { - return; + return 1; } pd.packet_size = tvb_reported_length_remaining(tvb, 0); @@ -688,12 +688,12 @@ dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) col_append_pw_info(pinfo, payload_size, cells, 0, &pd); } - return; + return tvb_captured_length(tvb); } -static void -dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int +dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { const char * proto_name_column; gint payload_size; @@ -706,7 +706,7 @@ dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_name_column = &shortname_aal5_sdu[0]; if (too_small_packet_or_notpw(tvb, pinfo, tree, proto_aal5_sdu, proto_name_column)) { - return; + return 1; } pd.packet_size = tvb_reported_length_remaining(tvb, 0); @@ -893,11 +893,12 @@ dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } } } + return tvb_captured_length(tvb); } -static void -dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int +dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { const char * proto_name_column; gint payload_size; @@ -910,7 +911,7 @@ dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_name_column = &shortname_n1_cw[0]; if (too_small_packet_or_notpw(tvb, pinfo, tree, proto_n1_cw, proto_name_column)) { - return; + return 1; } pd.packet_size = tvb_reported_length_remaining(tvb, 0); @@ -1055,11 +1056,12 @@ dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) col_clear(pinfo->cinfo, COL_INFO); col_append_pw_info(pinfo, payload_size, cells, padding_size, &pd); + return tvb_captured_length(tvb); } -static void -dissect_n1_nocw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int +dissect_n1_nocw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { const char * proto_name_column = &shortname_n1_nocw[0]; gint payload_size; @@ -1124,6 +1126,7 @@ dissect_n1_nocw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) col_clear(pinfo->cinfo, COL_INFO); col_append_pw_info(pinfo, payload_size, cells, 0, &pd); + return tvb_captured_length(tvb); } @@ -1961,13 +1964,13 @@ void proto_reg_handoff_pw_atm_ata(void) { dissector_handle_t h; - h = create_dissector_handle( dissect_n1_cw, proto_n1_cw ); + h = new_create_dissector_handle( dissect_n1_cw, proto_n1_cw ); dissector_add_for_decode_as( "mpls.label", h ); - h = create_dissector_handle( dissect_n1_nocw, proto_n1_nocw ); + h = new_create_dissector_handle( dissect_n1_nocw, proto_n1_nocw ); dissector_add_for_decode_as( "mpls.label", h ); - h = create_dissector_handle( dissect_11_or_aal5_pdu, proto_11_or_aal5_pdu ); + h = new_create_dissector_handle( dissect_11_or_aal5_pdu, proto_11_or_aal5_pdu ); dissector_add_for_decode_as( "mpls.label", h ); - h = create_dissector_handle( dissect_aal5_sdu, proto_aal5_sdu ); + h = new_create_dissector_handle( dissect_aal5_sdu, proto_aal5_sdu ); dissector_add_for_decode_as( "mpls.label", h ); dh_cell = find_dissector("mpls_pw_atm_cell"); diff --git a/epan/dissectors/packet-pw-fr.c b/epan/dissectors/packet-pw-fr.c index 3e962ddb58..9069c568cb 100644 --- a/epan/dissectors/packet-pw-fr.c +++ b/epan/dissectors/packet-pw-fr.c @@ -69,8 +69,8 @@ static const value_string vals_frg[] = { static dissector_handle_t fr_stripped_address_handle; -static void -dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) +static int +dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_ ) { gint packet_size; gint payload_size; @@ -98,12 +98,12 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) } col_set_str(pinfo->cinfo, COL_PROTOCOL, "FR PW"); col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet < PW encapsulation header"); - return; + return 1; } if (dissect_try_cw_first_nibble(tvb,pinfo,tree)) { - return; + return tvb_captured_length(tvb); } /* check how "good" is this packet */ @@ -195,11 +195,11 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) expert_add_info(pinfo, item, &ei_cw_bits03); } - (void)proto_tree_add_item( subtree, hf_cw_fecn, tvb, 0, 1, ENC_BIG_ENDIAN ); - (void)proto_tree_add_item( subtree, hf_cw_becn, tvb, 0, 1, ENC_BIG_ENDIAN ); - (void)proto_tree_add_item( subtree, hf_cw_de, tvb, 0, 1, ENC_BIG_ENDIAN ); - (void)proto_tree_add_item( subtree, hf_cw_cr, tvb, 0, 1, ENC_BIG_ENDIAN ); - (void)proto_tree_add_item( subtree, hf_cw_frg, tvb, 1, 1, ENC_BIG_ENDIAN ); + proto_tree_add_item( subtree, hf_cw_fecn, tvb, 0, 1, ENC_BIG_ENDIAN ); + proto_tree_add_item( subtree, hf_cw_becn, tvb, 0, 1, ENC_BIG_ENDIAN ); + proto_tree_add_item( subtree, hf_cw_de, tvb, 0, 1, ENC_BIG_ENDIAN ); + proto_tree_add_item( subtree, hf_cw_cr, tvb, 0, 1, ENC_BIG_ENDIAN ); + proto_tree_add_item( subtree, hf_cw_frg, tvb, 1, 1, ENC_BIG_ENDIAN ); item = proto_tree_add_item( subtree, hf_cw_len, tvb, 1, 1, ENC_BIG_ENDIAN ); if (packet_quality & PQ_CW_BAD_LEN_GT_PACKET) @@ -242,7 +242,7 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) tvb_payload = tvb_new_subset_length(tvb, encaps_size, payload_size); call_dissector( fr_stripped_address_handle, tvb_payload, pinfo, tree ); } - return; + return tvb_captured_length(tvb); } @@ -313,7 +313,7 @@ proto_reg_handoff_pw_fr(void) { dissector_handle_t pw_fr_mpls_handle; - pw_fr_mpls_handle = create_dissector_handle( dissect_pw_fr, proto_encaps ); + pw_fr_mpls_handle = new_create_dissector_handle( dissect_pw_fr, proto_encaps ); dissector_add_for_decode_as("mpls.label", pw_fr_mpls_handle); fr_stripped_address_handle = find_dissector("fr_stripped_address"); diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index 27c14b7381..f46ee4bda3 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -193,7 +193,7 @@ static void dissect_roofnet_data(proto_tree *tree, tvbuff_t *tvb, packet_info * /* * entry point of the roofnet dissector */ -static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item * it; proto_tree * roofnet_tree; @@ -219,17 +219,18 @@ static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that we do not have a malformed roofnet packet */ if ((roofnet_nlinks*6*4)+ROOFNET_HEADER_LENGTH > ROOFNET_MAX_LENGTH) { expert_add_info_format(pinfo, it, &ei_roofnet_too_many_links, "Too many links (%u)", roofnet_nlinks); - return; + return tvb_captured_length(tvb); } for (; roofnet_nlinks > 0; roofnet_nlinks--) { /* Do we have enough buffer to decode the next link ? */ if (tvb_reported_length_remaining(tvb, offset) < ROOFNET_LINK_DESCRIPTION_LENGTH) - return; + return offset; dissect_roofnet_link(roofnet_tree, tvb, &offset, nlink++); } dissect_roofnet_data(tree, tvb, pinfo, offset+4); + return tvb_captured_length(tvb); } void proto_register_roofnet(void) @@ -357,7 +358,7 @@ void proto_reg_handoff_roofnet(void) /* Until now there is no other option than having an IPv4 payload (maybe * extended one day to IPv6 or other?) */ ip_handle = find_dissector("ip"); - roofnet_handle = create_dissector_handle(dissect_roofnet, proto_roofnet); + roofnet_handle = new_create_dissector_handle(dissect_roofnet, proto_roofnet); /* I did not put the type numbers in the ethertypes.h as they only are * experimental and not official */ dissector_add_uint("ethertype", 0x0641, roofnet_handle); diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c index 5665e86aaa..fa8689c1da 100644 --- a/epan/dissectors/packet-sap.c +++ b/epan/dissectors/packet-sap.c @@ -115,8 +115,8 @@ static expert_field ei_sap_bogus_authentication_or_pad_length = EI_INIT; static dissector_handle_t sdp_handle; -static void -dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; int sap_version, is_ipv6, is_del, is_enc, is_comp, addr_len; @@ -200,7 +200,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((int) auth_data_len - pad_len - 1 < 0) { expert_add_info_format(pinfo, sai, &ei_sap_bogus_authentication_or_pad_length, "Bogus authentication length (%d) or pad length (%d)", auth_len, pad_len); - return; + return tvb_captured_length(tvb); } @@ -223,7 +223,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mangle = &ei_sap_compressed; proto_tree_add_expert(sap_tree, pinfo, mangle, tvb, offset, -1); - return; + return tvb_captured_length(tvb); } if (tree) { @@ -273,6 +273,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Done with SAP */ next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(sdp_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void proto_register_sap(void) @@ -381,7 +382,7 @@ proto_reg_handoff_sap(void) { dissector_handle_t sap_handle; - sap_handle = create_dissector_handle(dissect_sap, proto_sap); + sap_handle = new_create_dissector_handle(dissect_sap, proto_sap); dissector_add_uint("udp.port", UDP_PORT_SAP, sap_handle); /* diff --git a/epan/dissectors/packet-symantec.c b/epan/dissectors/packet-symantec.c index 94dc8c7009..7d8fbc376e 100644 --- a/epan/dissectors/packet-symantec.c +++ b/epan/dissectors/packet-symantec.c @@ -39,8 +39,8 @@ static int hf_symantec_etype = -1; static gint ett_symantec = -1; -static void -dissect_symantec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_symantec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *symantec_tree; @@ -73,7 +73,7 @@ dissect_symantec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* a valid packet can't be both v2 and v3 or neither v2 nor v3, */ if ((etypev2 == 0) == (etypev3 == 0)) - return; + return 12; col_set_str(pinfo->cinfo, COL_PROTOCOL, "Symantec"); @@ -113,6 +113,7 @@ dissect_symantec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissector_try_uint(ethertype_dissector_table, etypev3, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -143,7 +144,7 @@ proto_reg_handoff_symantec(void) ethertype_dissector_table = find_dissector_table("ethertype"); - symantec_handle = create_dissector_handle(dissect_symantec, + symantec_handle = new_create_dissector_handle(dissect_symantec, proto_symantec); dissector_add_uint("wtap_encap", WTAP_ENCAP_SYMANTEC, symantec_handle); } diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 5cac0f86f8..176b9a931d 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -132,8 +132,8 @@ static const value_string tacacs_resp_vals[] = { #define UDP_PORT_TACACS 49 #define TCP_PORT_TACACS 49 -static void -dissect_tacacs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tacacs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *tacacs_tree; proto_item *ti; @@ -199,6 +199,7 @@ dissect_tacacs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } void @@ -280,7 +281,7 @@ proto_reg_handoff_tacacs(void) { dissector_handle_t tacacs_handle; - tacacs_handle = create_dissector_handle(dissect_tacacs, proto_tacacs); + tacacs_handle = new_create_dissector_handle(dissect_tacacs, proto_tacacs); dissector_add_uint("udp.port", UDP_PORT_TACACS, tacacs_handle); } @@ -875,8 +876,8 @@ parse_tacplus_keys( const char *keys_from_option ) #endif } -static void -dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *new_tvb=NULL; proto_tree *tacplus_tree, *body_tree; @@ -895,7 +896,7 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->can_desegment && tacplus_preference_desegment) { pinfo->desegment_offset = 0; pinfo->desegment_len = len; - return; + return tvb_captured_length(tvb); } if( request ) { @@ -976,6 +977,7 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_tacplus_body( tvb, pinfo, new_tvb, body_tree); } } + return tvb_captured_length(tvb); } static void @@ -1275,7 +1277,7 @@ proto_reg_handoff_tacplus(void) { dissector_handle_t tacplus_handle; - tacplus_handle = create_dissector_handle(dissect_tacplus, + tacplus_handle = new_create_dissector_handle(dissect_tacplus, proto_tacplus); dissector_add_uint("tcp.port", TCP_PORT_TACACS, tacplus_handle); } diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 19cba28696..5208614f19 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -920,8 +920,8 @@ guint8 vnc_depth; static dissector_handle_t vnc_handle; /* Code to dissect the packets */ -static void -dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gboolean ret; gint offset = 0; @@ -967,7 +967,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) vnc_set_depth(pinfo, vnc_depth); if (ret) { - return; /* We're in a "startup" state; Cannot yet do "normal" processing */ + return tvb_captured_length(tvb); /* We're in a "startup" state; Cannot yet do "normal" processing */ } if(DEST_PORT_VNC || per_conversation_info->server_port == pinfo->destport) { @@ -976,6 +976,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { vnc_server_to_client(tvb, pinfo, &offset, vnc_tree); } + return tvb_captured_length(tvb); } /* Returns the new offset after processing the 4-byte vendor string */ @@ -1082,7 +1083,7 @@ static gboolean test_vnc_protocol(tvbuff_t *tvb, packet_info *pinfo, pinfo->srcport, pinfo->destport, 0); conversation_set_dissector(conversation, vnc_handle); - dissect_vnc(tvb, pinfo, tree); + dissect_vnc(tvb, pinfo, tree, data); return TRUE; } return FALSE; @@ -4781,7 +4782,7 @@ proto_reg_handoff_vnc(void) static guint vnc_preference_alternate_port_last = 0; if(!inited) { - vnc_handle = create_dissector_handle(dissect_vnc, proto_vnc); + vnc_handle = new_create_dissector_handle(dissect_vnc, proto_vnc); dissector_add_uint("tcp.port", 5500, vnc_handle); dissector_add_uint("tcp.port", 5501, vnc_handle); diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index 42f773f854..b7d678e19b 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -300,7 +300,7 @@ static void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo, circuit_type ctype } -static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *wcp_tree; proto_item *ti; @@ -311,7 +311,7 @@ static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "WCP"); col_clear(pinfo->cinfo, COL_INFO); - temp =tvb_get_ntohs(tvb, 0); + temp = tvb_get_ntohs(tvb, 0); cmd = (temp & 0xf000) >> 12; ext_cmd = (temp & 0x0f00) >> 8; @@ -363,7 +363,7 @@ static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* exit if done */ if ( cmd != 1 && cmd != 0 && !(cmd == 0xf && ext_cmd == 0)) - return; + return 2; if ( cmd == 1) { /* uncompressed data */ if ( !pinfo->fd->flags.visited){ /* if first pass */ @@ -376,7 +376,7 @@ static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { next_tvb = wcp_uncompress( tvb, wcp_header_len, pinfo, wcp_tree, pinfo->ctype, pinfo->circuit_id); if ( !next_tvb){ - return; + return tvb_captured_length(tvb); } } @@ -386,7 +386,7 @@ static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(fr_uncompressed_handle, next_tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } @@ -790,7 +790,7 @@ proto_reg_handoff_wcp(void) { */ fr_uncompressed_handle = find_dissector("fr_uncompressed"); - wcp_handle = create_dissector_handle(dissect_wcp, proto_wcp); + wcp_handle = new_create_dissector_handle(dissect_wcp, proto_wcp); dissector_add_uint("fr.nlpid", NLPID_COMPRESSED, wcp_handle); dissector_add_uint("ethertype", ETHERTYPE_WCP, wcp_handle); } diff --git a/epan/dissectors/packet-wreth.c b/epan/dissectors/packet-wreth.c index 4bca480227..e022faf27a 100644 --- a/epan/dissectors/packet-wreth.c +++ b/epan/dissectors/packet-wreth.c @@ -28,7 +28,6 @@ void proto_register_wreth(void); void proto_reg_handoff_wreth(void); -static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static gint WrethIdentPacket(tvbuff_t *tvb, guint8 Offset, packet_info * pInfo, proto_tree * pWrethTree); static gint WrethConnectPacket(tvbuff_t *tvb, guint8 Offset, packet_info * pInfo, proto_tree * pWrethTree); static gint WrethDisconnectPacket(tvbuff_t *tvb, guint8 Offset, packet_info * pInfo, proto_tree * pWrethTree); @@ -731,9 +730,8 @@ static const value_string ErrorCode_vals[] = { }; static value_string_ext ErrorCode_vals_ext = VALUE_STRING_EXT_INIT(ErrorCode_vals); -static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - guint16 packet_type,functionCode; guint8 fragmented; proto_item *mi, *ti; @@ -747,7 +745,7 @@ static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /*Read the packet type, if not good, exit*/ packet_type = tvb_get_ntohs(tvb,0); - if(packet_type != WSE_RETH_SUBTYPE) return; + if(packet_type != WSE_RETH_SUBTYPE) return 1; mi = proto_tree_add_protocol_format(tree, wreth_proto, tvb, Offset, -1, "WSE remote ethernet"); pWrethTree = proto_item_add_subtree(mi, ett_wreth); @@ -758,7 +756,7 @@ static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(fragmented > 2) { col_set_str(pinfo->cinfo, COL_INFO, "Invalid fragmented byte"); - return; + return tvb_captured_length(tvb); } if (tree) @@ -790,7 +788,7 @@ static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(pWrethTree, hf_Wreth_Retry, tvb, Offset + 11, 1, ENC_LITTLE_ENDIAN); WrethMailDissection(tvb, Offset + 12, pinfo, pWrethTree, fragmented); - return; + return tvb_captured_length(tvb); } ti = proto_tree_add_item(pWrethTree, hf_Wreth_Fragmented, tvb, Offset + 10, 1, ENC_LITTLE_ENDIAN); @@ -840,6 +838,7 @@ static void dissect_wreth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + return tvb_captured_length(tvb); } /*****************************************************************************/ @@ -1998,7 +1997,7 @@ void proto_reg_handoff_wreth(void) { dissector_handle_t wreth_handle; - wreth_handle = create_dissector_handle(dissect_wreth, wreth_proto); + wreth_handle = new_create_dissector_handle(dissect_wreth, wreth_proto); dissector_add_uint("ethertype", WRETH_PORT, wreth_handle); } |