summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-06-01 22:45:43 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-06-01 22:45:43 +0000
commit4b5af70dd3568a23ee1c638865ffde114e0945f4 (patch)
treeaf39871b9c0f7fbac61b9b3738337f092d8b6f47 /src
parent60ab52741f2196b9d3147ed15b7c8357f3235c6c (diff)
- hostmask.c:mask_addr(): fiex compile warnings
hostmask.c: In function ‘mask_addr’: hostmask.c:332:35: warning: declaration of ‘__v’ shadows a previous local [-Wshadow] hostmask.c:332:35: warning: shadowed declaration is here [-Wshadow] hostmask.c:332:35: warning: declaration of ‘__x’ shadows a previous local [-Wshadow] hostmask.c:332:35: warning: shadowed declaration is here [-Wshadow] git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@3771 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r--src/hostmask.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/hostmask.c b/src/hostmask.c
index 5c34013..c82a88c 100644
--- a/src/hostmask.c
+++ b/src/hostmask.c
@@ -335,15 +335,12 @@ mask_addr(struct irc_ssaddr *ip, int bits)
#ifdef IPV6
else
{
- n = bits / 8;
- m = bits % 8;
- v6_base_ip = (struct sockaddr_in6 *)ip;
-
- mask = ~((1 << (8 - m)) -1 );
- v6_base_ip->sin6_addr.s6_addr[n] = v6_base_ip->sin6_addr.s6_addr[n] & mask;
+ uint32_t tmp = 0;
+ v4_base_ip = (struct sockaddr_in *)ip;
- for (i = n + 1; i < 16; i++)
- v6_base_ip->sin6_addr.s6_addr[i] = 0;
+ mask = ~((1 << (32 - bits)) - 1);
+ tmp = ntohl(v4_base_ip->sin_addr.s_addr);
+ v4_base_ip->sin_addr.s_addr = htonl(tmp & mask);
}
#endif
}