mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-22 21:36:28 +00:00
Don't allow transport=tcp when tcpenable=no.
When tcpenable=no, sending to transport=tcp hosts was still allowed. Resolving the source address wasn't possible and yielded the string "(null)" in SIP messages. Fixed that and a couple of not-so-correct log messages. (closes issue ASTERISK-18837) Reported by: Andreas Topp Review: https://reviewboard.asterisk.org/r/1585 Reviewed by: Matt Jordan ........ Merged revisions 347166 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 347167 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -27870,12 +27870,14 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
|||||||
|
|
||||||
if (!strncasecmp(trans, "udp", 3)) {
|
if (!strncasecmp(trans, "udp", 3)) {
|
||||||
peer->transports |= SIP_TRANSPORT_UDP;
|
peer->transports |= SIP_TRANSPORT_UDP;
|
||||||
} else if (!strncasecmp(trans, "tcp", 3)) {
|
} else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tcp", 3)) {
|
||||||
peer->transports |= SIP_TRANSPORT_TCP;
|
peer->transports |= SIP_TRANSPORT_TCP;
|
||||||
} else if (!strncasecmp(trans, "tls", 3)) {
|
} else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tls", 3)) {
|
||||||
peer->transports |= SIP_TRANSPORT_TLS;
|
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 {
|
} else {
|
||||||
ast_log(LOG_NOTICE, "'%s' is not a valid transport type. if no other is specified, udp will be used.\n", trans);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!peer->default_outbound_transport) { /*!< The first transport listed should be default outbound */
|
if (!peer->default_outbound_transport) { /*!< The first transport listed should be default outbound */
|
||||||
@@ -29281,8 +29283,11 @@ static int reload_config(enum channelreloadreason reason)
|
|||||||
ast_log(LOG_WARNING, "To disallow external domains, you need to configure local SIP domains.\n");
|
ast_log(LOG_WARNING, "To disallow external domains, you need to configure local SIP domains.\n");
|
||||||
sip_cfg.allow_external_domains = 1;
|
sip_cfg.allow_external_domains = 1;
|
||||||
}
|
}
|
||||||
/* If not configured, set default transports */
|
/* If not or badly configured, set default transports */
|
||||||
if (default_transports == 0) {
|
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) {
|
||||||
default_transports = default_primary_transport = SIP_TRANSPORT_UDP;
|
default_transports = default_primary_transport = SIP_TRANSPORT_UDP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user