[asterisk-commits] seanbright: branch seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_se...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 1 16:08:59 CST 2012


Author: seanbright
Date: Thu Mar  1 16:08:54 2012
New Revision: 357720

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357720
Log:
Pass in port # to getaddrinfo()... it doesn't like us otherwise.

Modified:
    team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.c
    team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/include/asterisk/netsock2.h
    team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/main/netsock2.c

Modified: team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.c?view=diff&rev=357720&r1=357719&r2=357720
==============================================================================
--- team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.c (original)
+++ team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.c Thu Mar  1 16:08:54 2012
@@ -13419,10 +13419,9 @@
 		struct ast_sockaddr *addrs;
 		int num_addrs;
 
-		if ((num_addrs = ast_sockaddr_get_wildcard_addrs(&addrs, AST_AF_UNSPEC))) {
+		if ((num_addrs = ast_sockaddr_get_wildcard_addrs(&addrs, portno, AST_AF_UNSPEC))) {
 			int i;
 			for (i = 0; i < num_addrs; i++) {
-				ast_sockaddr_set_port(&addrs[i], portno);
 				if ((ns = ast_netsock_bindaddr(netsock, io, &addrs[i], qos.tos, qos.cos, socket_read, NULL))) {
 					ast_verb(2, "Binding IAX2 to default address %s\n", ast_sockaddr_stringify(&addrs[i]));
 					if (defaultsockfd < 0) {

Modified: team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/include/asterisk/netsock2.h
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/include/asterisk/netsock2.h?view=diff&rev=357720&r1=357719&r2=357720
==============================================================================
--- team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/include/asterisk/netsock2.h (original)
+++ team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/include/asterisk/netsock2.h Thu Mar  1 16:08:54 2012
@@ -371,13 +371,14 @@
  *
  * \details
  * \param[out] addrs The resulting array of ast_sockaddrs
+ * \param port The port number of the returned ast_sockaddrs
  * \param family Only addresses of the given family will be returned. Use 0 or
  * AST_AF_UNSPEC to get addresses of all families.
  *
  * \retval 0 Failure
  * \retval non-zero The number of elements in the addrs array
  */
-int ast_sockaddr_get_wildcard_addrs(struct ast_sockaddr **addrs, int family);
+int ast_sockaddr_get_wildcard_addrs(struct ast_sockaddr **addrs, int port, int family);
 
 /*!
  * \since 1.8

Modified: team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/main/netsock2.c
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/main/netsock2.c?view=diff&rev=357720&r1=357719&r2=357720
==============================================================================
--- team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/main/netsock2.c (original)
+++ team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/main/netsock2.c Thu Mar  1 16:08:54 2012
@@ -239,17 +239,20 @@
 	return 1;
 }
 
-int ast_sockaddr_get_wildcard_addrs(struct ast_sockaddr **addrs, int family)
+int ast_sockaddr_get_wildcard_addrs(struct ast_sockaddr **addrs, int port, int family)
 {
 	struct addrinfo hints, *res, *ai;
 	int e, i, res_cnt;
+	char portstr[6];
 
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
 	hints.ai_family = family;
 	hints.ai_socktype = SOCK_DGRAM;
 
-	if ((e = getaddrinfo(NULL, NULL, &hints, &res))) {
+	snprintf(portstr, sizeof(portstr), "%d", port);
+
+	if ((e = getaddrinfo(NULL, portstr, &hints, &res))) {
 		ast_log(LOG_ERROR, "getaddrinfo(NULL, NULL, ...): %s\n",
 			gai_strerror(e));
 		return 0;




More information about the asterisk-commits mailing list