From: serassio <> Date: Sat, 29 Jul 2006 22:17:29 +0000 (+0000) Subject: ARP acl support for OpenBSD, code common with the FreeBSD implementation. X-Git-Tag: SQUID_3_0_PRE5~207 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f71a524f646a4815e99181088adab4a2f9934620;p=thirdparty%2Fsquid.git ARP acl support for OpenBSD, code common with the FreeBSD implementation. --- diff --git a/configure b/configure index 975c81e433..ec3bbb97b3 100755 --- a/configure +++ b/configure @@ -20815,6 +20815,8 @@ if test "${enable_arp_acl+set}" = set; then ;; *-freebsd*) ;; + *-openbsd*) + ;; *-cygwin*) LIBS="$LIBS -liphlpapi" ;; diff --git a/configure.in b/configure.in index ef30180f8b..947b3ac233 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.426 2006/07/02 19:27:17 serassio Exp $ +dnl $Id: configure.in,v 1.427 2006/07/29 16:17:29 serassio Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AC_CONFIG_SRCDIR([src/main.cc]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_REVISION($Revision: 1.426 $)dnl +AC_REVISION($Revision: 1.427 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -863,6 +863,8 @@ AC_ARG_ENABLE(arp-acl, ;; *-freebsd*) ;; + *-openbsd*) + ;; *-cygwin*) LIBS="$LIBS -liphlpapi" ;; diff --git a/src/ACLARP.cc b/src/ACLARP.cc index 937776f75f..fbcf6b2ac4 100644 --- a/src/ACLARP.cc +++ b/src/ACLARP.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLARP.cc,v 1.21 2006/07/21 15:24:58 serassio Exp $ + * $Id: ACLARP.cc,v 1.22 2006/07/29 16:17:29 serassio Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -67,7 +67,7 @@ struct arpreq #endif #include #include -#ifdef _SQUID_FREEBSD_ +#if defined(_SQUID_FREEBSD_) || defined(_SQUID_OPENBSD_) #include #endif #if HAVE_NETINET_IF_ETHER_H @@ -437,7 +437,7 @@ aclMatchArp(SplayNode **dataptr, struct IN_ADDR c) return (0 == splayLastResult); } -#elif defined(_SQUID_FREEBSD_) +#elif defined(_SQUID_FREEBSD_) || defined(_SQUID_OPENBSD_) struct arpreq arpReq; @@ -625,55 +625,6 @@ aclArpCompare(acl_arp_data * const &a, acl_arp_data * const &b) return memcmp(a->eth, b->eth, 6); } -#if UNUSED_CODE -/********************************************************************** -* This is from the pre-splay-tree code for BSD -* I suspect the Linux approach will work on most O/S and be much -* better - -*********************************************************************** -static int -checkARP(u_long ip, char *eth) -{ - int mib[6] = - {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; - size_t needed; - char *buf, *next, *lim; - struct rt_msghdr *rtm; - struct sockaddr_inarp *sin; - struct sockaddr_dl *sdl; - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) { - debug(28, 0) ("Can't estimate ARP table size!\n"); - return 0; - } - if ((buf = xmalloc(needed)) == NULL) { - debug(28, 0) ("Can't allocate temporary ARP table!\n"); - return 0; - } - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { - debug(28, 0) ("Can't retrieve ARP table!\n"); - xfree(buf); - return 0; - } - lim = buf + needed; - for (next = buf; next < lim; next += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *) next; - sin = (struct sockaddr_inarp *) (rtm + 1); - sdl = (struct sockaddr_dl *) (sin + 1); - if (sin->sin_addr.s_addr == ip) { - if (sdl->sdl_alen) - if (!memcmp(LLADDR(sdl), eth, 6)) { - xfree(buf); - return 1; - } - break; - } - } - xfree(buf); - return 0; -} -**********************************************************************/ -#endif - static void aclDumpArpListWalkee(acl_arp_data * const &node, void *state) {