[asterisk-commits] mmichelson: branch mmichelson/acl-v6 r276208 - /team/mmichelson/acl-v6/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 13 16:49:53 CDT 2010


Author: mmichelson
Date: Tue Jul 13 16:49:39 2010
New Revision: 276208

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276208
Log:
Fix chan_iax2 errors.


Modified:
    team/mmichelson/acl-v6/channels/chan_iax2.c

Modified: team/mmichelson/acl-v6/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/acl-v6/channels/chan_iax2.c?view=diff&rev=276208&r1=276207&r2=276208
==============================================================================
--- team/mmichelson/acl-v6/channels/chan_iax2.c (original)
+++ team/mmichelson/acl-v6/channels/chan_iax2.c Tue Jul 13 16:49:39 2010
@@ -2039,15 +2039,17 @@
 static int addr_range_hash_cb(const void *obj, const int flags)
 {
 	const struct addr_range *lim = obj;
-	return abs((int) lim->ha.netaddr.s_addr);
+	struct sockaddr_in sin;
+	ast_sockaddr_to_sin(&lim->ha.addr, &sin);
+	return abs((int) sin.sin_addr.s_addr);
 }
 
 static int addr_range_cmp_cb(void *obj, void *arg, int flags)
 {
 	struct addr_range *lim1 = obj, *lim2 = arg;
-	return ((lim1->ha.netaddr.s_addr == lim2->ha.netaddr.s_addr) &&
-		(lim1->ha.netmask.s_addr == lim2->ha.netmask.s_addr)) ?
-		CMP_MATCH | CMP_STOP : 0;
+	return (!(ast_sockaddr_cmp_addr(&lim1->ha.addr, &lim2->ha.addr)) &&
+			!(ast_sockaddr_cmp_addr(&lim1->ha.netmask, &lim2->ha.netmask))) ?
+			CMP_MATCH | CMP_STOP : 0;
 }
 
 static int peercnt_hash_cb(const void *obj, const int flags)
@@ -2066,8 +2068,13 @@
 {
 	struct addr_range *addr_range = obj;
 	struct sockaddr_in *sin = arg;
-
-	if ((sin->sin_addr.s_addr & addr_range->ha.netmask.s_addr) == addr_range->ha.netaddr.s_addr) {
+	struct sockaddr_in ha_netmask_sin;
+	struct sockaddr_in ha_addr_sin;
+
+	ast_sockaddr_to_sin(&addr_range->ha.netmask, &ha_netmask_sin);
+	ast_sockaddr_to_sin(&addr_range->ha.addr, &ha_addr_sin);
+
+	if ((sin->sin_addr.s_addr & ha_netmask_sin.sin_addr.s_addr) == ha_addr_sin.sin_addr.s_addr) {
 		return CMP_MATCH | CMP_STOP;
 	}
 	return 0;
@@ -7833,7 +7840,7 @@
 	}
 
 	ast_sockaddr_from_sin(&addr, sin);
-	if (!ast_apply_ha(p->ha, addr)) {
+	if (!ast_apply_ha(p->ha, &addr)) {
 		if (authdebug)
 			ast_log(LOG_NOTICE, "Host %s denied access to register peer '%s'\n", ast_inet_ntoa(sin->sin_addr), p->name);
 		goto return_unref;




More information about the asterisk-commits mailing list