For ISDN, don't create an endpoint by ID and then use it.

That isn't working, because it depends on the notion that for every
"endpoint type" there's a "port type" for the packet_info structure;
that's not true for ISDN channels.

The whole point of "use the packet_info structure when trying to find a
conversation and create it if it doesn't exist" is to use address
information *already filled in by somebody for use by other dissectors*;
we don't do that with the ISDN channel number, because there's no *need*
to do so.

So just add a new find_or_create_conversation_by_id() routine, which
passes the packet_info structure to get the frame number, and explicitly
passes the endpoint type and ID.  Use that in the ISDN dissector.

Bug: 15018
Change-Id: Id0e997254b0eaf7cbc9261a2adff639ecbf083c0
Reviewed-on: https://code.wireshark.org/review/28904
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-07-31 14:14:04 -07:00
parent 83715db4a9
commit d950b14f26
4 changed files with 29 additions and 3 deletions

View File

@ -630,6 +630,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
find_heur_dissector_by_unique_short_name@Base 1.99.8
find_heur_dissector_list@Base 1.99.2
find_or_create_conversation@Base 1.9.1
find_or_create_conversation_by_id@Base 2.6.3
find_protocol_by_id@Base 1.9.1
find_sid_name@Base 1.9.1
find_stream_circ@Base 1.9.1

View File

@ -1508,6 +1508,26 @@ find_or_create_conversation(packet_info *pinfo)
return conv;
}
conversation_t *
find_or_create_conversation_by_id(packet_info *pinfo, const endpoint_type etype, const guint32 id)
{
conversation_t *conv=NULL;
/* Have we seen this conversation before? */
if ((conv = find_conversation_by_id(pinfo->num, etype, id, 0)) == NULL) {
/* No, this is a new conversation. */
DPRINT(("did not find previous conversation for frame #%u",
pinfo->num));
DINDENT();
conv = conversation_new_by_id(pinfo->num, etype, id, 0);
DENDENT();
}
DENDENT();
return conv;
}
void conversation_create_endpoint(struct _packet_info *pinfo, address* addr1, address* addr2,
endpoint_type etype, guint32 port1, guint32 port2, const guint options)
{

View File

@ -188,6 +188,12 @@ WS_DLL_PUBLIC conversation_t *find_conversation_pinfo(packet_info *pinfo, const
*/
WS_DLL_PUBLIC conversation_t *find_or_create_conversation(packet_info *pinfo);
/** A helper function that calls find_conversation_by_id() and, if a
* conversation is not found, calls conversation_new_by_id().
* The frame number is taken from pinfo.
*/
WS_DLL_PUBLIC conversation_t *find_or_create_conversation_by_id(packet_info *pinfo, const endpoint_type etype, const guint32 id);
WS_DLL_PUBLIC void conversation_add_proto_data(conversation_t *conv, const int proto,
void *proto_data);
WS_DLL_PUBLIC void *conversation_get_proto_data(const conversation_t *conv, const int proto);

View File

@ -96,8 +96,6 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "Network");
}
conversation_create_endpoint_by_id(pinfo, ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, 0);
if (tree) {
ti = proto_tree_add_item(tree, proto_isdn, tvb, 0, 0, ENC_NA);
isdn_tree = proto_item_add_subtree(ti, ett_isdn);
@ -109,7 +107,8 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
/*
* Set up a circuit for this channel, and assign it a dissector.
*/
conv = find_or_create_conversation(pinfo);
conv = find_or_create_conversation_by_id(pinfo, ENDPOINT_ISDN,
pinfo->pseudo_header->isdn.channel);
if (conversation_get_dissector(conv, 0) == NULL) {
/*