From 4cf3749e73f4525f53c789a14d09bf3c5a29c926 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 14 Aug 2022 10:42:58 +0200 Subject: [PATCH] add teamspeak3 (voice only) probe Signed-off-by: Toni Uhlig --- example.cfg | 2 +- probe.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/example.cfg b/example.cfg index cd1a8ee..b818e89 100644 --- a/example.cfg +++ b/example.cfg @@ -123,7 +123,7 @@ protocols: udp_timeout: 20; # Time after which the "connection" is forgotten regex_patterns: [ "hello" ]; }, # Forward Teamspeak3 (Voice only) - { name: "regex"; host: "localhost"; is_udp: true; port: "9987"; regex_patterns: [ "TS3INIT1" ]; }, + { name: "teamspeak"; host: "localhost"; is_udp: true; port: "9987"; }, # Forward IETF QUIC-50 ("Q050" -> "\x51\x30\x35\x30") # Remember that the regex needs to be adjusted for every supported QUIC version. { name: "regex"; host: "localhost"; is_udp: true; port: "4433"; regex_patterns: [ "\x51\x30\x35\x30" ]; }, diff --git a/probe.c b/probe.c index aa9db03..ecc2e73 100644 --- a/probe.c +++ b/probe.c @@ -40,6 +40,7 @@ static int is_tls_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_ static int is_adb_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_socks5_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_syslog_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); +static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_true(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { return 1; } /* Table of protocols that have a built-in probe @@ -55,6 +56,7 @@ static struct protocol_probe_desc builtins[] = { { "adb", is_adb_protocol }, { "socks5", is_socks5_protocol }, { "syslog", is_syslog_protocol }, + { "teamspeak", is_teamspeak_protocol }, { "anyprot", is_true } }; @@ -318,6 +320,14 @@ static int is_syslog_protocol(const char *p, ssize_t len, struct sslhcfg_protoco return 0; } +static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) +{ + if (len < 8) + return PROBE_NEXT; + + return !strncmp(p, "TS3INIT1", len); +} + static int regex_probe(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { #ifdef ENABLE_REGEX