]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
tcptls: Do not re-bind to wildcard on client creation.
authorAlexander Traud <pabstraud@compuserve.com>
Sun, 8 Oct 2017 14:11:10 +0000 (16:11 +0200)
committerAlexander Traud <pabstraud@compuserve.com>
Sun, 8 Oct 2017 14:23:13 +0000 (09:23 -0500)
Since ASTERISK-26922, this issue affected only those chan_sip which were
* enabled for dual-stack (bindaddr=::), and
* enabled for TCP (tcpenable=yes) and/or TLS (tlsenable=yes), and
* tried to register and/or invite a IPv4-only service,
* via TCP and/or TLS.
Now, ast_tcptls_client_create does not re-bind to [::] anymore.

ASTERISK-27324 #close

Change-Id: I4b242837bdeb1ec7130dc82505c6180a946fd9b5

main/tcptls.c

index 0d172f1494847726c5f36b2d2dd2eb6427274813..e237dc7bb570d472f9b6a6f7275bf525d2e1f497 100644 (file)
@@ -1147,7 +1147,8 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
 
        /* if a local address was specified, bind to it so the connection will
           originate from the desired address */
-       if (!ast_sockaddr_isnull(&desc->local_address)) {
+       if (!ast_sockaddr_isnull(&desc->local_address) &&
+           !ast_sockaddr_is_any(&desc->local_address)) {
                setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
                if (ast_bind(desc->accept_fd, &desc->local_address)) {
                        ast_log(LOG_ERROR, "Unable to bind %s to %s: %s\n",