--------------------- PatchSet 4106 Date: 2007/03/19 13:26:13 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: *** empty log message *** Members: include/IPAddress.h:1.1.2.1->1.1.2.2 lib/IPAddress.cc:1.1.2.2->1.1.2.3 Index: squid3/include/IPAddress.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid3/include/IPAddress.h 18 Mar 2007 09:07:00 -0000 1.1.2.1 +++ squid3/include/IPAddress.h 19 Mar 2007 13:27:47 -0000 1.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.h,v 1.1.2.1 2007/03/18 09:07:00 amosjeffries Exp $ + * $Id: IPAddress.h,v 1.1.2.2 2007/03/19 13:27:47 amosjeffries Exp $ */ #ifndef _INC_IPADDRESS_H #define _INC_IPADDRESS_H @@ -77,7 +77,7 @@ std::ostream& operator<<(std::ostream& os) const; char* NtoA(char *buf, unsigned int len) const; - bool ApplyMask(const IPAddress &); + const int ApplyMask(const IPAddress &); bool ApplyMask(const unsigned int cidr, IPAddressType mtype = None); /* variables */ Index: squid3/lib/IPAddress.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/IPAddress.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid3/lib/IPAddress.cc 18 Mar 2007 13:54:08 -0000 1.1.2.2 +++ squid3/lib/IPAddress.cc 19 Mar 2007 13:26:13 -0000 1.1.2.3 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.cc,v 1.1.2.2 2007/03/18 13:54:08 amosjeffries Exp $ + * $Id: IPAddress.cc,v 1.1.2.3 2007/03/19 13:26:13 amosjeffries Exp $ */ #include "IPAddress.h" @@ -59,16 +59,18 @@ memset(this,0,sizeof(IPAddress)); } -bool IPAddress::ApplyMask(IPAddress const &mask_addr) +const int IPAddress::ApplyMask(IPAddress const &mask_addr) { uint32_t *p1 = (uint32_t*)(&m_SocketAddr.sin6_addr); uint32_t const *p2 = (uint32_t const *)(&mask_addr.m_SocketAddr.sin6_addr); unsigned int blen = sizeof(m_SocketAddr.sin6_addr)/sizeof(uint32_t); + unsigned int changes = 0; for (unsigned int i = 0; i < blen; i++) { + if((p1[i] & p2[i]) != p1[i]) changes++; p1[i] &= p2[i]; } - return true; + return changes; } bool IPAddress::ApplyMask(const unsigned int icidr, IPAddressType mtype) {