Ordering IP addresses [Non trivial]

2005-05-25 Thread Rafael Martinez Torres
Your atention, please... At ACLIP.cc there is a function setting up a order relationship given two IP addresses/networks... aclIPaddrNetworkCompare() struct IN_ADDR A = p-addr1; const struct IN_ADDR B = q-addr1; const struct IN_ADDR C = q-addr2; A.s_addr = q-mask.s_addr;

Re: Ordering IP addresses [Non trivial]

2005-05-25 Thread Rafael Martinez Torres
- I can redefine the address ordering to byte-to-byte comparing (memcmp) on the two memory areas A B , but on IPv4 and i386 boxes§ they would invert the actual order, since network order inverts the bytes on host order (ntohl) , so... OK. As I see, the only purpose of previous function

Re: [Squid-cvs] squid3-ipv6 squid3/src ACLIP.cc,1.8.2.4,1.8.2.5

2005-05-25 Thread Henrik Nordstrom
On Wed, 25 May 2005, Rafael Martinez Torres wrote: Index: ACLIP.cc -if (ntohl(A.s_addr) ntohl(C.s_addr)) +if (memcmp(A, C, sizeof(struct IN_ADDR)) 0) Hmm.. this has quite different semantics. The original looks at the addresses in host byte order, while the memcmp looks at

Re: Ordering IP addresses [Non trivial]

2005-05-25 Thread Henrik Nordstrom
On Wed, 25 May 2005, Rafael Martinez Torres wrote: NOTES: -- - Solved the masking on IPv6, I cannot compare 128 bits integers, unless I define it. (squid128_int_t) - I can redefine the address ordering to byte-to-byte comparing (memcmp) on the two memory areas A B , but on IPv4 and i386

Re: [Squid-cvs] squid3-ipv6 squid3/src ACLIP.cc,1.8.2.4,1.8.2.5

2005-05-25 Thread Henrik Nordstrom
On Thu, 26 May 2005, Henrik Nordstrom wrote: On Wed, 25 May 2005, Rafael Martinez Torres wrote: Index: ACLIP.cc -if (ntohl(A.s_addr) ntohl(C.s_addr)) +if (memcmp(A, C, sizeof(struct IN_ADDR)) 0) Hmm.. this has quite different semantics. The original looks at the