[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r7008: Distinguish netfilter vs pf at configure time based on heade (in tor/trunk: . src/or)



Author: nickm
Date: 2006-08-10 05:01:46 -0400 (Thu, 10 Aug 2006)
New Revision: 7008

Modified:
   tor/trunk/
   tor/trunk/configure.in
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/or.h
Log:
 r7300@Kushana:  nickm | 2006-08-10 01:36:40 -0700
 Distinguish netfilter vs pf at configure time based on headers, not on OS.



Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
   - 17f730b7-d419-0410-b50f-85ee4b70197a:/local/or/tor/trunk:8245
1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
96637b51-b116-0410-a10e-9941ebb49b64:/tor/branches/spec:7005
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7030
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/trans-ap:7299
   + 17f730b7-d419-0410-b50f-85ee4b70197a:/local/or/tor/trunk:8245
1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
96637b51-b116-0410-a10e-9941ebb49b64:/tor/branches/spec:7005
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7030
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/trans-ap:7300

Modified: tor/trunk/configure.in
===================================================================
--- tor/trunk/configure.in	2006-08-10 09:01:37 UTC (rev 7007)
+++ tor/trunk/configure.in	2006-08-10 09:01:46 UTC (rev 7008)
@@ -58,23 +58,11 @@
 
 AC_ARG_ENABLE(transparent,
      AC_HELP_STRING(--disable-transparent, disable transparent proxy support),
-     [case "${enableval}" in 
+     [case "${enableval}" in
         yes) transparent=true ;;
         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 @@
 
 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 @@
   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])

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2006-08-10 09:01:37 UTC (rev 7007)
+++ tor/trunk/src/or/connection_edge.c	2006-08-10 09:01:46 UTC (rev 7008)
@@ -13,6 +13,17 @@
 
 #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;
 

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-08-10 09:01:37 UTC (rev 7007)
+++ tor/trunk/src/or/or.h	2006-08-10 09:01:46 UTC (rev 7008)
@@ -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"