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 /plugins/opcua/opcua.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 'plugins/opcua/opcua.c')
-rw-r--r-- | plugins/opcua/opcua.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c index 9e1fea8469..524ff3a38d 100644 --- a/plugins/opcua/opcua.c +++ b/plugins/opcua/opcua.c @@ -97,8 +97,7 @@ static const fragment_items opcua_frag_items = { }; -static GHashTable *opcua_fragment_table = NULL; -static GHashTable *opcua_reassembled_table = NULL; +static reassembly_table opcua_reassembly_table; /** OpcUa Transport Message Types */ enum MessageType @@ -199,8 +198,8 @@ void proto_register_opcua(void) range_convert_str(&global_tcp_ports_opcua, ep_strdup_printf("%u", OPCUA_PORT), 65535); - fragment_table_init(&opcua_fragment_table); - reassembled_table_init(&opcua_reassembled_table); + reassembly_table_init(&opcua_reassembly_table, + &addresses_reassembly_table_functions); proto_register_field_array(proto_opcua, hf, array_length(hf)); /* register user preferences */ @@ -328,12 +327,13 @@ static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree opcua_seqid = tvb_get_letohl(tvb, offset); offset += 4; /* Security RequestId */ /* check if tvb is part of a chunked message: - the UA protocol does not tell us that, so we look into opcua_fragment_table and - opcua_reassembled_table if the opcua_seqid belongs to a chunked message */ - frag_msg = fragment_get(pinfo, opcua_seqid, opcua_fragment_table); + the UA protocol does not tell us that, so we look into + opcua_reassembly_table if the opcua_seqid belongs to a + chunked message */ + frag_msg = fragment_get(&opcua_reassembly_table, pinfo, opcua_seqid, NULL); if (frag_msg == NULL) { - frag_msg = fragment_get_reassembled_id(pinfo, opcua_seqid, opcua_reassembled_table); + frag_msg = fragment_get_reassembled_id(&opcua_reassembly_table, pinfo, opcua_seqid); } if (frag_msg != NULL || chunkType != 'F') @@ -364,12 +364,12 @@ static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree } } - frag_msg = fragment_add_seq_check(tvb, + frag_msg = fragment_add_seq_check(&opcua_reassembly_table, + tvb, offset, pinfo, opcua_seqid, /* ID for fragments belonging together */ - opcua_fragment_table, /* list of message fragments */ - opcua_reassembled_table, /* list of reassembled messages */ + NULL, opcua_seqnum, /* fragment sequence number */ tvb_length_remaining(tvb, offset), /* fragment length - to the end */ bMoreFragments); /* More fragments? */ |