diff options
author | Walter Doekes <walter+asterisk@wjd.nu> | 2011-12-08 21:32:36 +0000 |
---|---|---|
committer | Walter Doekes <walter+asterisk@wjd.nu> | 2011-12-08 21:32:36 +0000 |
commit | 463bfdb4009ce23852be8e872ac86c595933cae4 (patch) | |
tree | d8ece9dd9643473e85850c504258f790e3613f8f /channels/chan_sip.c | |
parent | e1884139c478200b46b0332173b60785f1693ef1 (diff) |
Fix regression when using tcpenable=no and tlsenable=yes.
The tlsenable settings are tucked away in main/tcptls.c, so I missed
them when resolving ASTERISK-18837. This should resolve the test suite
breakage of the sip tls tests.
Review: https://reviewboard.asterisk.org/r/1615
Reviewed by: Matt Jordan
........
Merged revisions 347718 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 347727 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index edf5018cf..8f3b411ae 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -27893,10 +27893,10 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str peer->transports |= SIP_TRANSPORT_UDP; } else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tcp", 3)) { peer->transports |= SIP_TRANSPORT_TCP; - } else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tls", 3)) { + } else if (default_tls_cfg.enabled && !strncasecmp(trans, "tls", 3)) { peer->transports |= SIP_TRANSPORT_TLS; - } else if (!sip_cfg.tcp_enabled && (!strncasecmp(trans, "tcp", 3) || !strncasecmp(trans, "tls", 3))) { - ast_log(LOG_WARNING, "'%s' is not a valid transport type when tcpenabled=no. if no other is specified, the defaults from general will be used.\n", trans); + } else if (!strncasecmp(trans, "tcp", 3) || !strncasecmp(trans, "tls", 3)) { + ast_log(LOG_WARNING, "'%.3s' is not a valid transport type when %.3senabled=no. If no other is specified, the defaults from general will be used.\n", trans, trans); } else { ast_log(LOG_NOTICE, "'%s' is not a valid transport type. if no other is specified, the defaults from general will be used.\n", trans); } @@ -29305,11 +29305,22 @@ static int reload_config(enum channelreloadreason reason) sip_cfg.allow_external_domains = 1; } /* If not or badly configured, set default transports */ - if (!sip_cfg.tcp_enabled && ((default_transports & SIP_TRANSPORT_TCP) || (default_transports & SIP_TRANSPORT_TLS))) { - ast_log(LOG_WARNING, "Cannot use 'tcp' or 'tls' transport with tcpenable=no. Falling back to 'udp'.\n"); - default_transports = default_primary_transport = SIP_TRANSPORT_UDP; - } else if (default_transports == 0) { + if (!sip_cfg.tcp_enabled && (default_transports & SIP_TRANSPORT_TCP)) { + ast_log(LOG_WARNING, "Cannot use 'tcp' transport with tcpenable=no. Removing from available transports.\n"); + default_primary_transport &= ~SIP_TRANSPORT_TCP; + default_transports &= ~SIP_TRANSPORT_TCP; + } + if (!default_tls_cfg.enabled && (default_transports & SIP_TRANSPORT_TLS)) { + ast_log(LOG_WARNING, "Cannot use 'tls' transport with tlsenable=no. Removing from available transports.\n"); + default_primary_transport &= ~SIP_TRANSPORT_TLS; + default_transports &= ~SIP_TRANSPORT_TLS; + } + if (!default_transports) { + ast_log(LOG_WARNING, "No valid transports available, falling back to 'udp'.\n"); default_transports = default_primary_transport = SIP_TRANSPORT_UDP; + } else if (!default_primary_transport) { + ast_log(LOG_WARNING, "No valid default transport. Selecting 'udp' as default.\n"); + default_primary_transport = SIP_TRANSPORT_UDP; } /* Build list of authentication to various SIP realms, i.e. service providers */ |