From: hno <> Date: Sun, 9 Feb 2003 00:32:43 +0000 (+0000) Subject: Updated ARP acl code to C++ X-Git-Tag: SQUID_3_0_PRE1~371 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59cf1ca3c3027f9efe80af501e7a8c81213ba6f1;p=thirdparty%2Fsquid.git Updated ARP acl code to C++ --- diff --git a/src/acl.cc b/src/acl.cc index 8a21f2717d..825a4964f2 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $Id: acl.cc,v 1.299 2003/02/08 15:54:36 hno Exp $ + * $Id: acl.cc,v 1.300 2003/02/08 17:32:43 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -2924,7 +2924,8 @@ aclMatchArp(void *dataptr, struct in_addr c) arpReq.arp_ha.sa_data[2] & 0xff, arpReq.arp_ha.sa_data[3] & 0xff, arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff); /* Do lookup */ - *Top = splay_splay(&arpReq.arp_ha.sa_data, *Top, aclArpCompare); + const void *X = arpReq.arp_ha.sa_data; + *Top = splay_splay(&X, *Top, aclArpCompare); debug(28, 3) ("aclMatchArp: '%s' %s\n", inet_ntoa(c), splayLastResult ? "NOT found" : "found"); return (0 == splayLastResult); @@ -2987,7 +2988,8 @@ aclMatchArp(void *dataptr, struct in_addr c) arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff, ifr->ifr_name); /* Do lookup */ - *Top = splay_splay(&arpReq.arp_ha.sa_data, *Top, aclArpCompare); + const void *X = arpReq.arp_ha.sa_data; + *Top = splay_splay(&X, *Top, aclArpCompare); /* Return if match, otherwise continue to other interfaces */ if (0 == splayLastResult) { debug(28, 3) ("aclMatchArp: %s found on %s\n", @@ -3050,34 +3052,7 @@ aclMatchArp(void *dataptr, struct in_addr c) static int aclArpCompare(void * const &a, void * const &b) { -#if defined(_SQUID_LINUX_) - const unsigned short *d1 = (const unsigned short *)a; - const unsigned short *d2 = (const unsigned short *)b; - if (d1[0] != d2[0]) - return (d1[0] > d2[0]) ? 1 : -1; - if (d1[1] != d2[1]) - return (d1[1] > d2[1]) ? 1 : -1; - if (d1[2] != d2[2]) - return (d1[2] > d2[2]) ? 1 : -1; -#elif defined(_SQUID_SOLARIS_) - const unsigned char *d1 = (const unsigned char *)a; - const unsigned char *d2 = (const unsigned char *)b; - if (d1[0] != d2[0]) - return (d1[0] > d2[0]) ? 1 : -1; - if (d1[1] != d2[1]) - return (d1[1] > d2[1]) ? 1 : -1; - if (d1[2] != d2[2]) - return (d1[2] > d2[2]) ? 1 : -1; - if (d1[3] != d2[3]) - return (d1[3] > d2[3]) ? 1 : -1; - if (d1[4] != d2[4]) - return (d1[4] > d2[4]) ? 1 : -1; - if (d1[5] != d2[5]) - return (d1[5] > d2[5]) ? 1 : -1; -#else - WRITE ME; -#endif - return 0; + return memcmp(a, b, 6); } #if UNUSED_CODE @@ -3130,7 +3105,7 @@ checkARP(u_long ip, char *eth) #endif static void -aclDumpArpListWalkee(void * &node, void *state) +aclDumpArpListWalkee(void * const &node, void *state) { acl_arp_data *arp = (acl_arp_data *)node; static char buf[24];