DCT2000: Allow any PDU to be dissected.

There are traffic dumps that only include the PDU payload
without lower layer information.  This commit allows any
dissector to be embedded in the DCT2000 as a protocol name.
tshark/wireshark will decode it despite having no lower
layer information.

The change allows a DCT2000 protocol field to look for a
dissector.

The change can be enabled or disabled with the preference
dct2000.use_protocol_name_as_dissector_name and it defaults
to FALSE.

Example:

Session Transcript (format 3.1)
December 6, 2020     16:45:20.5185
LTE-RRC.1/lte_rrc.dl_dcch/1/// r tm 22.5695 l $2c02
S1AP.1/s1ap/1/// s tm 23.3926 l
$001700130000020063000608023d7c00830002400202a0
This commit is contained in:
Jose Rubio 2020-12-10 23:12:06 +01:00 committed by Wireshark GitLab Utility
parent 02c5f50009
commit 270561ade1
2 changed files with 20 additions and 2 deletions

View File

@ -121,6 +121,7 @@ static gboolean catapult_dct2000_try_sctpprim_heuristic = TRUE;
static gboolean catapult_dct2000_dissect_lte_rrc = TRUE;
static gboolean catapult_dct2000_dissect_mac_lte_oob_messages = TRUE;
static gboolean catapult_dct2000_dissect_old_protocol_names = FALSE;
static gboolean catapult_dct2000_use_protocol_name_as_dissector_name = FALSE;
/* Protocol subtree. */
static int ett_catapult_dct2000 = -1;
@ -3087,7 +3088,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
}
}
/* Last chance: is there a (private) registered protocol of the form
/* Next chance: is there a (private) registered protocol of the form
"dct2000.protocol" ? */
if (protocol_handle == 0) {
/* TODO: only look inside if a preference enabled? */
@ -3098,6 +3099,13 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
protocol_handle = find_dissector(dotted_protocol_name);
}
/* Last resort: Allow any PDU to be dissected if the protocol matches with
a dissector name */
if ( !protocol_handle && catapult_dct2000_use_protocol_name_as_dissector_name) {
protocol_handle = find_dissector(protocol_name);
}
break;
default:
@ -3677,6 +3685,16 @@ void proto_register_catapult_dct2000(void)
"When set, look for some older protocol names so that"
"they may be matched with wireshark dissectors.",
&catapult_dct2000_dissect_old_protocol_names);
/* Determines if the protocol field in the DCT2000 shall be used to lookup for disector*/
prefs_register_bool_preference(catapult_dct2000_module, "use_protocol_name_as_dissector_name",
"Look for a dissector using the protocol name in the "
"DCT2000 record",
"When set, if there is a Wireshark dissector matching "
"the protocol name, it will parse the PDU using "
"that dissector. This may be slow, so should be "
"disabled unless you are using this feature.",
&catapult_dct2000_use_protocol_name_as_dissector_name);
}
/*

View File

@ -908,7 +908,7 @@ parse_line(gchar *linebuff, gint line_length,
(linebuff[n] != '/') && (protocol_chars < MAX_PROTOCOL_NAME) && (n < line_length);
n++, protocol_chars++) {
if (!g_ascii_isalnum(linebuff[n]) && linebuff[n] != '_') {
if (!g_ascii_isalnum(linebuff[n]) && (linebuff[n] != '_') && (linebuff[n] != '.')) {
return FALSE;
}
protocol_name[protocol_chars] = linebuff[n];