]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Polish ZPH configuration interface
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 26 Dec 2008 21:11:24 +0000 (10:11 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 26 Dec 2008 21:11:24 +0000 (10:11 +1300)
This completes the ZPH patch merge for Squid 3.1. It makes significant
changes to the squid.conf options previously used.

ZPH controls are now formally called "qos_flows" with a set of options
to set individual output flow TOS based on the flow source. see squid.conf
documentation for details.

Since this is new IP-layer code it also places the new QoS code in a
directory src/ip/ and library libip.la inline with the planned source
layout model.

14 files changed:
configure.in
doc/release-notes/release-3.1.html
doc/release-notes/release-3.1.sgml
src/Makefile.am
src/cf.data.depend
src/cf.data.pre
src/client_side_reply.cc
src/forward.cc
src/icmp/Makefile.am
src/ip/Makefile.am [new file with mode: 0644]
src/ip/QosConfig.cc [new file with mode: 0644]
src/ip/QosConfig.h [new file with mode: 0644]
src/ip/stubQosConfig.cc [new file with mode: 0644]
src/structs.h

index 17c04882989fdbcff5d8a305524e336a714cb223..bbb7570ad3848e0bce45224cacdc3b186fa00439 100644 (file)
@@ -3817,6 +3817,7 @@ AC_CONFIG_FILES([\
        src/adaptation/Makefile \
        src/ICAP/Makefile \
        src/icmp/Makefile \
+       src/ip/Makefile \
        src/eCAP/Makefile \
        contrib/Makefile \
        snmplib/Makefile \
index 996177ef5cea088876d7d060a46eb257ff047c86..e29c778da29ea0e1642e3bb8107efa941db4f7da 100644 (file)
@@ -295,9 +295,9 @@ Microsoft NTLM Authentication instead of HTTP standard authentication through a
 <UL>
 <LI>Allows you to select a TOS/Diffserv value to mark local hits.</LI>
 <LI>Allows you to select a TOS/Diffserv value to mark peer hits.</LI>
-<LI>Allows you to selectively set only sibling or sibling+parent requests</LI>
-<LI>Allows any HTTP response towards clients will have the TOS value of the response coming from
-the remote server masked with the value of zph_preserve_miss_tos_mask.
+<LI>Allows you to selectively mark only sibling or parent requests</LI>
+<LI>Allows any HTTP response towards clients to have the TOS value of the response coming from
+the remote server preserved.
 For this to work correctly, you will need to patch your linux kernel with the TOS preserving ZPH patch.
 The kernel patch can be downloaded from 
 <A HREF="http://zph.bratcheda.org">http://zph.bratcheda.org</A></LI>
@@ -311,17 +311,20 @@ before copying the value to the TOS send towards clients.</LI>
 <P>Squid 3.1 needs to be configured with --enable-zph-qos for the ZPH QoS controls to be available.</P>
 
 <P>The configuration options for 2.7 and 3.1 are based on different ZPH patches.
-The two releases configuration differs and is not at this point directly translatable.</P>
+The two releases configuration differs and only the TOS mode settings are directly translatable.</P>
 <P>
 <UL>
-<LI><EM>zph_tos_local</EM>              Responses found as a HIT in the local cache</LI>
-<LI><EM>zph_tos_peer</EM>               Responses found as a HIT on peer caches.</LI>
-<LI><EM>zph_tos_parent</EM>             Qos to Sibling caches only or all peers.</LI>
-<LI><EM>zph_preserve_miss_tos</EM>      Use the same ToS settings received by Squid from the remote server,
-on the client connection. Requires a kernel patch.</LI>
+<LI><EM>qos_flows local-hit=0xff</EM>           Responses found as a HIT in the local cache</LI>
+<LI><EM>qos_flows sibling-hit=0xff</EM> Responses found as a HIT in a sibling peer</LI>
+<LI><EM>qos_flows parent-hit=0xff</EM>  Responses found as a HIT in a parent peer</LI>
 </UL>
 </P>
 
+<P>The lines above are spearated for documentation. qos_flows may be configured with all options on one line, or separated as shown.
+Also options may be repeated as many times as desired. Only the final configured value for any option will be used.</P>
+
+<P>The legacy Option and Priority modes available in Squid-2.7 are no longer supported.</P>
+
 
 <H2><A NAME="ss2.7">2.7</A> <A HREF="#toc2.7">SSL Bump (for HTTPS Filtering and Adaptation)</A>
 </H2>
@@ -912,55 +915,45 @@ DEFAULT: None bypassed.
 </PRE>
 </P>
 
-<DT><B>zph_preserve_miss_tos</B><DD>
+<DT><B>qos_flows local-hit= sibling-hit= parent-hit=</B><DD>
 <P>
 <PRE>
-        If set to on (default), any HTTP response towards clients will
-        have the TOS value of the response comming from the remote
-        server masked with the value of zph_preserve_miss_tos_mask.
-        For this to work correctly, you will need to patch your linux
-        kernel with the TOS preserving ZPH patch.
-        The kernel patch can be downloaded from http://zph.bratcheda.org
-        
-</PRE>
-</P>
+        Allows you to select a TOS/DSCP value to mark outgoing
+        connections with, based on where the reply was sourced.
 
-<DT><B>zph_preserve_miss_tos_mask</B><DD>
-<P>
-<PRE>
-        Allows you to mask certain bits in the TOS received from the
-        remote server, before copying the value to the TOS send towards
-        clients.
-        Default: 0xFF (255) (TOS from server is not changed).
-        
-</PRE>
-</P>
+        TOS values really only have local significance - so you should
+        know what you're specifying. For more information, see RFC2474,
+        RFC2475, and RFC3260.
 
-<DT><B>zph_tos_local</B><DD>
-<P>
-<PRE>
-        Allows you to select a TOS/Diffserv value to mark local hits. Read above
-        (tcp_outgoing_tos) for details/requirements about TOS.
-        Default: 0 (disabled).
-        
-</PRE>
-</P>
+        The TOS/DSCP byte must be exactly that - octet value 0x00-0xFF.
+        Note that in practice often only values up to 0x3F are usable
+        as the two highest bits have been redefined for use by ECN
+        (RFC3168).
 
-<DT><B>zph_tos_parent</B><DD>
-<P>
-<PRE>
-        Set this to off if you want only sibling hits to be marked.
-        If set to on (default), parent hits are being marked too.
-        
-</PRE>
-</P>
+        This setting is configured by setting the source TOS values:
 
-<DT><B>zph_tos_peer</B><DD>
-<P>
-<PRE>
-        Allows you to select a TOS/Diffserv value to mark peer hits. Read above
-        (tcp_outgoing_tos) for details/requirements about TOS.
-        Default: 0 (disabled).
+        local-hit=0xFF          Value to mark local cache hits.
+
+        sibling-hit=0xFF        Value to mark hits from sibling peers.
+
+        parent-hit=0xFF         Value to mark hits from parent peers.
+
+
+        NOTE: 'miss' preserve feature is only possible on Linux at this time.
+
+        For the following to work correctly, you will need to patch your
+        linux kernel with the TOS preserving ZPH patch.
+        The kernel patch can be downloaded from http://zph.bratcheda.org
+
+        disable-preserve-miss
+                If set, any HTTP response towards clients will
+                have the TOS value of the response comming from the
+                remote server masked with the value of miss-mask.
+        miss-mask=0xFF
+                Allows you to mask certain bits in the TOS received from the
+                remote server, before copying the value to the TOS sent
+                towards clients.
+                Default: 0xFF (TOS from server is not changed).
         
 </PRE>
 </P>
@@ -1399,7 +1392,7 @@ The helper will now compile and work with dns_nameservers on more variants of Li
 <P>Replaced by <EM>url_rewrite_bypass</EM></P>
 
 <DT><B>zph_local</B><DD>
-<P>Replaced by <EM>zph_tos_local</EM></P>
+<P>Replaced by <EM>qos_flows local-hit=</EM></P>
 
 <DT><B>zph_mode</B><DD>
 <P>Obsolete.</P>
@@ -1408,10 +1401,10 @@ The helper will now compile and work with dns_nameservers on more variants of Li
 <P>Obsolete.</P>
 
 <DT><B>zph_parent</B><DD>
-<P>Replaced by <EM>zph_tos_peer</EM> and <EM>zph_tos_parent</EM></P>
+<P>Replaced by <EM>qos_flows parent-hit=</EM></P>
 
 <DT><B>zph_sibling</B><DD>
-<P>Replaced by <EM>zph_tos_peer</EM></P>
+<P>Replaced by <EM>qos_flows sibling-hit=</EM></P>
 
 </DL>
 </P>
index c6d34e35ba8afb94d310c86a728941731b13b0ee..e4814f3899da21bf8aac4439a7cba1ada8e60ec5 100644 (file)
@@ -211,9 +211,9 @@ Microsoft NTLM Authentication instead of HTTP standard authentication through a
 <itemize>
        <item>Allows you to select a TOS/Diffserv value to mark local hits.
        <item>Allows you to select a TOS/Diffserv value to mark peer hits.
-       <item>Allows you to selectively set only sibling or sibling+parent requests
-       <item>Allows any HTTP response towards clients will have the TOS value of the response coming from
-               the remote server masked with the value of zph_preserve_miss_tos_mask.
+       <item>Allows you to selectively mark only sibling or parent requests
+       <item>Allows any HTTP response towards clients to have the TOS value of the response coming from
+               the remote server preserved.
                For this to work correctly, you will need to patch your linux kernel with the TOS preserving ZPH patch.
                The kernel patch can be downloaded from <url url="http://zph.bratcheda.org" name="http://zph.bratcheda.org">
        <item>Allows you to mask certain bits in the TOS received from the remote server,
@@ -224,16 +224,19 @@ Microsoft NTLM Authentication instead of HTTP standard authentication through a
 <p>Squid 3.1 needs to be configured with --enable-zph-qos for the ZPH QoS controls to be available.
 
 <p>The configuration options for 2.7 and 3.1 are based on different ZPH patches.
-The two releases configuration differs and is not at this point directly translatable.
+The two releases configuration differs and only the TOS mode settings are directly translatable.
 
 <itemize>
-<item><em>zph_tos_local</em>           Responses found as a HIT in the local cache
-<item><em>zph_tos_peer</em>            Responses found as a HIT on peer caches.
-<item><em>zph_tos_parent</em>          Qos to Sibling caches only or all peers.
-<item><em>zph_preserve_miss_tos</em>   Use the same ToS settings received by Squid from the remote server,
-                                       on the client connection. Requires a kernel patch.
+<item><em>qos_flows local-hit=0xff</em>                Responses found as a HIT in the local cache
+<item><em>qos_flows sibling-hit=0xff</em>      Responses found as a HIT in a sibling peer
+<item><em>qos_flows parent-hit=0xff</em>       Responses found as a HIT in a parent peer
 </itemize>
 
+<p>The lines above are spearated for documentation. qos_flows may be configured with all options on one line, or separated as shown.
+Also options may be repeated as many times as desired. Only the final configured value for any option will be used.
+
+<p>The legacy <b>Option</b> and <b>Priority</b> modes available in Squid-2.7 are no longer supported.
+
 
 <sect1>SSL Bump (for HTTPS Filtering and Adaptation)
 
@@ -731,42 +734,44 @@ NOCOMMENT_START
        See also: sslproxy_flags and DONT_VERIFY_PEER.
        </verb>
 
-       <tag>zph_preserve_miss_tos</tag>
+       <tag>qos_flows local-hit= sibling-hit= parent-hit=</tag>
        <verb>
-       If set to on (default), any HTTP response towards clients will
-       have the TOS value of the response comming from the remote
-       server masked with the value of zph_preserve_miss_tos_mask.
-       For this to work correctly, you will need to patch your linux
-       kernel with the TOS preserving ZPH patch.
-       The kernel patch can be downloaded from http://zph.bratcheda.org
-       </verb>
+        Allows you to select a TOS/DSCP value to mark outgoing
+        connections with, based on where the reply was sourced.
 
-       <tag>zph_preserve_miss_tos_mask</tag>
-       <verb>
-       Allows you to mask certain bits in the TOS received from the
-       remote server, before copying the value to the TOS send towards
-       clients.
-       Default: 0xFF (255) (TOS from server is not changed).
-       </verb>
+        TOS values really only have local significance - so you should
+        know what you're specifying. For more information, see RFC2474,
+        RFC2475, and RFC3260.
 
-       <tag>zph_tos_local</tag>
-       <verb>
-       Allows you to select a TOS/Diffserv value to mark local hits. Read above
-       (tcp_outgoing_tos) for details/requirements about TOS.
-       Default: 0 (disabled).
-       </verb>
+        The TOS/DSCP byte must be exactly that - octet value 0x00-0xFF.
+        Note that in practice often only values up to 0x3F are usable
+        as the two highest bits have been redefined for use by ECN
+        (RFC3168).
 
-       <tag>zph_tos_parent</tag>
-       <verb>
-       Set this to off if you want only sibling hits to be marked.
-       If set to on (default), parent hits are being marked too.
-       </verb>
+        This setting is configured by setting the source TOS values:
 
-       <tag>zph_tos_peer</tag>
-       <verb>
-       Allows you to select a TOS/Diffserv value to mark peer hits. Read above
-       (tcp_outgoing_tos) for details/requirements about TOS.
-       Default: 0 (disabled).
+        local-hit=0xFF          Value to mark local cache hits.
+
+        sibling-hit=0xFF        Value to mark hits from sibling peers.
+
+        parent-hit=0xFF         Value to mark hits from parent peers.
+
+
+        NOTE: 'miss' preserve feature is only possible on Linux at this time.
+
+        For the following to work correctly, you will need to patch your
+        linux kernel with the TOS preserving ZPH patch.
+        The kernel patch can be downloaded from http://zph.bratcheda.org
+
+        disable-preserve-miss
+                If set, any HTTP response towards clients will
+                have the TOS value of the response comming from the
+                remote server masked with the value of miss-mask.
+        miss-mask=0xFF
+                Allows you to mask certain bits in the TOS received from the
+                remote server, before copying the value to the TOS sent
+                towards clients.
+                Default: 0xFF (TOS from server is not changed).
        </verb>
 
 
@@ -1164,7 +1169,7 @@ This section gives an account of those changes in three categories:
        <p>Replaced by <em>url_rewrite_bypass</em>
 
        <tag>zph_local</tag>
-       <p>Replaced by <em>zph_tos_local</em>
+       <p>Replaced by <em>qos_flows local-hit=</em>
 
        <tag>zph_mode</tag>
        <p>Obsolete.
@@ -1173,10 +1178,10 @@ This section gives an account of those changes in three categories:
        <p>Obsolete.
 
        <tag>zph_parent</tag>
-       <p>Replaced by <em>zph_tos_peer</em> and <em>zph_tos_parent</em>
+       <p>Replaced by <em>qos_flows parent-hit=</em>
 
        <tag>zph_sibling</tag>
-       <p>Replaced by <em>zph_tos_peer</em>
+       <p>Replaced by <em>qos_flows sibling-hit=</em>
 
 </descrip>
 
index f515ce8ee1eb45aae7ac1ffec08345dec872e259..85423cd556f3421eb30cc36db8065a880b3c9ee3 100644 (file)
@@ -34,7 +34,7 @@ LOADABLE_MODULES_SOURCES = \
 TESTS=$(check_PROGRAMS)
 check_PROGRAMS=
 
-SUBDIRS                = fs repl auth icmp
+SUBDIRS                = fs repl auth icmp ip
 
 if USE_ADAPTATION
 SUBDIRS += adaptation
@@ -243,7 +243,13 @@ libexec_PROGRAMS = \
        @DISK_PROGRAMS@ \
        $(UNLINKD)
 
-cf_gen_SOURCES = cf_gen.cc defines.h debug.cc time.cc
+cf_gen_SOURCES = \
+       cf_gen.cc \
+       defines.h \
+       debug.cc \
+       ip/stubQosConfig.cc \
+       time.cc
+
 nodist_cf_gen_SOURCES = globals.cc
 nodist_cf_gen_HEADER = cf_gen_defines.h
 cf_gen.$(OBJEXT): cf_gen_defines.h
@@ -423,7 +429,6 @@ libsquid_la_SOURCES = \
         TextException.cc \
         TextException.h
 
-
 # authentication framework
 libauth_la_SOURCES = \
        AuthConfig.cc \
@@ -684,6 +689,7 @@ squid_LDADD = \
        libsquid.la \
        libauth.la \
        icmp/libicmp.la icmp/libicmp-core.la \
+       ip/libip.la \
        -L../lib \
        @XTRA_OBJS@ \
        @DISK_LINKOBJS@ \
@@ -864,6 +870,7 @@ ufsdump_SOURCES = \
        peer_sourcehash.cc \
        peer_userhash.cc \
        protos.h \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -1210,6 +1217,7 @@ tests_testAuth_SOURCES = \
        tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc acl.cc mem.cc \
        MemBuf.cc HttpHdrContRange.cc Packer.cc ACLChecklist.cc HttpHdrCc.cc HttpHdrSc.cc \
        HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \
+       ip/stubQosConfig.cc \
        StatHist.cc HttpHdrRange.cc ETag.cc tests/stub_errorpage.cc \
        tests/stub_HttpRequest.cc tests/stub_DelayId.cc \
        tests/stub_MemObject.cc mem_node.cc \
@@ -1286,6 +1294,7 @@ tests_testACLMaxUserIP_SOURCES= \
        mem_node.cc \
        Packer.cc \
        Parsing.cc \
+       ip/stubQosConfig.cc \
        StatHist.cc \
        stmem.cc \
        String.cc \
@@ -1422,6 +1431,7 @@ tests_testCacheManager_SOURCES = \
        peer_select.cc \
        peer_sourcehash.cc \
        peer_userhash.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -1492,7 +1502,8 @@ tests_testDiskIO_SOURCES = \
        tests/testDiskIO.cc \
        tests/testDiskIO.h \
        tests/testMain.cc \
-       tests/stub_cache_manager.cc
+       tests/stub_cache_manager.cc \
+       ip/stubQosConfig.cc
 nodist_tests_testDiskIO_SOURCES= \
        $(SWAP_TEST_GEN_SOURCES)
 tests_testDiskIO_LDADD = \
@@ -1598,6 +1609,7 @@ tests_testEvent_SOURCES = \
        peer_select.cc \
        peer_sourcehash.cc \
        peer_userhash.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -1754,6 +1766,7 @@ tests_testEventLoop_SOURCES = \
        peer_select.cc \
        peer_sourcehash.cc \
        peer_userhash.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -1900,6 +1913,7 @@ tests_test_http_range_SOURCES = \
        peer_sourcehash.cc \
        peer_userhash.cc \
        pconn.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -2061,6 +2075,7 @@ tests_testHttpRequest_SOURCES = \
        peer_select.cc \
        peer_sourcehash.cc \
        peer_userhash.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
@@ -2159,6 +2174,7 @@ STORE_TEST_SOURCES=\
        HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \
        StatHist.cc HttpHdrRange.cc ETag.cc tests/stub_errorpage.cc \
        tests/stub_HttpRequest.cc tests/stub_access_log.cc \
+       ip/stubQosConfig.cc \
        refresh.cc \
        tests/stub_store_client.cc \
        tests/stub_tools.cc \
@@ -2209,14 +2225,16 @@ tests_testStore_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
        @SQUID_CPPUNIT_LA@
 
 # string needs mem.cc.
+# libsquid pulls in SquidConfig and children. stub them.
 tests_testString_SOURCES = \
        mem.cc \
+       ip/stubQosConfig.cc \
        String.cc \
        tests/testMain.cc \
        tests/testString.cc \
        tests/testString.h \
        tests/stub_cache_manager.cc \
-       time.cc 
+       time.cc
 nodist_tests_testString_SOURCES = \
        $(TESTSOURCES)
 tests_testString_LDADD = \
@@ -2423,6 +2441,7 @@ tests_testURL_SOURCES = \
        peer_select.cc \
        peer_sourcehash.cc \
        peer_userhash.cc \
+       ip/stubQosConfig.cc \
        redirect.cc \
        referer.cc \
        refresh.cc \
index 54b5c33cefe548877b4eff46080a851153add4a9..6a459ccb772da7c8162996598ef742902a67a2c5 100644 (file)
@@ -38,6 +38,7 @@ logformat
 onoff
 peer
 peer_access            cache_peer acl
+QosConfig
 refreshpattern
 removalpolicy
 size_t
index eef5511ade84281563df07af71579a1a585b38f4..9e8105cbab36d27f3e0038ab156c1d06693964c2 100644 (file)
@@ -1226,8 +1226,8 @@ DOC_START
        tcp_outgoing_tos 0x20 good_service_net
 
        TOS/DSCP values really only have local significance - so you should
-       know what you're specifying. For more information, see RFC2474 and
-       RFC3260.
+       know what you're specifying. For more information, see RFC2474,
+       RFC2475, and RFC3260.
 
        The TOS/DSCP byte must be exactly that - a octet value  0 - 255, or
        "default" to use whatever default your host has. Note that in
@@ -1253,64 +1253,50 @@ DOC_START
        making the request.
 DOC_END
 
-NAME: zph_tos_local
-TYPE: int
+NAME: qos_flows
+TYPE: QosConfig
 IFDEF: USE_ZPH_QOS
-DEFAULT: 0
-LOC: Config.zph_tos_local
+DEFAULT: none
+LOC: Config.zph
 DOC_START
-       Allows you to select a TOS/Diffserv value to mark local hits. Read above
-       (tcp_outgoing_tos) for details/requirements about TOS.
-       Default: 0 (disabled).
-DOC_END
+       Allows you to select a TOS/DSCP value to mark outgoing
+       connections with, based on where the reply was sourced.
 
-NAME: zph_tos_peer
-TYPE: int
-IFDEF: USE_ZPH_QOS
-DEFAULT: 0
-LOC: Config.zph_tos_peer
-DOC_START
-       Allows you to select a TOS/Diffserv value to mark peer hits. Read above
-       (tcp_outgoing_tos) for details/requirements about TOS.
-       Default: 0 (disabled).
-DOC_END
+       TOS values really only have local significance - so you should
+       know what you're specifying. For more information, see RFC2474,
+       RFC2475, and RFC3260.
 
-NAME: zph_tos_parent
-COMMENT: on|off
-TYPE: onoff
-IFDEF: USE_ZPH_QOS
-DEFAULT: on
-LOC: Config.onoff.zph_tos_parent
-DOC_START
-       Set this to off if you want only sibling hits to be marked.
-       If set to on (default), parent hits are being marked too.
-DOC_END
+       The TOS/DSCP byte must be exactly that - octet value 0x00-0xFF.
+       Note that in practice often only values up to 0x3F are usable
+       as the two highest bits have been redefined for use by ECN
+       (RFC3168).
 
-NAME: zph_preserve_miss_tos
-COMMENT: on|off
-TYPE: onoff
-IFDEF: USE_ZPH_QOS
-DEFAULT: on
-LOC: Config.onoff.zph_preserve_miss_tos
-DOC_START
-       If set to on (default), any HTTP response towards clients will
-       have the TOS value of the response comming from the remote
-       server masked with the value of zph_preserve_miss_tos_mask.
-       For this to work correctly, you will need to patch your linux
-       kernel with the TOS preserving ZPH patch.
-       The kernel patch can be downloaded from http://zph.bratcheda.org
-DOC_END
+       This setting is configured by setting the source TOS values:
+
+       local-hit=0xFF          Value to mark local cache hits.
+
+       sibling-hit=0xFF        Value to mark hits from sibling peers.
+
+       parent-hit=0xFF         Value to mark hits from parent peers.
+
+
+       NOTE: 'miss' preserve feature is only possible on Linux at this time.
+
+       For the following to work correctly, you will need to patch your
+       linux kernel with the TOS preserving ZPH patch.
+       The kernel patch can be downloaded from http://zph.bratcheda.org
+
+       disable-preserve-miss
+               If set, any HTTP response towards clients will
+               have the TOS value of the response comming from the
+               remote server masked with the value of miss-mask.
+
+       miss-mask=0xFF
+               Allows you to mask certain bits in the TOS received from the
+               remote server, before copying the value to the TOS sent
+               towards clients.
+               Default: 0xFF (TOS from server is not changed).
 
-NAME: zph_preserve_miss_tos_mask
-TYPE: int
-IFDEF: USE_ZPH_QOS
-DEFAULT: 255
-LOC: Config.zph_preserve_miss_tos_mask
-DOC_START
-       Allows you to mask certain bits in the TOS received from the
-       remote server, before copying the value to the TOS send towards
-       clients.
-       Default: 255 (TOS from server is not changed).
 DOC_END
 
 NAME: tcp_outgoing_address
index 6d9a58d80447e25982507656fa33a460471813c5..c6f92167188f07df2fe61252fbd2388c01959a86 100644 (file)
@@ -1635,9 +1635,9 @@ clientReplyContext::doGetMoreData()
         assert(http->out.size == 0);
         assert(http->out.offset == 0);
 #if USE_ZPH_QOS
-        if (Config.zph_tos_local) {
-            debugs(33, 2, "ZPH Local hit, TOS="<<Config.zph_tos_local);
-            comm_set_tos(http->getConn()->fd,Config.zph_tos_local);
+        if (Config.zph.tos_local_hit) {
+            debugs(33, 2, "ZPH Local hit, TOS=" << Config.zph.tos_local_hit);
+            comm_set_tos(http->getConn()->fd, Config.zph.tos_local_hit);
         }
 #endif /* USE_ZPH_QOS */
         tempBuffer.offset = reqofs;
@@ -1915,13 +1915,14 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
     if (reqofs==0 && !logTypeIsATcpHit(http->logType)) {
         assert(fd >= 0); // the beginning of this method implies fd may be -1
         int tos = 0;
-        if (Config.zph_tos_peer &&
-                (http->request->hier.code==SIBLING_HIT ||
-                 (Config.onoff.zph_tos_parent && http->request->hier.code==PARENT_HIT) ) ) {
-            tos = Config.zph_tos_peer;
-            debugs(33, 2, "ZPH: Peer hit with hier.code="<<http->request->hier.code<<", TOS="<<tos);
-        } else if (Config.onoff.zph_preserve_miss_tos && Config.zph_preserve_miss_tos_mask) {
-            tos = fd_table[fd].upstreamTOS & Config.zph_preserve_miss_tos_mask;
+        if (Config.zph.tos_sibling_hit && http->request->hier.code==SIBLING_HIT ) {
+            tos = Config.zph.tos_sibling_hit;
+            debugs(33, 2, "ZPH: Sibling Peer hit with hier.code=" << http->request->hier.code << ", TOS=" << tos);
+        } else if (Config.zph.tos_parent_hit && http->request->hier.code==PARENT_HIT) {
+            tos = Config.zph.tos_parent_hit;
+            debugs(33, 2, "ZPH: Parent Peer hit with hier.code=" << http->request->hier.code << ", TOS=" << tos);
+        } else if (Config.zph.preserve_miss_tos && Config.zph.preserve_miss_tos_mask) {
+            tos = fd_table[fd].upstreamTOS & Config.zph.preserve_miss_tos_mask;
             debugs(33, 2, "ZPH: Preserving TOS on miss, TOS="<<tos);
         }
         comm_set_tos(fd,tos);
index 87dabbe8feb53bfd723d5b197e3b44537a5f2a81..71b876d2a55066f4d37f3e3663fb063ce32cd2ac 100644 (file)
@@ -965,7 +965,9 @@ FwdState::dispatch()
 
     netdbPingSite(request->GetHost());
 
-#if USE_ZPH_QOS
+#if USE_ZPH_QOS && _SQUID_LINUX_
+    /* Bug 2537: This part of ZPH only applies to patched Linux kernels. */
+
     /* Retrieves remote server TOS value, and stores it as part of the
      * original client request FD object. It is later used to forward
      * remote server's TOS in the response to the client in case of a MISS.
index 790b3eefad40ac2037267f113de1655fa5932930..aae47e9d04eee3235544bd964ed5e67498f89be2 100644 (file)
@@ -62,10 +62,11 @@ pinger_SOURCES = \
 # TODO: remove when these are cleaned up in their own way.
 nodist_pinger_SOURCES = \
        ../debug.cc \
+       ../globals.cc \
        ../time.cc \
        ../SquidConfig.cc \
        ../SquidNew.cc \
-       ../globals.cc
+       ../ip/stubQosConfig.cc
 
 pinger_LDFLAGS = $(LIBADD_DL)
 pinger_LDADD=\
diff --git a/src/ip/Makefile.am b/src/ip/Makefile.am
new file mode 100644 (file)
index 0000000..1ac2440
--- /dev/null
@@ -0,0 +1,39 @@
+#
+#  Makefile for the Squid IP layer API
+#
+
+# Housekeeping, shared by all Squid Makefiles.
+# TODO: make this set by configure?
+AM_CFLAGS = @SQUID_CFLAGS@
+AM_CXXFLAGS = @SQUID_CXXFLAGS@
+DEFS = @DEFS@
+CLEANFILES = 
+
+INCLUDES = -I$(top_srcdir)/src @SQUID_CPPUNIT_INC@ -I$(top_srcdir)/include -I$(top_builddir)/lib
+$(OBJS): $(top_srcdir)/include/version.h $(top_srcdir)/include/autoconf.h
+
+
+# IP Specific Configurations
+
+#EXTRA_PROGRAMS = \
+#      testIcmp
+
+noinst_LTLIBRARIES = libip.la
+
+libip_la_SOURCES = \
+       QosConfig.h \
+       QosConfig.cc
+
+
+check_PROGRAMS= testHeaders
+TESTS= $(check_PROGRAMS)
+
+## Special Universal .h dependency test script
+## aborts if error encountered
+testHeaders: $(top_srcdir)/src/icmp/*.h
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/icmp/" || exit 1
+
+## No such file...
+testHeaders.c:
+       touch testHeaders.c
+CLEANFILES += testHeaders.c
diff --git a/src/ip/QosConfig.cc b/src/ip/QosConfig.cc
new file mode 100644 (file)
index 0000000..3ce3687
--- /dev/null
@@ -0,0 +1,69 @@
+#include "squid.h"
+
+#if USE_ZPH_QOS
+
+#include "QosConfig.h"
+#include "Store.h"
+
+QosConfig::QosConfig() : 
+       tos_local_hit(0),
+       tos_sibling_hit(0),
+       tos_parent_hit(0),
+       preserve_miss_tos(1),
+       preserve_miss_tos_mask(255)
+{
+    ;
+}
+
+void
+QosConfig::parseConfigLine()
+{
+    // %i honors 0 and 0x prefixes, which are important for things like umask
+    /* parse options ... */
+    char *token;
+    while( (token = strtok(NULL, w_space)) ) {
+
+        if(strncmp(token, "local-hit=",10) == 0) {
+            sscanf(&token[10], "%i", &tos_local_hit);
+        }
+        else if(strncmp(token, "sibling-hit=",12) == 0) {
+            sscanf(&token[12], "%i", &tos_sibling_hit);
+        }
+        else if(strncmp(token, "parent-hit=",11) == 0) {
+            sscanf(&token[11], "%i", &tos_parent_hit);
+        }
+        else if(strcmp(token, "disable-preserve-miss") == 0) {
+            preserve_miss_tos = 0;
+            preserve_miss_tos_mask = 0;
+        }
+        else if(preserve_miss_tos && strncmp(token, "miss-mask=",10) == 0) {
+            sscanf(&token[10], "%i", &preserve_miss_tos_mask);
+        }
+    }
+}
+
+void
+QosConfig::dumpConfigLine(StoreEntry * entry, const char *name) const
+{
+    storeAppendPrintf(entry, "%s", name);
+
+    if (tos_local_hit >0) {
+        storeAppendPrintf(entry, " local-hit=%2x", tos_local_hit);
+    }
+
+    if (tos_sibling_hit >0) {
+        storeAppendPrintf(entry, " sibling-hit=%2x", tos_sibling_hit);
+    }
+    if (tos_parent_hit >0) {
+        storeAppendPrintf(entry, " parent-hit=%2x", tos_parent_hit);
+    }
+    if (preserve_miss_tos != 0) {
+        storeAppendPrintf(entry, " disable-preserve-miss");
+    }
+    if (preserve_miss_tos && preserve_miss_tos_mask != 0) {
+        storeAppendPrintf(entry, " miss-mask=%2x", preserve_miss_tos_mask);
+    }
+    storeAppendPrintf(entry, "\n");
+}
+
+#endif /* USE_ZPH_QOS */
diff --git a/src/ip/QosConfig.h b/src/ip/QosConfig.h
new file mode 100644 (file)
index 0000000..61d400a
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef SQUID_QOSCONFIG_H
+#define SQUID_QOSCONFIG_H
+
+#include "config.h"
+
+#if USE_ZPH_QOS
+
+class StoreEntry;
+
+class QosConfig
+{
+public:
+    int tos_local_hit;
+    int tos_sibling_hit;
+    int tos_parent_hit;
+    int preserve_miss_tos;
+    int preserve_miss_tos_mask;
+
+public:
+    QosConfig();
+    ~QosConfig() {};
+
+    void parseConfigLine();
+    void dumpConfigLine(StoreEntry *entry, const char *name) const;
+};
+
+/* legacy parser access wrappers */
+#define parse_QosConfig(X)     (X)->parseConfigLine()
+#define dump_QosConfig(e,n,X)  (X).dumpConfigLine(e,n)
+#define free_QosConfig(X)
+
+#endif /* USE_ZPH_QOS */
+#endif /* SQUID_QOSCONFIG_H */
diff --git a/src/ip/stubQosConfig.cc b/src/ip/stubQosConfig.cc
new file mode 100644 (file)
index 0000000..dc7a666
--- /dev/null
@@ -0,0 +1,51 @@
+#include "squid.h"
+
+#if USE_ZPH_QOS
+
+#include "QosConfig.h"
+#include "Store.h"
+
+QosConfig::QosConfig() : 
+       tos_local_hit(0),
+       tos_sibling_hit(0),
+       tos_parent_hit(0),
+       preserve_miss_tos(1),
+       preserve_miss_tos_mask(255)
+{
+    ;
+}
+
+void
+QosConfig::parseConfigLine()
+{
+    // %i honors 0 and 0x prefixes, which are important for things like umask
+    /* parse options ... */
+    char *token;
+    while( (token = strtok(NULL, w_space)) ) {
+
+        if(strncmp(token, "local-hit=",10) == 0) {
+            sscanf(&token[10], "%i", &tos_local_hit);
+        }
+        else if(strncmp(token, "sibling-hit=",12) == 0) {
+            sscanf(&token[12], "%i", &tos_sibling_hit);
+        }
+        else if(strncmp(token, "parent-hit=",11) == 0) {
+            sscanf(&token[11], "%i", &tos_parent_hit);
+        }
+        else if(strcmp(token, "disable-preserve-miss") == 0) {
+            preserve_miss_tos = 0;
+            preserve_miss_tos_mask = 0;
+        }
+        else if(preserve_miss_tos && strncmp(token, "miss-mask=",10) == 0) {
+            sscanf(&token[10], "%i", &preserve_miss_tos_mask);
+        }
+    }
+}
+
+void
+QosConfig::dumpConfigLine(StoreEntry * entry, const char *name) const
+{
+    ; /* Not needed in stub */
+}
+
+#endif /* USE_ZPH_QOS */
index 4ab885692a5f4ae922b1c432b681f09022686600..c7bc3ad7245bb61b0621d5110d6517b4bfffcde2 100644 (file)
@@ -124,6 +124,10 @@ struct relist {
 #include "icmp/IcmpConfig.h"
 #endif
 
+#if USE_ZPH_QOS
+#include "QosConfig.h"
+#endif
+
 /* forward decl for SquidConfig, see RemovalPolicy.h */
 
 class RemovalPolicySettings;
@@ -443,10 +447,6 @@ struct SquidConfig {
         int log_uses_indirect_client;
 #endif /* FOLLOW_X_FORWARDED_FOR */
 
-#if USE_ZPH_QOS
-        int zph_tos_parent;
-        int zph_preserve_miss_tos;
-#endif
         int WIN32_IpAddrChangeMonitor;
     } onoff;
 
@@ -592,11 +592,11 @@ struct SquidConfig {
     int sleep_after_fork;      /* microseconds */
     time_t minimum_expiry_time;        /* seconds */
     external_acl *externalAclHelperList;
+
 #if USE_ZPH_QOS
-    int zph_tos_local;
-    int zph_tos_peer;
-    int zph_preserve_miss_tos_mask;
+    QosConfig zph;
 #endif
+
 #if USE_SSL
 
     struct {