changeset 20:45f84c2bbf43

MERGE: new upstream v4.5.2. BUGS: No other things handles: just merge.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 01 Sep 2021 20:52:51 +0200
parents 4a6383e57d12 (diff) f271ad092ec7 (current diff)
children 735b41782ed7
files Makefile distinfo
diffstat 9 files changed, 234 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- /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/
--- /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
--- 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
--- /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=<ip-address> dbname=<database-number> password=<database-user-password> port=<port> connect_timeout=<seconds>"
++#redis-userdb="ip=<ip-address> socket=<unix-domain-socket-path> dbname=<database-number> password=<database-user-password> port=<port> connect_timeout=<seconds>"
+ 
+ # 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=<ip-address> dbname=<database-number> password=<database-user-password> port=<port> connect_timeout=<seconds>"
++#redis-statsdb="ip=<ip-address> socket=<unix-domain-socket-path> dbname=<database-number> password=<database-user-password> port=<port> connect_timeout=<seconds>"
+ 
+ # The default realm to be used for the users when no explicit 
+ # origin/realm relationship is found in the database, or if the TURN
--- /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;
+   }
--- /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,...);
+ 
--- /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) {
--- 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
--- 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