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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 27 15:55:06 CST 2012


Author: seanbright
Date: Mon Feb 27 15:55:02 2012
New Revision: 357088

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357088
Log:
Temporarily copy our sin to an ast_sockaddr in socket_process so we can start
pulling changes into helper functions.

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=357088&r1=357087&r2=357088
==============================================================================
--- 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 Mon Feb 27 15:55:02 2012
@@ -8442,7 +8442,7 @@
 }
 
 /*! \brief Acknowledgment received for OUR registration */
-static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int callno)
+static int iax2_ack_registry(struct iax_ies *ies, struct ast_sockaddr *addr, int callno)
 {
 	struct iax2_registry *reg;
 	/* Start pessimistic */
@@ -8453,7 +8453,6 @@
 	struct ast_sockaddr	oldus = AST_SOCKADDR_INIT_VALUE;
 	struct ast_sockaddr us = AST_SOCKADDR_INIT_VALUE;
 	int oldmsgs;
-	struct sockaddr_in reg_addr;
 
 	if (ies->apparent_addr) {
 		ast_sockaddr_from_sin(&us, ies->apparent_addr);
@@ -8474,9 +8473,8 @@
 	}
 	ast_sockaddr_copy(&oldus, &us);
 	oldmsgs = reg->messages;
-	ast_sockaddr_to_sin(&reg->addr, &reg_addr);
-	if (inaddrcmp(&reg_addr, sin)) {
-		ast_log(LOG_WARNING, "Received unsolicited registry ack from '%s'\n", ast_inet_ntoa(sin->sin_addr));
+	if (ast_sockaddr_cmp(&reg->addr, addr)) {
+		ast_log(LOG_WARNING, "Received unsolicited registry ack from '%s'\n", ast_sockaddr_stringify_addr(addr));
 		return -1;
 	}
 	ast_sockaddr_copy(&reg->us, &us);
@@ -8500,8 +8498,12 @@
 			ast_copy_string(msgstatus, " with no messages waiting", sizeof(msgstatus));
 		}
 		snprintf(ourip, sizeof(ourip), "%s", ast_sockaddr_stringify(&reg->us));
-		ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus);
-		manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(sin->sin_addr));
+		ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_sockaddr_stringify_addr(addr), ourip, msgstatus);
+		manager_event(EVENT_FLAG_SYSTEM, "Registry",
+			"ChannelType: IAX2\r\n"
+			"Domain: %s\r\n"
+			"Status: Registered\r\n",
+			ast_sockaddr_stringify_addr(addr));
 	}
 	reg->regstate = REG_STATE_REGISTERED;
 	return 0;
@@ -9929,6 +9931,9 @@
 	struct ast_codec_pref pref;
 	char *using_prefs = "mine";
 
+	/* SRB: Remove me at some point */
+	struct ast_sockaddr addr = AST_SOCKADDR_INIT_VALUE;
+
 	/* allocate an iax_frame with 4096 bytes of data buffer */
 	fr = alloca(sizeof(*fr) + 4096);
 	memset(fr, 0, sizeof(*fr));
@@ -9938,6 +9943,8 @@
 	res = thread->buf_len;
 	fd = thread->iofd;
 	memcpy(&sin, &thread->iosin, sizeof(sin));
+
+	ast_sockaddr_from_sin(&addr, &sin);
 
 	if (res < sizeof(*mh)) {
 		ast_log(LOG_WARNING, "midget packet received (%d of %d min)\n", res, (int) sizeof(*mh));
@@ -11335,7 +11342,7 @@
 				registry_authrequest(fr->callno);
 				break;
 			case IAX_COMMAND_REGACK:
-				if (iax2_ack_registry(&ies, &sin, fr->callno)) 
+				if (iax2_ack_registry(&ies, &addr, fr->callno)) 
 					ast_log(LOG_WARNING, "Registration failure\n");
 				/* Send ack immediately, before we destroy */
 				send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);




More information about the svn-commits mailing list