[asterisk-commits] tilghman: trunk r94662 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 22 19:38:46 CST 2007


Author: tilghman
Date: Sat Dec 22 19:38:46 2007
New Revision: 94662

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94662
Log:
Merged revisions 94660 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r94660 | tilghman | 2007-12-22 19:21:03 -0600 (Sat, 22 Dec 2007) | 2 lines

Argh... I suppose third time's the charm.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=94662&r1=94661&r2=94662
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Dec 22 19:38:46 2007
@@ -3093,33 +3093,34 @@
 			varregs = ast_load_realtime("sipregs", "name", newpeername, NULL);
 
 		var = ast_load_realtime("sippeers", "name", newpeername, "host", "dynamic", NULL);
-		if (!var && sin) {
+		if (!var && sin)
 			var = ast_load_realtime("sippeers", "name", newpeername, "host", ast_inet_ntoa(sin->sin_addr), NULL);
-			if (!var) {
-				var = ast_load_realtime("sippeers", "name", newpeername, NULL);
-				/*!\note
-				 * If this one loaded something, then we need to ensure that the host
-				 * field matched.  The only reason why we can't have this as a criteria
-				 * is because we only have the IP address and the host field might be
-				 * set as a name (and the reverse PTR might not match).
-				 */
-				if (var) {
-					for (tmp = var; tmp; tmp = tmp->next) {
-						if (!strcasecmp(var->name, "host")) {
-							struct in_addr sin2 = { 0, };
-							struct ast_dnsmgr_entry *dnsmgr = NULL;
-							if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
-								/* No match */
-								ast_variables_destroy(var);
-								var = NULL;
-							}
-							break;
+		if (!var) {
+			var = ast_load_realtime("sippeers", "name", newpeername, NULL);
+			/*!\note
+			 * If this one loaded something, then we need to ensure that the host
+			 * field matched.  The only reason why we can't have this as a criteria
+			 * is because we only have the IP address and the host field might be
+			 * set as a name (and the reverse PTR might not match).
+			 */
+			if (var) {
+				for (tmp = var; tmp; tmp = tmp->next) {
+					if (!strcasecmp(var->name, "host")) {
+						struct in_addr sin2 = { 0, };
+						struct ast_dnsmgr_entry *dnsmgr = NULL;
+						if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
+							/* No match */
+							ast_variables_destroy(var);
+							var = NULL;
 						}
+						break;
 					}
 				}
 			}
 		}
-	} else if (sin) {	/* Then check on IP address for dynamic peers */
+	}
+
+	if (!var && sin) {	/* Then check on IP address for dynamic peers */
 		ast_copy_string(ipaddr, ast_inet_ntoa(sin->sin_addr), sizeof(ipaddr));
 		portnum = ntohs(sin->sin_port);
 		sprintf(portstring, "%u", portnum);
@@ -3139,7 +3140,7 @@
 				var = ast_load_realtime("sippeers", "name", newpeername, NULL);
 			}
 		}
-		if(!var) { /*We couldn't match on ipaddress and port, so we need to check if port is insecure*/
+		if (!var) { /*We couldn't match on ipaddress and port, so we need to check if port is insecure*/
 			peerlist = ast_load_realtime_multientry("sippeers", "host", ipaddr, NULL);
 			if (peerlist) {
 				var = get_insecure_variable_from_config(peerlist);
@@ -3163,7 +3164,7 @@
 					}
 				}
 			} else {
-				if(realtimeregs) {
+				if (realtimeregs) {
 					peerlist = ast_load_realtime_multientry("sipregs", "ipaddr", ipaddr, NULL);
 					if (peerlist) {
 						varregs = get_insecure_variable_from_config(peerlist);




More information about the asterisk-commits mailing list