summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-01 19:15:27 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-01 19:15:27 +0000
commit145862efc772da990aa2c7fbd5000a81e8476b8b (patch)
treebaa5450dc97f8509428f572112e04d2536f7befe /src/users.cpp
parent424463bf9dc486fa7cee883f889f190540250d47 (diff)
Add support for comparing ipv6 for clone counting
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4620 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 93ffadb83..83d62ecf7 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -833,7 +833,11 @@ long FindMatchingGlobal(userrec* user)
for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
{
#ifdef IPV6
- /* TODO: clone matching for ipv6 */
+ /* I dont think theres any faster way of matching two ipv6 addresses than memcmp
+ * Let me know if you think of one.
+ */
+ if (!memcmp(a->second->ip4.s6_addr, user->ip4.s6_addr, sizeof(in6_addr)))
+ x++;
#else
if (a->second->ip4.s_addr == user->ip4.s_addr)
x++;
@@ -847,10 +851,12 @@ long FindMatchingLocal(userrec* user)
long x = 0;
for (std::vector<userrec*>::const_iterator a = local_users.begin(); a != local_users.end(); a++)
{
+ userrec* comp = *a;
#ifdef IPV6
- /* TODO clone matching for ipv6 */
+ /* I dont think theres any faster way of matching two ipv6 addresses than memcmp */
+ if (!memcmp(comp->ip4.s6_addr, user->ip4.s6_addr, sizeof(in6_addr)))
+ x++;
#else
- userrec* comp = *a;
if (comp->ip4.s_addr == user->ip4.s_addr)
x++;
#endif