QosConfig.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "acl/Gadgets.h"
11 #include "cache_cf.h"
12 #include "comm/Connection.h"
13 #include "compat/cmsg.h"
14 #include "ConfigParser.h"
15 #include "fde.h"
16 #include "globals.h"
17 #include "hier_code.h"
18 #include "ip/QosConfig.h"
19 #include "ip/tools.h"
20 #include "Parsing.h"
21 
22 #include <cerrno>
23 
25 
27 {
29  delete next;
30 }
31 
33 
35 {
37  delete next;
38 }
39 
40 void
42 {
43 #if USE_QOS_TOS && _SQUID_LINUX_
44  /* Bug 2537: This part of ZPH only applies to patched Linux kernels. */
45  tos_t tos = 1;
46  int tos_len = sizeof(tos);
47  clientFde->tosFromServer = 0;
48  if (setsockopt(server->fd,SOL_IP,IP_RECVTOS,&tos,tos_len)==0) {
49  unsigned char buf[512];
50  int len = 512;
51  if (getsockopt(server->fd,SOL_IP,IP_PKTOPTIONS,buf,(socklen_t*)&len) == 0) {
52  /* Parse the PKTOPTIONS structure to locate the TOS data message
53  * prepared in the kernel by the ZPH incoming TCP TOS preserving
54  * patch.
55  */
56  unsigned char * pbuf = buf;
57  while (pbuf-buf < len) {
58  struct cmsghdr *o = (struct cmsghdr*)pbuf;
59  if (o->cmsg_len<=0)
60  break;
61 
62  if (o->cmsg_level == SOL_IP && o->cmsg_type == IP_TOS) {
63  int *tmp = (int*)SQUID_CMSG_DATA(o);
64  clientFde->tosFromServer = (tos_t)*tmp;
65  break;
66  }
67  pbuf += CMSG_LEN(o->cmsg_len);
68  }
69  } else {
70  int xerrno = errno;
71  debugs(33, DBG_IMPORTANT, "QOS: error in getsockopt(IP_PKTOPTIONS) on " << server << " " << xstrerr(xerrno));
72  }
73  } else {
74  int xerrno = errno;
75  debugs(33, DBG_IMPORTANT, "QOS: error in setsockopt(IP_RECVTOS) on " << server << " " << xstrerr(xerrno));
76  }
77 #endif
78 }
79 
81 {
82 #if USE_LIBNETFILTERCONNTRACK
83  /* Allocate a new conntrack */
84  if (struct nf_conntrack *ct = nfct_new()) {
85 
86  /* Prepare data needed to find the connection in the conntrack table.
87  * We need the local and remote IP address, and the local and remote
88  * port numbers.
89  */
90 
91  if (Ip::EnableIpv6 && server->local.isIPv6()) {
92  nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET6);
93  struct in6_addr serv_fde_remote_ip6;
94  server->remote.getInAddr(serv_fde_remote_ip6);
95  nfct_set_attr(ct, ATTR_IPV6_DST, serv_fde_remote_ip6.s6_addr);
96  struct in6_addr serv_fde_local_ip6;
97  server->local.getInAddr(serv_fde_local_ip6);
98  nfct_set_attr(ct, ATTR_IPV6_SRC, serv_fde_local_ip6.s6_addr);
99  } else {
100  nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET);
101  struct in_addr serv_fde_remote_ip;
102  server->remote.getInAddr(serv_fde_remote_ip);
103  nfct_set_attr_u32(ct, ATTR_IPV4_DST, serv_fde_remote_ip.s_addr);
104  struct in_addr serv_fde_local_ip;
105  server->local.getInAddr(serv_fde_local_ip);
106  nfct_set_attr_u32(ct, ATTR_IPV4_SRC, serv_fde_local_ip.s_addr);
107  }
108 
109  nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_TCP);
110  nfct_set_attr_u16(ct, ATTR_PORT_DST, htons(server->remote.port()));
111  nfct_set_attr_u16(ct, ATTR_PORT_SRC, htons(server->local.port()));
112 
113  /* Open a handle to the conntrack */
114  if (struct nfct_handle *h = nfct_open(CONNTRACK, 0)) {
115  /* Register the callback. The callback function will record the mark value. */
116  nfct_callback_register(h, NFCT_T_ALL, getNfMarkCallback, (void *)clientFde);
117  /* Query the conntrack table using the data previously set */
118  int x = nfct_query(h, NFCT_Q_GET, ct);
119  if (x == -1) {
120  debugs(17, 2, "QOS: Failed to retrieve connection mark: (" << x << ") " << strerror(errno)
121  << " (Destination " << server->remote << ", source " << server->local << ")" );
122  }
123  nfct_close(h);
124  } else {
125  debugs(17, 2, "QOS: Failed to open conntrack handle for upstream netfilter mark retrieval.");
126  }
127  nfct_destroy(ct);
128 
129  } else {
130  debugs(17, 2, "QOS: Failed to allocate new conntrack for upstream netfilter mark retrieval.");
131  }
132 #endif
133 }
134 
135 #if USE_LIBNETFILTERCONNTRACK
136 int
137 Ip::Qos::getNfMarkCallback(enum nf_conntrack_msg_type,
138  struct nf_conntrack *ct,
139  void *data)
140 {
141  fde *clientFde = (fde *)data;
142  clientFde->nfmarkFromServer = nfct_get_attr_u32(ct, ATTR_MARK);
143  debugs(17, 3, "QOS: Retrieved connection mark value: " << clientFde->nfmarkFromServer);
144 
145  return NFCT_CB_CONTINUE;
146 }
147 #endif
148 
149 int
151 {
152  tos_t tos = 0;
153  if (Ip::Qos::TheConfig.tosSiblingHit && hierCode==SIBLING_HIT) {
154  tos = Ip::Qos::TheConfig.tosSiblingHit;
155  debugs(33, 2, "QOS: Sibling Peer hit with hier code=" << hierCode << ", TOS=" << int(tos));
156  } else if (Ip::Qos::TheConfig.tosParentHit && hierCode==PARENT_HIT) {
157  tos = Ip::Qos::TheConfig.tosParentHit;
158  debugs(33, 2, "QOS: Parent Peer hit with hier code=" << hierCode << ", TOS=" << int(tos));
159  } else if (Ip::Qos::TheConfig.preserveMissTos) {
160  tos = fd_table[conn->fd].tosFromServer & Ip::Qos::TheConfig.preserveMissTosMask;
161  tos = (tos & ~Ip::Qos::TheConfig.tosMissMask) | (Ip::Qos::TheConfig.tosMiss & Ip::Qos::TheConfig.tosMissMask);
162  debugs(33, 2, "QOS: Preserving TOS on miss, TOS=" << int(tos));
163  } else if (Ip::Qos::TheConfig.tosMiss) {
164  tos = Ip::Qos::TheConfig.tosMiss & Ip::Qos::TheConfig.tosMissMask;
165  debugs(33, 2, "QOS: Cache miss, setting TOS=" << int(tos));
166  }
167  return setSockTos(conn, tos);
168 }
169 
170 int
172 {
173  nfmark_t mark = 0;
174  if (Ip::Qos::TheConfig.markSiblingHit && hierCode==SIBLING_HIT) {
175  mark = Ip::Qos::TheConfig.markSiblingHit;
176  debugs(33, 2, "QOS: Sibling Peer hit with hier code=" << hierCode << ", Mark=" << mark);
177  } else if (Ip::Qos::TheConfig.markParentHit && hierCode==PARENT_HIT) {
178  mark = Ip::Qos::TheConfig.markParentHit;
179  debugs(33, 2, "QOS: Parent Peer hit with hier code=" << hierCode << ", Mark=" << mark);
180  } else if (Ip::Qos::TheConfig.preserveMissMark) {
181  mark = fd_table[conn->fd].nfmarkFromServer & Ip::Qos::TheConfig.preserveMissMarkMask;
182  mark = (mark & ~Ip::Qos::TheConfig.markMissMask) | (Ip::Qos::TheConfig.markMiss & Ip::Qos::TheConfig.markMissMask);
183  debugs(33, 2, "QOS: Preserving mark on miss, Mark=" << mark);
184  } else if (Ip::Qos::TheConfig.markMiss) {
185  mark = Ip::Qos::TheConfig.markMiss & Ip::Qos::TheConfig.markMissMask;
186  debugs(33, 2, "QOS: Cache miss, setting Mark=" << mark);
187  }
188  return setSockNfmark(conn, mark);
189 }
190 
191 int
193 {
194  debugs(33, 2, "QOS: Setting TOS for local hit, TOS=" << int(Ip::Qos::TheConfig.tosLocalHit));
195  return setSockTos(conn, Ip::Qos::TheConfig.tosLocalHit);
196 }
197 
198 int
200 {
201  debugs(33, 2, "QOS: Setting netfilter mark for local hit, mark=" << Ip::Qos::TheConfig.markLocalHit);
202  return setSockNfmark(conn, Ip::Qos::TheConfig.markLocalHit);
203 }
204 
205 /* Qos::Config class */
206 
208 
209 Ip::Qos::Config::Config() : tosLocalHit(0), tosSiblingHit(0), tosParentHit(0),
210  tosMiss(0), tosMissMask(0), preserveMissTos(false),
211  preserveMissTosMask(0xFF), markLocalHit(0), markSiblingHit(0),
212  markParentHit(0), markMiss(0), markMissMask(0),
213  preserveMissMark(false), preserveMissMarkMask(0xFFFFFFFF),
214  tosToServer(NULL), tosToClient(NULL), nfmarkToServer(NULL),
215  nfmarkToClient(NULL)
216 {
217 }
218 
219 void
221 {
222  /* parse options ... */
223  char *token;
224  /* These are set as appropriate and then used to check whether the initial loop has been done */
225  bool mark = false;
226  bool tos = false;
227  /* Assume preserve is true. We don't set at initialisation as this affects isHitTosActive().
228  We have to do this now, as we may never match the 'tos' parameter below */
229 #if !USE_QOS_TOS
230  debugs(3, DBG_CRITICAL, "ERROR: Invalid option 'qos_flows'. QOS features not enabled in this build");
231  self_destruct();
232 #endif
233 
234  while ( (token = ConfigParser::NextToken()) ) {
235 
236  // Work out TOS or mark. Default to TOS for backwards compatibility
237  if (!(mark || tos)) {
238  if (strncmp(token, "mark",4) == 0) {
239 #if SO_MARK && USE_LIBCAP
240  mark = true;
241  // Assume preserve is true. We don't set at initialisation as this affects isHitNfmarkActive()
242 #if USE_LIBNETFILTERCONNTRACK
243  preserveMissMark = true;
244 # else // USE_LIBNETFILTERCONNTRACK
245  preserveMissMark = false;
246  debugs(3, DBG_IMPORTANT, "WARNING: Squid not compiled with Netfilter conntrack library. "
247  << "Netfilter mark preservation not available.");
248 #endif // USE_LIBNETFILTERCONNTRACK
249 #elif SO_MARK // SO_MARK && USE_LIBCAP
250  debugs(3, DBG_CRITICAL, "ERROR: Invalid parameter 'mark' in qos_flows option. "
251  << "Linux Netfilter marking not available without LIBCAP support.");
252  self_destruct();
253 #else // SO_MARK && USE_LIBCAP
254  debugs(3, DBG_CRITICAL, "ERROR: Invalid parameter 'mark' in qos_flows option. "
255  << "Linux Netfilter marking not available on this platform.");
256  self_destruct();
257 #endif // SO_MARK && USE_LIBCAP
258  } else if (strncmp(token, "tos",3) == 0) {
259  preserveMissTos = true;
260  tos = true;
261  } else {
262  preserveMissTos = true;
263  tos = true;
264  }
265  }
266 
267  if (strncmp(token, "local-hit=",10) == 0) {
268 
269  if (mark) {
270  if (!xstrtoui(&token[10], NULL, &markLocalHit, 0, std::numeric_limits<nfmark_t>::max())) {
271  debugs(3, DBG_CRITICAL, "ERROR: Bad mark local-hit value " << &token[10]);
272  self_destruct();
273  }
274  } else {
275  unsigned int v = 0;
276  if (!xstrtoui(&token[10], NULL, &v, 0, std::numeric_limits<tos_t>::max())) {
277  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS local-hit value " << &token[10]);
278  self_destruct();
279  }
280  tosLocalHit = (tos_t)v;
281  }
282 
283  } else if (strncmp(token, "sibling-hit=",12) == 0) {
284 
285  if (mark) {
286  if (!xstrtoui(&token[12], NULL, &markSiblingHit, 0, std::numeric_limits<nfmark_t>::max())) {
287  debugs(3, DBG_CRITICAL, "ERROR: Bad mark sibling-hit value " << &token[12]);
288  self_destruct();
289  }
290  } else {
291  unsigned int v = 0;
292  if (!xstrtoui(&token[12], NULL, &v, 0, std::numeric_limits<tos_t>::max())) {
293  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS sibling-hit value " << &token[12]);
294  self_destruct();
295  }
296  tosSiblingHit = (tos_t)v;
297  }
298 
299  } else if (strncmp(token, "parent-hit=",11) == 0) {
300 
301  if (mark) {
302  if (!xstrtoui(&token[11], NULL, &markParentHit, 0, std::numeric_limits<nfmark_t>::max())) {
303  debugs(3, DBG_CRITICAL, "ERROR: Bad mark parent-hit value " << &token[11]);
304  self_destruct();
305  }
306  } else {
307  unsigned int v = 0;
308  if (!xstrtoui(&token[11], NULL, &v, 0, std::numeric_limits<tos_t>::max())) {
309  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS parent-hit value " << &token[11]);
310  self_destruct();
311  }
312  tosParentHit = (tos_t)v;
313  }
314 
315  } else if (strncmp(token, "miss=",5) == 0) {
316 
317  char *end;
318  if (mark) {
319  if (!xstrtoui(&token[5], &end, &markMiss, 0, std::numeric_limits<nfmark_t>::max())) {
320  debugs(3, DBG_CRITICAL, "ERROR: Bad mark miss value " << &token[5]);
321  self_destruct();
322  }
323  if (*end == '/') {
324  if (!xstrtoui(end + 1, NULL, &markMissMask, 0, std::numeric_limits<nfmark_t>::max())) {
325  debugs(3, DBG_CRITICAL, "ERROR: Bad mark miss mask value " << (end + 1) << ". Using 0xFFFFFFFF instead.");
326  markMissMask = 0xFFFFFFFF;
327  }
328  } else {
329  markMissMask = 0xFFFFFFFF;
330  }
331  } else {
332  unsigned int v = 0;
333  if (!xstrtoui(&token[5], &end, &v, 0, std::numeric_limits<tos_t>::max())) {
334  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS miss value " << &token[5]);
335  self_destruct();
336  }
337  tosMiss = (tos_t)v;
338  if (*end == '/') {
339  if (!xstrtoui(end + 1, NULL, &v, 0, std::numeric_limits<tos_t>::max())) {
340  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS miss mask value " << (end + 1) << ". Using 0xFF instead.");
341  tosMissMask = 0xFF;
342  } else
343  tosMissMask = (tos_t)v;
344  } else {
345  tosMissMask = 0xFF;
346  }
347  }
348 
349  } else if (strcmp(token, "disable-preserve-miss") == 0) {
350 
351  if (preserveMissTosMask!=0xFFU || preserveMissMarkMask!=0xFFFFFFFFU) {
352  debugs(3, DBG_CRITICAL, "ERROR: miss-mask feature cannot be set with disable-preserve-miss");
353  self_destruct();
354  }
355  if (mark) {
356  preserveMissMark = false;
357  preserveMissMarkMask = 0;
358  } else {
359  preserveMissTos = false;
360  preserveMissTosMask = 0;
361  }
362 
363  } else if (strncmp(token, "miss-mask=",10) == 0) {
364 
365  if (mark && preserveMissMark) {
366  if (!xstrtoui(&token[10], NULL, &preserveMissMarkMask, 0, std::numeric_limits<nfmark_t>::max())) {
367  debugs(3, DBG_CRITICAL, "ERROR: Bad mark miss-mark value " << &token[10]);
368  self_destruct();
369  }
370  } else if (preserveMissTos) {
371  unsigned int v = 0;
372  if (!xstrtoui(&token[10], NULL, &v, 0, std::numeric_limits<tos_t>::max())) {
373  debugs(3, DBG_CRITICAL, "ERROR: Bad TOS miss-mark value " << &token[10]);
374  self_destruct();
375  }
376  preserveMissTosMask = (tos_t)v;
377  } else {
378  debugs(3, DBG_CRITICAL, "ERROR: miss-mask feature cannot be set without miss-preservation enabled");
379  self_destruct();
380  }
381 
382  }
383  }
384 }
385 
391 void
392 Ip::Qos::Config::dumpConfigLine(char *entry, const char *name) const
393 {
394  char *p = entry;
395  if (isHitTosActive()) {
396 
397  p += snprintf(p, 11, "%s", name); // strlen("qos_flows ");
398  p += snprintf(p, 4, "%s", "tos");
399 
400  if (tosLocalHit > 0) {
401  p += snprintf(p, 16, " local-hit=0x%02X", tosLocalHit);
402  }
403  if (tosSiblingHit > 0) {
404  p += snprintf(p, 18, " sibling-hit=0x%02X", tosSiblingHit);
405  }
406  if (tosParentHit > 0) {
407  p += snprintf(p, 17, " parent-hit=0x%02X", tosParentHit);
408  }
409  if (tosMiss > 0) {
410  p += snprintf(p, 11, " miss=0x%02X", tosMiss);
411  if (tosMissMask!=0xFFU) {
412  p += snprintf(p, 6, "/0x%02X", tosMissMask);
413  }
414  }
415  if (preserveMissTos == 0) {
416  p += snprintf(p, 23, " disable-preserve-miss");
417  }
418  if (preserveMissTos && preserveMissTosMask != 0) {
419  p += snprintf(p, 16, " miss-mask=0x%02X", preserveMissTosMask);
420  }
421  p += snprintf(p, 2, "\n");
422  }
423 
424  if (isHitNfmarkActive()) {
425  p += snprintf(p, 11, "%s", name); // strlen("qos_flows ");
426  p += snprintf(p, 5, "%s", "mark");
427 
428  if (markLocalHit > 0) {
429  p += snprintf(p, 22, " local-hit=0x%02X", markLocalHit);
430  }
431  if (markSiblingHit > 0) {
432  p += snprintf(p, 24, " sibling-hit=0x%02X", markSiblingHit);
433  }
434  if (markParentHit > 0) {
435  p += snprintf(p, 23, " parent-hit=0x%02X", markParentHit);
436  }
437  if (markMiss > 0) {
438  p += snprintf(p, 17, " miss=0x%02X", markMiss);
439  if (markMissMask!=0xFFFFFFFFU) {
440  p += snprintf(p, 12, "/0x%02X", markMissMask);
441  }
442  }
443  if (preserveMissMark == false) {
444  p += snprintf(p, 23, " disable-preserve-miss");
445  }
446  if (preserveMissMark && preserveMissMarkMask != 0) {
447  p += snprintf(p, 22, " miss-mask=0x%02X", preserveMissMarkMask);
448  }
449  p += snprintf(p, 2, "\n");
450  }
451 }
452 
453 int
454 Ip::Qos::setSockTos(const int fd, tos_t tos, int type)
455 {
456  // Bug 3731: FreeBSD produces 'invalid option'
457  // unless we pass it a 32-bit variable storing 8-bits of data.
458  // NP: it is documented as 'int' for all systems, even those like Linux which accept 8-bit char
459  // so we convert to a int before setting.
460  int bTos = tos;
461 
462  debugs(50, 3, "for FD " << fd << " to " << bTos);
463 
464  if (type == AF_INET) {
465 #if defined(IP_TOS)
466  const int x = setsockopt(fd, IPPROTO_IP, IP_TOS, &bTos, sizeof(bTos));
467  if (x < 0) {
468  int xerrno = errno;
469  debugs(50, 2, "setsockopt(IP_TOS) on " << fd << ": " << xstrerr(xerrno));
470  }
471  return x;
472 #else
473  debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IP_TOS) not supported on this platform");
474  return -1;
475 #endif
476  } else { // type == AF_INET6
477 #if defined(IPV6_TCLASS)
478  const int x = setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &bTos, sizeof(bTos));
479  if (x < 0) {
480  int xerrno = errno;
481  debugs(50, 2, "setsockopt(IPV6_TCLASS) on " << fd << ": " << xstrerr(xerrno));
482  }
483  return x;
484 #else
485  debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IPV6_TCLASS) not supported on this platform");
486  return -1;
487 #endif
488  }
489 
490  /* CANNOT REACH HERE */
491 }
492 
493 int
495 {
496  const int x = Ip::Qos::setSockTos(conn->fd, tos, conn->remote.isIPv4() ? AF_INET : AF_INET6);
497  conn->tos = (x >= 0) ? tos : 0;
498  return x;
499 }
500 
501 int
502 Ip::Qos::setSockNfmark(const int fd, nfmark_t mark)
503 {
504 #if SO_MARK && USE_LIBCAP
505  debugs(50, 3, "for FD " << fd << " to " << mark);
506  const int x = setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(nfmark_t));
507  if (x < 0) {
508  int xerrno = errno;
509  debugs(50, 2, "setsockopt(SO_MARK) on " << fd << ": " << xstrerr(xerrno));
510  }
511  return x;
512 #elif USE_LIBCAP
513  debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(SO_MARK) not supported on this platform");
514  return -1;
515 #else
516  debugs(50, DBG_IMPORTANT, "WARNING: Netfilter marking disabled (netfilter marking requires build with LIBCAP)");
517  return -1;
518 #endif
519 }
520 
521 int
523 {
524  const int x = Ip::Qos::setSockNfmark(conn->fd, mark);
525  conn->nfmark = (x >= 0) ? mark : 0;
526  return x;
527 }
528 
529 bool
531 {
532  acl_nfmark * nfmarkAcls [] = { nfmarkToServer, nfmarkToClient };
533 
534  for (int i=0; i<2; ++i) {
535  while (nfmarkAcls[i]) {
536  acl_nfmark *l = nfmarkAcls[i];
537  if (l->nfmark > 0)
538  return true;
539  nfmarkAcls[i] = l->next;
540  }
541  }
542 
543  return false;
544 }
545 
546 bool
548 {
549  acl_tos * tosAcls [] = { tosToServer, tosToClient };
550 
551  for (int i=0; i<2; ++i) {
552  while (tosAcls[i]) {
553  acl_tos *l = tosAcls[i];
554  if (l->tos > 0)
555  return true;
556  tosAcls[i] = l->next;
557  }
558  }
559 
560  return false;
561 }
562 
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream...
Definition: QosConfig.h:215
int socklen_t
Definition: types.h:158
bool isAclNfmarkActive() const
Definition: QosConfig.cc:530
#define fd_table
Definition: fde.h:157
int cmsg_level
Definition: cmsg.h:37
char * strerror(int ern)
Definition: strerror.c:22
int cmsg_type
Definition: cmsg.h:38
nfmark_t nfmark
Definition: Connection.h:150
int type
Definition: errorpage.cc:79
void self_destruct(void)
Definition: cache_cf.cc:255
int i
Definition: membanger.c:49
unsigned int nfmarkFromServer
Definition: fde.h:150
acl_tos * next
Definition: QosConfig.h:35
void dumpConfigLine(char *entry, const char *name) const
Definition: QosConfig.cc:392
#define SQUID_CMSG_DATA(cmsg)
Definition: cmsg.h:51
#define DBG_CRITICAL
Definition: Debug.h:44
char * p
Definition: membanger.c:43
int conn
the current server connection FD
Definition: Transport.cc:26
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition: QosConfig.h:218
#define CMSG_LEN(len)
Definition: cmsg.h:77
A const & max(A const &lhs, A const &rhs)
tos_t tos
Definition: QosConfig.h:37
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:171
acl_nfmark * next
Definition: QosConfig.h:49
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:211
unsigned char tos_t
Definition: forward.h:26
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:212
bool isIPv6() const
Definition: Address.cc:157
const char * xstrerr(int error)
Definition: xstrerror.cc:83
void const char HLPCB void * data
Definition: stub_helper.cc:16
tos_t tosFromServer
Definition: fde.h:145
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:223
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:213
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:220
#define DBG_IMPORTANT
Definition: Debug.h:45
Definition: cmsg.h:35
static char * NextToken()
Config TheConfig
Globally available instance of Qos::Config.
Definition: QosConfig.cc:207
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition: QosConfig.h:210
bool isIPv4() const
Definition: Address.cc:151
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
void const char * buf
Definition: stub_helper.cc:16
unsigned short port() const
Definition: Address.cc:786
Ip::Address local
Definition: Connection.h:135
~acl_tos()
Definition: QosConfig.cc:26
Ip::Address remote
Definition: Connection.h:138
hier_code
Definition: hier_code.h:12
void parseConfigLine()
Definition: QosConfig.cc:220
ACLList * aclList
Definition: QosConfig.h:50
Config TheConfig
Definition: Config.cc:16
static char server[MAXLINE]
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:219
CBDATA_CLASS_INIT(acl_tos)
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:199
int EnableIpv6
Whether IPv6 is supported and type of support.
Definition: tools.h:25
Definition: fde.h:49
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:522
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:221
bool getInAddr(struct in_addr &) const
Definition: Address.cc:1038
bool isAclTosActive() const
Definition: QosConfig.cc:547
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:192
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:494
void aclDestroyAclList(ACLList **list)
Definition: Gadgets.cc:275
void getNfmarkFromServer(const Comm::ConnectionPointer &server, const fde *clientFde)
Definition: QosConfig.cc:80
bool xstrtoui(const char *s, char **end, unsigned int *value, unsigned int min, unsigned int max)
Definition: xstrto.cc:86
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition: QosConfig.cc:41
uint32_t nfmark_t
Definition: forward.h:25
nfmark_t nfmark
Definition: QosConfig.h:51
#define NULL
Definition: types.h:166
ACLList * aclList
Definition: QosConfig.h:36
#define false
Definition: GnuRegex.c:233
unsigned int cmsg_len
Definition: cmsg.h:36
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:150
Definition: Address.cc:190

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors