diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-22 22:59:08 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-23 13:09:55 +0000 |
commit | 2bbbb4879c3e0885fd971bd75ca88a183feb92f0 (patch) | |
tree | 9bbd51756fa6230f3555612e27863b316371ad38 /epan | |
parent | 073cfb33ec84f12d7904f0e6ed2b0a5d049f4ded (diff) |
register_dissector -> new_register_dissector
Change-Id: Ic368dd8e83cf39e0c934da0ae2744778e2d54ce6
Reviewed-on: https://code.wireshark.org/review/12050
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
29 files changed, 253 insertions, 235 deletions
diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c index 032234cfd1..9c4d32bdff 100644 --- a/epan/dissectors/packet-alcap.c +++ b/epan/dissectors/packet-alcap.c @@ -1319,7 +1319,7 @@ extern void alcap_tree_from_bearer_key(proto_tree* tree, tvbuff_t* tvb, packet_i #define GET_MSG_TYPE(id) ( array_length(msg_types) <= id ? &(msg_types[0]) : &(msg_types[id]) ) -static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *alcap_tree = NULL; alcap_message_info_t* msg_info = wmem_new0(wmem_packet_scope(), alcap_message_info_t); int len = tvb_reported_length(tvb); @@ -1475,6 +1475,7 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { if (tree && leg) alcap_leg_tree(alcap_tree,tvb,pinfo,leg); } + return tvb_captured_length(tvb); } void @@ -2391,7 +2392,7 @@ proto_register_alcap(void) proto_alcap = proto_register_protocol(alcap_proto_name, alcap_proto_name_short, "alcap"); - register_dissector("alcap", dissect_alcap, proto_alcap); + new_register_dissector("alcap", dissect_alcap, proto_alcap); proto_register_field_array(proto_alcap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c index 0ba7e4c9c3..c55b61901d 100644 --- a/epan/dissectors/packet-arp.c +++ b/epan/dissectors/packet-arp.c @@ -1363,8 +1363,8 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data static const guint8 mac_allzero[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static void -dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint16 ar_hrd; guint16 ar_pro; @@ -1393,11 +1393,11 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ar_hrd = tvb_get_ntohs(tvb, AR_HRD); if (ar_hrd == ARPHRD_ATM2225) { call_dissector(atmarp_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } if (ar_hrd == ARPHRD_AX25) { call_dissector(ax25arp_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* Protocol Address Type */ ar_pro = tvb_get_ntohs(tvb, AR_PRO); @@ -1747,6 +1747,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, " (duplicate use of %s detected!)", arpproaddr_to_str((guint8*)&duplicate_ip, 4, ETHERTYPE_IP)); } + return tvb_captured_length(tvb); } void @@ -1971,7 +1972,7 @@ proto_register_arp(void) atmarp_handle = new_create_dissector_handle(dissect_atmarp, proto_arp); ax25arp_handle = new_create_dissector_handle(dissect_ax25arp, proto_arp); - arp_handle = register_dissector( "arp" , dissect_arp, proto_arp ); + arp_handle = new_register_dissector( "arp" , dissect_arp, proto_arp ); /* Preferences */ arp_module = prefs_register_protocol(proto_arp, NULL); diff --git a/epan/dissectors/packet-bctp.c b/epan/dissectors/packet-bctp.c index 58372a2f04..64bde42b31 100644 --- a/epan/dissectors/packet-bctp.c +++ b/epan/dissectors/packet-bctp.c @@ -67,7 +67,7 @@ static const value_string bvei_vals[] = { }; -static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { +static int dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { proto_item* pi = proto_tree_add_item(tree, proto_bctp, tvb,0,2, ENC_NA); proto_tree* pt = proto_item_add_subtree(pi,ett_bctp); tvbuff_t* sub_tvb = tvb_new_subset_remaining(tvb, 2); @@ -78,14 +78,15 @@ static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { proto_tree_add_item(pt, hf_bctp_tpei, tvb,0,2, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_bctp_tpi, tvb,0,2, ENC_BIG_ENDIAN); - if ( dissector_try_uint(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) { - return; - } else if (tpi <= 0x22) { - call_dissector(data_handle,sub_tvb, pinfo, tree); - } else { - /* tpi > 0x22 */ - call_dissector(text_handle,sub_tvb, pinfo, tree); + if (!dissector_try_uint(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) { + if (tpi <= 0x22) { + call_dissector(data_handle,sub_tvb, pinfo, tree); + } else { + /* tpi > 0x22 */ + call_dissector(text_handle,sub_tvb, pinfo, tree); + } } + return tvb_captured_length(tvb); } void @@ -105,7 +106,7 @@ proto_register_bctp (void) proto_register_field_array(proto_bctp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("bctp", dissect_bctp, proto_bctp); + new_register_dissector("bctp", dissect_bctp, proto_bctp); bctp_dissector_table = register_dissector_table("bctp.tpi", "BCTP Tunneled Protocol Indicator", FT_UINT32, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); } diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 23ecfc8329..6c27aa2713 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -6689,8 +6689,8 @@ dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* * Dissect a BGP packet. */ -static void -dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { volatile int offset = 0; /* offset into the tvbuff */ gint reported_length_remaining; @@ -6789,7 +6789,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; - return; + return tvb_captured_length(tvb); } } @@ -6803,7 +6803,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * as an error. */ show_reported_bounds_error(tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* @@ -6821,7 +6821,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ pinfo->desegment_offset = offset; pinfo->desegment_len = bgp_len - length_remaining; - return; + return tvb_captured_length(tvb); } } @@ -6874,6 +6874,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (offset <= offset_before) break; } + return tvb_captured_length(tvb); } /* @@ -8323,7 +8324,7 @@ proto_register_bgp(void) "BGP dissector detect the length of the AS number in AS_PATH attributes automatically or manually (NOTE: Automatic detection is not 100% accurate)", &bgp_asn_len, asn_len, FALSE); - register_dissector("bgp", dissect_bgp, proto_bgp); + new_register_dissector("bgp", dissect_bgp, proto_bgp); } void @@ -8331,7 +8332,7 @@ proto_reg_handoff_bgp(void) { dissector_handle_t bgp_handle; - bgp_handle = create_dissector_handle(dissect_bgp, proto_bgp); + bgp_handle = new_create_dissector_handle(dissect_bgp, proto_bgp); dissector_add_uint("tcp.port", BGP_TCP_PORT, bgp_handle); } /* diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 0bfc1c8b46..664e9cc156 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -6383,8 +6383,8 @@ static void get_bssgp_msg_params(guint8 oct, const gchar **msg_str, int *ett_tre return; } -static void -dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; @@ -6422,7 +6422,7 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_INFO, "%s", msg_str); }else{ expert_add_info_format(pinfo, ti, &ei_bssgp_msg_type, "Unknown message 0x%x", g_pdu_type); - return; + return 1; } /* @@ -6443,6 +6443,7 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { (*msg_fcn_p)(tvb, bssgp_tree, pinfo, offset, len - offset); } + return tvb_captured_length(tvb); } void @@ -7043,7 +7044,7 @@ proto_register_bssgp(void) proto_register_subtree_array(ett, array_length(ett)); expert_bssgp = expert_register_protocol(proto_bssgp); expert_register_field_array(expert_bssgp, ei, array_length(ei)); - register_dissector("bssgp", dissect_bssgp, proto_bssgp); + new_register_dissector("bssgp", dissect_bssgp, proto_bssgp); /* Register configuration options */ bssgp_module = prefs_register_protocol(proto_bssgp, NULL); diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c index 91fab30562..db73c4c984 100644 --- a/epan/dissectors/packet-clnp.c +++ b/epan/dissectors/packet-clnp.c @@ -204,8 +204,8 @@ gboolean clnp_decode_atn_options = FALSE; * CLNP part / main entry point */ -static void -dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *clnp_tree; proto_item *ti, *ti_len = NULL, *ti_pdu_len = NULL, *ti_tot_len = NULL; @@ -247,14 +247,14 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, 1); if (call_dissector(ositp_inactive_handle, next_tvb, pinfo, tree) == 0) call_dissector(data_handle,tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* return if version not known */ cnf_vers = tvb_get_guint8(tvb, P_CLNP_VERS); if (cnf_vers != ISO8473_V1) { call_dissector(data_handle,tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* fixed part decoding */ @@ -272,7 +272,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < minimum length %u", FIXED_PART_LEN); - return; + return 2; } proto_tree_add_uint(clnp_tree, hf_clnp_version, tvb, P_CLNP_VERS, 1, cnf_vers); @@ -319,7 +319,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Segment length is less than the header length. */ expert_add_info_format(pinfo, ti_pdu_len, &ei_clnp_length, "PDU length < header length %u", cnf_hdr_len); - return; + return 7; } cnf_cksum = tvb_get_ntohs(tvb, P_CLNP_CKSUM); cksum_status = calc_checksum(tvb, 0, cnf_hdr_len, cnf_cksum); @@ -369,7 +369,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < %u", FIXED_PART_LEN + 1); - return; + return offset; } dst_len = tvb_get_guint8(tvb, offset); if (tree) { @@ -386,7 +386,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < %u", FIXED_PART_LEN + 1 + dst_len); - return; + return offset; } nsel = tvb_get_guint8(tvb, offset + dst_len - 1); set_address_tvb(&pinfo->net_dst, get_osi_address_type(), dst_len, tvb, offset); @@ -405,7 +405,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < %u", FIXED_PART_LEN + 1 + dst_len + 1); - return; + return offset; } src_len = tvb_get_guint8(tvb, offset); if (tree) { @@ -423,7 +423,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < %u", FIXED_PART_LEN + 1 + dst_len + 1 + src_len); - return; + return offset; } set_address_tvb(&pinfo->net_src, get_osi_address_type(), src_len, tvb, offset); copy_address_shallow(&pinfo->src, &pinfo->net_src); @@ -447,7 +447,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, ti_len, &ei_clnp_length, "Header length value < %u", FIXED_PART_LEN + 1 + dst_len + 1 + SEGMENTATION_PART_LEN); - return; + return offset; } du_id = tvb_get_ntohs(tvb, offset); @@ -460,7 +460,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Reassembled length is less than the length of this segment. */ expert_add_info_format(pinfo, ti_tot_len, &ei_clnp_length, "Total length < segment length %u", segment_length); - return; + return offset; } offset += SEGMENTATION_PART_LEN; opt_len -= SEGMENTATION_PART_LEN; @@ -529,7 +529,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); pinfo->fragmented = save_fragmented; - return; + return tvb_captured_length(tvb); } if (tvb_offset_exists(tvb, offset)) { @@ -544,19 +544,19 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (nsel==NSEL_NET && tvb_get_guint8(next_tvb, 0)==NLPID_ISO10747_IDRP) { if(call_dissector(idrp_handle, next_tvb, pinfo, tree) != 0) { pinfo->fragmented = save_fragmented; - return; + return tvb_captured_length(tvb); } } if (nsel == (guchar)tp_nsap_selector || always_decode_transport) { if (call_dissector(ositp_handle, next_tvb, pinfo, tree) != 0) { pinfo->fragmented = save_fragmented; - return; /* yes, it appears to be COTP or CLTP */ + return tvb_captured_length(tvb); /* yes, it appears to be COTP or CLTP */ } } if (dissector_try_heuristic(clnp_heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) { pinfo->fragmented = save_fragmented; - return; /* yes, it appears to be one of the protocols in the heuristic list */ + return tvb_captured_length(tvb); /* yes, it appears to be one of the protocols in the heuristic list */ } break; @@ -586,7 +586,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->flags.in_error_pkt = save_in_error_pkt; } pinfo->fragmented = save_fragmented; - return; /* we're done with this PDU */ + return tvb_captured_length(tvb); /* we're done with this PDU */ case ERQ_NPDU: case ERP_NPDU: @@ -597,6 +597,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); call_dissector(data_handle,next_tvb, pinfo, tree); pinfo->fragmented = save_fragmented; + return tvb_captured_length(tvb); } /* dissect_clnp */ static void @@ -737,7 +738,7 @@ proto_register_clnp(void) proto_register_subtree_array(ett, array_length(ett)); expert_clnp = expert_register_protocol(proto_clnp); expert_register_field_array(expert_clnp, ei, array_length(ei)); - register_dissector("clnp", dissect_clnp, proto_clnp); + new_register_dissector("clnp", dissect_clnp, proto_clnp); clnp_heur_subdissector_list = register_heur_dissector_list("clnp"); register_init_routine(clnp_reassemble_init); register_cleanup_routine(clnp_reassemble_cleanup); @@ -771,7 +772,7 @@ proto_reg_handoff_clnp(void) idrp_handle = find_dissector("idrp"); data_handle = find_dissector("data"); - clnp_handle = create_dissector_handle(dissect_clnp, proto_clnp); + clnp_handle = new_create_dissector_handle(dissect_clnp, proto_clnp); dissector_add_uint("osinl.incl", NLPID_ISO8473_CLNP, clnp_handle); dissector_add_uint("osinl.incl", NLPID_NULL, clnp_handle); /* Inactive subset */ dissector_add_uint("x.25.spi", NLPID_ISO8473_CLNP, clnp_handle); diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index 9d1111a94a..f3a57d1be9 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -58,8 +58,8 @@ static gboolean generate_md5_hash = FALSE; static gint ett_data = -1; -static void -dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) +static int +dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree, void* data _U_) { gint bytes; @@ -110,6 +110,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) PROTO_ITEM_SET_GENERATED (ti); } } + return tvb_captured_length(tvb); } void @@ -136,7 +137,7 @@ proto_register_data(void) "data" /* abbrev */ ); - register_dissector("data", dissect_data, proto_data); + new_register_dissector("data", dissect_data, proto_data); proto_register_fields(proto_data, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index e352dd29f1..77fec90292 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -337,8 +337,8 @@ static gint looks_like_dtls(tvbuff_t *tvb, guint32 offset); /* * Code to actually dissect the packets */ -static void -dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { conversation_t *conversation; @@ -376,8 +376,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) session->last_nontls_frame >= pinfo->fd->num) { /* This conversation started at a different protocol and STARTTLS was * used, but this packet comes too early. */ - /* TODO: convert to new-style dissector and return 0 to reject packet. */ - return; + return 0; } /* try decryption only the first time we see this packet @@ -450,6 +449,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } tap_queue_packet(dtls_tap, pinfo, NULL); + return tvb_captured_length(tvb); } static gboolean @@ -467,13 +467,13 @@ dissect_dtls_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat /* Advance offset to the end of the current DTLS record */ offset += tvb_get_ntohs(tvb, offset + 11) + 13; if (offset == length) { - dissect_dtls(tvb, pinfo, tree); + dissect_dtls(tvb, pinfo, tree, data); return TRUE; } } if (pinfo->fragmented && offset >= 13) { - dissect_dtls(tvb, pinfo, tree); + dissect_dtls(tvb, pinfo, tree, data); return TRUE; } return FALSE; @@ -490,12 +490,12 @@ dissect_dtls_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat offset += tvb_get_ntohs(tvb, offset + 8) + 10; } else { /* Dissect what we've got, which might be as little as 3 bytes. */ - dissect_dtls(tvb, pinfo, tree); + dissect_dtls(tvb, pinfo, tree, data); return TRUE; } if (offset == length) { /* Can this ever happen? Well, just in case ... */ - dissect_dtls(tvb, pinfo, tree); + dissect_dtls(tvb, pinfo, tree, data); return TRUE; } } @@ -504,7 +504,7 @@ dissect_dtls_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat * original number of bytes present before truncation or we're dealing with * a packet fragment that's also been truncated. */ if ((length >= 3) && (offset <= tvb_reported_length(tvb) || pinfo->fragmented)) { - dissect_dtls(tvb, pinfo, tree); + dissect_dtls(tvb, pinfo, tree, data); return TRUE; } return FALSE; @@ -1833,7 +1833,7 @@ proto_register_dtls(void) } #endif - register_dissector("dtls", dissect_dtls, proto_dtls); + new_register_dissector("dtls", dissect_dtls, proto_dtls); dtls_handle = find_dissector("dtls"); register_init_routine(dtls_init); diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c index 35142fb6e1..b0dd2ef462 100644 --- a/epan/dissectors/packet-esis.c +++ b/epan/dissectors/packet-esis.c @@ -243,8 +243,8 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i * Output: * void, but we will add to the proto_tree if it is not NULL. */ -static void -dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 version, length; proto_item *ti, *type_item; proto_tree *esis_tree = NULL; @@ -265,7 +265,6 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { expert_add_info_format(pinfo, ti, &ei_esis_length, "Bogus ESIS length (%u, must be >= %u)", length, ESIS_HDR_FIXED_LENGTH ); - return; } version = tvb_get_guint8(tvb, 2); @@ -336,6 +335,7 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { default: expert_add_info(pinfo, type_item, &ei_esis_type); } + return tvb_captured_length(tvb); } /* dissect_esis */ @@ -413,7 +413,7 @@ proto_register_esis(void) { proto_register_subtree_array(ett, array_length(ett)); expert_esis = expert_register_protocol(proto_esis); expert_register_field_array(expert_esis, ei, array_length(ei)); - register_dissector("esis", dissect_esis, proto_esis); + new_register_dissector("esis", dissect_esis, proto_esis); } void diff --git a/epan/dissectors/packet-gmr1_rach.c b/epan/dissectors/packet-gmr1_rach.c index bffaa65813..2caeb33821 100644 --- a/epan/dissectors/packet-gmr1_rach.c +++ b/epan/dissectors/packet-gmr1_rach.c @@ -870,8 +870,8 @@ dissect_gmprs_rach_type2_kls2(tvbuff_t *tvb, int offset, tvb, offset + 15, 1, ENC_BIG_ENDIAN); } -static void -dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { const int RACH_IE_CLASS1 = (1 << 0); const int RACH_IE_CLASS2_GMR1 = (1 << 1); @@ -916,7 +916,7 @@ dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!ies) { col_append_str(pinfo->cinfo, COL_INFO, "(Invalid)"); call_dissector(data_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } col_append_str(pinfo->cinfo, COL_INFO, "(RACH) "); @@ -932,6 +932,8 @@ dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (ies & RACH_IE_CLASS2_GMPRS_TYPE2) dissect_gmprs_rach_type2_kls2(tvb, 2, pinfo, rach_tree); + + return tvb_captured_length(tvb); } void @@ -1183,7 +1185,7 @@ proto_register_gmr1_rach(void) proto_register_field_array(proto_gmr1_rach, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("gmr1_rach", dissect_gmr1_rach, proto_gmr1_rach); + new_register_dissector("gmr1_rach", dissect_gmr1_rach, proto_gmr1_rach); } void diff --git a/epan/dissectors/packet-gmrp.c b/epan/dissectors/packet-gmrp.c index 6d66f89a83..d73732ce88 100644 --- a/epan/dissectors/packet-gmrp.c +++ b/epan/dissectors/packet-gmrp.c @@ -107,8 +107,8 @@ static const value_string event_vals[] = { /* Code to actually dissect the packets */ -static void -dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *gmrp_tree, *msg_tree, *attr_tree; @@ -142,7 +142,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + 2), pinfo, tree); - return; + return tvb_captured_length(tvb); } offset += 2; @@ -173,7 +173,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } @@ -192,7 +192,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } attr_index = 0; @@ -227,7 +227,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } else @@ -260,7 +260,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } break; @@ -275,7 +275,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } /* Show attribute value */ @@ -304,7 +304,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } break; @@ -313,7 +313,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } @@ -324,6 +324,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msg_index++; } + return tvb_captured_length(tvb); } @@ -393,7 +394,7 @@ proto_register_gmrp(void) expert_gmrp = expert_register_protocol(proto_gmrp); expert_register_field_array(expert_gmrp, ei, array_length(ei)); - register_dissector("gmrp", dissect_gmrp, proto_gmrp); + new_register_dissector("gmrp", dissect_gmrp, proto_gmrp); } diff --git a/epan/dissectors/packet-gprs-llc.c b/epan/dissectors/packet-gprs-llc.c index 2d4e6ce160..df4b5a060f 100644 --- a/epan/dissectors/packet-gprs-llc.c +++ b/epan/dissectors/packet-gprs-llc.c @@ -458,8 +458,8 @@ static void llc_gprs_dissect_xid(tvbuff_t *tvb, } -static void -dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 addr_fld=0, sapi=0, ctrl_fld_fb=0, frame_format, tmp=0; guint16 offset=0 , epm = 0, nu=0, ctrl_fld_ui_s=0; @@ -490,7 +490,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (addr_fld > 128 ) { col_set_str(pinfo->cinfo, COL_INFO, "Invalid packet - Protocol Discriminator bit is set to 1"); - return; + return offset; } sapi = addr_fld & 0xF; @@ -1113,6 +1113,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* END MLT CHANGES */ break; } + return tvb_captured_length(tvb); } @@ -1338,7 +1339,7 @@ proto_register_llcgprs(void) proto_register_subtree_array(ett, array_length(ett)); expert_llcgprs = expert_register_protocol(proto_llcgprs); expert_register_field_array(expert_llcgprs, ei, array_length(ei)); - register_dissector("llcgprs", dissect_llcgprs, proto_llcgprs); + new_register_dissector("llcgprs", dissect_llcgprs, proto_llcgprs); llcgprs_module = prefs_register_protocol ( proto_llcgprs, NULL ); prefs_register_bool_preference ( llcgprs_module, "autodetect_cipher_bit", diff --git a/epan/dissectors/packet-gsm_a_rp.c b/epan/dissectors/packet-gsm_a_rp.c index 3f47859a99..be5eb4208a 100644 --- a/epan/dissectors/packet-gsm_a_rp.c +++ b/epan/dissectors/packet-gsm_a_rp.c @@ -418,8 +418,8 @@ static void (*rp_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo /* GENERIC DISSECTOR FUNCTIONS */ -static void -dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 oct; guint32 offset, saved_offset; @@ -475,9 +475,9 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint_format(rp_tree, hf_gsm_a_rp_msg_type, tvb, saved_offset, 1, oct, "Message Type %s", str ? str : "(Unknown)"); - if (str == NULL) return; + if (str == NULL) return offset; - if (offset >=len) return; + if (offset >=len) return offset; /* * decode elements @@ -490,6 +490,7 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { (*rp_msg_fcn[idx])(tvb, rp_tree, pinfo, offset, len - offset); } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -559,7 +560,7 @@ proto_register_gsm_a_rp(void) expert_gsm_a_rp = expert_register_protocol(proto_a_rp); expert_register_field_array(expert_gsm_a_rp, ei, array_length(ei)); - register_dissector("gsm_a_rp", dissect_rp, proto_a_rp); + new_register_dissector("gsm_a_rp", dissect_rp, proto_a_rp); } void @@ -567,7 +568,7 @@ proto_reg_handoff_gsm_a_rp(void) { dissector_handle_t gsm_a_rp_handle; - gsm_a_rp_handle = create_dissector_handle(dissect_rp, proto_a_rp); + gsm_a_rp_handle = new_create_dissector_handle(dissect_rp, proto_a_rp); /* Dissect messages embedded in SIP */ dissector_add_string("media_type","application/vnd.3gpp.sms", gsm_a_rp_handle); gsm_sms_handle = find_dissector("gsm_sms"); diff --git a/epan/dissectors/packet-gsm_a_rr.c b/epan/dissectors/packet-gsm_a_rr.c index 3b1a0af4d6..9ff6da22df 100644 --- a/epan/dissectors/packet-gsm_a_rr.c +++ b/epan/dissectors/packet-gsm_a_rr.c @@ -10811,8 +10811,8 @@ void get_rr_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf * The code should probably be cleaned up. * The name CCCH might not be correct! */ -static void -dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { static gsm_a_tap_rec_t tap_rec[4]; @@ -10842,7 +10842,7 @@ dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * too short to be CCCH */ call_dissector(data_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } col_append_str(pinfo->cinfo, COL_INFO, "(CCCH) "); @@ -10896,7 +10896,7 @@ dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: /* XXX - hf_idx is still -1! this is a bug in the implementation, and I don't know how to fix it so simple return here */ - return; + return tvb_captured_length(tvb); } /* @@ -10969,10 +10969,10 @@ dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tap_queue_packet(gsm_a_tap, pinfo, tap_p); if (msg_str == NULL) - return; + return offset; if (offset >= len) - return; + return offset; /* * decode elements @@ -10982,6 +10982,7 @@ dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) }else{ (*msg_fcn_p)(tvb, ccch_tree, pinfo, offset, len - offset); } + return tvb_captured_length(tvb); } const value_string gsm_a_rr_short_pd_msg_strings[] = { @@ -11030,8 +11031,8 @@ const value_string short_protocol_discriminator_vals[] = { { 0, NULL } }; -static void -dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { static gsm_a_tap_rec_t tap_rec[4]; static gsm_a_tap_rec_t *tap_p; @@ -11104,7 +11105,7 @@ dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_bits_item(sacch_tree, hf_gsm_a_rr_short_pd, tvb, offset * 8 + bit_offset++, 1, ENC_BIG_ENDIAN); if (hf_idx == -1) - return; + return 1; /* * add SACCH message name @@ -11122,7 +11123,7 @@ dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tap_queue_packet(gsm_a_tap, pinfo, tap_p); if (msg_str == NULL) - return; + return offset; /* * decode elements @@ -11132,6 +11133,7 @@ dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) }else{ (*msg_fcn_p)(tvb, sacch_tree, pinfo, offset, len - offset); } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -13338,7 +13340,7 @@ proto_register_gsm_a_rr(void) proto_register_protocol("GSM CCCH", "GSM CCCH", "gsm_a.ccch"); /* subdissector code */ - register_dissector("gsm_a_ccch", dissect_ccch, proto_a_ccch); + new_register_dissector("gsm_a_ccch", dissect_ccch, proto_a_ccch); /* Register the protocol name and description */ proto_a_sacch = @@ -13347,7 +13349,7 @@ proto_register_gsm_a_rr(void) proto_register_field_array(proto_a_sacch, hf_rr_short_pd, array_length(hf_rr_short_pd)); /* subdissector code */ - register_dissector("gsm_a_sacch", dissect_sacch, proto_a_sacch); + new_register_dissector("gsm_a_sacch", dissect_sacch, proto_a_sacch); /* subtree array (for both sub-dissectors) */ proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-gvrp.c b/epan/dissectors/packet-gvrp.c index f2dc019a6b..b7f02d4f97 100644 --- a/epan/dissectors/packet-gvrp.c +++ b/epan/dissectors/packet-gvrp.c @@ -89,8 +89,8 @@ static const value_string event_vals[] = { }; /* Code to actually dissect the packets */ -static void -dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *id_item; proto_tree *gvrp_tree, *msg_tree, *attr_tree; @@ -127,7 +127,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + 2), pinfo, tree); - return; + return tvb_captured_length(tvb); } offset += 2; @@ -157,7 +157,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } @@ -175,7 +175,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } attr_index = 0; @@ -208,7 +208,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } else @@ -241,7 +241,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } break; @@ -255,7 +255,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset),pinfo, tree); - return; + return tvb_captured_length(tvb); } /* Show attribute value */ @@ -269,7 +269,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - return; + return tvb_captured_length(tvb); } } @@ -280,6 +280,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msg_index++; } + return tvb_captured_length(tvb); } @@ -343,7 +344,7 @@ proto_register_gvrp(void) expert_gvrp = expert_register_protocol(proto_gvrp); expert_register_field_array(expert_gvrp, ei, array_length(ei)); - register_dissector("gvrp", dissect_gvrp, proto_gvrp); + new_register_dissector("gvrp", dissect_gvrp, proto_gvrp); } void diff --git a/epan/dissectors/packet-h263.c b/epan/dissectors/packet-h263.c index fbdd0d136a..1c2e16f06f 100644 --- a/epan/dissectors/packet-h263.c +++ b/epan/dissectors/packet-h263.c @@ -627,7 +627,7 @@ dissect_h263_picture_layer( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, A word of 17 bits. Its value is 0000 0000 0000 0000 1. ( 1xxx xxxx ) */ -static void dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) +static int dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_ ) { guint offset = 0; proto_item *h263_payload_item = NULL; @@ -645,7 +645,7 @@ static void dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if(length<4){ if( tree ) proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA ); - return; + return tvb_captured_length(tvb); } /* Check for PSC, PSC is a word of 22 bits. Its value is 0000 0000 0000 0000' 1000 00xx xxxx xxxx. */ data = tvb_get_ntohl(tvb, offset); @@ -690,6 +690,8 @@ static void dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr } if( tree ) proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA ); + + return tvb_captured_length(tvb); } void @@ -1021,7 +1023,7 @@ proto_register_h263_data(void) proto_h263_data = proto_register_protocol("ITU-T Recommendation H.263", "H.263", "h263"); proto_register_field_array(proto_h263_data, hf, array_length(hf)); - register_dissector("h263data", dissect_h263_data, proto_h263_data); + new_register_dissector("h263data", dissect_h263_data, proto_h263_data); } /* diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 3cbec4fbe6..02e2d9384c 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -2495,8 +2495,8 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) pinfo->fragmented = save_fragmented; } -static void -dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ip_tree; proto_item *ti, *tf; @@ -2506,11 +2506,11 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(version == 4){ dissect_ip_v4(tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } if(version == 6){ call_dissector(ipv6_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* Bogus IP version */ @@ -2521,6 +2521,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ip_tree = proto_item_add_subtree(ti, ett_ip); tf = proto_tree_add_item(ip_tree, hf_ip_version, tvb, 0, 1, ENC_NA); expert_add_info(pinfo, tf, &ei_ip_bogus_ip_version); + return 1; } static gboolean @@ -3167,7 +3168,7 @@ proto_register_ip(void) "Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port", &try_heuristic_first); - register_dissector("ip", dissect_ip, proto_ip); + new_register_dissector("ip", dissect_ip, proto_ip); register_init_routine(ip_defragment_init); register_cleanup_routine(ip_defragment_cleanup); ip_tap = register_tap("ip"); diff --git a/epan/dissectors/packet-ipars.c b/epan/dissectors/packet-ipars.c index 5e44bec563..d39d5abc0a 100644 --- a/epan/dissectors/packet-ipars.c +++ b/epan/dissectors/packet-ipars.c @@ -45,8 +45,8 @@ static gint ett_ipars = -1; #define MAX_EOM_MSG_SIZE (16) /* max size of an EOMx indicator string */ -static void -dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) +static int +dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree, void* data _U_) { int bytes; guint8 ia = 0, ta = 0, cmd = 0, la = 0; @@ -112,13 +112,13 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) if (ia == 0x03) { proto_tree_add_protocol_format(ipars_tree, proto_ipars, tvb, 0, 1, "GoAhead Next IA"); col_set_str(pinfo->cinfo, COL_INFO, "GoAhead"); - return; + return tvb_captured_length(tvb); } else if (ia != S1) { proto_tree_add_protocol_format(ipars_tree, proto_ipars, tvb, 0, bytes, "Unknown format - Data (%d byte%s)", bytes, plurality(bytes, "", "s")); - return; + return tvb_captured_length(tvb); } proto_tree_add_protocol_format(ipars_tree, proto_ipars, tvb, 0, 1, "S1"); ia = tvb_get_guint8(tvb, 1) & 0x3f; @@ -127,7 +127,7 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) 0, bytes, "Unknown format - Data (%d byte%s)", bytes, plurality(bytes, "", "s")); - return; + return tvb_captured_length(tvb); } proto_tree_add_protocol_format(ipars_tree, proto_ipars, tvb, 1, 1, "S2"); ia = tvb_get_guint8(tvb, 2) & 0x3f; @@ -150,11 +150,11 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) 0, bytes, "Data (%d byte%s)", bytes, plurality(bytes, "", "s")); - return; - + return tvb_captured_length(tvb); } } } + return tvb_captured_length(tvb); } void @@ -167,7 +167,7 @@ proto_register_ipars(void) proto_ipars = proto_register_protocol("International Passenger Airline Reservation System", "IPARS", "ipars"); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("ipars", dissect_ipars, proto_ipars); + new_register_dissector("ipars", dissect_ipars, proto_ipars); } /* diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 8b84d1d79a..03c3cdc945 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -1985,8 +1985,8 @@ dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data _ /* END SHIM6 PART */ -static void -dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ipv6_tree, *ipv6_exthdr_tree, *pt; proto_item *ipv6_item, *ti, *pi; @@ -2028,7 +2028,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Invalid IPv6 header (%u bytes, need exactly 40)", tvb_reported_length(tvb)); expert_add_info(pinfo, ipv6_item, &ei_ipv6_invalid_header); - return; + return tvb_captured_length(tvb); } ipv6_tree = proto_item_add_subtree(ipv6_item, ett_ipv6); @@ -2047,7 +2047,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_INFO, "Bogus IPv6 version (%u, must be 6)", version); expert_add_info_format(pinfo, ti_ipv6_version, &ei_ipv6_bogus_ipv6_version, "Bogus IPv6 version"); - return; + return offset + IP6H_CTL_VFC; } tfc = IPv6_HDR_TCLS(ipv6); @@ -2305,7 +2305,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) plen = ipv6_info->jumbo_length; if (plen == 0) { col_add_fstr(pinfo->cinfo, COL_INFO, "Bogus IPv6 jumbo length"); - return; + return tvb_captured_length(tvb); } } else if (plen == 0) { /* IPv6 length zero is invalid if there is a hop-by-hop header without jumbo option */ @@ -2313,14 +2313,14 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (ti_ipv6_plen) { expert_add_info(pinfo, ti_ipv6_plen, &ei_ipv6_opt_jumbo_missing); } - return; + return tvb_captured_length(tvb); } else if (plen < (guint32)advance) { col_add_fstr(pinfo->cinfo, COL_INFO, "Bogus IPv6 payload length"); if (ti_ipv6_plen) { proto_item_append_text(ti_ipv6_plen, " (Bogus, less than hop-by-hop extension header length)"); expert_add_info(pinfo, ti_ipv6_plen, &ei_ipv6_bogus_ipv6_length); } - return; + return tvb_captured_length(tvb); } } } @@ -2330,7 +2330,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ti_ipv6_plen, " (Bogus, next header is %s)", ipprotostr(nxt)); expert_add_info(pinfo, ti_ipv6_plen, &ei_ipv6_bogus_ipv6_length); } - return; + return tvb_captured_length(tvb); } if (plen > (tvb_reported_length(tvb) - 40)) { expert_add_info_format(pinfo, ti_ipv6_plen, &ei_ipv6_bogus_payload_length, @@ -2432,6 +2432,7 @@ again: } } pinfo->fragmented = save_fragmented; + return tvb_captured_length(tvb); } void @@ -3534,7 +3535,7 @@ proto_register_ipv6(void) "Whether to display IPv6 extension headers as a separate protocol or a sub-protocol of the IPv6 packet", &ipv6_exthdr_under_root); - register_dissector("ipv6", dissect_ipv6, proto_ipv6); + new_register_dissector("ipv6", dissect_ipv6, proto_ipv6); register_init_routine(ipv6_reassemble_init); register_cleanup_routine(ipv6_reassemble_cleanup); ipv6_tap = register_tap("ipv6"); diff --git a/epan/dissectors/packet-isis.c b/epan/dissectors/packet-isis.c index f65d734344..2fa46bc199 100644 --- a/epan/dissectors/packet-isis.c +++ b/epan/dissectors/packet-isis.c @@ -70,8 +70,8 @@ static const value_string isis_vals[] = { { 0, NULL} }; -static void -dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *version_item; proto_tree *isis_tree = NULL; @@ -103,7 +103,6 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Unknown ISIS version (%u vs %u)", isis_version, ISIS_REQUIRED_VERSION ); expert_add_info(pinfo, version_item, &ei_isis_version); - return; } offset += 1; @@ -146,6 +145,7 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_expert(tree, pinfo, &ei_isis_type, tvb, offset, -1); } + return tvb_captured_length(tvb); } /* dissect_isis */ void @@ -209,7 +209,7 @@ proto_register_isis(void) expert_isis = expert_register_protocol(proto_isis); expert_register_field_array(expert_isis, ei, array_length(ei)); - isis_handle = register_dissector("isis", dissect_isis, proto_isis); + isis_handle = new_register_dissector("isis", dissect_isis, proto_isis); isis_dissector_table = register_dissector_table("isis.type", "ISIS Type", FT_UINT8, BASE_DEC, DISSECTOR_TABLE_ALLOW_DUPLICATE); diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c index 72140f3c28..dee36e40e5 100644 --- a/epan/dissectors/packet-iuup.c +++ b/epan/dissectors/packet-iuup.c @@ -605,7 +605,7 @@ static void add_payload_crc(tvbuff_t* tvb, packet_info* pinfo, proto_item* iuup_ #define PROCEDURE_MASK 0x0f #define FQC_MASK 0xc0 #define PDUTYPE_MASK 0xf0 -static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) { +static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, void* data _U_) { proto_item* pi; proto_item* iuup_item = NULL; proto_item* pdutype_item = NULL; @@ -664,12 +664,11 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) expert_add_info(pinfo, pi, &ei_iuup_error_response); } - if (!tree) return; proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN); add_hdr_crc(tvb, pinfo, iuup_tree, crccheck); add_payload_crc(tvb, pinfo, iuup_tree); dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,4,pinfo->circuit_id); - return; + return tvb_captured_length(tvb); case PDUTYPE_DATA_NO_CRC: col_append_fstr(pinfo->cinfo, COL_INFO," RFCI %u", (guint)(second_octet & 0x3f)); @@ -680,12 +679,10 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) expert_add_info(pinfo, pi, &ei_iuup_error_response); } - if (!tree) - return; proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN); add_hdr_crc(tvb, pinfo, iuup_tree, crccheck); dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,3,pinfo->circuit_id); - return; + return tvb_captured_length(tvb); case PDUTYPE_DATA_CONTROL_PROC: if (tree) { ack_item = proto_tree_add_item(iuup_tree,hf_iuup_ack_nack,tvb,0,1,ENC_BIG_ENDIAN); @@ -707,43 +704,40 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) case ACKNACK_ACK: switch(second_octet & PROCEDURE_MASK) { case PROC_INIT: - if (!tree) return; proto_tree_add_item(iuup_tree,hf_iuup_spare_03,tvb,2,1,ENC_BIG_ENDIAN); proto_tree_add_item(iuup_tree,hf_iuup_spare_ff,tvb,3,1,ENC_BIG_ENDIAN); - return; + return tvb_captured_length(tvb); case PROC_RATE: - if (!tree) return; dissect_iuup_ratectl(tvb,pinfo,iuup_tree); - return; + return tvb_captured_length(tvb); case PROC_TIME: case PROC_ERROR: break; default: expert_add_info(pinfo, proc_item, &ei_iuup_procedure_indicator); - return; + return tvb_captured_length(tvb); } break; case ACKNACK_NACK: pi = proto_tree_add_item(iuup_tree,hf_iuup_error_cause_val,tvb,4,1,ENC_BIG_ENDIAN); expert_add_info(pinfo, pi, &ei_iuup_error_response); - return; + return tvb_captured_length(tvb); case ACKNACK_RESERVED: expert_add_info(pinfo, ack_item, &ei_iuup_ack_nack); - return; + return tvb_captured_length(tvb); case ACKNACK_PROC: break; } switch( second_octet & PROCEDURE_MASK ) { case PROC_INIT: - if (tree) add_payload_crc(tvb, pinfo, iuup_tree); + add_payload_crc(tvb, pinfo, iuup_tree); dissect_iuup_init(tvb,pinfo,iuup_tree,pinfo->circuit_id); - return; + return tvb_captured_length(tvb); case PROC_RATE: - if (!tree) return; add_payload_crc(tvb, pinfo, iuup_tree); dissect_iuup_ratectl(tvb,pinfo,iuup_tree); - return; + return tvb_captured_length(tvb); case PROC_TIME: { proto_tree* time_tree; @@ -769,7 +763,7 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) } proto_tree_add_item(iuup_tree,hf_iuup_spare_bytes,tvb,5,-1,ENC_NA); - return; + return tvb_captured_length(tvb); } case PROC_ERROR: col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb,4) & 0x3f,iuup_error_causes,"Unknown (%u)")); @@ -778,19 +772,20 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree) pi = proto_tree_add_item(iuup_tree,hf_iuup_errorevt_cause_val,tvb,4,1,ENC_BIG_ENDIAN); expert_add_info(pinfo, pi, &ei_iuup_error_response); proto_tree_add_item(iuup_tree,hf_iuup_spare_bytes,tvb,5,-1,ENC_NA); - return; + return tvb_captured_length(tvb); default: /* bad */ expert_add_info(pinfo, proc_item, &ei_iuup_procedure_indicator); - return; + return tvb_captured_length(tvb); } default: expert_add_info(pinfo, pdutype_item, &ei_iuup_pdu_type); - return; + break; } + return tvb_captured_length(tvb); } -static gboolean dissect_iuup_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static gboolean dissect_iuup_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int len = tvb_captured_length(tvb); guint8 first_octet = tvb_get_guint8(tvb,0); @@ -817,24 +812,25 @@ static gboolean dissect_iuup_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree return FALSE; } - dissect_iuup(tvb, pinfo, tree); + dissect_iuup(tvb, pinfo, tree, data); return TRUE; } -static void find_iuup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int find_iuup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int len = tvb_captured_length(tvb); int offset = 0; while (len > 3) { - if ( dissect_iuup_heur(tvb_new_subset_remaining(tvb,offset), pinfo, tree) ) - return; + if ( dissect_iuup_heur(tvb_new_subset_remaining(tvb,offset), pinfo, tree, data) ) + return tvb_captured_length(tvb); offset++; len--; } call_dissector(data_handle, tvb, pinfo, tree); + return tvb_captured_length(tvb); } static void init_iuup(void) { @@ -1000,8 +996,8 @@ void proto_register_iuup(void) { proto_register_subtree_array(ett, array_length(ett)); expert_iuup = expert_register_protocol(proto_iuup); expert_register_field_array(expert_iuup, ei, array_length(ei)); - register_dissector("iuup", dissect_iuup, proto_iuup); - register_dissector("find_iuup", find_iuup, proto_iuup); + new_register_dissector("iuup", dissect_iuup, proto_iuup); + new_register_dissector("find_iuup", find_iuup, proto_iuup); register_init_routine(&init_iuup); register_cleanup_routine(&cleanup_iuup); diff --git a/epan/dissectors/packet-lapb.c b/epan/dissectors/packet-lapb.c index 8dd9d1e187..910e2b0510 100644 --- a/epan/dissectors/packet-lapb.c +++ b/epan/dissectors/packet-lapb.c @@ -61,8 +61,8 @@ static const xdlc_cf_items lapb_cf_items = { &hf_lapb_ftype_s_u }; -static void -dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *lapb_tree, *ti; guint16 control; @@ -99,7 +99,7 @@ dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) proto_tree_add_protocol_format(tree, proto_lapb, tvb, 0, -1, "Invalid LAPB frame"); - return; + return 1; } switch (pinfo->p2p_dir) { @@ -153,6 +153,7 @@ dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + return tvb_captured_length(tvb); } void @@ -213,7 +214,7 @@ proto_register_lapb(void) proto_register_field_array (proto_lapb, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("lapb", dissect_lapb, proto_lapb); + new_register_dissector("lapb", dissect_lapb, proto_lapb); } void diff --git a/epan/dissectors/packet-lapdm.c b/epan/dissectors/packet-lapdm.c index 8f81127fe7..fffe40d43c 100644 --- a/epan/dissectors/packet-lapdm.c +++ b/epan/dissectors/packet-lapdm.c @@ -216,8 +216,8 @@ lapdm_defragment_cleanup (void) } -static void -dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *lapdm_tree, *addr_tree, *length_tree; proto_item *lapdm_ti, *addr_ti, *length_ti; @@ -230,7 +230,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that there's enough data */ if (tvb_captured_length(tvb) < LAPDM_HEADER_LEN) - return; + return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPDm"); @@ -285,7 +285,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* No point in doing anything if no payload */ if( !MIN(len, available_length) ) - return; + return 2; payload = tvb_new_subset(tvb, LAPDM_HEADER_LEN, MIN(len,available_length), len); @@ -344,6 +344,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) payload, pinfo, tree)) call_dissector(data_handle,payload, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -489,7 +490,7 @@ proto_register_lapdm(void) proto_register_field_array (proto_lapdm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("lapdm", dissect_lapdm, proto_lapdm); + new_register_dissector("lapdm", dissect_lapdm, proto_lapdm); lapdm_sapi_dissector_table = register_dissector_table("lapdm.sapi", "LAPDm SAPI", FT_UINT8, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c index 91fc71b409..2146c8f388 100644 --- a/epan/dissectors/packet-lapsat.c +++ b/epan/dissectors/packet-lapsat.c @@ -433,8 +433,8 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int is_ return ctl; } -static void -dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_) { proto_tree *lapsat_tree, *addr_tree; proto_item *lapsat_ti, *addr_ti; @@ -445,7 +445,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that there's enough data */ if (tvb_captured_length(tvb) < LAPSAT_HEADER_LEN) - return; + return 0; /* Set protocol column */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPSat"); @@ -503,7 +503,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_get_guint8(tvb, 3) : tvb_captured_length(tvb) - hlen; if (!plen) - return; /* No point in doing more if there is no payload */ + return 3; /* No point in doing more if there is no payload */ DISSECTOR_ASSERT((plen + hlen) <= tvb_captured_length(tvb)); @@ -574,6 +574,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!dissector_try_uint(lapsat_sapi_dissector_table, sapi, payload, pinfo, tree)) call_dissector(data_handle, payload, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -762,7 +763,7 @@ proto_register_lapsat(void) proto_register_field_array (proto_lapsat, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("lapsat", dissect_lapsat, proto_lapsat); + new_register_dissector("lapsat", dissect_lapsat, proto_lapsat); lapsat_sapi_dissector_table = register_dissector_table("lapsat.sapi", "LAPSat SAPI", FT_UINT8, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); diff --git a/epan/dissectors/packet-mac-lte-framed.c b/epan/dissectors/packet-mac-lte-framed.c index 25319f29ef..995878a9c6 100644 --- a/epan/dissectors/packet-mac-lte-framed.c +++ b/epan/dissectors/packet-mac-lte-framed.c @@ -34,8 +34,8 @@ static int proto_mac_lte_framed = -1; extern int proto_mac_lte; /* Main dissection function. */ -static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) +static int dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, void* data _U_) { gint offset = 0; struct mac_lte_info *p_mac_lte_info; @@ -45,7 +45,7 @@ static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, /* Need to find enabled mac-lte dissector */ dissector_handle_t mac_lte_handle = find_dissector("mac-lte"); if (!mac_lte_handle) { - return; + return 0; } /* Do this again on re-dissection to re-discover offset of actual PDU */ @@ -55,7 +55,7 @@ static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, - tag for data - at least one byte of MAC PDU payload */ if ((size_t)tvb_reported_length_remaining(tvb, offset) < (3+2)) { - return; + return 5; } /* If redissecting, use previous info struct (if available) */ @@ -71,7 +71,7 @@ static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, /* Dissect the fields to populate p_mac_lte */ if (!dissect_mac_lte_context_fields(p_mac_lte_info, tvb, &offset)) { - return; + return offset; } /* Store info in packet (first time) */ @@ -85,6 +85,7 @@ static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, /* Create tvb that starts at actual MAC PDU */ mac_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector_only(mac_lte_handle, mac_tvb, pinfo, tree, NULL); + return tvb_captured_length(tvb); } void proto_register_mac_lte_framed(void) @@ -93,7 +94,7 @@ void proto_register_mac_lte_framed(void) proto_mac_lte_framed = proto_register_protocol("mac-lte-framed", "MAC-LTE-FRAMED", "mac-lte-framed"); /* Allow other dissectors to find this one by name. */ - register_dissector("mac-lte-framed", dissect_mac_lte_framed, proto_mac_lte_framed); + new_register_dissector("mac-lte-framed", dissect_mac_lte_framed, proto_mac_lte_framed); } /* diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 6ec4d403fa..f487965753 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -436,8 +436,8 @@ static void dissect_megaco_Packagesdescriptor(tvbuff_t *tvb, proto_tree *tree, gint tvb_next_offset, gint tvb_current_offset); static void tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree); -static void -dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static int +dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); static gint megaco_tvb_find_token(tvbuff_t *tvb, gint offset, gint maxlength); static dissector_handle_t data_handle; @@ -469,7 +469,7 @@ static int dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree * It's not a TPKT packet; * Is in MEGACO ? */ - dissect_megaco_text(tvb, pinfo, tree); + dissect_megaco_text(tvb, pinfo, tree, data); } dissect_tpkt_encap(tvb, pinfo, tree, TRUE, megaco_text_handle); @@ -550,8 +550,8 @@ my_proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, * dissect_megaco_text - The dissector for the MEGACO Protocol, using * text encoding. */ -static void -dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint tvb_len, len; gint tvb_offset,tvb_current_offset,tvb_previous_offset,tvb_next_offset,tokenlen; @@ -599,7 +599,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dword = tvb_get_ntoh24(tvb,0); if ((dword == 0x836803)&&(h248_otp_handle)){ call_dissector(h248_otp_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } msg = gcp_msg(pinfo, tvb_raw_offset(tvb), keep_persistent_data); @@ -616,7 +616,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * * tvb_offset = tvb_find_guint8(tvb, tvb_offset, 5, 'M'); */ - if(!tvb_get_nstringz0(tvb,tvb_offset,sizeof(word),word)) return; + if(!tvb_get_nstringz0(tvb,tvb_offset,sizeof(word),word)) return tvb_captured_length(tvb); short_form = (tvb_get_guint8(tvb, tvb_offset ) == '!'); @@ -633,8 +633,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } call_dissector(handle,tvb,pinfo,tree); - - return; + return tvb_captured_length(tvb); } @@ -656,7 +655,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_previous_offset == -1) { expert_add_info_format(pinfo, ti, &ei_megaco_parse_error, "Sorry, no \"/\" in the MEGACO header, I can't parse this packet"); - return; + return tvb_captured_length(tvb); } my_proto_tree_add_string(megaco_tree, hf_megaco_start, tvb, 0, tvb_previous_offset+1, @@ -682,7 +681,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_previous_offset == tvb_current_offset) { expert_add_info_format(pinfo, ti, &ei_megaco_parse_error, "[ Parse error: missing SEP in MEGACO header ]"); - return; + return tvb_current_offset; } tvb_previous_offset = tvb_current_offset; @@ -701,7 +700,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_current_offset == -1) { expert_add_info_format(pinfo, ti, &ei_megaco_parse_error, "[ Parse error: no body in MEGACO message (missing SEP after mId) ]"); - return; + return tvb_captured_length(tvb); } tvb_next_offset = megaco_tvb_skip_wsp(tvb, tvb_current_offset); @@ -774,7 +773,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_command_start_offset = tvb_previous_offset; dissect_megaco_errordescriptor(tvb, megaco_tree, tvb_len-1, tvb_command_start_offset); } - return; + return tvb_captured_length(tvb); /* transactionResponseAck * transactionResponseAck = ResponseAckToken LBRKT transactionAck * *(COMMA transactionAck) RBRKT @@ -803,7 +802,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(global_megaco_raw_text){ tvb_raw_text_add(tvb, megaco_tree); } - return; + return tvb_captured_length(tvb); /* Pe and PN is transactionPending, P+"any char" is transactionReply */ case PENDINGTOKEN: @@ -824,7 +823,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "%d Pending", pending_id); my_proto_tree_add_uint(megaco_tree, hf_megaco_transid, tvb, save_offset, save_length, pending_id); - return; + return tvb_captured_length(tvb); /* transactionReply */ case REPLYTOKEN: @@ -851,7 +850,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tempchar = tvb_get_guint8(tvb,tvb_offset); if ((tempchar == 'E')||(tempchar == 'e')){ dissect_megaco_errordescriptor(tvb, megaco_tree, tvb_transaction_end_offset-1, tvb_offset); - return; + return tvb_captured_length(tvb); } /* Offset should be at first printable char after { */ tvb_previous_offset = tvb_offset; @@ -881,7 +880,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_expert_format(tree, pinfo, &ei_megaco_error_descriptor_transaction_list, tvb, 0, -1, "Sorry, can't understand errorDescriptor / transactionList = %s, can't parse it pos %u", tvb_format_text(tvb,tvb_previous_offset,2),tvb_previous_offset); - return; + return tvb_captured_length(tvb); } /* end switch */ /* Only these remains now * transactionReply = ReplyToken EQUAL TransactionID LBRKT @@ -914,7 +913,7 @@ nextcontext: if (tvb_current_offset >= tvb_next_offset) { proto_tree_add_expert_format(megaco_tree, pinfo, &ei_megaco_parse_error, tvb, context_offset, context_length, "Parse error: Invalid offset"); - return; + return tvb_captured_length(tvb); } tvb_current_offset = tvb_next_offset; @@ -1075,13 +1074,13 @@ nextcontext: gint tvb_topology_end_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '}'); if ( tvb_topology_end_offset == -1 ){ expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Missing \"}\""); - return; + return tvb_captured_length(tvb); } tvb_command_start_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '{'); if ( tvb_command_start_offset == -1 ){ expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Missing \"{\""); - return; + return tvb_captured_length(tvb); } dissect_megaco_topologydescriptor(tvb, megaco_tree_command_line, tvb_topology_end_offset-1, tvb_command_start_offset+1); @@ -1122,7 +1121,7 @@ nextcontext: tvb_transaction_end_offset, '='); if (tvb_offset == -1 ) { proto_tree_add_expert_format(megaco_tree, pinfo, &ei_megaco_parse_error, tvb, tvb_command_start_offset, len+1, "Parse error: Missing \"=\""); - return; + return tvb_captured_length(tvb); } tvb_offset = megaco_tvb_skip_wsp_return(tvb, tvb_offset -1); tokenlen = tvb_offset - tvb_command_start_offset; @@ -1317,11 +1316,9 @@ nextcontext: break; default: - { proto_item_append_text(sub_ti, "<None> 0x%02x", tempchar); expert_add_info(pinfo, sub_ti, &ei_megaco_no_command); - return; - } + return tvb_captured_length(tvb); } } else{ @@ -1409,13 +1406,13 @@ nextcontext: tvb_transaction_end_offset, '='); if (tvb_offset == -1 ) { expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Missing \"=\""); - return; + return tvb_captured_length(tvb); } tvb_offset = megaco_tvb_skip_wsp(tvb, tvb_offset+1); tokenlen = tvb_next_offset - tvb_offset; if (tokenlen+1 <= 0) { expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Invalid token length (%d)", tokenlen+1); - return; + return tvb_captured_length(tvb); } tempchar = tvb_get_guint8(tvb, tvb_offset); @@ -1431,7 +1428,7 @@ nextcontext: case 'E': if ((tokenlen+1 > (int) sizeof(TermID))) { expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Invalid TermID length (%d)", tokenlen+1); - return; + return tvb_captured_length(tvb); } tvb_get_nstringz0(tvb,tvb_offset,tokenlen+1,TermID); TermID[0] = 'e'; @@ -1544,6 +1541,7 @@ nextcontext: if(global_megaco_raw_text){ tvb_raw_text_add(tvb, megaco_tree); } + return tvb_captured_length(tvb); } #define MEGACO_MODEM_TOKEN 1 @@ -3720,7 +3718,7 @@ proto_register_megaco(void) proto_megaco = proto_register_protocol("MEGACO", "MEGACO", "megaco"); - register_dissector("megaco", dissect_megaco_text, proto_megaco); + new_register_dissector("megaco", dissect_megaco_text, proto_megaco); proto_register_field_array(proto_megaco, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-meta.c b/epan/dissectors/packet-meta.c index 21bb434a1f..aa968e8733 100644 --- a/epan/dissectors/packet-meta.c +++ b/epan/dissectors/packet-meta.c @@ -506,8 +506,8 @@ static gint32 evaluate_meta_items(guint16 schema, tvbuff_t *tvb, packet_info *pi return total_len; } -static void -dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { #define META_HEADER_SIZE 8 guint16 schema, proto, hdrlen, reserved; @@ -537,12 +537,12 @@ dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (item_len < 0) { /* evaluate_meta_items signalled an error */ - return; /* stop parsing */ + return META_HEADER_SIZE; /* stop parsing */ } if (hdrlen != item_len) { expert_add_info(pinfo, ti, &ei_meta_invalid_header); - return; + return META_HEADER_SIZE; } /* find next subdissector based on the chosen schema */ @@ -600,6 +600,7 @@ dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(next_dissector ? next_dissector : data_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -780,7 +781,7 @@ proto_register_meta(void) expert_module_t* expert_meta; proto_meta = proto_register_protocol("Metadata", "META", "meta"); - register_dissector("meta", dissect_meta, proto_meta); + new_register_dissector("meta", dissect_meta, proto_meta); proto_register_field_array(proto_meta, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-mka.c b/epan/dissectors/packet-mka.c index 346010958c..af6656ce42 100644 --- a/epan/dissectors/packet-mka.c +++ b/epan/dissectors/packet-mka.c @@ -454,8 +454,8 @@ dissect_icv(proto_tree *mka_tree, tvbuff_t *tvb, int *offset_ptr) *offset_ptr = offset; } -static void -dissect_mka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 mka_version_type = 0; @@ -470,12 +470,10 @@ dissect_mka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * The 802.1X-2010 spec specifies support for MKA version 1 only - * If not version 1, bail out. */ mka_version_type = tvb_get_guint8(tvb, offset); if (mka_version_type != 1) { - proto_tree_add_expert(mka_tree, pinfo, &ei_unexpected_data, tvb, offset, -1); - return; + expert_add_info(pinfo, ti, &ei_unexpected_data); } /* @@ -515,6 +513,7 @@ dissect_mka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += tvb_reported_length_remaining(tvb, offset); } } + return tvb_captured_length(tvb); } void @@ -759,7 +758,7 @@ proto_register_mka(void) }; proto_mka = proto_register_protocol("MACsec Key Agreement", "EAPOL-MKA", "mka"); - register_dissector("mka", dissect_mka, proto_mka); + new_register_dissector("mka", dissect_mka, proto_mka); proto_register_field_array(proto_mka, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index ec1b1ff26f..8960abde42 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -357,8 +357,8 @@ dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(dissector_data, next_tvb, pinfo, tree); } -static void -dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint32 label = MPLS_LABEL_INVALID; @@ -436,7 +436,7 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_strlcpy(PW_ACH, "Generic Associated Channel Header",50); next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(dissector_pw_ach, next_tvb, pinfo, tree ); - return; + return tvb_captured_length(tvb); } else g_strlcpy(PW_ACH, "PW Associated Channel Header",50); @@ -453,7 +453,7 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) found = dissector_try_uint_new(mpls_subdissector_table, label, next_tvb, pinfo, tree, FALSE, &mplsinfo); if (found) - return; + return tvb_captured_length(tvb); /* 2) use the 1st nibble logic (see BCP 4928, RFC 4385 and 5586) */ if (first_nibble == 4) { @@ -461,16 +461,16 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* IP dissector may reduce the length of the tvb. We need to do the same, so that ethernet trailer is detected. */ set_actual_length(tvb, offset+tvb_reported_length(next_tvb)); - return; + return tvb_captured_length(tvb); } else if (first_nibble == 6) { call_dissector(dissector_ipv6, next_tvb, pinfo, tree); /* IPv6 dissector may reduce the length of the tvb. We need to do the same, so that ethernet trailer is detected. */ set_actual_length(tvb, offset+tvb_reported_length(next_tvb)); - return; + return tvb_captured_length(tvb); } else if (first_nibble == 1) { call_dissector(dissector_pw_ach, next_tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } else if (tvb_captured_length(next_tvb) >= 14) { guint16 etype = tvb_get_ntohs(next_tvb, 12); if ((etype == ETHERTYPE_IP) ||(etype == ETHERTYPE_ARP) || @@ -479,10 +479,11 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* This looks like an ethernet packet with a known ethertype. Decode payload as Ethernet PW */ call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } } call_dissector(dissector_data, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -603,7 +604,7 @@ proto_register_mpls(void) expert_mpls = expert_register_protocol(proto_mpls); expert_register_field_array(expert_mpls, ei, array_length(ei)); - register_dissector("mpls", dissect_mpls, proto_mpls); + new_register_dissector("mpls", dissect_mpls, proto_mpls); pw_ach_subdissector_table = register_dissector_table("pwach.channel_type", "PW Associated Channel Type", FT_UINT16, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); |