[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
Tue Feb 28 08:47:30 CST 2012


Author: seanbright
Date: Tue Feb 28 08:47:23 2012
New Revision: 357215

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357215
Log:
Convert debugaddr over.

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=357215&r1=357214&r2=357215
==============================================================================
--- 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 Tue Feb 28 08:47:23 2012
@@ -1099,18 +1099,18 @@
 #define TRUNK_CALL_START	IAX_MAX_CALLS / 2
 
 /* Debug routines... */
-static struct sockaddr_in debugaddr;
+static struct ast_sockaddr debugaddr;
 
 static void iax_outputframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen)
 {
-	if (iaxdebug ||
-	    (sin && debugaddr.sin_addr.s_addr && 
-	     (!ntohs(debugaddr.sin_port) ||
-	      debugaddr.sin_port == sin->sin_port) &&
-	     debugaddr.sin_addr.s_addr == sin->sin_addr.s_addr)) {
-		if (iaxdebug) {
-			iax_showframe(f, fhi, rx, sin, datalen);
-		} else {
+	if (iaxdebug) {
+		iax_showframe(f, fhi, rx, sin, datalen);
+	} else {
+		struct ast_sockaddr addr = AST_SOCKADDR_INIT_VALUE;
+
+		ast_sockaddr_from_sin(&addr, sin);
+
+		if (!ast_sockaddr_cmp(&debugaddr, &addr)) {
 			iaxdebug = 1;
 			iax_showframe(f, fhi, rx, sin, datalen);
 			iaxdebug = 0;
@@ -7367,8 +7367,6 @@
 
 	if (!strcasecmp(a->argv[3], "peer")) {
 		struct iax2_peer *peer;
-		struct sockaddr_in peer_addr;
-
 
 		if (a->argc != e->args + 1)
 			return CLI_SHOWUSAGE;
@@ -7380,13 +7378,9 @@
 			return CLI_FAILURE;
 		}
 
-		ast_sockaddr_to_sin(&peer->addr, &peer_addr);
-
-		debugaddr.sin_addr = peer_addr.sin_addr;
-		debugaddr.sin_port = peer_addr.sin_port;
-
-		ast_cli(a->fd, "IAX2 Debugging Enabled for IP: %s:%d\n",
-			ast_inet_ntoa(debugaddr.sin_addr), ntohs(debugaddr.sin_port));
+		ast_sockaddr_copy(&debugaddr, &peer->addr);
+
+		ast_cli(a->fd, "IAX2 Debugging Enabled for IP: %s\n", ast_sockaddr_stringify(&debugaddr));
 
 		ao2_ref(peer, -1);
 	} else if (!strncasecmp(a->argv[3], "on", 2)) {
@@ -7394,7 +7388,7 @@
 		ast_cli(a->fd, "IAX2 Debugging Enabled\n");
 	} else {
 		iaxdebug = 0;
-		memset(&debugaddr, 0, sizeof(debugaddr));
+		ast_sockaddr_setnull(&debugaddr);
 		ast_cli(a->fd, "IAX2 Debugging Disabled\n");
 	}
 	return CLI_SUCCESS;
@@ -13539,7 +13533,7 @@
 		ao2_callback(peercnts, OBJ_NODATA, set_peercnt_limit_all_cb, NULL);
 		trunk_timed = trunk_untimed = 0; 
 		trunk_nmaxmtu = trunk_maxmtu = 0;
-		memset(&debugaddr, '\0', sizeof(debugaddr));
+		ast_sockaddr_setnull(&debugaddr);
 
 		AST_LIST_LOCK(&registrations);
 		AST_LIST_TRAVERSE(&registrations, reg, entry)




More information about the svn-commits mailing list