[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
Wed Feb 29 16:51:07 CST 2012


Author: seanbright
Date: Wed Feb 29 16:51:02 2012
New Revision: 357656

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357656
Log:
In the absence of a specific bindaddr, bind to both the IPv4 and IPv6 wildcard
addresses.

Modified:
    team/seanbright/the_ipv6ification_of_chan_iax2_by_the_coward_sean_bright/channels/chan_iax2.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=357656&r1=357655&r2=357656
==============================================================================
--- 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 Wed Feb 29 16:51:02 2012
@@ -13407,12 +13407,18 @@
 	}
 
 	if (defaultsockfd < 0) {
-		if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, qos.tos, qos.cos, socket_read, NULL))) {
-			ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno));
-		} else {
-			ast_verb(2, "Binding IAX2 to default address 0.0.0.0:%d\n", portno);
-			defaultsockfd = ast_netsock_sockfd(ns);
-			ast_netsock_unref(ns);
+		struct ast_sockaddr *addrs;
+		int num_addrs;
+
+		if ((num_addrs = ast_sockaddr_get_wildcard_addrs(&addrs, AST_AF_UNSPEC))) {
+			int i;
+			for (i = 0; i < num_addrs; i++) {
+				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]));
+					defaultsockfd = ast_netsock_sockfd(ns);
+					ast_netsock_unref(ns);
+				}
+			}
 		}
 	}
 	if (reload) {




More information about the asterisk-commits mailing list