[svn-commits] pabelanger: branch 1.8 r293496 - /branches/1.8/channels/chan_iax2.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 1 11:09:10 CDT 2010


Author: pabelanger
Date: Mon Nov  1 11:09:05 2010
New Revision: 293496

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=293496
Log:
Use ast_sockaddr_from_sin function not memcpy

This resolves some IAX2 registration issue report on the 
asterisk-users mailing list. 

(closes issue #18202)
Reported by: pabelanger
Patches: 
      update_registry.patch.v2 uploaded by pabelanger (license 224)
Tested by: pabelanger, Nic Colledge (mailing list)

Review: https://reviewboard.asterisk.org/r/993

Modified:
    branches/1.8/channels/chan_iax2.c

Modified: branches/1.8/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_iax2.c?view=diff&rev=293496&r1=293495&r2=293496
==============================================================================
--- branches/1.8/channels/chan_iax2.c (original)
+++ branches/1.8/channels/chan_iax2.c Mon Nov  1 11:09:05 2010
@@ -8700,7 +8700,7 @@
 		peercnt_modify(0, 0, &p->addr);
 
 		/* Stash the IP address from which they registered */
-		memcpy(&p->addr, sin, sizeof(p->addr));
+		ast_sockaddr_from_sin(&p->addr, sin);
 
 		snprintf(data, sizeof(data), "%s:%d:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), p->expiry);
 		if (!ast_test_flag64(p, IAX_TEMPONLY) && sin->sin_addr.s_addr) {
@@ -11190,10 +11190,13 @@
 				if ((ast_strlen_zero(iaxs[fr->callno]->secret) && ast_strlen_zero(iaxs[fr->callno]->inkeys)) ||
 						ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED)) {
 
-					if (f.subclass.integer == IAX_COMMAND_REGREL)
+					if (f.subclass.integer == IAX_COMMAND_REGREL) {
 						memset(&sin, 0, sizeof(sin));
-					if (update_registry(&sin, fr->callno, ies.devicetype, fd, ies.refresh))
+						sin.sin_family = AF_INET;
+					}
+					if (update_registry(&sin, fr->callno, ies.devicetype, fd, ies.refresh)) {
 						ast_log(LOG_WARNING, "Registry error\n");
+					}
 					if (!iaxs[fr->callno]) {
 						break;
 					}




More information about the svn-commits mailing list