]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Updated ARP acl code to C++
authorhno <>
Sun, 9 Feb 2003 00:32:43 +0000 (00:32 +0000)
committerhno <>
Sun, 9 Feb 2003 00:32:43 +0000 (00:32 +0000)
src/acl.cc

index 8a21f2717df862ee578fafd3da8e960bcc5fba97..825a4964f2f8ba5987f12d9cb57e730193c9eff5 100644 (file)
@@ -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];