Commit d893d8c5 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

r7300@Kushana: nickm | 2006-08-10 01:36:40 -0700

 Distinguish netfilter vs pf at configure time based on headers, not on OS.


svn:r7008
parent 5cff4164
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -63,18 +63,6 @@ AC_ARG_ENABLE(transparent,
        no)  transparent=false ;;
        *) AC_MSG_ERROR(bad value for --enable-transparent) ;;
      esac], [transparent=true])
if test x$transparent = xtrue; then
   AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
   case $host in
     *-*-linux* )
       AC_DEFINE(TRANS_NETFILTER, 1, "Define for transparent netfilter") ;;
     *-*-openbsd*)
       AC_DEFINE(TRANS_PF, 1, "Define for transparent pf")
       AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
     *-*-*bsd* )
       AC_DEFINE(TRANS_PF, 1, "Define for transparent pf") ;;
   esac
fi

case $host in
   *-*-solaris* )
@@ -379,6 +367,11 @@ dnl These headers are not essential

AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.h limits.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h syslog.h sys/time.h sys/resource.h stddef.h inttypes.h utime.h sys/utime.h sys/mman.h alloca.h)

AC_CHECK_HEADERS(net/if.h, [net_if_found=1], [net_if_found=0])
AC_CHECK_HEADERS(net/pfvar.h, [net_pfvar_found=1], [net_pfvar_found=0])
AC_CHECK_HEADERS(linux/netfilter_ipv4, [linux_netfilter_ipv4=1],
                                       [linux_netfilter_ipv4=0])

AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit strlcat strlcpy strtoull getpwnam getpwuid ftello getaddrinfo localtime_r gmtime_r event_get_version event_get_method event_set_log_callback memmem mmap strtok_r)

if test $enable_threads = "yes"; then
@@ -386,6 +379,25 @@ if test $enable_threads = "yes"; then
  AC_CHECK_FUNCS(pthread_create)
fi

if test x$transparent = xtrue ; then
   transparent_ok=0
   if test x$net_if_found = x1 -a x$net_pfvar_found = x1 ; then
     transparent_ok=1
   fi
   if test x$linux_netfilter_ipv4 = x1 ; then
     transparent_ok=1
   fi
   if x$transparent_ok = x1 ; then
     AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
     case $host in
       *-*-openbsd*)
         AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
     esac
   else
     AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
   fi
fi

AC_FUNC_FSEEKO

AC_CHECK_MEMBERS([struct timeval.tv_sec])
+11 −0
Original line number Diff line number Diff line
@@ -13,6 +13,17 @@ const char connection_edge_c_id[] =

#include "or.h"

#ifdef HAVE_LINUX_NETFILTER_IPV4_H
#include <linux/netfilter_ipv4.h>
#define TRANS_NETFILTER
#endif

#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
#include <net/if.h>
#include <net/pfvar.h>
#define TRANS_PF
#endif

/* List of exit_redirect_t */
static smartlist_t *redirect_exit_list = NULL;

+0 −9
Original line number Diff line number Diff line
@@ -113,15 +113,6 @@
#error "Tor requires libevent to build."
#endif

#ifdef TRANS_NETFILTER
#include <linux/netfilter_ipv4.h>
#endif

#ifdef TRANS_PF
#include <net/if.h>
#include <net/pfvar.h>
#endif

#include "../common/crypto.h"
#include "../common/tortls.h"
#include "../common/log.h"