[asterisk-commits] qwell: branch 1.8-digiumphones r358692 - in /branches/1.8-digiumphones: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 8 12:03:01 CST 2012


Author: qwell
Date: Thu Mar  8 12:02:58 2012
New Revision: 358692

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=358692
Log:
Prevent outbound SIP NOTIFY packets from displaying a port of 0

In the change from 1.6.2 to 1.8, ast_sockaddr was introduced which changed the
behavior of ast_find_ourip such that port number was wiped out.  This caused
the port in internip (which is used for Contact and Call-ID on NOTIFYs) to be
0.  This change causes ast_find_ourip to be port-preserving again.

(closes issue ASTERISK-19430)
........

Merged revisions 357665 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/1.8-digiumphones/   (props changed)
    branches/1.8-digiumphones/main/acl.c

Propchange: branches/1.8-digiumphones/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar  8 12:02:58 2012
@@ -1,1 +1,1 @@
-/branches/1.8:1-357100
+/branches/1.8:1-357100,357665

Modified: branches/1.8-digiumphones/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8-digiumphones/main/acl.c?view=diff&rev=358692&r1=358691&r2=358692
==============================================================================
--- branches/1.8-digiumphones/main/acl.c (original)
+++ branches/1.8-digiumphones/main/acl.c Thu Mar  8 12:02:58 2012
@@ -737,6 +737,7 @@
 {
 	char ourhost[MAXHOSTNAMELEN] = "";
 	struct ast_sockaddr root;
+	int res, port = ast_sockaddr_port(ourip);
 
 	/* just use the bind address if it is nonzero */
 	if (!ast_sockaddr_is_any(bindaddr)) {
@@ -749,6 +750,8 @@
 		ast_log(LOG_WARNING, "Unable to get hostname\n");
 	} else {
 		if (resolve_first(ourip, ourhost, PARSE_PORT_FORBID, family) == 0) {
+			/* reset port since resolve_first wipes this out */
+			ast_sockaddr_set_port(ourip, port);
 			return 0;
 		}
 	}
@@ -756,8 +759,12 @@
 	/* A.ROOT-SERVERS.NET. */
 	if (!resolve_first(&root, "A.ROOT-SERVERS.NET", PARSE_PORT_FORBID, 0) &&
 	    !ast_ouraddrfor(&root, ourip)) {
+		/* reset port since resolve_first wipes this out */
+		ast_sockaddr_set_port(ourip, port);
 		return 0;
 	}
-	return get_local_address(ourip);
-}
-
+	res = get_local_address(ourip);
+	ast_sockaddr_set_port(ourip, port);
+	return res;
+}
+




More information about the asterisk-commits mailing list