From ee0927b67fe665a317b97de9dd0fa7cd6163d69b Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 15 Oct 2009 23:12:38 +1300 Subject: [PATCH] SourceLayout: pull ARP operations into libeui This separates the current code for ARP lookup and encode/decode. Also makes the code buildable without fatal build errors on non-supporting systems. A loud run-time error is generated if related features are attempt use on non-supporting systems. FUTURE WORK: * unit-tests * on-demand lookups and logging of MAC/EUI-48 for a client similar to how ident is done. * on-demand passing MAC/EUI-48 to external_acl_type helpers * EUI-64 for IPv6 support. * Increased ARP support on other OS. --- configure.in | 30 +- doc/release-notes/release-3.2.sgml | 8 +- src/Makefile.am | 3 +- src/acl/Arp.cc | 492 ++----------------- src/acl/Arp.h | 7 +- src/acl/Makefile.am | 2 +- src/eui/Eui48.cc | 516 ++++++++++++++++++++ src/eui/Eui48.h | 64 +++ src/eui/Makefile.am | 10 + test-suite/buildtests/layer-02-maximus.opts | 4 +- 10 files changed, 656 insertions(+), 480 deletions(-) create mode 100644 src/eui/Eui48.cc create mode 100644 src/eui/Eui48.h create mode 100644 src/eui/Makefile.am diff --git a/configure.in b/configure.in index 655dfaf3ad..5c8171efa9 100644 --- a/configure.in +++ b/configure.in @@ -1075,11 +1075,11 @@ AC_ARG_ENABLE(cachemgr-hostname, esac ]) -AM_CONDITIONAL(ENABLE_ARP_ACL, false) -AC_ARG_ENABLE(arp-acl, - AS_HELP_STRING([--enable-arp-acl],[Enable use of ARP ACL lists (ether address)]), +AM_CONDITIONAL(USE_SQUID_EUI, false) +AC_ARG_ENABLE(eui, + AS_HELP_STRING([--enable-eui],[Enable use of ARP / MAC/ EUI (ether address)]), [ if test "$enableval" = "yes" ; then - AC_MSG_NOTICE([ARP ACL lists enabled (ether address)]) + AC_MSG_NOTICE([EUI controls enabled (ether address)]) case "$host" in *-linux-*) ;; @@ -1092,18 +1092,29 @@ AC_ARG_ENABLE(arp-acl, *-netbsd*) ;; *-cygwin*) - LIBS="$LIBS -liphlpapi" + EUILIB="-liphlpapi" ;; *-mingw*) - LIBS="$LIBS -liphlpapi" + EUILIB="-liphlpapi" ;; *) - AC_MSG_WARN([ARP ACL support probably won't work on $host.]) + AC_MSG_WARN([EUI support probably won't work on $host.]) sleep 10 ;; esac - AC_DEFINE(USE_ARP_ACL,1,[Define this to include code which lets you specify access control elements based on ethernet hardware addresses. This code uses functions found in 4.4 BSD derviations (e.g. FreeBSD, ?).]) - AM_CONDITIONAL(ENABLE_ARP_ACL, true) + AC_CHECK_HEADERS( \ + Iphlpapi.h \ + net/if.h \ + net/if_arp.h \ + net/if_dl.h \ + net/route.h \ + netinet/if_ether.h \ + sys/sockio.h \ + sys/sysctl.h \ + sys/ioctl.h \ + ) + AC_DEFINE(USE_SQUID_EUI,1,[Define this to include code which lets you use ethernet hardware addresses. This code uses functions found in 4.4 BSD derviations (e.g. FreeBSD, ?).]) + AM_CONDITIONAL(USE_SQUID_EUI, true) fi ]) @@ -4099,6 +4110,7 @@ AC_CONFIG_FILES([\ src/adaptation/icap/Makefile \ src/adaptation/ecap/Makefile \ src/esi/Makefile \ + src/eui/Makefile \ src/icmp/Makefile \ src/ident/Makefile \ src/ip/Makefile \ diff --git a/doc/release-notes/release-3.2.sgml b/doc/release-notes/release-3.2.sgml index f6b81967e3..dcc71782c2 100644 --- a/doc/release-notes/release-3.2.sgml +++ b/doc/release-notes/release-3.2.sgml @@ -350,6 +350,10 @@ This section gives an account of those changes in three categories: New options