1 --- /configure.in 2008-04-29 02:52:30 +0000
2 +++ /configure.in 2008-05-03 23:37:00 +0000
7 +AC_ARG_ENABLE(zph-qos,
8 +[ --enable-zph-qos Enable ZPH QOS support],
9 +[ if test "$enableval" = "yes" ; then
10 + echo "ZPH QOS enabled"
11 + AC_DEFINE(USE_ZPH_QOS,1,
12 + [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
13 + When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
17 AC_ARG_WITH(filedescriptors,
18 [ --with-filedescriptors=NUMBER
19 Force squid to support NUMBER filedescriptors],
21 --- /src/cf.data.pre 2008-05-02 11:12:10 +0000
22 +++ /src/cf.data.pre 2008-05-03 23:37:00 +0000
23 @@ -1103,6 +1103,66 @@
31 +LOC: Config.zph_tos_local
33 + Allows you to select a TOS/Diffserv value to mark local hits. Read above
34 + (tcp_outgoing_tos) for details/requirements about TOS.
35 + Default: 0 (disabled).
42 +LOC: Config.zph_tos_peer
44 + Allows you to select a TOS/Diffserv value to mark peer hits. Read above
45 + (tcp_outgoing_tos) for details/requirements about TOS.
46 + Default: 0 (disabled).
54 +LOC: Config.onoff.zph_tos_parent
56 + Set this to off if you want only sibling hits to be marked.
57 + If set to on (default), parent hits are being marked too.
60 +NAME: zph_preserve_miss_tos
65 +LOC: Config.onoff.zph_preserve_miss_tos
67 + If set to on (default), any HTTP response towards clients will
68 + have the TOS value of the response comming from the remote
69 + server masked with the value of zph_preserve_miss_tos_mask.
70 + For this to work correctly, you will need to patch your linux
71 + kernel with the TOS preserving ZPH patch.
72 + The kernel patch can be downloaded from http://zph.bratcheda.org
75 +NAME: zph_preserve_miss_tos_mask
79 +LOC: Config.zph_preserve_miss_tos_mask
81 + Allows you to mask certain bits in the TOS received from the
82 + remote server, before copying the value to the TOS send towards
84 + Default: 255 (TOS from server is not changed).
87 NAME: tcp_outgoing_address
91 --- /src/client_side_reply.cc 2008-03-30 14:29:57 +0000
92 +++ /src/client_side_reply.cc 2008-05-03 23:37:00 +0000
96 #include "MemObject.h"
100 #include "ACLChecklist.h"
103 @@ -1548,6 +1551,58 @@
104 /* guarantee nothing has been sent yet! */
105 assert(http->out.size == 0);
106 assert(http->out.offset == 0);
108 + if (Config.zph_tos_local ||
109 + Config.zph_tos_peer ||
110 + Config.onoff.zph_preserve_miss_tos && Config.zph_preserve_miss_tos_mask)
112 + int need_change = 0;
116 + int tos_len = sizeof(tos_old);
119 + if (Config.zph_tos_local)
123 + tos = Config.zph_tos_local;
125 + else if (Config.zph_tos_peer &&
126 + (http->request->hier.code==SIBLING_HIT ||
127 + Config.onoff.zph_tos_parent&&http->request->hier.code==PARENT_HIT))
129 + /* sibling or parent hit */
131 + tos = Config.zph_tos_peer;
134 + if (http->request->flags.proxy_keepalive)
136 + res = getsockopt(http->getConn()->fd, IPPROTO_IP, IP_TOS, &tos_old, (socklen_t*)&tos_len);
139 + debugs(33, 1, "ZPH: error in getsockopt(IP_TOS) on keepalived FD "<< http->getConn()->fd << " " << xstrerror());
141 + else if (hit && tos_old != tos)
143 + /* HIT: 1-st request, or previous was MISS,
144 + * or local/parent hit change.
155 + comm_set_tos(http->getConn()->fd,tos);
158 +#endif /* USE_ZPH_QOS */
159 tempBuffer.offset = reqofs;
160 tempBuffer.length = getNextNode()->readBuffer.length;
161 tempBuffer.data = getNextNode()->readBuffer.data;
162 @@ -1833,6 +1888,16 @@
167 + if (reqofs==0 && !logTypeIsATcpHit(http->logType) &&
168 + Config.onoff.zph_preserve_miss_tos &&
169 + Config.zph_preserve_miss_tos_mask)
171 + int tos = fd_table[fd].upstreamTOS & Config.zph_preserve_miss_tos_mask;
172 + comm_set_tos(fd,tos);
176 /* We've got the final data to start pushing... */
177 flags.storelogiccomplete = 1;
180 --- /src/fde.h 2007-08-13 23:20:50 +0000
181 +++ /src/fde.h 2008-05-03 23:37:00 +0000
187 + unsigned char upstreamTOS; /* see FwdState::dispatch() */
193 --- /src/forward.cc 2008-04-12 15:16:27 +0000
194 +++ /src/forward.cc 2008-05-03 23:37:00 +0000
197 netdbPingSite(request->host);
200 + /* Retrieves remote server TOS value, and stores it as part of the
201 + * original client request FD object. It is later used to forward
202 + * remote server's TOS in the response to the client in case of a MISS.
204 + fde * clientFde = &fd_table[client_fd];
208 + int tos_len = sizeof(tos);
209 + clientFde->upstreamTOS = 0;
210 + if (setsockopt(server_fd,SOL_IP,IP_RECVTOS,&tos,tos_len)==0)
212 + unsigned char buf[512];
214 + if (getsockopt(server_fd,SOL_IP,IP_PKTOPTIONS,buf,(socklen_t*)&len) == 0)
216 + /* Parse the PKTOPTIONS structure to locate the TOS data message
217 + * prepared in the kernel by the ZPH incoming TCP TOS preserving
220 + unsigned char * p = buf;
221 + while (p-buf < len)
223 + struct cmsghdr *o = (struct cmsghdr*)p;
224 + if (o->cmsg_len<=0)
227 + if (o->cmsg_level == SOL_IP && o->cmsg_type == IP_TOS)
229 + clientFde->upstreamTOS = (unsigned char)(*(int*)CMSG_DATA(o));
232 + p += CMSG_LEN(o->cmsg_len);
237 + debugs(33, 1, "ZPH: error in getsockopt(IP_PKTOPTIONS) on FD "<<server_fd<<" "<<xstrerror());
242 + debugs(33, 1, "ZPH: error in setsockopt(IP_RECVTOS) on FD "<<server_fd<<" "<<xstrerror());
247 if (servers && (p = servers->_peer)) {
249 request->peer_login = p->login;
251 --- /src/structs.h 2008-05-02 11:12:10 +0000
252 +++ /src/structs.h 2008-05-03 23:37:00 +0000
254 int httpd_suppress_version_string;
255 int global_internal_static;
256 int debug_override_X;
261 + int zph_tos_parent;
262 + int zph_preserve_miss_tos;
269 int sleep_after_fork; /* microseconds */
270 time_t minimum_expiry_time; /* seconds */
271 external_acl *externalAclHelperList;
275 + int zph_preserve_miss_tos_mask;