summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-01-12 00:08:00 +0100
committerAnders Broman <a.broman58@gmail.com>2016-01-25 23:16:02 +0000
commit0ff957aedec43e0ba3c0e7f54b9de14d54da86ec (patch)
treee713734076be28381faa07536e4424bc09475029 /epan
parent0f5bed39fe90659615b192d9a88d7d206d349fff (diff)
downloadwireshark-0ff957aedec43e0ba3c0e7f54b9de14d54da86ec.tar.gz
dns,spdy,ssl-utils: fix export PDU
Dissectors registered with SSL must be registered for Export PDU to work properly. Otherwise the dissector name could be NULL, resulting in a capture file that cannot properly be dissected. Add an assertion to ssl-utils to catch this situation. Note that this results in an "wmem_alloc: assertion failed: (allocator->in_scope)" report because these functions are possibly called in the protocol handoff routines... Can be fixed later. The DNS dissector is fixed by merging the UDP/TCP dissectors into a single dns handle which recognizes TCP and then assumes the length prefix if TCP. Change-Id: If73b9b09a4682d66fb8fa026c42a3475648f9bf1 Reviewed-on: https://code.wireshark.org/review/13194 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dns.c28
-rw-r--r--epan/dissectors/packet-spdy.c5
-rw-r--r--epan/dissectors/packet-ssl-utils.c3
3 files changed, 15 insertions, 21 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 3234cf2cb2..0d351398d4 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -419,9 +419,7 @@ static expert_field ei_dns_undecoded_option = EI_INIT;
static dissector_table_t dns_tsig_dissector_table=NULL;
-/* Added to be able to configure DNS ports. */
-static dissector_handle_t dns_tcp_handle;
-static dissector_handle_t dns_udp_handle;
+static dissector_handle_t dns_handle;
static range_t *global_dns_tcp_port_range;
static range_t *global_dns_udp_port_range;
@@ -4094,40 +4092,36 @@ proto_reg_handoff_dns(void)
static gboolean Initialized = FALSE;
if (!Initialized) {
- dissector_handle_t dns_sctp_handle;
dissector_handle_t mdns_udp_handle;
dissector_handle_t llmnr_udp_handle;
- dns_udp_handle = create_dissector_handle(dissect_dns_udp_sctp, proto_dns);
- dns_tcp_handle = create_dissector_handle(dissect_dns_tcp, proto_dns);
- dns_sctp_handle = create_dissector_handle(dissect_dns_udp_sctp, proto_dns);
mdns_udp_handle = create_dissector_handle(dissect_mdns_udp, proto_mdns);
llmnr_udp_handle = create_dissector_handle(dissect_llmnr_udp, proto_llmnr);
dissector_add_uint("udp.port", UDP_PORT_MDNS, mdns_udp_handle);
- dissector_add_uint("tcp.port", TCP_PORT_MDNS, dns_tcp_handle);
+ dissector_add_uint("tcp.port", TCP_PORT_MDNS, dns_handle);
dissector_add_uint("udp.port", UDP_PORT_LLMNR, llmnr_udp_handle);
- dissector_add_uint("sctp.port", SCTP_PORT_DNS, dns_sctp_handle);
+ dissector_add_uint("sctp.port", SCTP_PORT_DNS, dns_handle);
#if 0
- dissector_add_uint("sctp.ppi", DNS_PAYLOAD_PROTOCOL_ID, dns_sctp_handle);
+ dissector_add_uint("sctp.ppi", DNS_PAYLOAD_PROTOCOL_ID, dns_handle);
#endif
stats_tree_register("dns", "dns", "DNS", 0, dns_stats_tree_packet, dns_stats_tree_init, NULL);
gssapi_handle = find_dissector("gssapi");
ntlmssp_handle = find_dissector("ntlmssp");
- ssl_dissector_add(TCP_PORT_DNS_TLS, dns_tcp_handle);
- dtls_dissector_add(UDP_PORT_DNS_DTLS, dns_udp_handle);
+ ssl_dissector_add(TCP_PORT_DNS_TLS, dns_handle);
+ dtls_dissector_add(UDP_PORT_DNS_DTLS, dns_handle);
Initialized = TRUE;
} else {
- dissector_delete_uint_range("tcp.port", dns_tcp_port_range, dns_tcp_handle);
- dissector_delete_uint_range("udp.port", dns_udp_port_range, dns_udp_handle);
+ dissector_delete_uint_range("tcp.port", dns_tcp_port_range, dns_handle);
+ dissector_delete_uint_range("udp.port", dns_udp_port_range, dns_handle);
g_free(dns_tcp_port_range);
g_free(dns_udp_port_range);
}
dns_tcp_port_range = range_copy(global_dns_tcp_port_range);
dns_udp_port_range = range_copy(global_dns_udp_port_range);
- dissector_add_uint_range("tcp.port", dns_tcp_port_range, dns_tcp_handle);
- dissector_add_uint_range("udp.port", dns_udp_port_range, dns_udp_handle);
+ dissector_add_uint_range("tcp.port", dns_tcp_port_range, dns_handle);
+ dissector_add_uint_range("udp.port", dns_udp_port_range, dns_handle);
}
void
@@ -5620,7 +5614,7 @@ proto_register_dns(void)
dns_tsig_dissector_table = register_dissector_table("dns.tsig.mac", "DNS TSIG MAC Dissectors", FT_STRING, BASE_NONE, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
- register_dissector("dns", dissect_dns, proto_dns);
+ dns_handle = register_dissector("dns", dissect_dns, proto_dns);
dns_tap = register_tap("dns");
}
diff --git a/epan/dissectors/packet-spdy.c b/epan/dissectors/packet-spdy.c
index b1863f2083..5dca654bb7 100644
--- a/epan/dissectors/packet-spdy.c
+++ b/epan/dissectors/packet-spdy.c
@@ -1912,7 +1912,7 @@ void proto_register_spdy(void)
expert_spdy = expert_register_protocol(proto_spdy);
expert_register_field_array(expert_spdy, ei, array_length(ei));
- register_dissector("spdy", dissect_spdy, proto_spdy);
+ spdy_handle = register_dissector("spdy", dissect_spdy, proto_spdy);
spdy_module = prefs_register_protocol(proto_spdy, NULL);
prefs_register_bool_preference(spdy_module, "assemble_data_frames",
@@ -1931,9 +1931,6 @@ void proto_register_spdy(void)
"using \"Content-Encoding: \"",
&spdy_decompress_body);
- /** Create dissector handle and register for dissection. */
- spdy_handle = create_dissector_handle(dissect_spdy, proto_spdy);
-
register_init_routine(&spdy_init_protocol);
/*
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index 3c40f53f72..c6570bb754 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -4152,6 +4152,9 @@ ssl_association_add(const char* dissector_table_name, dissector_handle_t main_ha
{
DISSECTOR_ASSERT(main_handle);
DISSECTOR_ASSERT(subdissector_handle);
+ /* Registration is required for Export PDU feature to work properly. */
+ DISSECTOR_ASSERT_HINT(dissector_handle_get_dissector_name(subdissector_handle),
+ "SSL appdata dissectors must register with register_dissector()!");
ssl_debug_printf("association_add %s port %d handle %p\n", dissector_table_name, port, (void *)subdissector_handle);
if (port) {