[svn-commits] seanbright: trunk r357014 - in /trunk: channels/chan_iax2.c main/netsock.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 27 11:03:50 CST 2012


Author: seanbright
Date: Mon Feb 27 11:03:46 2012
New Revision: 357014

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357014
Log:
Address comments from Mark Michelson

Modified:
    trunk/channels/chan_iax2.c
    trunk/main/netsock.c

Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=357014&r1=357013&r2=357014
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Feb 27 11:03:46 2012
@@ -12270,7 +12270,7 @@
 {
 	int sd;
 
-	sd = socket(ast_sockaddr_is_ipv4(addr) ? AF_INET : AF_INET6, SOCK_DGRAM, 0);
+	sd = socket(addr->ss.ss_family, SOCK_DGRAM, 0);
 	if (sd < 0) {
 		ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno));
 		return -1;
@@ -12302,8 +12302,7 @@
 	if (!(tmp = ast_strdupa(srcaddr)))
 		return -1;
 
-	host = strsep(&tmp, ":");
-	portstr = tmp;
+	ast_sockaddr_split_hostport(tmp, &host, &portstr, 0);
 
 	if (portstr) {
 		port = atoi(portstr);

Modified: trunk/main/netsock.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/netsock.c?view=diff&rev=357014&r1=357013&r2=357014
==============================================================================
--- trunk/main/netsock.c (original)
+++ trunk/main/netsock.c Mon Feb 27 11:03:46 2012
@@ -167,6 +167,11 @@
 	struct ast_sockaddr addr;
 
 	if (ast_sockaddr_parse(&addr, bindinfo, 0)) {
+		if (!ast_sockaddr_is_ipv4(&addr)) {
+			ast_log(LOG_WARNING, "Only IPv4 addresses are supported at this time.\n");
+			return NULL;
+		}
+
 		if (!ast_sockaddr_port(&addr)) {
 			ast_sockaddr_set_port(&addr, defaultport);
 		}




More information about the svn-commits mailing list