{ NULL, 0, NULL }
};
+/*
+ * http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
+ */
/* string_string is inappropriate as it compares strings while
* "byte strings MUST NOT be truncated" (RFC 7301) */
typedef struct ssl_alpn_protocol {
gboolean match_exact;
const char *dissector_name;
} ssl_alpn_protocol_t;
-/* http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids */
+
+/*
+ * For SSL/TLS; the dissectors should handle running atop a byte-stream
+ * protocol such as TCP.
+ */
static const ssl_alpn_protocol_t ssl_alpn_protocols[] = {
{ "http/1.1", TRUE, "http" },
/* SPDY moves so fast, just 1, 2 and 3 are registered with IANA but there
* already exists 3.1 as of this writing... match the prefix. */
{ "spdy/", FALSE, "spdy" },
- { "stun.turn", TRUE, "turnchannel" },
- { "stun.nat-discovery", TRUE, "stun" },
+ { "stun.turn", TRUE, "turnchannel-tcp" }, /* RFC 7443 */
+ { "stun.nat-discovery", TRUE, "stun-tcp" }, /* RFC 7443 */
/* draft-ietf-httpbis-http2-16 */
{ "h2-", FALSE, "http2" }, /* draft versions */
{ "h2", TRUE, "http2" }, /* final version */
};
+/*
+ * For DTLS; the dissectors should handle running atop a datagram
+ * protocol such as UDP.
+ */
+static const ssl_alpn_protocol_t dtls_alpn_protocols[] = {
+ { "stun.turn", TRUE, "turnchannel" }, /* RFC 7443 */
+ { "stun.nat-discovery", TRUE, "stun-udp" }, /* RFC 7443 */
+};
+
const value_string quic_transport_parameter_id[] = {
{ SSL_HND_QUIC_TP_INITIAL_MAX_STREAM_DATA, "initial_max_stream_data" },
{ SSL_HND_QUIC_TP_INITIAL_MAX_DATA, "initial_max_data" },
ssl_dissect_hnd_hello_ext_alpn(ssl_common_dissect_t *hf, tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree,
guint32 offset, guint32 offset_end,
- guint8 hnd_type, SslSession *session)
+ guint8 hnd_type, SslSession *session,
+ gboolean is_dtls)
{
/* https://tools.ietf.org/html/rfc7301#section-3.1
guint32 next_offset, alpn_length, name_length;
guint8 *proto_name = NULL;
guint32 proto_name_length = 0;
+ const ssl_alpn_protocol_t *alpn_protocols;
+ size_t n_alpn_protocols;
/* ProtocolName protocol_name_list<2..2^16-1> */
if (!ssl_add_vector(hf, tvb, pinfo, tree, offset, offset_end, &alpn_length,
/* If ALPN is given in ServerHello, then ProtocolNameList MUST contain
* exactly one "ProtocolName". */
if (proto_name) {
+ alpn_protocols = is_dtls ? dtls_alpn_protocols : ssl_alpn_protocols;
+ n_alpn_protocols = is_dtls ? G_N_ELEMENTS(dtls_alpn_protocols) : G_N_ELEMENTS(ssl_alpn_protocols);
/* '\0'-terminated string for prefix/full string comparison purposes. */
- for (size_t i = 0; i < G_N_ELEMENTS(ssl_alpn_protocols); i++) {
- const ssl_alpn_protocol_t *alpn_proto = &ssl_alpn_protocols[i];
+ for (size_t i = 0; i < n_alpn_protocols; i++) {
+ const ssl_alpn_protocol_t *alpn_proto = &alpn_protocols[i];
if ((alpn_proto->match_exact &&
proto_name_length == strlen(alpn_proto->proto_name) &&
offset++;
break;
case SSL_HND_HELLO_EXT_ALPN:
- offset = ssl_dissect_hnd_hello_ext_alpn(hf, tvb, pinfo, ext_tree, offset, next_offset, hnd_type, session);
+ offset = ssl_dissect_hnd_hello_ext_alpn(hf, tvb, pinfo, ext_tree, offset, next_offset, hnd_type, session, is_dtls);
break;
case SSL_HND_HELLO_EXT_STATUS_REQUEST_V2:
if (hnd_type == SSL_HND_CLIENT_HELLO)
/* heuristic subdissectors (used for the DATA field) */
heur_subdissector_list = register_heur_dissector_list("stun", proto_stun);
+ register_dissector("stun-tcp", dissect_stun_tcp, proto_stun);
register_dissector("stun-udp", dissect_stun_udp, proto_stun);
register_dissector("stun-heur", dissect_stun_heur, proto_stun);
}
void
proto_reg_handoff_stun(void)
{
- stun_tcp_handle = create_dissector_handle(dissect_stun_tcp, proto_stun);
- stun_udp_handle = create_dissector_handle(dissect_stun_udp, proto_stun);
+ stun_tcp_handle = find_dissector("stun-tcp");
+ stun_udp_handle = find_dissector("stun-udp");
dissector_add_uint_with_preference("tcp.port", TCP_PORT_STUN, stun_tcp_handle);
dissector_add_uint_with_preference("udp.port", UDP_PORT_STUN, stun_udp_handle);
/* Initialize the subtree pointers */
static gint ett_turnchannel = -1;
+static dissector_handle_t turnchannel_tcp_handle;
static dissector_handle_t turnchannel_udp_handle;
static int
proto_turnchannel = proto_register_protocol("TURN Channel",
"TURNCHANNEL", "turnchannel");
+ turnchannel_tcp_handle = register_dissector("turnchannel-tcp", dissect_turnchannel_tcp, proto_turnchannel);
turnchannel_udp_handle = register_dissector("turnchannel", dissect_turnchannel_message, proto_turnchannel);
/* subdissectors */
void
proto_reg_handoff_turnchannel(void)
{
- dissector_handle_t turnchannel_tcp_handle;
-
- turnchannel_tcp_handle = create_dissector_handle(dissect_turnchannel_tcp, proto_turnchannel);
-
/* Register for "Decode As" in case STUN negotiation isn't captured */
dissector_add_for_decode_as_with_preference("tcp.port", turnchannel_tcp_handle);
dissector_add_for_decode_as_with_preference("udp.port", turnchannel_udp_handle);