SOURCES: squid_hit_miss_mark.patch - up to 3.0STABLE8

dzeus dzeus at pld-linux.org
Fri Sep 19 00:07:26 CEST 2008


Author: dzeus                        Date: Thu Sep 18 22:07:26 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- up to 3.0STABLE8

---- Files affected:
SOURCES:
   squid_hit_miss_mark.patch (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: SOURCES/squid_hit_miss_mark.patch
diff -u SOURCES/squid_hit_miss_mark.patch:1.6 SOURCES/squid_hit_miss_mark.patch:1.7
--- SOURCES/squid_hit_miss_mark.patch:1.6	Wed May 14 23:38:03 2008
+++ SOURCES/squid_hit_miss_mark.patch	Fri Sep 19 00:07:20 2008
@@ -1,32 +1,12 @@
---- /configure.in	2008-04-29 02:52:30 +0000
-+++ /configure.in	2008-05-03 23:37:00 +0000
-@@ -1733,6 +1733,16 @@
-   fi
- ])
- 
-+AC_ARG_ENABLE(zph-qos,
-+[  --enable-zph-qos        Enable ZPH QOS support],
-+[ if test "$enableval" = "yes" ; then
-+    echo "ZPH QOS enabled"
-+    AC_DEFINE(USE_ZPH_QOS,1,
-+    [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
-+      When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
-+  fi
-+])
-+
- AC_ARG_WITH(filedescriptors,
- [  --with-filedescriptors=NUMBER
-                           Force squid to support NUMBER filedescriptors],
-
---- /src/cf.data.pre	2008-05-02 11:12:10 +0000
-+++ /src/cf.data.pre	2008-05-03 23:37:00 +0000
-@@ -1103,6 +1103,66 @@
+diff -Nur squid-3.0.STABLE8/src/cf.data.pre squid-3.0.STABLE8-zph/src/cf.data.pre
+--- squid-3.0.STABLE8/src/cf.data.pre	2008-07-18 13:02:53.000000000 +0300
++++ squid-3.0.STABLE8-zph/src/cf.data.pre	2008-08-22 13:25:45.000000000 +0300
+@@ -1119,6 +1119,60 @@
  	making the request.
  DOC_END
  
 +NAME: zph_tos_local
 +TYPE: int
-+IFDEF: USE_ZPH_QOS
 +DEFAULT: 0
 +LOC: Config.zph_tos_local
 +DOC_START
@@ -37,7 +17,6 @@
 +
 +NAME: zph_tos_peer
 +TYPE: int
-+IFDEF: USE_ZPH_QOS
 +DEFAULT: 0
 +LOC: Config.zph_tos_peer
 +DOC_START
@@ -49,9 +28,8 @@
 +NAME: zph_tos_parent
 +COMMENT: on|off
 +TYPE: onoff
-+IFDEF: USE_ZPH_QOS
-+DEFAULT: on
 +LOC: Config.onoff.zph_tos_parent
++DEFAULT: on
 +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.
@@ -60,21 +38,18 @@
 +NAME: zph_preserve_miss_tos
 +COMMENT: on|off
 +TYPE: onoff
-+IFDEF: USE_ZPH_QOS
-+DEFAULT: on
 +LOC: Config.onoff.zph_preserve_miss_tos
++DEFAULT: on
 +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
 +
 +NAME: zph_preserve_miss_tos_mask
 +TYPE: int
-+IFDEF: USE_ZPH_QOS
 +DEFAULT: 255
 +LOC: Config.zph_preserve_miss_tos_mask
 +DOC_START
@@ -87,193 +62,141 @@
  NAME: tcp_outgoing_address
  TYPE: acl_address
  DEFAULT: none
-
---- /src/client_side_reply.cc	2008-03-30 14:29:57 +0000
-+++ /src/client_side_reply.cc	2008-05-03 23:37:00 +0000
-@@ -48,6 +48,9 @@
+diff -Nur squid-3.0.STABLE8/src/client_side_reply.cc squid-3.0.STABLE8-zph/src/client_side_reply.cc
+--- squid-3.0.STABLE8/src/client_side_reply.cc	2008-07-18 13:02:54.000000000 +0300
++++ squid-3.0.STABLE8-zph/src/client_side_reply.cc	2008-08-22 13:25:54.000000000 +0300
+@@ -48,6 +48,7 @@
  #include "ESI.h"
  #endif
  #include "MemObject.h"
-+#if USE_ZPH_QOS
 +#include "fde.h"
-+#endif
  #include "ACLChecklist.h"
  #include "ACL.h"
  #if DELAY_POOLS
-@@ -1548,6 +1551,58 @@
+@@ -1548,6 +1549,11 @@
          /* guarantee nothing has been sent yet! */
          assert(http->out.size == 0);
          assert(http->out.offset == 0);
-+#if USE_ZPH_QOS        
-+        if (Config.zph_tos_local ||
-+        	Config.zph_tos_peer ||
-+	        Config.onoff.zph_preserve_miss_tos && Config.zph_preserve_miss_tos_mask)
-+		{
-+		   int need_change = 0;
-+		   int hit = 0;
-+		   int tos = 0;
-+		   int tos_old = 0;
-+		   int tos_len = sizeof(tos_old);
-+		   int res;
-+		               
-+		   if (Config.zph_tos_local)
-+		   {
-+			   /* local hit */
-+		       hit = 1;
-+		       tos = Config.zph_tos_local;
-+		   }
-+		   else if (Config.zph_tos_peer && 
-+			    	(http->request->hier.code==SIBLING_HIT ||
-+			    	Config.onoff.zph_tos_parent&&http->request->hier.code==PARENT_HIT))
-+		   {
-+			  /* sibling or parent hit */
-+		       hit = 1;
-+		       tos = Config.zph_tos_peer;
-+		   }
-+		   
-+		   if (http->request->flags.proxy_keepalive)
-+		   {
-+			   res = getsockopt(http->getConn()->fd, IPPROTO_IP, IP_TOS, &tos_old, (socklen_t*)&tos_len);
-+		       if (res < 0)
-+		       {
-+		           debugs(33, 1, "ZPH: error in getsockopt(IP_TOS) on keepalived FD "<< http->getConn()->fd << " " << xstrerror());
-+		       }
-+		       else if (hit && tos_old != tos)
-+		       {
-+		    	   /* HIT: 1-st request, or previous was MISS,
-+		    	    * or local/parent hit change.
-+		    	    */
-+		           need_change = 1;                    
-+		       }
-+		   }
-+		   else if (hit)
-+		   {
-+			   /* no keepalive */
-+		       need_change = 1;
-+		   }
-+		   if (need_change) {
-+			   comm_set_tos(http->getConn()->fd,tos);
-+		   }
-+		}        
-+#endif /* USE_ZPH_QOS */        
++        if (Config.zph_tos_local)
++      	{
++			debugs(33, 1, "ZPH hit hier.code=" << http->request->hier.code <<" TOS="<<Config.zph_tos_local);
++	    	comm_set_tos(http->getConn()->fd,Config.zph_tos_local);
++      	}             
          tempBuffer.offset = reqofs;
          tempBuffer.length = getNextNode()->readBuffer.length;
          tempBuffer.data = getNextNode()->readBuffer.data;
-@@ -1833,6 +1888,16 @@
-         body_buf = buf;
-     }
+@@ -1827,6 +1833,24 @@
+     char *buf = next()->readBuffer.data;
  
-+#if USE_ZPH_QOS    
-+    if (reqofs==0 && !logTypeIsATcpHit(http->logType) &&
-+       	Config.onoff.zph_preserve_miss_tos &&
-+       	Config.zph_preserve_miss_tos_mask)
+     char *body_buf = buf;
++    
++    if (reqofs==0 && !logTypeIsATcpHit(http->logType))
 +    {
-+    	int tos = fd_table[fd].upstreamTOS & Config.zph_preserve_miss_tos_mask;
-+    	comm_set_tos(fd,tos);
-+    }
-+#endif    
-+
-     /* We've got the final data to start pushing... */
-     flags.storelogiccomplete = 1;
- 
-
---- /src/fde.h	2007-08-13 23:20:50 +0000
-+++ /src/fde.h	2008-05-03 23:37:00 +0000
-@@ -106,6 +106,9 @@
++		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, 1, "ZPH: Peer hit, TOS="<<tos<<" hier.code="<<http->request->hier.code);
++		}
++		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;
++			debugs(33, 1, "ZPH: Preserving TOS on miss, TOS="<<tos);
++		}
++		comm_set_tos(fd,tos);
++    }     
+ 
+     if (buf != result.data) {
+         /* we've got to copy some data */
+diff -Nur squid-3.0.STABLE8/src/fde.h squid-3.0.STABLE8-zph/src/fde.h
+--- squid-3.0.STABLE8/src/fde.h	2008-07-18 13:02:54.000000000 +0300
++++ squid-3.0.STABLE8-zph/src/fde.h	2008-08-22 13:26:05.000000000 +0300
+@@ -106,7 +106,7 @@
          long handle;
      } win32;
  #endif
-+#if USE_ZPH_QOS
+-
 +    unsigned char upstreamTOS;			/* see FwdState::dispatch()  */
-+#endif
- 
  };
  
-
---- /src/forward.cc	2008-04-12 15:16:27 +0000
-+++ /src/forward.cc	2008-05-03 23:37:00 +0000
-@@ -964,6 +964,54 @@
+ #endif /* SQUID_FDE_H */
+diff -Nur squid-3.0.STABLE8/src/forward.cc squid-3.0.STABLE8-zph/src/forward.cc
+--- squid-3.0.STABLE8/src/forward.cc	2008-07-18 13:02:54.000000000 +0300
++++ squid-3.0.STABLE8-zph/src/forward.cc	2008-08-22 13:26:10.000000000 +0300
+@@ -964,6 +964,52 @@
  
      netdbPingSite(request->host);
  
-+#if USE_ZPH_QOS
 +    /* 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.
 +     */
-+    fde * clientFde = &fd_table[client_fd];
-+    if (clientFde)
-+    {
-+    	int tos = 1;
-+    	int tos_len = sizeof(tos);
-+    	clientFde->upstreamTOS = 0;
-+        if (setsockopt(server_fd,SOL_IP,IP_RECVTOS,&tos,tos_len)==0)
-+        {
-+           unsigned char buf[512];
-+           int len = 512;
-+           if (getsockopt(server_fd,SOL_IP,IP_PKTOPTIONS,buf,(socklen_t*)&len) == 0)
-+           {
-+               /* Parse the PKTOPTIONS structure to locate the TOS data message
-+                * prepared in the kernel by the ZPH incoming TCP TOS preserving
-+                * patch.
-+                */
-+        	   unsigned char * p = buf;
-+               while (p-buf < len)
-+               {
-+                  struct cmsghdr *o = (struct cmsghdr*)p;
-+                  if (o->cmsg_len<=0)
-+                     break;
-+    
-+                  if (o->cmsg_level == SOL_IP && o->cmsg_type == IP_TOS)
-+                  {
-+                	  clientFde->upstreamTOS = (unsigned char)(*(int*)CMSG_DATA(o));
-+                	  break;
-+                  }
-+                  p += CMSG_LEN(o->cmsg_len);
-+               }
-+           }
-+           else
-+           {
-+               debugs(33, 1, "ZPH: error in getsockopt(IP_PKTOPTIONS) on FD "<<server_fd<<" "<<xstrerror());
-+           }
-+        }
-+        else
-+        {
-+        	debugs(33, 1, "ZPH: error in setsockopt(IP_RECVTOS) on FD "<<server_fd<<" "<<xstrerror());
-+        }
-+    }    
-+#endif
++	fde * clientFde = &fd_table[client_fd];
++	if (clientFde)
++	{
++		int tos = 1;
++		int tos_len = sizeof(tos);
++		clientFde->upstreamTOS = 0;
++	    if (setsockopt(server_fd,SOL_IP,IP_RECVTOS,&tos,tos_len)==0)
++	    {
++	       unsigned char buf[512];
++	       int len = 512;
++	       if (getsockopt(server_fd,SOL_IP,IP_PKTOPTIONS,buf,(socklen_t*)&len) == 0)
++	       {
++	           /* Parse the PKTOPTIONS structure to locate the TOS data message
++	            * prepared in the kernel by the ZPH incoming TCP TOS preserving
++	            * patch.
++	            */
++	    	   unsigned char * p = buf;
++	           while (p-buf < len)
++	           {
++	              struct cmsghdr *o = (struct cmsghdr*)p;
++	              if (o->cmsg_len<=0)
++	                 break;
++	
++	              if (o->cmsg_level == SOL_IP && o->cmsg_type == IP_TOS)
++	              {
++	            	  clientFde->upstreamTOS = (unsigned char)(*(int*)CMSG_DATA(o));
++	            	  break;
++	              }
++	              p += CMSG_LEN(o->cmsg_len);
++	           }
++	       }
++	       else
++	       {
++	           debugs(33, 1, "ZPH: error in getsockopt(IP_PKTOPTIONS) on FD "<<server_fd<<" "<<xstrerror());
++	       }
++	    }
++	    else
++	    {
++	    	debugs(33, 1, "ZPH: error in setsockopt(IP_RECVTOS) on FD "<<server_fd<<" "<<xstrerror());
++	    }
++	}    
 +
      if (servers && (p = servers->_peer)) {
          p->stats.fetches++;
          request->peer_login = p->login;
-
---- /src/structs.h	2008-05-02 11:12:10 +0000
-+++ /src/structs.h	2008-05-03 23:37:00 +0000
-@@ -554,9 +554,11 @@
+diff -Nur squid-3.0.STABLE8/src/structs.h squid-3.0.STABLE8-zph/src/structs.h
+--- squid-3.0.STABLE8/src/structs.h	2008-07-18 13:02:54.000000000 +0300
++++ squid-3.0.STABLE8-zph/src/structs.h	2008-08-22 13:26:24.000000000 +0300
+@@ -553,6 +553,8 @@
+         int emailErrData;
          int httpd_suppress_version_string;
          int global_internal_static;
-         int debug_override_X;
--    }
--
--    onoff;
-+#if USE_ZPH_QOS
 +        int zph_tos_parent;
 +        int zph_preserve_miss_tos;
-+#endif
-+    } onoff;
- 
-     class ACL *aclList;
- 
-@@ -720,6 +722,11 @@
+         int debug_override_X;
+         int WIN32_IpAddrChangeMonitor;
+     }
+@@ -721,6 +723,9 @@
      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; 
-+#endif
++    int zph_preserve_miss_tos_mask;
  #if USE_SSL
  
      struct
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/squid_hit_miss_mark.patch?r1=1.6&r2=1.7&f=u



More information about the pld-cvs-commit mailing list