diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-03-22 23:59:54 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-03-22 23:59:54 +0000 |
commit | a2414d8909088ddb40c907886e725993e6baecb5 (patch) | |
tree | 53f0ebac8baa171f4317c7eb502a354da8596c72 /epan/dissectors/packet-btobex.c | |
parent | 3295912210fa1a8d7d0b1a18aa7c100f27905ed1 (diff) |
Don't wire into the reassembly code the notion that reassemblies should
be done on flows from one address to another; reassembly for protocols
running atop TCP should be done on flows from one TCP endpoint to
another.
We do this by:
adding "reassembly table" as a data structure;
associating hash tables for both in-progress reassemblies and
completed reassemblies with that data structure (currently, not
all reassemblies use the latter; they might keep completed
reassemblies in the first table);
having functions to create and destroy keys in that table;
offering standard routines for doing address-based and
address-and-port-based flow processing, so that dissectors not
needing their own specialized flow processing can just use them.
This fixes some mis-reassemblies of NIS YPSERV YPALL responses (where
the second YPALL response is processed as if it were a continuation of
a previous response between different endpoints, even though said
response is already reassembled), and also allows the DCE RPC-specific
stuff to be moved out of epan/reassembly.c into the DCE RPC dissector.
svn path=/trunk/; revision=48491
Diffstat (limited to 'epan/dissectors/packet-btobex.c')
-rw-r--r-- | epan/dissectors/packet-btobex.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c index 9877b269cd..fbdbdc24d3 100644 --- a/epan/dissectors/packet-btobex.c +++ b/epan/dissectors/packet-btobex.c @@ -188,8 +188,7 @@ static int hf_btobex_reassembled_length = -1; static gint ett_btobex_fragment = -1; static gint ett_btobex_fragments = -1; -static GHashTable *fragment_table; -static GHashTable *reassembled_table; +static reassembly_table btobex_reassembly_table; static const fragment_items btobex_frag_items = { &ett_btobex_fragment, @@ -552,8 +551,8 @@ void proto_reg_handoff_btobex(void); static void defragment_init(void) { - fragment_table_init(&fragment_table); - reassembled_table_init(&reassembled_table); + reassembly_table_init(&btobex_reassembly_table, + &addresses_reassembly_table_functions); } static int @@ -1327,10 +1326,11 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) complete = FALSE; - if (fragment_get(pinfo, pinfo->p2p_dir, fragment_table)) { + if (fragment_get(&btobex_reassembly_table, pinfo, pinfo->p2p_dir, NULL)) { /* not the first fragment */ - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, pinfo->p2p_dir, - fragment_table, reassembled_table, tvb_length(tvb), TRUE); + frag_msg = fragment_add_seq_next(&btobex_reassembly_table, + tvb, 0, pinfo, pinfo->p2p_dir, NULL, + tvb_length(tvb), TRUE); new_tvb = process_reassembled_data(tvb, 0, pinfo, "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree); @@ -1343,10 +1343,13 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_get_ntohs(tvb, offset+1) > (no_of_segments * tvb_length(tvb))) no_of_segments++; - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, pinfo->p2p_dir, - fragment_table, reassembled_table, tvb_length(tvb), TRUE); + frag_msg = fragment_add_seq_next(&btobex_reassembly_table, + tvb, 0, pinfo, pinfo->p2p_dir, NULL, + tvb_length(tvb), TRUE); - fragment_set_tot_len(pinfo, pinfo->p2p_dir, fragment_table, no_of_segments-1); + fragment_set_tot_len(&btobex_reassembly_table, + pinfo, pinfo->p2p_dir, NULL, + no_of_segments-1); new_tvb = process_reassembled_data(tvb, 0, pinfo, "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree); |