diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-09 17:25:09 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-09 17:25:09 +0000 |
commit | 069393ece988d36fa51af2217181c8e4e31a8abe (patch) | |
tree | 855d34b7fb33bb2cb5b7c3d3a45414c4576cf05c | |
parent | 00e268663c553801803e83c7b370d75cbd21eed0 (diff) |
Merged revisions 174301 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r174301 | mmichelson | 2009-02-09 11:20:55 -0600 (Mon, 09 Feb 2009) | 20 lines
Merged revisions 174282 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r174282 | mmichelson | 2009-02-09 11:11:05 -0600 (Mon, 09 Feb 2009) | 12 lines
Don't do an SRV lookup if a port is specified
RFC 3263 says to do A record lookups on a hostname
if a port has been specified, so that's what we're
going to do. See section 4.2.
(closes issue #14419)
Reported by: klaus3000
Patches:
patch_chan_sip_nosrvifport_1.4.23.txt uploaded by klaus3000 (license 65)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@174322 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8e0c492e5..5e0af097c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4140,7 +4140,7 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer) struct ast_hostent ahp; struct sip_peer *peer; char *port; - int portno; + int portno = 0; char host[MAXHOSTNAMELEN], *hostn; char peername[256]; @@ -4177,7 +4177,10 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer) */ hostn = peername; - if (global_srvlookup) { + /* Section 4.2 of RFC 3263 specifies that if a port number is specified, then + * an A record lookup should be used instead of SRV. + */ + if (!port && global_srvlookup) { char service[MAXHOSTNAMELEN]; int tportno; int ret; @@ -4189,6 +4192,8 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer) portno = tportno; } } + if (!portno) + portno = port ? atoi(port) : STANDARD_SIP_PORT; hp = ast_gethostbyname(hostn, &ahp); if (!hp) { ast_log(LOG_WARNING, "No such host: %s\n", peername); |