dnl
dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
dnl
-dnl $Id: configure.in,v 1.367 2004/12/26 11:23:15 serassio Exp $
+dnl $Id: configure.in,v 1.368 2005/01/06 10:44:39 serassio Exp $
dnl
dnl
dnl
AC_CONFIG_AUX_DIR(cfgaux)
AM_INIT_AUTOMAKE(squid, 3.0-PRE3-CVS)
AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.367 $)dnl
+AC_REVISION($Revision: 1.368 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AM_MAINTAINER_MODE
;;
*-freebsd*)
;;
+ *-cygwin*)
+ LIBS="$LIBS -liphlpapi"
+ ;;
+ *-mingw*)
+ LIBS="$LIBS -liphlpapi"
+ ;;
*)
echo "WARNING: ARP ACL support probably won't work on $host."
sleep 10
/*
- * $Id: ACLARP.cc,v 1.10 2004/12/21 19:40:16 serassio Exp $
+ * $Id: ACLARP.cc,v 1.11 2005/01/06 10:44:39 serassio Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
*/
#include "config.h"
+#ifdef _SQUID_CYGWIN_
+#include <squid_windows.h>
+#endif
#include "squid.h"
+#ifdef _SQUID_WIN32_
+
+struct arpreq
+{
+
+ struct sockaddr arp_pa; /* protocol address */
+
+ struct sockaddr arp_ha; /* hardware address */
+ int arp_flags; /* flags */
+};
+
+#include <Iphlpapi.h>
+#else
+
#ifdef _SQUID_SOLARIS_
#include <sys/sockio.h>
#else
#if HAVE_NETINET_IF_ETHER_H
#include <netinet/if_ether.h>
#endif
+#endif
#include "ACLARP.h"
return (0 == splayLastResult);
+#elif defined(_SQUID_WIN32_)
+
+ DWORD dwNetTable = 0;
+
+ DWORD ipNetTableLen = 0;
+
+ PMIB_IPNETTABLE NetTable = NULL;
+
+ DWORD i;
+
+ SplayNode<acl_arp_data *> **Top = dataptr;
+
+ struct arpreq arpReq;
+
+ /* Get size of Windows ARP table */
+ if (GetIpNetTable(NetTable, &ipNetTableLen, FALSE) != ERROR_INSUFFICIENT_BUFFER) {
+ debug(28, 0) ("Can't estimate ARP table size!\n");
+ return 0;
+ }
+
+ /* Allocate space for ARP table and assign pointers */
+ if ((NetTable = (PMIB_IPNETTABLE)xmalloc(ipNetTableLen)) == NULL) {
+ debug(28, 0) ("Can't allocate temporary ARP table!\n");
+ return 0;
+ }
+
+ /* Get actual ARP table */
+ if ((dwNetTable = GetIpNetTable(NetTable, &ipNetTableLen, FALSE)) != NO_ERROR) {
+ debug(28, 0) ("Can't retrieve ARP table!\n");
+ xfree(NetTable);
+ return 0;
+ }
+
+ /* Find MAC address from net table */
+ for (i = 0 ; i < NetTable->dwNumEntries ; i++) {
+ if ((c.s_addr == NetTable->table[i].dwAddr) && (NetTable->table[i].dwType > 2)) {
+ arpReq.arp_ha.sa_family = AF_UNSPEC;
+ memcpy(arpReq.arp_ha.sa_data, NetTable->table[i].bPhysAddr, NetTable[i].table->dwPhysAddrLen);
+ }
+ }
+
+ xfree(NetTable);
+
+ if (arpReq.arp_ha.sa_data[0] == 0 && arpReq.arp_ha.sa_data[1] == 0 &&
+ arpReq.arp_ha.sa_data[2] == 0 && arpReq.arp_ha.sa_data[3] == 0 &&
+ arpReq.arp_ha.sa_data[4] == 0 && arpReq.arp_ha.sa_data[5] == 0)
+ return 0;
+
+ debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x\n",
+ arpReq.arp_ha.sa_data[0] & 0xff, arpReq.arp_ha.sa_data[1] & 0xff,
+ 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 = (*Top)->splay((acl_arp_data *)&arpReq.arp_ha.sa_data, aclArpCompare);
+
+ debug(28, 3) ("aclMatchArp: '%s' %s\n",
+ inet_ntoa(c), splayLastResult ? "NOT found" : "found");
+
+ return (0 == splayLastResult);
+
#else
WRITE ME;