Accept protocol aliases in Decode As (-d tcp.port==4433,ssl)

Change-Id: Idb2e4f9964cf0b5c1237a0d4b5e0954adfd5e6b6
Reviewed-on: https://code.wireshark.org/review/31895
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2019-02-05 14:13:29 +01:00
parent 62a8d40b5f
commit 78827c8752
2 changed files with 10 additions and 2 deletions

View File

@ -208,9 +208,11 @@ class case_decrypt_tls(subprocesstest.SubprocessTestCase):
if not features.have_gnutls:
self.skipTest('Requires GnuTLS.')
key_file = os.path.join(dirs.key_dir, 'rsasnakeoil2.key')
# Test protocol alias while at it (ssl -> tls)
self.assertRun((cmd_tshark,
'-r', capture_file('tls-renegotiation.pcap'),
'-o', 'tls.keys_list:0.0.0.0,4433,http,{}'.format(key_file),
'-d', 'tcp.port==4433,ssl',
'-Tfields',
'-e', 'http.content_length',
'-Y', 'http',

View File

@ -118,7 +118,7 @@ fprint_all_protocols_for_layer_types(FILE *output, gchar *table_name)
* to pass parameters and store results
*/
struct protocol_name_search{
gchar *searched_name; /* Protocol filter name we are looking for */
const char *searched_name; /* Protocol filter name we are looking for */
dissector_handle_t matched_handle; /* Handle for a dissector whose protocol has the specified filter name */
guint nb_match; /* How many dissectors matched searched_name */
};
@ -387,8 +387,14 @@ gboolean decode_as_command_option(const gchar *cl_param)
cmdarg_err("No protocol name specified"); /* Note, we don't exit here, but dissector_matching will remain NULL, so we exit below */
}
else {
header_field_info *hfi = proto_registrar_get_byalias(dissector_str);
user_protocol_name.nb_match = 0;
user_protocol_name.searched_name = dissector_str;
if (hfi) {
user_protocol_name.searched_name = hfi->abbrev;
} else {
user_protocol_name.searched_name = dissector_str;
}
user_protocol_name.matched_handle = NULL;
dissector_table_foreach_handle(table_name, find_protocol_name_func, &user_protocol_name); /* Go and perform the search for this dissector in the this table's dissectors' names and shortnames */