[svn-commits] jpdionne: branch group/v6-new r270800 - in /team/group/v6-new: channels/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 16 09:39:09 CDT 2010


Author: jpdionne
Date: Wed Jun 16 09:39:05 2010
New Revision: 270800

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270800
Log:
Fix TLS and TCP server configuration.

- Removed unecessary tmp variables.
- Use 'tlsbindaddr' config variable instead of 'tlsbind'


Modified:
    team/group/v6-new/channels/chan_sip.c
    team/group/v6-new/main/tcptls.c

Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=270800&r1=270799&r2=270800
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Wed Jun 16 09:39:05 2010
@@ -25749,8 +25749,6 @@
 	struct ast_sockaddr old_bindaddr = bindaddr;
 	int registry_count = 0, peer_count = 0, timerb_set = 0, timert1_set = 0;
 	time_t run_start, run_end;
-	struct ast_sockaddr tcp_tmp = { {0,} };
-	struct ast_sockaddr tls_tmp = { {0,} };
 	struct sockaddr_in externip_sin;
 
 	run_start = time(0);
@@ -26062,13 +26060,13 @@
 		} else if (!strcasecmp(v->name, "tcpenable")) {
 			if(!ast_false(v->value)) {
 				ast_debug(2, "Enabling TCP socket for listening\n");
-				ast_sockaddr_parse(&tcp_tmp, "[::]:5060", 0);
+				ast_sockaddr_parse(&sip_tcp_desc.local_address, "[::]:5060", 0);
 			}
 		} else if (!strcasecmp(v->name, "tcpbindaddr")) {
-			if (ast_parse_arg(v->value, PARSE_ADDR, &tcp_tmp))
+			if (ast_parse_arg(v->value, PARSE_ADDR, &sip_tcp_desc.local_address))
 				ast_log(LOG_WARNING, "Invalid %s '%s' at line %d of %s\n", v->name, v->value, v->lineno, config);
 			ast_debug(2, "Setting TCP socket address to %s\n",
-				  ast_sockaddr_stringify(&tcp_tmp));
+				  ast_sockaddr_stringify(&sip_tcp_desc.local_address));
 		} else if (!strcasecmp(v->name, "dynamic_exclude_static") || !strcasecmp(v->name, "dynamic_excludes_static")) {
 			global_dynamic_exclude_static = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "contactpermit") || !strcasecmp(v->name, "contactdeny")) {
@@ -26598,19 +26596,16 @@
 	ast_mutex_unlock(&netlock);
 
 	/* Start TCP server */
-	ast_sockaddr_copy(&sip_tcp_desc.local_address, &tcp_tmp);
 	ast_tcptls_server_start(&sip_tcp_desc);
- 	if (sip_tcp_desc.accept_fd == -1 && !ast_sockaddr_isnull(&tcp_tmp)) {
+ 	if (sip_tcp_desc.accept_fd == -1 && !ast_sockaddr_isnull(&sip_tcp_desc.local_address)) {
 		/* TCP server start failed. Tell the admin */
 		ast_log(LOG_ERROR, "SIP TCP Server start failed. Not listening on TCP socket.\n");
-		ast_sockaddr_setnull(&tcp_tmp);
-		ast_sockaddr_copy(&sip_tcp_desc.local_address, &tcp_tmp);
+		ast_sockaddr_setnull(&sip_tcp_desc.local_address);
 	} else {
 		ast_debug(2, "SIP TCP server started\n");
 	}
 
 	/* Start TLS server if needed */
-	ast_sockaddr_copy(&sip_tls_desc.local_address, &tls_tmp);
 	memcpy(sip_tls_desc.tls_cfg, &default_tls_cfg, sizeof(default_tls_cfg));
 
 	if (ast_ssl_setup(sip_tls_desc.tls_cfg)) {
@@ -26644,13 +26639,16 @@
 		}
 
 		/* If TCP is running on a different IP than UDP, then add it too */
-		if (!ast_sockaddr_isnull(&tcp_tmp) && !ast_sockaddr_cmp(&bindaddr, &tcp_tmp))
-			add_sip_domain(ast_sockaddr_stringify(&tcp_tmp), SIP_DOMAIN_AUTO, NULL);
+		if (!ast_sockaddr_isnull(&sip_tcp_desc.local_address) && 
+				!ast_sockaddr_cmp(&bindaddr, &sip_tcp_desc.local_address))
+			add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address), 
+				SIP_DOMAIN_AUTO, NULL);
 
 		/* If TLS is running on a different IP than UDP and TCP, then add that too */
-		if (ast_sockaddr_isnull(&tls_tmp) && !ast_sockaddr_cmp(&bindaddr, &tls_tmp)
-						&& ast_sockaddr_cmp(&tcp_tmp, &tls_tmp))
-			add_sip_domain(ast_sockaddr_stringify(&tls_tmp), SIP_DOMAIN_AUTO, NULL);
+		if (ast_sockaddr_isnull(&sip_tls_desc.local_address) && 
+				!ast_sockaddr_cmp(&bindaddr, &sip_tls_desc.local_address))
+			add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address), 
+				SIP_DOMAIN_AUTO, NULL);
 
 		/* Our extern IP address, if configured */
 		if (!ast_sockaddr_isnull(&externip))

Modified: team/group/v6-new/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/tcptls.c?view=diff&rev=270800&r1=270799&r2=270800
==============================================================================
--- team/group/v6-new/main/tcptls.c (original)
+++ team/group/v6-new/main/tcptls.c Wed Jun 16 09:39:05 2010
@@ -557,7 +557,7 @@
 		ast_set2_flag(&tls_cfg->flags, ast_true(value), AST_SSL_VERIFY_CLIENT);
 	} else if (!strcasecmp(varname, "tlsdontverifyserver")) {
 		ast_set2_flag(&tls_cfg->flags, ast_true(value), AST_SSL_DONT_VERIFY_SERVER);
-	} else if (!strcasecmp(varname, "tlsbind") || !strcasecmp(varname, "sslbind")) {
+	} else if (!strcasecmp(varname, "tlsbindaddr") || !strcasecmp(varname, "sslbindaddr")) {
 		if (ast_parse_arg(value, PARSE_ADDR, &tls_desc->local_address))
 			ast_log(LOG_WARNING, "Invalid %s '%s'\n", varname, value);
 	} else if (!strcasecmp(varname, "tlsclientmethod") || !strcasecmp(varname, "sslclientmethod")) {




More information about the svn-commits mailing list