diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2018-05-24 21:02:26 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-05-25 02:41:29 +0000 |
commit | 0362891ecfaba58b1e82fe9e5c579396f81c28bb (patch) | |
tree | 31246e0db8280cb6cfb3e54bc513eb2411021785 | |
parent | 0dcd8cd1a2c8ee6a11152ba7476ea43f26beeab4 (diff) |
media_type: Default decode application/octet-stream as data
Remove registering media_type application/octet-stream from both
thread and uasip because the settings will interfere each other.
Enable decoding as for media_type instead.
Bug: 14729
Change-Id: I58c527977fe4713418219fc3126ce7a93c4bb641
Reviewed-on: https://code.wireshark.org/review/27789
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/dissectors/packet-data.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-thread.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-uasip.c | 10 |
3 files changed, 17 insertions, 20 deletions
diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index a26144f3f1..459b4a4449 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -23,6 +23,7 @@ * print routines */ void proto_register_data(void); +void proto_reg_handoff_data(void); int proto_data = -1; @@ -53,6 +54,8 @@ static gboolean generate_md5_hash = FALSE; static gint ett_data = -1; +static dissector_handle_t data_handle; + static int dissect_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -147,7 +150,7 @@ proto_register_data(void) "data" /* abbrev */ ); - register_dissector("data", dissect_data, proto_data); + data_handle = register_dissector("data", dissect_data, proto_data); proto_register_fields(proto_data, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); @@ -183,6 +186,12 @@ proto_register_data(void) proto_set_cant_toggle(proto_data); } +void +proto_reg_handoff_data(void) +{ + dissector_add_string("media_type", "application/octet-stream", data_handle); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/dissectors/packet-thread.c b/epan/dissectors/packet-thread.c index a944a4e808..bbdf65ad66 100644 --- a/epan/dissectors/packet-thread.c +++ b/epan/dissectors/packet-thread.c @@ -1,5 +1,5 @@ /* packet-thread.c - * Routines for Thread CoAP and beacon packet dissection + * Routines for Thread over CoAP and beacon packet dissection * * Robert Cragie <robert.cragie@arm.com> * @@ -681,7 +681,6 @@ static const value_string thread_bcn_tlv_vals[] = { }; /* Preferences */ -static gboolean thread_coap_decode = FALSE; static gboolean thread_use_pan_id_in_key = FALSE; static const gchar *thread_seq_ctr_str = NULL; static gboolean thread_auto_acq_seq_ctr = TRUE; @@ -3362,11 +3361,7 @@ proto_register_thread(void) proto_thread = proto_register_protocol("Thread", "Thread", "thread"); thread_module = prefs_register_protocol(proto_thread, proto_reg_handoff_thread); - prefs_register_bool_preference(thread_module, "thr_coap_decode", - "Decode CoAP for Thread", - "Try to decode CoAP for Thread", - &thread_coap_decode); - + prefs_register_obsolete_preference(thread_module, "thr_coap_decode"); prefs_register_string_preference(thread_module, "thr_seq_ctr", "Thread sequence counter", "32-bit sequence counter for hash", @@ -3429,11 +3424,8 @@ void proto_reg_handoff_thread(void) { /* Thread Content-Format is opaque byte string, i.e. application/octet-stream */ - if (thread_coap_decode) { - dissector_add_string("media_type", "application/octet-stream", thread_coap_handle); - } else { - dissector_delete_string("media_type", "application/octet-stream", thread_coap_handle); - } + /* Enable decoding "Internet media type" as Thread over CoAP */ + dissector_add_for_decode_as("media_type", thread_coap_handle); proto_coap = proto_get_id_by_filter_name("coap"); } diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index 3a8333047d..03bb4f8ca2 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -54,7 +54,6 @@ static expert_field ei_uasip_tlv_length = EI_INIT; static guint8 proxy_ipaddr[4]; static const char *pref_proxy_ipaddr_s = NULL; -static gboolean uasip_enabled = FALSE; static gboolean use_proxy_ipaddr = FALSE; static gboolean noesip_enabled = FALSE; @@ -519,7 +518,7 @@ void proto_register_uasip(void) expert_register_field_array(expert_uasip, ei, array_length(ei)); uasip_module = prefs_register_protocol(proto_uasip, proto_reg_handoff_uasip); - prefs_register_bool_preference(uasip_module, "aplication_octet_stream", "Try to decode application/octet-stream as UASIP", "UA SIP Protocol enabled", &uasip_enabled); + prefs_register_obsolete_preference(uasip_module, "aplication_octet_stream"); prefs_register_bool_preference(uasip_module, "noesip", "Try to decode SIP NOE", "NOE SIP Protocol", &noesip_enabled); prefs_register_string_preference(uasip_module, "proxy_ipaddr", "Proxy IP Address", "IPv4 address of the proxy (Invalid values will be ignored)", @@ -543,11 +542,8 @@ void proto_reg_handoff_uasip(void) use_proxy_ipaddr = FALSE; memset(proxy_ipaddr, 0, sizeof(proxy_ipaddr)); - if(uasip_enabled){ - dissector_add_string("media_type", "application/octet-stream", uasip_handle); - }else{ - dissector_delete_string("media_type", "application/octet-stream", uasip_handle); - } + /* Enable decoding "Internet media type" as UASIP */ + dissector_add_for_decode_as("media_type", uasip_handle); if (strcmp(pref_proxy_ipaddr_s, "") != 0) { if (str_to_ip(pref_proxy_ipaddr_s, proxy_ipaddr)) { |