From 145862efc772da990aa2c7fbd5000a81e8476b8b Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 1 Aug 2006 19:15:27 +0000 Subject: Add support for comparing ipv6 for clone counting git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4620 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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::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 -- cgit v1.2.3