epan: Remove fragment_get_reassembled()

Because completed reassemblies are hashed in the reassembled_table for
all the frame numbers that contributed fragments,
fragment_get_reassembled_id() works wherever fragment_get_reassembled()
does, and also works where the fragment id is not the frame number.

However, since the reassembled_table hash key only depends on the
fragment id and the frame number, it only allows a frame to have
one reassembly with a given fragment id. Some protocols can have
more than one reassembly with a given fragment id (that differ on
addresses or other keys), such as GSM SMS, and the wrong reassembly
is retrieved on the second pass in those cases.

For this reason, we might want to add additional key elements to
reassembled_table, such as layer number. fragment_get_reassembled_id
already takes packet_info as a parameter and can accommodate that
without further changes, but fragment_get_reassembled cannot, so
remove the latter in favor of the former.
This commit is contained in:
John Thacker 2022-06-09 22:49:03 -04:00 committed by A Wireshark GitLab Utility
parent 47c418d419
commit f1cbc6b662
5 changed files with 3 additions and 23 deletions

View File

@ -4450,7 +4450,7 @@ dissect_dcerpc_cn_stub(tvbuff_t *tvb, int offset, packet_info *pinfo,
then exit
*/
if (pinfo->fd->visited) {
fd_head = fragment_get_reassembled(&dcerpc_co_reassembly_table, frame);
fd_head = fragment_get_reassembled_id(&dcerpc_co_reassembly_table, pinfo, frame);
goto end_cn_stub;
}

View File

@ -981,7 +981,7 @@ dissect_serial_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot
}
else
{
fd_head = fragment_get_reassembled(&ftdi_reassembly_table, desegment_data->first_frame);
fd_head = fragment_get_reassembled_id(&ftdi_reassembly_table, pinfo, desegment_data->first_frame);
payload_tvb = process_reassembled_data(tvb, 0, pinfo, "Reassembled", fd_head,
&ftdi_frag_items, NULL, ftdi_tree);
}
@ -989,7 +989,7 @@ dissect_serial_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot
if (next_desegment_data)
{
fragment_head *next_head;
next_head = fragment_get_reassembled(&ftdi_reassembly_table, next_desegment_data->first_frame);
next_head = fragment_get_reassembled_id(&ftdi_reassembly_table, pinfo, next_desegment_data->first_frame);
process_reassembled_data(tvb, 0, pinfo, "Reassembled", next_head, &ftdi_frag_items, NULL, ftdi_tree);
}

View File

@ -631,21 +631,6 @@ fragment_get(reassembly_table *table, const packet_info *pinfo,
return lookup_fd_head(table, pinfo, id, data, NULL);
}
/* id *must* be the frame number for this to work! */
fragment_head *
fragment_get_reassembled(reassembly_table *table, const guint32 id)
{
fragment_head *fd_head;
reassembled_key key;
/* create key to search hash with */
key.frame = id;
key.id = id;
fd_head = (fragment_head *)g_hash_table_lookup(table->reassembled_table, &key);
return fd_head;
}
fragment_head *
fragment_get_reassembled_id(reassembly_table *table, const packet_info *pinfo,
const guint32 id)

View File

@ -440,10 +440,6 @@ fragment_get(reassembly_table *table, const packet_info *pinfo,
const guint32 id, const void *data);
/* The same for the reassemble table */
/* id *must* be the frame number for this to work! */
WS_DLL_PUBLIC fragment_head *
fragment_get_reassembled(reassembly_table *table, const guint32 id);
WS_DLL_PUBLIC fragment_head *
fragment_get_reassembled_id(reassembly_table *table, const packet_info *pinfo,
const guint32 id);

View File

@ -710,7 +710,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
fragment_delete@Base 1.9.1
fragment_end_seq_next@Base 1.9.1
fragment_get@Base 1.9.1
fragment_get_reassembled@Base 1.9.1
fragment_get_reassembled_id@Base 1.9.1
fragment_get_tot_len@Base 1.9.1
fragment_set_partial_reassembly@Base 1.9.1