]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability fixes for netfilter MARK support.
authorAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 6 Oct 2010 13:03:11 +0000 (07:03 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 6 Oct 2010 13:03:11 +0000 (07:03 -0600)
configure.in
src/cache_cf.cc
src/cf_gen_defines
src/fde.h
src/ip/Makefile.am
src/ip/QosConfig.cc
src/ip/QosConfig.h

index b30f1bf8566e163755adb0e9eabbf14e62f660b5..510c8f8f61c22527610277a3b433107081967522 100644 (file)
@@ -1316,29 +1316,35 @@ AC_ARG_WITH(netfilter-conntrack,
                  [Do not use Netfilter conntrack libraries for packet marking.
                   A path to alternative library location may be specified by
                   using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
-    case "$withval" in
-      yes|no) with_netfilter_conntrack=$withval ;;
-      *)   squid_opt_netfilterconntrackpath=$withval
-           with_netfilter_conntrack=yes ;;
-    esac], [
+case "$with_netfilter_conntrack" in
+  yes|no)
+    : # Nothing special to do here
+    ;;
+  *)
+    if test ! -d "$withval" ; then
+      AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
+    fi
+    squid_opt_netfilterconntrackpath=$withval
+    LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
+    CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
     with_netfilter_conntrack=yes
+  esac
 ])
-if test x"$with_netfilter_conntrack" = "xyes"; then
-    if test "x$squid_opt_netfilterconntrackpath" != "x"; then
-        if ! test -d "$squid_opt_netfilterconntrackpath"; then
-            AC_MSG_ERROR([--with-netfilter-conntrack path '$squid_opt_netfilterconntrackpath' does not exist])
+AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
+if test "x$with_netfilter_conntrack" != "xno"; then
+    AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
+        if test x"$with_netfilter_conntrack" = "xyes"; then
+            AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
         fi
-        LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
-        CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
-    fi
-    AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,
-        with_netfilter_conntrack=no
-        if test x"$withval" = "xyes"; then
-            AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack libraries not found])
-        fi )
+        with_netfilter_conntrack=no])
     AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
-        libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,with_netfilter_conntrack=no)
+        libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
+        if test x"$with_netfilter_conntrack" = "xyes"; then
+            AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
+        fi
+        with_netfilter_conntrack=no])
 fi
+AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
 
 
 dnl Enable Large file support
index 8aa5138d4b792821ca47404338776d5b8a5f60a4..0c8530f5f5352b39307e8eef8c8149927a5ad9ea 100644 (file)
@@ -1301,6 +1301,8 @@ free_acl_tos(acl_tos ** head)
     }
 }
 
+#if defined(SO_MARK)
+
 CBDATA_TYPE(acl_nfmark);
 
 static void
@@ -1369,6 +1371,7 @@ free_acl_nfmark(acl_nfmark ** head)
         cbdataFree(l);
     }
 }
+#endif /* SO_MARK */
 
 CBDATA_TYPE(acl_size_t);
 
index 50ce262939cae85d9578a2286b7bf892c6af3ed6..37615ed510ac8919264c41ce1f9f20cd83dc2cc4 100644 (file)
@@ -32,6 +32,7 @@ BEGIN {
        define["USE_WCCPv2"]="--enable-wccpv2"
        define["USE_QOS_TOS"]="--enable-zph-qos"
        define["_SQUID_MSWIN_"]="MS Windows"
+       define["SO_MARK"]="Packet MARK (Linux)"
 }
 /^IFDEF:/ {
        if (define[$2] != "")
index 2fc1d4076ff8835c76798e7dfb23701cd6e51b8a..089ad24c17baf5f491cd75f3ebf1160c1def5d0b 100644 (file)
--- a/src/fde.h
+++ b/src/fde.h
@@ -130,7 +130,8 @@ private:
         type = 0;
         remote_port = 0;
         local_addr.SetEmpty();
-        tos = '\0';
+        tosToServer = '\0';
+        nfmarkToServer = 0;
         sock_family = 0;
         memset(ipaddr, '\0', MAX_IPSTRLEN);
         memset(desc,'\0',FD_DESC_SZ);
@@ -160,9 +161,8 @@ private:
 #ifdef _SQUID_MSWIN_
         win32.handle = NULL;
 #endif
-#if USE_ZPH_QOS
-        upstreamTOS = 0;
-#endif
+        tosFromServer = '\0';
+        nfmarkFromServer = 0;
     }
 };
 
index ce15112d041aa39cdd0a804622c66d3eae3533df..989f29d2911173b575bc798d52b894d789665c26 100644 (file)
@@ -9,8 +9,8 @@ libip_la_SOURCES = \
        Address.cc \
        Intercept.h \
        Intercept.cc \
-       Qos.h \
-       Qos.cc \
+       QosConfig.h \
+       QosConfig.cc \
        Qos.cci \
        tools.cc \
        tools.h
index 948e23aa4745613a8b96917f08e40b8a75f6c2f8..36ce6cadac9d759ab91760b9400820af0a69a718 100644 (file)
@@ -1,18 +1,20 @@
+#include "squid.h"
+
 #include "acl/Gadgets.h"
 #include "ConfigParser.h"
 #include "fde.h"
 #include "hier_code.h"
 #include "ip/tools.h"
-#include "Qos.h"
+#include "ip/QosConfig.h"
 #include "Parsing.h"
-#include "squid.h"
 
 /* Qos namespace */
 
 void
 Ip::Qos::getTosFromServer(const int server_fd, fde *clientFde)
 {
-#if USE_QOS_TOS 
+#if USE_QOS_TOS && _SQUID_LINUX_
+    /* Bug 2537: This part of ZPH only applies to patched Linux kernels. */
     tos_t tos = 1;
     int tos_len = sizeof(tos); 
     clientFde->tosFromServer = 0;
index 4011ffef3c91be006cbcf4e1c4361c9be07253a0..9ad9c48fc8ae80c3a9eec633500e75b6a4181f47 100644 (file)
@@ -32,6 +32,7 @@ namespace Qos
     /**
     * Function to retrieve the TOS value of the inbound packet.
     * Called by FwdState::dispatch if QOS options are enabled.
+    * Bug 2537: This part of ZPH only applies to patched Linux kernels
     * @param server_fd Server side descriptor of connection to get TOS for
     * @param clientFde Pointer to client side fde instance to set tosFromServer in
     */