[svn-commits] mmichelson: branch 1.6.1 r174326 - in /branches/1.6.1: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 9 11:26:39 CST 2009


Author: mmichelson
Date: Mon Feb  9 11:26:39 2009
New Revision: 174326

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174326
Log:
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)


........

................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_sip.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=174326&r1=174325&r2=174326
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Mon Feb  9 11:26:39 2009
@@ -4411,7 +4411,7 @@
 	struct ast_hostent ahp;
 	struct sip_peer *peer;
 	char *port;
-	int portno;
+	int portno = 0;
 	char host[MAXHOSTNAMELEN], *hostn;
 	char peername[256];
 	int srv_ret = 0;
@@ -4466,8 +4466,10 @@
 			  In the future, we should first check NAPTR to find out transport preference
 		 */
 		hostn = peername;
-		portno = port ? atoi(port) : (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT;
-		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;
 	
@@ -4478,7 +4480,8 @@
 				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);




More information about the svn-commits mailing list