aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/libwireshark0.symbols1
-rw-r--r--epan/dissectors/packet-dtls.c2
-rw-r--r--epan/dissectors/packet-http.c2
-rw-r--r--epan/dissectors/packet-http2.c2
-rw-r--r--epan/dissectors/packet-ssl-utils.c2
-rw-r--r--epan/dissectors/packet-ssl.c3
-rw-r--r--epan/dissectors/packet-stun.c4
-rw-r--r--epan/dissectors/packet-turnchannel.c4
-rw-r--r--epan/packet.c53
-rw-r--r--epan/packet.h8
10 files changed, 71 insertions, 10 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index 75e93c0075..b7813434b3 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -1314,6 +1314,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
register_depend_dissector@Base 2.1.0
register_dissector@Base 2.1.0
register_dissector_table@Base 1.9.1
+ register_dissector_table_alias@Base 2.9.0
register_dissector_with_data@Base 2.5.0
register_export_object@Base 2.3.0
register_export_pdu_tap@Base 1.99.0
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
index c53ab64569..9a9f08f762 100644
--- a/epan/dissectors/packet-dtls.c
+++ b/epan/dissectors/packet-dtls.c
@@ -1936,7 +1936,7 @@ proto_register_dtls(void)
dtls_associations = register_dissector_table("dtls.port", "DTLS Port", proto_dtls, FT_UINT16, BASE_DEC);
- ssl_common_register_dtls_alpn_dissector_table("dtls.handshake.extensions_alpn_str",
+ ssl_common_register_dtls_alpn_dissector_table("dtls.alpn",
"DTLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs",
proto_dtls);
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index c61488ba44..0f7fccd24c 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -4148,7 +4148,7 @@ proto_reg_handoff_http(void)
* SSL/TLS Application-Layer Protocol Negotiation (ALPN) protocol
* ID.
*/
- dissector_add_string("tls.handshake.extensions_alpn_str", "http/1.1", http_tls_handle);
+ dissector_add_string("tls.alpn", "http/1.1", http_tls_handle);
ntlmssp_handle = find_dissector_add_dependency("ntlmssp", proto_http);
gssapi_handle = find_dissector_add_dependency("gssapi", proto_http);
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c
index 30ca095d28..2713060c83 100644
--- a/epan/dissectors/packet-http2.c
+++ b/epan/dissectors/packet-http2.c
@@ -3349,7 +3349,7 @@ proto_reg_handoff_http2(void)
/*
* SSL/TLS Application-Layer Protocol Negotiation (ALPN) protocol ID.
*/
- dissector_add_string("tls.handshake.extensions_alpn_str", "h2", http2_handle);
+ dissector_add_string("tls.alpn", "h2", http2_handle);
dissector_add_string("http.upgrade", "h2", http2_handle);
dissector_add_string("http.upgrade", "h2c", http2_handle);
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index 870c760547..bbf85c4095 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -8767,6 +8767,7 @@ ssl_common_register_ssl_alpn_dissector_table(const char *name,
{
ssl_alpn_dissector_table = register_dissector_table(name, ui_name,
proto, FT_STRING, FALSE);
+ register_dissector_table_alias(ssl_alpn_dissector_table, "ssl.handshake.extensions_alpn_str");
}
void
@@ -8775,6 +8776,7 @@ ssl_common_register_dtls_alpn_dissector_table(const char *name,
{
dtls_alpn_dissector_table = register_dissector_table(name, ui_name,
proto, FT_STRING, FALSE);
+ register_dissector_table_alias(ssl_alpn_dissector_table, "dtls.handshake.extensions_alpn_str");
}
void
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index 9c58c0f73b..8bbd9d3c99 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -4572,6 +4572,7 @@ proto_register_tls(void)
"TLS", "tls");
ssl_associations = register_dissector_table("tls.port", "TLS Port", proto_tls, FT_UINT16, BASE_DEC);
+ register_dissector_table_alias(ssl_associations, "ssl.port");
/* Required function calls to register the header fields and
* subtrees used */
@@ -4647,7 +4648,7 @@ proto_register_tls(void)
/* heuristic dissectors for any premable e.g. CredSSP before RDP */
ssl_heur_subdissector_list = register_heur_dissector_list("tls", proto_tls);
- ssl_common_register_ssl_alpn_dissector_table("tls.handshake.extensions_alpn_str",
+ ssl_common_register_ssl_alpn_dissector_table("tls.alpn",
"SSL/TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs",
proto_tls);
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index 49a5b0d80a..a688f3009f 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -1735,8 +1735,8 @@ proto_reg_handoff_stun(void)
* SSL/TLS and DTLS Application-Layer Protocol Negotiation (ALPN)
* protocol ID.
*/
- dissector_add_string("tls.handshake.extensions_alpn_str", "stun.nat-discovery", stun_tcp_handle);
- dissector_add_string("dtls.handshake.extensions_alpn_str", "stun.nat-discovery", stun_udp_handle);
+ dissector_add_string("tls.alpn", "stun.nat-discovery", stun_tcp_handle);
+ dissector_add_string("dtls.alpn", "stun.nat-discovery", stun_udp_handle);
heur_dissector_add("udp", dissect_stun_heur, "STUN over UDP", "stun_udp", proto_stun, HEURISTIC_ENABLE);
diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c
index 313b4f3f7c..d757cfc7c0 100644
--- a/epan/dissectors/packet-turnchannel.c
+++ b/epan/dissectors/packet-turnchannel.c
@@ -206,8 +206,8 @@ proto_reg_handoff_turnchannel(void)
* SSL/TLS and DTLS Application-Layer Protocol Negotiation (ALPN)
* protocol ID.
*/
- dissector_add_string("tls.handshake.extensions_alpn_str", "stun.turn", turnchannel_tcp_handle);
- dissector_add_string("dtls.handshake.extensions_alpn_str", "stun.turn", turnchannel_udp_handle);
+ dissector_add_string("tls.alpn", "stun.turn", turnchannel_tcp_handle);
+ dissector_add_string("dtls.alpn", "stun.turn", turnchannel_udp_handle);
/* TURN negotiation is handled through STUN2 dissector (packet-stun.c),
so only it should be able to determine if a packet is a TURN packet */
diff --git a/epan/packet.c b/epan/packet.c
index a63cbf6a34..538b93ea15 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -91,9 +91,17 @@ struct dissector_table {
gboolean supports_decode_as;
};
+/*
+ * Dissector tables. const char * -> dissector_table *
+ */
static GHashTable *dissector_tables = NULL;
/*
+ * Dissector table aliases. const char * -> const char *
+ */
+static GHashTable *dissector_table_aliases = NULL;
+
+/*
* List of registered dissectors.
*/
static GHashTable *registered_dissectors = NULL;
@@ -191,6 +199,9 @@ packet_init(void)
dissector_tables = g_hash_table_new_full(g_str_hash, g_str_equal,
NULL, destroy_dissector_table);
+ dissector_table_aliases = g_hash_table_new_full(g_str_hash, g_str_equal,
+ NULL, NULL);
+
registered_dissectors = g_hash_table_new_full(g_str_hash, g_str_equal,
NULL, NULL);
@@ -243,6 +254,7 @@ packet_cleanup(void)
g_slist_free(cleanup_routines);
g_slist_free(postseq_cleanup_routines);
g_hash_table_destroy(dissector_tables);
+ g_hash_table_destroy(dissector_table_aliases);
g_hash_table_destroy(registered_dissectors);
g_hash_table_destroy(depend_dissector_lists);
g_hash_table_destroy(heur_dissector_lists);
@@ -914,7 +926,17 @@ struct dtbl_entry {
dissector_table_t
find_dissector_table(const char *name)
{
- return (dissector_table_t)g_hash_table_lookup(dissector_tables, name);
+ dissector_table_t dissector_table = (dissector_table_t) g_hash_table_lookup(dissector_tables, name);
+ if (! dissector_table) {
+ const char *new_name = (const char *) g_hash_table_lookup(dissector_table_aliases, name);
+ if (new_name) {
+ dissector_table = (dissector_table_t) g_hash_table_lookup(dissector_tables, new_name);
+ }
+ if (dissector_table) {
+ g_warning("%s is now %s", name, new_name);
+ }
+ }
+ return dissector_table;
}
/* Find an entry in a uint dissector table. */
@@ -2468,12 +2490,39 @@ dissector_table_t register_custom_dissector_table(const char *name,
}
void
+register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name) {
+ if (!dissector_table || !alias_name) return;
+
+ const char *name = NULL;
+ GList *list = g_hash_table_get_keys(dissector_tables);
+ for (GList *cur = list; cur; cur = cur->next) {
+ if (g_hash_table_lookup(dissector_tables, cur->data) == dissector_table) {
+ name = (const char *) cur->data;
+ break;
+ }
+ }
+ g_list_free(list);
+ if (!name) return;
+
+ g_hash_table_insert(dissector_table_aliases, (gpointer) alias_name, (gpointer) name);
+}
+
+void
deregister_dissector_table(const char *name)
{
- dissector_table_t sub_dissectors = find_dissector_table(name);
+ dissector_table_t sub_dissectors = (dissector_table_t) g_hash_table_lookup(dissector_tables, name);
if (!sub_dissectors) return;
g_hash_table_remove(dissector_tables, name);
+
+ GList *list = g_hash_table_get_keys(dissector_table_aliases);
+ for (GList *cur = list; cur; cur = cur->next) {
+ gpointer alias_name = cur->data;
+ if (g_hash_table_lookup(dissector_table_aliases, alias_name) == name) {
+ g_hash_table_remove(dissector_table_aliases, alias_name);
+ }
+ }
+ g_list_free(list);
}
const char *
diff --git a/epan/packet.h b/epan/packet.h
index 6f78640083..e2f9e32949 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -179,6 +179,14 @@ WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func);
+/** Register a dissector table alias.
+ * This is for dissectors whose original name has changed, e.g. SSL to TLS.
+ * @param dissector_table_t dissector table returned by register_dissector_table.
+ * @param alias_name alias for the dissector table name.
+ */
+WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table,
+ const char *alias_name);
+
/** Deregister the dissector table by table name. */
void deregister_dissector_table(const char *name);