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 /asn1/t38 | |
parent | 3295912210fa1a8d7d0b1a18aa7c100f27905ed1 (diff) | |
download | wireshark-a2414d8909088ddb40c907886e725993e6baecb5.tar.gz |
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 'asn1/t38')
-rw-r--r-- | asn1/t38/packet-t38-template.c | 22 | ||||
-rw-r--r-- | asn1/t38/t38.cnf | 23 |
2 files changed, 22 insertions, 23 deletions
diff --git a/asn1/t38/packet-t38-template.c b/asn1/t38/packet-t38-template.c index cbe63ea50a..312d42180b 100644 --- a/asn1/t38/packet-t38-template.c +++ b/asn1/t38/packet-t38-template.c @@ -148,7 +148,7 @@ static gboolean primary_part = TRUE; static guint32 seq_number = 0; /* Tables for reassembly of Data fragments. */ -static GHashTable *data_fragment_table = NULL; +static reassembly_table data_reassembly_table; static const fragment_items data_frag_items = { /* Fragment subtrees */ @@ -203,8 +203,9 @@ static t38_packet_info *t38_info=NULL; static void t38_defragment_init(void) { - /* Init reassemble tables */ - fragment_table_init(&data_fragment_table); + /* Init reassembly table */ + reassembly_table_init(&data_reassembly_table, + &addresses_reassembly_table_functions); } @@ -289,21 +290,14 @@ void t38_add_address(packet_info *pinfo, fragment_data * -force_reassemble_seq(packet_info *pinfo, guint32 id, - GHashTable *fragment_table) +force_reassemble_seq(reassembly_table *table, packet_info *pinfo, guint32 id) { - fragment_key key; fragment_data *fd_head; fragment_data *fd_i; fragment_data *last_fd; guint32 dfpos, size, packet_lost, burst_lost, seq_num; - /* create key to search hash with */ - key.src = pinfo->src; - key.dst = pinfo->dst; - key.id = id; - - fd_head = (fragment_data *)g_hash_table_lookup(fragment_table, &key); + fd_head = fragment_get(table, pinfo, id, NULL); /* have we already seen this frame ?*/ if (pinfo->fd->flags.visited) { @@ -334,8 +328,8 @@ force_reassemble_seq(packet_info *pinfo, guint32 id, } /* we have received an entire packet, defragment it and - * free all fragments - */ + * free all fragments + */ size=0; last_fd=NULL; for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) { diff --git a/asn1/t38/t38.cnf b/asn1/t38/t38.cnf index d5df9e8b6a..0a81847f06 100644 --- a/asn1/t38/t38.cnf +++ b/asn1/t38/t38.cnf @@ -79,13 +79,15 @@ VAL_PTR=&Data_Field_field_type_value /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */ if (p_t38_packet_conv_info->reass_start_seqnum != -1) { - frag_msg = fragment_add_seq(tvb, offset, actx->pinfo, + frag_msg = fragment_add_seq(&data_reassembly_table, /* reassembly table */ + tvb, offset, actx->pinfo, p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */ - data_fragment_table, /* list of message fragments */ + NULL, seq_number + Data_Field_item_num - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */ /*0,*/ 0, /* fragment length */ - FALSE); /* More fragments */ + FALSE, /* More fragments */ + 0); if ( Data_Field_field_type_value == 7 ) { /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment), @@ -93,9 +95,9 @@ VAL_PTR=&Data_Field_field_type_value * and get some stat, like packet lost and burst number of packet lost */ if (!frag_msg) { - force_reassemble_seq(actx->pinfo, - p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */ - data_fragment_table /* list of message fragments */ + force_reassemble_seq(&data_reassembly_table, /* reassembly table */ + actx->pinfo, + p_t38_packet_conv_info->reass_ID /* ID for fragments belonging together */ ); } else { col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)"); @@ -201,12 +203,15 @@ VAL_PTR=&Data_Field_field_type_value p_t38_conv_info->additional_hdlc_data_field_counter = p_t38_packet_conv_info->additional_hdlc_data_field_counter; } } - frag_msg = fragment_add_seq(value_tvb, 0, actx->pinfo, + frag_msg = fragment_add_seq(&data_reassembly_table, + value_tvb, 0, + actx->pinfo, p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */ - data_fragment_table, /* list of message fragments */ + NULL, seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */ value_len, /* fragment length */ - TRUE); /* More fragments */ + TRUE, /* More fragments */ + 0); p_t38_packet_conv_info->seqnum_prev_data_field = (gint32)seq_number; process_reassembled_data(tvb, offset, actx->pinfo, "Reassembled T38", frag_msg, &data_frag_items, NULL, tree); |