[asterisk-commits] mmichelson: branch 1.4 r174282 - /branches/1.4/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 9 11:11:05 CST 2009
Author: mmichelson
Date: Mon Feb 9 11:11:05 2009
New Revision: 174282
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174282
Log:
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)
Modified:
branches/1.4/channels/chan_sip.c
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=174282&r1=174281&r2=174282
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Feb 9 11:11:05 2009
@@ -2922,7 +2922,7 @@
struct ast_hostent ahp;
struct sip_peer *p;
char *port;
- int portno;
+ int portno = 0;
char host[MAXHOSTNAMELEN], *hostn;
char peer[256];
@@ -2957,8 +2957,10 @@
}
} else {
hostn = peer;
- portno = port ? atoi(port) : STANDARD_SIP_PORT;
- if (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 && srvlookup) {
char service[MAXHOSTNAMELEN];
int tportno;
int ret;
@@ -2970,6 +2972,9 @@
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", peer);
More information about the asterisk-commits
mailing list