[svn-commits] mnicholson: branch 10 r344334 - in /branches/10: ./ res/res_rtp_asterisk.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 10 10:25:09 CST 2011


Author: mnicholson
Date: Thu Nov 10 10:25:05 2011
New Revision: 344334

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=344334
Log:
only attempt to do stun handling on ipv4 or ipv4 mapped to ipv6 addresses

Patch by: jkonieczny (modified)
ASTERISK-18490
........

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

Modified:
    branches/10/   (props changed)
    branches/10/res/res_rtp_asterisk.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_rtp_asterisk.c?view=diff&rev=344334&r1=344333&r2=344334
==============================================================================
--- branches/10/res/res_rtp_asterisk.c (original)
+++ branches/10/res/res_rtp_asterisk.c Thu Nov 10 10:25:05 2011
@@ -2094,7 +2094,18 @@
 
 	if (!(version = (seqno & 0xC0000000) >> 30)) {
 		struct sockaddr_in addr_tmp;
-		ast_sockaddr_to_sin(&addr, &addr_tmp);
+		struct ast_sockaddr addr_v4;
+		if (ast_sockaddr_is_ipv4(&addr)) {
+			ast_sockaddr_to_sin(&addr, &addr_tmp);
+		} else if (ast_sockaddr_ipv4_mapped(&addr, &addr_v4)) {
+			ast_debug(1, "Using IPv6 mapped address %s for STUN\n",
+				  ast_sockaddr_stringify(&addr));
+			ast_sockaddr_to_sin(&addr_v4, &addr_tmp);
+		} else {
+			ast_debug(1, "Cannot do STUN for non IPv4 address %s\n",
+				  ast_sockaddr_stringify(&addr));
+			return &ast_null_frame;
+		}
 		if ((ast_stun_handle_packet(rtp->s, &addr_tmp, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == AST_STUN_ACCEPT) &&
 		    ast_sockaddr_isnull(&remote_address)) {
 			ast_sockaddr_from_sin(&addr, &addr_tmp);




More information about the svn-commits mailing list