fqdncache.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 /* DEBUG: section 35 FQDN Cache */
10 
11 #include "squid.h"
12 #include "cbdata.h"
13 #include "dns/forward.h"
14 #include "dns/LookupDetails.h"
15 #include "dns/rfc1035.h"
16 #include "event.h"
17 #include "fqdncache.h"
18 #include "helper.h"
19 #include "mgr/Registration.h"
20 #include "snmp_agent.h"
21 #include "SquidConfig.h"
22 #include "StatCounters.h"
23 #include "Store.h"
24 #include "util.h"
25 
26 #if SQUID_SNMP
27 #include "snmp_core.h"
28 #endif
29 
31 
67 #define FQDN_LOW_WATER 90
69 
71 #define FQDN_HIGH_WATER 95
72 
80 {
82 
83 public:
84  fqdncache_entry(const char *name);
86 
87  hash_link hash; /* must be first */
88  time_t lastref;
89  time_t expires;
90  unsigned char name_count;
91  char *names[FQDN_MAX_NAMES + 1];
93  void *handlerData;
95 
96  struct timeval request_time;
98  unsigned short locks;
99 
100  struct Flags {
101  Flags() : negcached(false), fromhosts(false) {}
102 
103  bool negcached;
104  bool fromhosts;
105  } flags;
106 
107  int age() const;
108 };
109 
111 static struct _fqdn_cache_stats {
112  int requests;
113  int replies;
114  int hits;
115  int misses;
118 
121 
123 static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message);
124 static void fqdncacheRelease(fqdncache_entry *);
125 static void fqdncacheCallback(fqdncache_entry *, int wait);
126 static fqdncache_entry *fqdncache_get(const char *);
127 static int fqdncacheExpiredEntry(const fqdncache_entry *);
128 static void fqdncacheLockEntry(fqdncache_entry * f);
129 static void fqdncacheUnlockEntry(fqdncache_entry * f);
130 static void fqdncacheAddEntry(fqdncache_entry * f);
131 
133 static hash_table *fqdn_table = nullptr;
134 
136 static long fqdncache_low = 180;
137 
139 static long fqdncache_high = 200;
140 
142 inline int fqdncacheCount() { return fqdn_table ? fqdn_table->count : 0; }
143 
144 int
146 {
147  return request_time.tv_sec ? tvSubMsec(request_time, current_time) : -1;
148 }
149 
154 static void
156 {
158  debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f->hash) << "'.");
159  dlinkDelete(&f->lru, &lru_list);
160  delete f;
161 }
162 
168 static fqdncache_entry *
169 fqdncache_get(const char *name)
170 {
171  hash_link *e;
172  static fqdncache_entry *f;
173  f = nullptr;
174 
175  if (fqdn_table) {
176  if ((e = (hash_link *)hash_lookup(fqdn_table, name)) != nullptr)
177  f = (fqdncache_entry *) e;
178  }
179 
180  return f;
181 }
182 
184 static int
186 {
187  /* all static entries are locked, so this takes care of them too */
188 
189  if (f->locks != 0)
190  return 0;
191 
192  if (f->expires > squid_curtime)
193  return 0;
194 
195  return 1;
196 }
197 
199 void
201 {
202  dlink_node *m;
203  dlink_node *prev = nullptr;
204  fqdncache_entry *f;
205  int removed = 0;
206  eventAdd("fqdncache_purgelru", fqdncache_purgelru, nullptr, 10.0, 1);
207 
208  for (m = lru_list.tail; m; m = prev) {
210  break;
211 
212  prev = m->prev;
213 
214  f = (fqdncache_entry *)m->data;
215 
216  if (f->locks != 0)
217  continue;
218 
219  fqdncacheRelease(f);
220 
221  ++removed;
222  }
223 
224  debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries");
225 }
226 
228 static void
230 {
231  dlink_node *m = lru_list.head;
232  fqdncache_entry *i = nullptr;
233  fqdncache_entry *t;
234 
235  while (m) {
236  if (i != nullptr) { /* need to delay deletion */
237  fqdncacheRelease(i); /* we just override locks */
238  i = nullptr;
239  }
240 
241  t = (fqdncache_entry *)m->data;
242 
243  if (t->flags.fromhosts)
244  i = t;
245 
246  m = m->next;
247  }
248 
249  if (i != nullptr)
250  fqdncacheRelease(i);
251 }
252 
254  lastref(0),
255  expires(squid_curtime + Config.negativeDnsTtl),
256  name_count(0),
257  handler(nullptr),
258  handlerData(nullptr),
259  error_message(nullptr),
260  locks(0) // XXX: use Lock
261 {
262  hash.key = xstrdup(name);
263 
264  memset(&request_time, 0, sizeof(request_time));
265  memset(&names, 0, sizeof(names));
266 }
267 
269 static void
271 {
273 
274  if (nullptr != e) {
275  /* avoid collision */
276  fqdncache_entry *q = (fqdncache_entry *) e;
277  fqdncacheRelease(q);
278  }
279 
280  hash_join(fqdn_table, &f->hash);
281  dlinkAdd(f, &f->lru, &lru_list);
282  f->lastref = squid_curtime;
283 }
284 
290 static void
292 {
293  FQDNH *callback;
294  void *cbdata;
295  f->lastref = squid_curtime;
296 
297  if (!f->handler)
298  return;
299 
301 
302  callback = f->handler;
303 
304  f->handler = nullptr;
305 
307  const Dns::LookupDetails details(SBuf(f->error_message), wait);
308  callback(f->name_count ? f->names[0] : nullptr, details, cbdata);
309  }
310 
312 }
313 
315 static int
316 fqdncacheParse(fqdncache_entry *f, const rfc1035_rr * answers, int nr, const char *error_message)
317 {
318  int k;
319  int ttl = 0;
320  const char *name = (const char *)f->hash.key;
322  f->flags.negcached = true;
323 
324  if (nr < 0) {
325  debugs(35, 3, "fqdncacheParse: Lookup of '" << name << "' failed (" << error_message << ")");
326  f->error_message = xstrdup(error_message);
327  return -1;
328  }
329 
330  if (nr == 0) {
331  debugs(35, 3, "fqdncacheParse: No DNS records for '" << name << "'");
332  f->error_message = xstrdup("No DNS records");
333  return 0;
334  }
335 
336  debugs(35, 3, "fqdncacheParse: " << nr << " answers for '" << name << "'");
337  assert(answers);
338 
339  for (k = 0; k < nr; ++k) {
340  if (answers[k]._class != RFC1035_CLASS_IN)
341  continue;
342 
343  if (answers[k].type == RFC1035_TYPE_PTR) {
344  if (!answers[k].rdata[0]) {
345  debugs(35, 2, "fqdncacheParse: blank PTR record for '" << name << "'");
346  continue;
347  }
348 
349  if (strchr(answers[k].rdata, ' ')) {
350  debugs(35, 2, "fqdncacheParse: invalid PTR record '" << answers[k].rdata << "' for '" << name << "'");
351  continue;
352  }
353 
354  f->names[f->name_count] = xstrdup(answers[k].rdata);
355  ++ f->name_count;
356  } else if (answers[k].type != RFC1035_TYPE_CNAME)
357  continue;
358 
359  if (ttl == 0 || (int) answers[k].ttl < ttl)
360  ttl = answers[k].ttl;
361 
362  if (f->name_count >= FQDN_MAX_NAMES)
363  break;
364  }
365 
366  if (f->name_count == 0) {
367  debugs(35, DBG_IMPORTANT, "fqdncacheParse: No PTR record for '" << name << "'");
368  return 0;
369  }
370 
371  if (ttl > Config.positiveDnsTtl)
372  ttl = Config.positiveDnsTtl;
373 
374  if (ttl < Config.negativeDnsTtl)
375  ttl = Config.negativeDnsTtl;
376 
377  f->expires = squid_curtime + ttl;
378 
379  f->flags.negcached = false;
380 
381  return f->name_count;
382 }
383 
389 static void
390 fqdncacheHandleReply(void *data, const rfc1035_rr * answers, int na, const char *error_message, const bool lastAnswer)
391 {
392  assert(lastAnswer); // reverse DNS lookups do not generate multiple queries
393  fqdncache_entry *f;
394  static_cast<generic_cbdata *>(data)->unwrap(&f);
396  const int age = f->age();
398  fqdncacheParse(f, answers, na, error_message);
400  fqdncacheCallback(f, age);
401 }
402 
413 void
414 fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH * handler, void *handlerData)
415 {
416  fqdncache_entry *f = nullptr;
417  char name[MAX_IPSTRLEN];
418  generic_cbdata *c;
419  addr.toStr(name,MAX_IPSTRLEN);
420  debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name << "'.");
422 
423  if (name[0] == '\0') {
424  debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!");
425  static const Dns::LookupDetails details(SBuf("Invalid hostname"), -1); // error, no lookup
426  if (handler)
427  handler(nullptr, details, handlerData);
428  return;
429  }
430 
431  f = fqdncache_get(name);
432 
433  if (nullptr == f) {
434  /* miss */
435  (void) 0;
436  } else if (fqdncacheExpiredEntry(f)) {
437  /* hit, but expired -- bummer */
438  fqdncacheRelease(f);
439  f = nullptr;
440  } else {
441  /* hit */
442  debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name << "'");
443 
444  if (f->flags.negcached)
446  else
447  ++ FqdncacheStats.hits;
448 
449  f->handler = handler;
450 
451  f->handlerData = cbdataReference(handlerData);
452 
453  fqdncacheCallback(f, -1); // no lookup
454 
455  return;
456  }
457 
458  debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name << "'");
460  f = new fqdncache_entry(name);
461  f->handler = handler;
462  f->handlerData = cbdataReference(handlerData);
464  c = new generic_cbdata(f);
466 }
467 
480 const char *
481 fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
482 {
483  char name[MAX_IPSTRLEN];
484  fqdncache_entry *f = nullptr;
485 
486  if (addr.isAnyAddr() || addr.isNoAddr()) {
487  debugs(35, 7, "nothing to lookup: " << addr);
488  return nullptr;
489  }
490 
491  addr.toStr(name,MAX_IPSTRLEN);
493  f = fqdncache_get(name);
494 
495  if (nullptr == f) {
496  (void) 0;
497  } else if (fqdncacheExpiredEntry(f)) {
498  fqdncacheRelease(f);
499  f = nullptr;
500  } else if (f->flags.negcached) {
501  debugs(35, 5, "negative HIT: " << addr);
503  // ignore f->error_message: the caller just checks FQDN cache presence
504  return nullptr;
505  } else {
506  debugs(35, 5, "HIT: " << addr);
507  ++ FqdncacheStats.hits;
508  f->lastref = squid_curtime;
509  // ignore f->error_message: the caller just checks FQDN cache presence
510  return f->names[0];
511  }
512 
513  /* no entry [any more] */
514  debugs(35, 5, "MISS: " << addr);
516 
517  if (flags & FQDN_LOOKUP_IF_MISS) {
518  fqdncache_nbgethostbyaddr(addr, nullptr, nullptr);
519  }
520 
521  return nullptr;
522 }
523 
529 void
531 {
532  fqdncache_entry *f = nullptr;
533  int k;
534  int ttl;
535 
536  if (fqdn_table == nullptr)
537  return;
538 
539  storeAppendPrintf(sentry, "FQDN Cache Statistics:\n");
540 
541  storeAppendPrintf(sentry, "FQDNcache Entries In Use: %d\n",
542  fqdncache_entry::UseCount());
543 
544  storeAppendPrintf(sentry, "FQDNcache Entries Cached: %d\n",
545  fqdncacheCount());
546 
547  storeAppendPrintf(sentry, "FQDNcache Requests: %d\n",
549 
550  storeAppendPrintf(sentry, "FQDNcache Hits: %d\n",
552 
553  storeAppendPrintf(sentry, "FQDNcache Negative Hits: %d\n",
555 
556  storeAppendPrintf(sentry, "FQDNcache Misses: %d\n",
558 
559  storeAppendPrintf(sentry, "FQDN Cache Contents:\n\n");
560 
561  storeAppendPrintf(sentry, "%-45.45s %3s %3s %3s %s\n",
562  "Address", "Flg", "TTL", "Cnt", "Hostnames");
563 
565 
566  while ((f = (fqdncache_entry *) hash_next(fqdn_table))) {
567  ttl = (f->flags.fromhosts ? -1 : (f->expires - squid_curtime));
568  storeAppendPrintf(sentry, "%-45.45s %c%c %3.3d % 3d",
569  hashKeyStr(&f->hash),
570  f->flags.negcached ? 'N' : ' ',
571  f->flags.fromhosts ? 'H' : ' ',
572  ttl,
573  (int) f->name_count);
574 
575  for (k = 0; k < (int) f->name_count; ++k)
576  storeAppendPrintf(sentry, " %s", f->names[k]);
577 
578  storeAppendPrintf(sentry, "\n");
579  }
580 }
581 
583 static void
585 {
586  if (f->locks++ == 0) {
587  dlinkDelete(&f->lru, &lru_list);
588  dlinkAdd(f, &f->lru, &lru_list);
589  }
590 }
591 
593 static void
595 {
596  assert(f->locks > 0);
597  -- f->locks;
598 
599  if (fqdncacheExpiredEntry(f))
600  fqdncacheRelease(f);
601 }
602 
604 {
605  for (int k = 0; k < (int)name_count; ++k)
606  xfree(names[k]);
607 
608  xfree(hash.key);
610 }
611 
619 void
621 {
622  fqdncache_high = (long) (((float) Config.fqdncache.size *
623  (float) FQDN_HIGH_WATER) / (float) 100);
624  fqdncache_low = (long) (((float) Config.fqdncache.size *
625  (float) FQDN_LOW_WATER) / (float) 100);
627 }
628 
635 void
636 fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
637 {
638  fqdncache_entry *fce= fqdncache_get(addr);
639  if (fce) {
640  if (1 == fce->flags.fromhosts) {
642  } else if (fce->locks > 0) {
643  debugs(35, DBG_IMPORTANT, "WARNING: can't add static entry for locked address '" << addr << "'");
644  return;
645  } else {
646  fqdncacheRelease(fce);
647  }
648  }
649 
650  fce = new fqdncache_entry(addr);
651 
652  int j = 0;
653  for (auto &h : hostnames) {
654  fce->names[j] = xstrdup(h.c_str());
655  Tolower(fce->names[j]);
656  ++j;
657 
658  if (j >= FQDN_MAX_NAMES)
659  break;
660  }
661 
662  fce->name_count = j;
663  fce->names[j] = nullptr; /* it's safe */
664  fce->flags.fromhosts = true;
665  fqdncacheAddEntry(fce);
666  fqdncacheLockEntry(fce);
667 }
668 
670 static void
672 {
673  Mgr::RegisterAction("fqdncache", "FQDN Cache Stats and Contents",
674  fqdnStats, 0, 1);
675 
676 }
677 
684 void
686 {
687  int n;
688 
690 
691  if (fqdn_table)
692  return;
693 
694  debugs(35, 3, "Initializing FQDN Cache...");
695 
696  memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
697  lru_list = dlink_list();
698 
699  fqdncache_high = (long) (((float) Config.fqdncache.size *
700  (float) FQDN_HIGH_WATER) / (float) 100);
701 
702  fqdncache_low = (long) (((float) Config.fqdncache.size *
703  (float) FQDN_LOW_WATER) / (float) 100);
704 
705  n = hashPrime(fqdncache_high / 4);
706 
707  fqdn_table = hash_create((HASHCMP *) strcmp, n, hash4);
708 }
709 
710 #if SQUID_SNMP
711 
717 {
718  variable_list *Answer = nullptr;
719  MemBuf tmp;
720  debugs(49, 5, "snmp_netFqdnFn: Processing request:" << snmpDebugOid(Var->name, Var->name_length, tmp));
721  *ErrP = SNMP_ERR_NOERROR;
722 
723  switch (Var->name[LEN_SQ_NET + 1]) {
724 
725  case FQDN_ENT:
726  Answer = snmp_var_new_integer(Var->name, Var->name_length,
727  fqdncacheCount(),
728  SMI_GAUGE32);
729  break;
730 
731  case FQDN_REQ:
732  Answer = snmp_var_new_integer(Var->name, Var->name_length,
734  SMI_COUNTER32);
735  break;
736 
737  case FQDN_HITS:
738  Answer = snmp_var_new_integer(Var->name, Var->name_length,
740  SMI_COUNTER32);
741  break;
742 
743  case FQDN_PENDHIT:
744  /* this is now worthless */
745  Answer = snmp_var_new_integer(Var->name, Var->name_length,
746  0,
747  SMI_GAUGE32);
748  break;
749 
750  case FQDN_NEGHIT:
751  Answer = snmp_var_new_integer(Var->name, Var->name_length,
753  SMI_COUNTER32);
754  break;
755 
756  case FQDN_MISS:
757  Answer = snmp_var_new_integer(Var->name, Var->name_length,
759  SMI_COUNTER32);
760  break;
761 
762  case FQDN_GHBN:
763  Answer = snmp_var_new_integer(Var->name, Var->name_length,
764  0, /* deprecated */
765  SMI_COUNTER32);
766  break;
767 
768  default:
769  *ErrP = SNMP_ERR_NOSUCHNAME;
770  break;
771  }
772 
773  return Answer;
774 }
775 
776 #endif /*SQUID_SNMP */
777 
struct timeval request_time
Definition: fqdncache.cc:96
#define FQDN_LOOKUP_IF_MISS
Definition: defines.h:34
static long fqdncache_high
Definition: fqdncache.cc:139
#define RFC1035_TYPE_CNAME
Definition: rfc1035.h:94
void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *)
MEMPROXY_CLASS(fqdncache_entry)
const char * snmpDebugOid(oid *Name, snint Len, MemBuf &outbuf)
Definition: snmp_core.cc:1056
time_t expires
Definition: fqdncache.cc:89
bool fromhosts
Definition: fqdncache.cc:104
#define cbdataReferenceValidDone(var, ptr)
Definition: cbdata.h:239
void fqdnStats(StoreEntry *sentry)
Definition: fqdncache.cc:530
bool isAnyAddr() const
Definition: Address.cc:190
static IDNSCB fqdncacheHandleReply
Definition: fqdncache.cc:122
std::list< SBuf > SBufList
Definition: forward.h:22
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:855
void hash_remove_link(hash_table *, hash_link *)
Definition: hash.cc:220
struct SquidConfig::@94 fqdncache
Definition: SBuf.h:93
unsigned short locks
Definition: fqdncache.cc:98
static long fqdncache_low
Definition: fqdncache.cc:136
#define xstrdup
@ FQDN_REQ
Definition: cache_snmp.h:204
@ FQDN_ENT
Definition: cache_snmp.h:203
Definition: cbdata.cc:37
hash_link * hash_lookup(hash_table *, const void *)
Definition: hash.cc:146
int HASHCMP(const void *, const void *)
Definition: hash.h:13
struct StatCounters::@116 dns
int count
Definition: hash.h:31
HASHHASH hash4
Definition: hash.h:46
int hashPrime(int n)
Definition: hash.cc:293
#define cbdataReference(var)
Definition: cbdata.h:348
void fqdncache_init(void)
Definition: fqdncache.cc:685
const char * hashKeyStr(const hash_link *)
Definition: hash.cc:313
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
Definition: fqdncache.cc:30
int tvSubMsec(struct timeval t1, struct timeval t2)
Definition: gadgets.cc:51
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:812
int name_length
Definition: snmp_vars.h:71
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
oid * name
Definition: snmp_vars.h:70
#define FQDN_MAX_NAMES
Definition: defines.h:35
#define FQDN_HIGH_WATER
Definition: fqdncache.cc:71
void fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
Definition: fqdncache.cc:636
#define RFC1035_TYPE_PTR
Definition: rfc1035.h:95
int64_t snint
Definition: cache_snmp.h:14
void Tolower(char *)
Definition: util.cc:28
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:18
StatHist svcTime
Definition: StatCounters.h:99
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
Definition: fqdncache.cc:481
hash_link hash
Definition: fqdncache.cc:87
static fqdncache_entry * fqdncache_get(const char *)
Definition: fqdncache.cc:169
static hash_table * fqdn_table
Definition: fqdncache.cc:133
static void fqdncacheRelease(fqdncache_entry *)
Definition: fqdncache.cc:155
void fqdncache_purgelru(void *)
Definition: fqdncache.cc:200
struct fqdncache_entry::Flags flags
Definition: MemBuf.h:23
#define SMI_GAUGE32
Definition: snmp_vars.h:77
struct variable_list * snmp_var_new_integer(oid *, int, int, unsigned char)
Definition: snmp_vars.c:151
@ FQDN_NEGHIT
Definition: cache_snmp.h:207
time_t positiveDnsTtl
Definition: SquidConfig.h:106
Flags()
Definition: fqdncache.cc:101
void count(double val)
Definition: StatHist.cc:55
#define assert(EX)
Definition: assert.h:17
time_t negativeDnsTtl
Definition: SquidConfig.h:105
encapsulates DNS lookup results
Definition: LookupDetails.h:22
static void fqdncacheAddEntry(fqdncache_entry *f)
Definition: fqdncache.cc:270
dlink_node lru
Definition: fqdncache.cc:97
Definition: fqdncache.cc:79
variable_list * snmp_netFqdnFn(variable_list *Var, snint *ErrP)
Definition: fqdncache.cc:716
time_t squid_curtime
Definition: stub_libtime.cc:20
void hash_first(hash_table *)
Definition: hash.cc:172
void fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH *handler, void *handlerData)
Definition: fqdncache.cc:414
static void purge_entries_fromhosts(void)
Definition: fqdncache.cc:229
bool isNoAddr() const
Definition: Address.cc:304
#define xfree
unsigned int ttl
Definition: rfc1035.h:42
static void fqdncacheLockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:584
@ FQDN_GHBN
Definition: cache_snmp.h:209
int fqdncacheCount()
Definition: fqdncache.cc:142
static void fqdncacheRegisterWithCacheManager(void)
Definition: fqdncache.cc:671
Definition: fqdncache.cc:100
#define FQDN_LOW_WATER
Definition: fqdncache.cc:68
time_t lastref
Definition: fqdncache.cc:88
@ FQDN_HITS
Definition: cache_snmp.h:205
char * error_message
Definition: fqdncache.cc:94
void * handlerData
Definition: fqdncache.cc:93
#define LEN_SQ_NET
Definition: cache_snmp.h:49
@ FQDN_PENDHIT
Definition: cache_snmp.h:206
void IDNSCB(void *cbdata, const rfc1035_rr *answer, const int recordsInAnswer, const char *error, bool lastAnswer)
Definition: forward.h:17
hash_table * hash_create(HASHCMP *, int, HASHHASH *)
Definition: hash.cc:108
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
Definition: Registration.cc:54
unsigned char name_count
Definition: fqdncache.cc:90
static void fqdncacheUnlockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:594
static struct _fqdn_cache_stats FqdncacheStats
static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message)
Definition: fqdncache.cc:316
#define DBG_IMPORTANT
Definition: Stream.h:38
char * names[FQDN_MAX_NAMES+1]
Definition: fqdncache.cc:91
void fqdncache_restart(void)
Definition: fqdncache.cc:620
#define SNMP_ERR_NOSUCHNAME
Definition: snmp_error.h:44
void FQDNH(const char *, const Dns::LookupDetails &details, void *)
Definition: fqdncache.h:26
@ FQDN_MISS
Definition: cache_snmp.h:208
#define RFC1035_CLASS_IN
Definition: rfc1035.h:96
int age() const
time passed since request_time or -1 if unknown
Definition: fqdncache.cc:145
fqdncache_entry(const char *name)
Definition: fqdncache.cc:253
bool negcached
Definition: fqdncache.cc:103
static int fqdncacheExpiredEntry(const fqdncache_entry *)
Definition: fqdncache.cc:185
hash_link * hash_next(hash_table *)
Definition: hash.cc:188
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
~fqdncache_entry()
Definition: fqdncache.cc:603
FQDNH * handler
Definition: fqdncache.cc:92
void hash_join(hash_table *, hash_link *)
Definition: hash.cc:131
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
static void fqdncacheCallback(fqdncache_entry *, int wait)
Definition: fqdncache.cc:291
#define SNMP_ERR_NOERROR
Definition: snmp_error.h:42
class SquidConfig Config
Definition: SquidConfig.cc:12
int unsigned int
Definition: stub_fd.cc:19
#define SMI_COUNTER32
Definition: snmp_vars.h:76
StatCounters statCounter
Definition: StatCounters.cc:12
static dlink_list lru_list
Definition: fqdncache.cc:120

 

Introduction

Documentation

Support

Miscellaneous