# HG changeset patch # User Franz Glasner # Date 1630522371 -7200 # Node ID 45f84c2bbf43f23cc659970bdca37707232fc265 # Parent 4a6383e57d128cd8a8f0b7466a54cc51fffad250# Parent f271ad092ec72f4f5c71de7d9509512670710b57 MERGE: new upstream v4.5.2. BUGS: No other things handles: just merge. diff -r f271ad092ec7 -r 45f84c2bbf43 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,3 @@ +syntax: regexp + +^work/ diff -r f271ad092ec7 -r 45f84c2bbf43 .hgtags --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,2 @@ +288fd9742645042db6dd0c7c19bb835441e3dd53 v4.5.1.1 +1a26b3d090c3b316e73a1703d1a44adc75e555f0 v4.5.1.1_1 diff -r f271ad092ec7 -r 45f84c2bbf43 Makefile --- a/Makefile Wed Sep 01 20:47:52 2021 +0200 +++ b/Makefile Wed Sep 01 20:52:51 2021 +0200 @@ -3,10 +3,10 @@ CATEGORIES= net MASTER_SITES= http://turnserver.open-sys.org/downloads/extradocs/:xdocs \ http://coturn.net/turnserver/extradocs/:xdocs -PKGNAMEPREFIX= +PKGNAMEPREFIX= fmg- DISTFILES= turn.extra.docs-2.0.0.1.tar.gz:xdocs -MAINTAINER= bhughes@FreeBSD.org +MAINTAINER= f.glasner@feldmann-mg.com COMMENT= STUN/TURN Server; IPv6, DTLS support; RFCs 5389, 5766, 6062, 6156 LICENSE= BSD3CLAUSE @@ -29,6 +29,8 @@ SUB_FILES= pkg-message USE_RC_SUBR= turnserver +CONFLICTS_INSTALL= turnserver coturn + MANPAGES= turnserver.1 turnadmin.1 turnutils.1 turnutils_peer.1 \ turnutils_stunclient.1 turnutils_uclient.1 coturn.1 \ turnutils_oauth.1 turnutils_natdiscovery.1 @@ -113,7 +115,7 @@ do-install-SQLITE-on: ${MKDIR} ${STAGEDIR}${PREFIX}/var/db - ${INSTALL_DATA} ${WRKSRC}/sqlite/turndb ${STAGEDIR}${PREFIX}/var/db/turndb + ${INSTALL_DATA} ${WRKSRC}/sqlite/turndb ${STAGEDIR}${PREFIX}/var/db/turndb.sample do-install-EXAMPLES-on: .for dir in basic loadbalance longtermsecure longtermsecuredb restapi selfloadbalance diff -r f271ad092ec7 -r 45f84c2bbf43 distinfo diff -r f271ad092ec7 -r 45f84c2bbf43 files/patch-examples_etc_turnserver.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-examples_etc_turnserver.conf Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,24 @@ +--- examples/etc/turnserver.conf.orig ++++ examples/etc/turnserver.conf +@@ -322,17 +322,17 @@ + # as the user database. + # This database can be used for long-term credential mechanism + # and it can store the secret value for secret-based timed authentication in TURN REST API. +-# Use the string format below (space separated parameters, all optional): ++# Use the string format below (space separated parameters, all optional, "socket" has higher prio then "ip"): + # +-#redis-userdb="ip= dbname= password= port= connect_timeout=" ++#redis-userdb="ip= socket= dbname= password= port= connect_timeout=" + + # Redis status and statistics database connection string, if used (default - empty, no Redis stats DB used). + # This database keeps allocations status information, and it can be also used for publishing + # and delivering traffic and allocation event notifications. + # The connection string has the same parameters as redis-userdb connection string. +-# Use the string format below (space separated parameters, all optional): ++# Use the string format below (space separated parameters, all optional, "socket" has higher prio than "ip"): + # +-#redis-statsdb="ip= dbname= password= port= connect_timeout=" ++#redis-statsdb="ip= socket= dbname= password= port= connect_timeout=" + + # The default realm to be used for the users when no explicit + # origin/realm relationship is found in the database, or if the TURN diff -r f271ad092ec7 -r 45f84c2bbf43 files/patch-src_apps_common_hiredis__libevent2.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-src_apps_common_hiredis__libevent2.c Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,79 @@ +--- src/apps/common/hiredis_libevent2.c.orig ++++ src/apps/common/hiredis_libevent2.c +@@ -55,6 +55,7 @@ + char *ip; + int port; + char *pwd; ++ char *usocket; + int db; + }; + +@@ -223,12 +224,13 @@ + + ///////////////////////// Attach ///////////////////////////////// + +-redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, int db) ++redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, char *usocket, int db) + { + + struct redisLibeventEvents *e = NULL; + redisAsyncContext *ac = NULL; + ++ char sockpath[256] = "\0"; + char ip[256]; + if(ip0 && ip0[0]) + STRCPY(ip,ip0); +@@ -239,7 +241,14 @@ + if(port0>0) + port=port0; + +- ac = redisAsyncConnect(ip, port); ++ if(usocket) ++ STRCPY(sockpath, usocket); ++ ++ if(usocket) { ++ ac = redisAsyncConnectUnix(sockpath); ++ } else { ++ ac = redisAsyncConnect(ip, port); ++ } + if (!ac) { + fprintf(stderr,"Error: %s:%s\n", ac->errstr, ac->c.errstr); + return NULL; +@@ -256,6 +265,11 @@ + e->port = port; + if(pwd) + e->pwd = strdup(pwd); ++ if(usocket) { ++ e->usocket = strdup(usocket); ++ } else { ++ e->usocket = NULL; ++ } + e->db = db; + + /* Register functions to start/stop listening for events */ +@@ -277,6 +291,12 @@ + e); + + if (e->rev == NULL || e->wev == NULL) { ++ if(e->rev) ++ event_free(e->rev); ++ if(e->wev) ++ event_free(e->wev); ++ free(e->ip); ++ free(e->pwd); + free(e); + return NULL; + } +@@ -327,7 +347,11 @@ + e->context = NULL; + } + +- ac = redisAsyncConnect(e->ip, e->port); ++ if(e->usocket) { ++ ac = redisAsyncConnectUnix(e->usocket); ++ } else { ++ ac = redisAsyncConnect(e->ip, e->port); ++ } + if(!ac) { + return; + } diff -r f271ad092ec7 -r 45f84c2bbf43 files/patch-src_apps_common_hiredis__libevent2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-src_apps_common_hiredis__libevent2.h Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,11 @@ +--- src/apps/common/hiredis_libevent2.h.orig 2019-03-02 21:06:19 UTC ++++ src/apps/common/hiredis_libevent2.h +@@ -50,7 +50,7 @@ typedef void* redis_context_handle; + + void redis_async_init(void); + +-redis_context_handle redisLibeventAttach(struct event_base *base, char *ip, int port, char *pwd, int db); ++redis_context_handle redisLibeventAttach(struct event_base *base, char *ip, int port, char *pwd, char *usocket, int db); + + void send_message_to_redis(redis_context_handle rch, const char *command, const char *key, const char *format,...); + diff -r f271ad092ec7 -r 45f84c2bbf43 files/patch-src_apps_relay_dbdrivers_dbd__redis.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-src_apps_relay_dbdrivers_dbd__redis.c Wed Sep 01 20:52:51 2021 +0200 @@ -0,0 +1,108 @@ +--- src/apps/relay/dbdrivers/dbd_redis.c.orig ++++ src/apps/relay/dbdrivers/dbd_redis.c +@@ -50,6 +50,7 @@ + char *host; + char *dbname; + char *password; ++ char *usocket; + unsigned int connect_timeout; + unsigned int port; + }; +@@ -61,6 +62,7 @@ + if(co->host) free(co->host); + if(co->dbname) free(co->dbname); + if(co->password) free(co->password); ++ if(co->usocket) free(co->usocket); + bzero(co,sizeof(Ryconninfo)); + } + } +@@ -103,6 +105,8 @@ + co->host = strdup(seq + 1); + else if (!strcmp(s, "hostaddr")) + co->host = strdup(seq + 1); ++ else if (!strcmp(s, "socket")) ++ co->usocket = strdup(seq + 1); + else if (!strcmp(s, "dbname")) + co->dbname = strdup(seq + 1); + else if (!strcmp(s, "db")) +@@ -185,6 +189,7 @@ + redisContext *rc = NULL; + + char ip[256] = "\0"; ++ char sockpath[256] = "\0"; + int port = DEFAULT_REDIS_PORT; + if (co->host) + STRCPY(ip,co->host); +@@ -194,13 +199,24 @@ + if (co->port) + port = (int) (co->port); + ++ if (co->usocket) ++ STRCPY(sockpath,co->usocket); ++ + if (co->connect_timeout) { + struct timeval tv; + tv.tv_usec = 0; + tv.tv_sec = (time_t) (co->connect_timeout); +- rc = redisConnectWithTimeout(ip, port, tv); ++ if (co->usocket) { ++ rc = redisConnectUnixWithTimeout(sockpath, tv); ++ } else { ++ rc = redisConnectWithTimeout(ip, port, tv); ++ } + } else { +- rc = redisConnect(ip, port); ++ if (co->usocket) { ++ rc = redisConnectUnix(sockpath); ++ } else { ++ rc = redisConnect(ip, port); ++ } + } + + if (!rc) { +@@ -248,7 +264,7 @@ + } + } + +- ret = redisLibeventAttach(base, co->host, co->port, co->password, atoi(co->dbname)); ++ ret = redisLibeventAttach(base, co->host, co->port, co->password, co->usocket, atoi(co->dbname)); + + if (!ret) { + TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot initialize Redis DB connection\n"); +@@ -294,12 +310,16 @@ + RyconninfoFree(co); + } else { + char ip[256] = "\0"; ++ char sockpath[256] = "\0"; + int port = DEFAULT_REDIS_PORT; + if (co->host) + STRCPY(ip,co->host); + if (!ip[0]) + STRCPY(ip,"127.0.0.1"); + ++ if (co->usocket) ++ STRCPY(sockpath,co->usocket); ++ + if (co->port) + port = (int) (co->port); + +@@ -307,9 +327,17 @@ + struct timeval tv; + tv.tv_usec = 0; + tv.tv_sec = (time_t) (co->connect_timeout); +- redisconnection = redisConnectWithTimeout(ip, port, tv); ++ if (co->usocket) { ++ redisconnection = redisConnectUnixWithTimeout(sockpath, tv); ++ } else { ++ redisconnection = redisConnectWithTimeout(ip, port, tv); ++ } + } else { +- redisconnection = redisConnect(ip, port); ++ if (co->usocket) { ++ redisconnection = redisConnectUnix(sockpath); ++ } else { ++ redisconnection = redisConnect(ip, port); ++ } + } + + if (redisconnection) { diff -r f271ad092ec7 -r 45f84c2bbf43 pkg-descr --- a/pkg-descr Wed Sep 01 20:47:52 2021 +0200 +++ b/pkg-descr Wed Sep 01 20:52:51 2021 +0200 @@ -1,4 +1,4 @@ This a BSD-licensed version of the Coturn TURN Server implementation, with IPv6 and DTLS extensions. -WWW: http://code.google.com/p/coturn/ +WWW: https://github.com/coturn/coturn diff -r f271ad092ec7 -r 45f84c2bbf43 pkg-plist --- a/pkg-plist Wed Sep 01 20:47:52 2021 +0200 +++ b/pkg-plist Wed Sep 01 20:52:51 2021 +0200 @@ -6,7 +6,7 @@ bin/turnutils_stunclient bin/turnutils_uclient lib/libturnclient.a -%%SQLITE%%var/db/turndb +%%SQLITE%%@sample var/db/turndb.sample var/db/turndb etc/turnserver.conf.default man/man1/turnserver.1.gz man/man1/turnadmin.1.gz