aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-03-22 23:59:54 +0000
committerGuy Harris <guy@alum.mit.edu>2013-03-22 23:59:54 +0000
commita2414d8909088ddb40c907886e725993e6baecb5 (patch)
tree53f0ebac8baa171f4317c7eb502a354da8596c72 /plugins
parent3295912210fa1a8d7d0b1a18aa7c100f27905ed1 (diff)
downloadwireshark-a2414d8909088ddb40c907886e725993e6baecb5.tar.gz
wireshark-a2414d8909088ddb40c907886e725993e6baecb5.tar.bz2
wireshark-a2414d8909088ddb40c907886e725993e6baecb5.zip
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')
-rw-r--r--plugins/m2m/packet-m2m.c7
-rw-r--r--plugins/opcua/opcua.c22
-rw-r--r--plugins/profinet/packet-pn-rt.c10
-rw-r--r--plugins/wimax/mac_hd_generic_decoder.c7
4 files changed, 25 insertions, 21 deletions
diff --git a/plugins/m2m/packet-m2m.c b/plugins/m2m/packet-m2m.c
index 48025252e6..8c4de49627 100644
--- a/plugins/m2m/packet-m2m.c
+++ b/plugins/m2m/packet-m2m.c
@@ -55,7 +55,7 @@ static dissector_handle_t wimax_hack_burst_handle;
static dissector_handle_t wimax_pdu_burst_handle;
static dissector_handle_t wimax_phy_attributes_burst_handle;
-static GHashTable *pdu_frag_table = NULL;
+static reassembly_table pdu_reassembly_table;
static gint proto_m2m = -1;
@@ -158,7 +158,8 @@ static gint hf_m2m_phy_attributes = -1;
static void
m2m_defragment_init(void)
{
- fragment_table_init(&pdu_frag_table);
+ reassembly_table_init(&pdu_reassembly_table,
+ &addresses_reassembly_table_functions);
}
@@ -454,7 +455,7 @@ static void pdu_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint
}
else /* fragmented PDU */
{ /* add the frag */
- pdu_frag = fragment_add_seq(tvb, offset, pinfo, burst_number, pdu_frag_table, frag_number - 1, length, ((frag_type==TLV_LAST_FRAG)?0:1));
+ pdu_frag = fragment_add_seq(&pdu_reassembly_table, tvb, offset, pinfo, burst_number, NULL, frag_number - 1, length, ((frag_type==TLV_LAST_FRAG)?0:1), 0);
if(pdu_frag && frag_type == TLV_LAST_FRAG)
{
/* create the new tvb for defraged frame */
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? */
diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c
index 11cced6b27..bc621fa89c 100644
--- a/plugins/profinet/packet-pn-rt.c
+++ b/plugins/profinet/packet-pn-rt.c
@@ -333,7 +333,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* for reasemble processing we need some inits.. */
/* Register PNIO defrag table init routine. */
-static GHashTable *pdu_frag_table = NULL;
+static reassembly_table pdu_reassembly_table;
static GHashTable *reasembled_frag_table = NULL;
static dissector_handle_t data_handle;
@@ -355,7 +355,8 @@ pnio_defragment_init(void)
for (i=0; i < 16; i++) /* init the reasemble help array */
start_frag_OR_ID[i] = 0;
- fragment_table_init(&pdu_frag_table);
+ reassembly_table_init(&pdu_reassembly_table,
+ &addresses_reassembly_table_functions);
if (reasembled_frag_table == NULL)
{
reasembled_frag_table = g_hash_table_new(NULL, NULL);
@@ -431,8 +432,9 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
}
u32ReasembleID = start_frag_OR_ID[u32FragID];
/* use frame data instead of "pnio fraglen" which sets 8 octet steps */
- pdu_frag = fragment_add_seq(tvb, offset, pinfo, u32ReasembleID, pdu_frag_table, uFragNumber,
- (tvb_length(tvb) - offset)/*u8FragDataLength*8*/, bMoreFollows);
+ pdu_frag = fragment_add_seq(&pdu_reassembly_table, tvb, offset,
+ pinfo, u32ReasembleID, NULL, uFragNumber,
+ (tvb_length(tvb) - offset)/*u8FragDataLength*8*/, bMoreFollows, 0);
if (pdu_frag && !bMoreFollows) /* PDU is complete! and last fragment */
{ /* store this frag as the completed frag in hash table */
diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c
index 9c812df956..edd4545ea9 100644
--- a/plugins/wimax/mac_hd_generic_decoder.c
+++ b/plugins/wimax/mac_hd_generic_decoder.c
@@ -87,7 +87,7 @@ static gint extended_subheader_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_
static gint arq_feedback_payload_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *parent_item);
/* Static variables */
-static GHashTable *payload_frag_table = NULL;
+static reassembly_table payload_reassembly_table;
gint proto_mac_header_generic_decoder = -1;
static gint ett_mac_header_generic_decoder = -1;
@@ -598,7 +598,8 @@ void wimax_defragment_init(void)
{
gint i;
- fragment_table_init(&payload_frag_table);
+ reassembly_table_init(&payload_reassembly_table,
+ &addresses_reassembly_table_functions);
/* Init fragmentation variables. */
for (i = 0; i < MAX_CID; i++)
@@ -1073,7 +1074,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto
/* Use dl_src and dl_dst in defrag. */
pinfo->src = pinfo->dl_src;
pinfo->dst = pinfo->dl_dst;
- payload_frag = fragment_add_seq(tvb, offset, pinfo, cid, payload_frag_table, frag_number[cid_index], frag_len, ((frag_type==LAST_FRAG)?0:1));
+ payload_frag = fragment_add_seq(&payload_reassembly_table, tvb, offset, pinfo, cid, NULL, frag_number[cid_index], frag_len, ((frag_type==LAST_FRAG)?0:1), 0);
/* Restore address pointers. */
pinfo->src = save_src;
pinfo->dst = save_dst;