fqdncache.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 "SquidConfig.h"
21 #include "SquidTime.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 
65 #define FQDN_LOW_WATER 90
67 
69 #define FQDN_HIGH_WATER 95
70 
78 {
80 
81 public:
82  fqdncache_entry(const char *name);
84 
85  hash_link hash; /* must be first */
86  time_t lastref;
87  time_t expires;
88  unsigned char name_count;
89  char *names[FQDN_MAX_NAMES + 1];
91  void *handlerData;
93 
94  struct timeval request_time;
96  unsigned short locks;
97 
98  struct Flags {
100 
101  bool negcached;
102  bool fromhosts;
103  } flags;
104 
105  int age() const;
106 };
107 
109 static struct _fqdn_cache_stats {
110  int requests;
111  int replies;
112  int hits;
113  int misses;
116 
119 
121 static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message);
122 static void fqdncacheRelease(fqdncache_entry *);
123 static void fqdncacheCallback(fqdncache_entry *, int wait);
124 static fqdncache_entry *fqdncache_get(const char *);
125 static int fqdncacheExpiredEntry(const fqdncache_entry *);
126 static void fqdncacheLockEntry(fqdncache_entry * f);
127 static void fqdncacheUnlockEntry(fqdncache_entry * f);
129 static void fqdncacheAddEntry(fqdncache_entry * f);
130 
133 
135 static long fqdncache_low = 180;
136 
138 static long fqdncache_high = 200;
139 
141 inline int fqdncacheCount() { return fqdn_table ? fqdn_table->count : 0; }
142 
143 int
145 {
146  return request_time.tv_sec ? tvSubMsec(request_time, current_time) : -1;
147 }
148 
153 static void
155 {
156  hash_remove_link(fqdn_table, (hash_link *) f);
157  debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f->hash) << "'.");
158  dlinkDelete(&f->lru, &lru_list);
159  delete f;
160 }
161 
167 static fqdncache_entry *
168 fqdncache_get(const char *name)
169 {
170  hash_link *e;
171  static fqdncache_entry *f;
172  f = NULL;
173 
174  if (fqdn_table) {
175  if ((e = (hash_link *)hash_lookup(fqdn_table, name)) != NULL)
176  f = (fqdncache_entry *) e;
177  }
178 
179  return f;
180 }
181 
183 static int
185 {
186  /* all static entries are locked, so this takes care of them too */
187 
188  if (f->locks != 0)
189  return 0;
190 
191  if (f->expires > squid_curtime)
192  return 0;
193 
194  return 1;
195 }
196 
198 void
200 {
201  dlink_node *m;
202  dlink_node *prev = NULL;
203  fqdncache_entry *f;
204  int removed = 0;
205  eventAdd("fqdncache_purgelru", fqdncache_purgelru, NULL, 10.0, 1);
206 
207  for (m = lru_list.tail; m; m = prev) {
209  break;
210 
211  prev = m->prev;
212 
213  f = (fqdncache_entry *)m->data;
214 
215  if (f->locks != 0)
216  continue;
217 
218  fqdncacheRelease(f);
219 
220  ++removed;
221  }
222 
223  debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries");
224 }
225 
227 static void
229 {
230  dlink_node *m = lru_list.head;
232  fqdncache_entry *t;
233 
234  while (m) {
235  if (i != NULL) { /* need to delay deletion */
236  fqdncacheRelease(i); /* we just override locks */
237  i = NULL;
238  }
239 
240  t = (fqdncache_entry *)m->data;
241 
242  if (t->flags.fromhosts)
243  i = t;
244 
245  m = m->next;
246  }
247 
248  if (i != NULL)
249  fqdncacheRelease(i);
250 }
251 
253  lastref(0),
254  expires(squid_curtime + Config.negativeDnsTtl),
255  name_count(0),
256  handler(nullptr),
257  handlerData(nullptr),
258  error_message(nullptr),
259  locks(0) // XXX: use Lock
260 {
261  hash.key = xstrdup(name);
262 
263  memset(&request_time, 0, sizeof(request_time));
264  memset(&names, 0, sizeof(names));
265 }
266 
268 static void
270 {
271  hash_link *e = (hash_link *)hash_lookup(fqdn_table, f->hash.key);
272 
273  if (NULL != e) {
274  /* avoid colission */
275  fqdncache_entry *q = (fqdncache_entry *) e;
276  fqdncacheRelease(q);
277  }
278 
279  hash_join(fqdn_table, &f->hash);
280  dlinkAdd(f, &f->lru, &lru_list);
281  f->lastref = squid_curtime;
282 }
283 
289 static void
291 {
292  FQDNH *callback;
293  void *cbdata;
294  f->lastref = squid_curtime;
295 
296  if (!f->handler)
297  return;
298 
300 
301  callback = f->handler;
302 
303  f->handler = NULL;
304 
305  if (cbdataReferenceValidDone(f->handlerData, &cbdata)) {
306  const Dns::LookupDetails details(f->error_message, wait);
307  callback(f->name_count ? f->names[0] : NULL, details, cbdata);
308  }
309 
311 }
312 
314 static int
315 fqdncacheParse(fqdncache_entry *f, const rfc1035_rr * answers, int nr, const char *error_message)
316 {
317  int k;
318  int ttl = 0;
319  const char *name = (const char *)f->hash.key;
321  f->flags.negcached = true;
322 
323  if (nr < 0) {
324  debugs(35, 3, "fqdncacheParse: Lookup of '" << name << "' failed (" << error_message << ")");
325  f->error_message = xstrdup(error_message);
326  return -1;
327  }
328 
329  if (nr == 0) {
330  debugs(35, 3, "fqdncacheParse: No DNS records for '" << name << "'");
331  f->error_message = xstrdup("No DNS records");
332  return 0;
333  }
334 
335  debugs(35, 3, "fqdncacheParse: " << nr << " answers for '" << name << "'");
336  assert(answers);
337 
338  for (k = 0; k < nr; ++k) {
339  if (answers[k]._class != RFC1035_CLASS_IN)
340  continue;
341 
342  if (answers[k].type == RFC1035_TYPE_PTR) {
343  if (!answers[k].rdata[0]) {
344  debugs(35, 2, "fqdncacheParse: blank PTR record for '" << name << "'");
345  continue;
346  }
347 
348  if (strchr(answers[k].rdata, ' ')) {
349  debugs(35, 2, "fqdncacheParse: invalid PTR record '" << answers[k].rdata << "' for '" << name << "'");
350  continue;
351  }
352 
353  f->names[f->name_count] = xstrdup(answers[k].rdata);
354  ++ f->name_count;
355  } else if (answers[k].type != RFC1035_TYPE_CNAME)
356  continue;
357 
358  if (ttl == 0 || (int) answers[k].ttl < ttl)
359  ttl = answers[k].ttl;
360 
361  if (f->name_count >= FQDN_MAX_NAMES)
362  break;
363  }
364 
365  if (f->name_count == 0) {
366  debugs(35, DBG_IMPORTANT, "fqdncacheParse: No PTR record for '" << name << "'");
367  return 0;
368  }
369 
370  if (ttl > Config.positiveDnsTtl)
371  ttl = Config.positiveDnsTtl;
372 
373  if (ttl < Config.negativeDnsTtl)
374  ttl = Config.negativeDnsTtl;
375 
376  f->expires = squid_curtime + ttl;
377 
378  f->flags.negcached = false;
379 
380  return f->name_count;
381 }
382 
388 static void
389 fqdncacheHandleReply(void *data, const rfc1035_rr * answers, int na, const char *error_message, const bool lastAnswer)
390 {
391  assert(lastAnswer); // reverse DNS lookups do not generate multiple queries
392  fqdncache_entry *f;
393  static_cast<generic_cbdata *>(data)->unwrap(&f);
395  const int age = f->age();
397  fqdncacheParse(f, answers, na, error_message);
399  fqdncacheCallback(f, age);
400 }
401 
412 void
414 {
415  fqdncache_entry *f = NULL;
416  char name[MAX_IPSTRLEN];
417  generic_cbdata *c;
418  addr.toStr(name,MAX_IPSTRLEN);
419  debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name << "'.");
421 
422  if (name[0] == '\0') {
423  debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!");
424  const Dns::LookupDetails details("Invalid hostname", -1); // error, no lookup
425  if (handler)
426  handler(NULL, details, handlerData);
427  return;
428  }
429 
430  f = fqdncache_get(name);
431 
432  if (NULL == f) {
433  /* miss */
434  (void) 0;
435  } else if (fqdncacheExpiredEntry(f)) {
436  /* hit, but expired -- bummer */
437  fqdncacheRelease(f);
438  f = NULL;
439  } else {
440  /* hit */
441  debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name << "'");
442 
443  if (f->flags.negcached)
445  else
446  ++ FqdncacheStats.hits;
447 
448  f->handler = handler;
449 
450  f->handlerData = cbdataReference(handlerData);
451 
452  fqdncacheCallback(f, -1); // no lookup
453 
454  return;
455  }
456 
457  debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name << "'");
459  f = new fqdncache_entry(name);
460  f->handler = handler;
461  f->handlerData = cbdataReference(handlerData);
463  c = new generic_cbdata(f);
465 }
466 
479 const char *
481 {
482  char name[MAX_IPSTRLEN];
483  fqdncache_entry *f = NULL;
484 
485  if (addr.isAnyAddr() || addr.isNoAddr()) {
486  return NULL;
487  }
488 
489  addr.toStr(name,MAX_IPSTRLEN);
491  f = fqdncache_get(name);
492 
493  if (NULL == f) {
494  (void) 0;
495  } else if (fqdncacheExpiredEntry(f)) {
496  fqdncacheRelease(f);
497  f = NULL;
498  } else if (f->flags.negcached) {
500  // ignore f->error_message: the caller just checks FQDN cache presence
501  return NULL;
502  } else {
503  ++ FqdncacheStats.hits;
504  f->lastref = squid_curtime;
505  // ignore f->error_message: the caller just checks FQDN cache presence
506  return f->names[0];
507  }
508 
509  /* no entry [any more] */
510 
512 
513  if (flags & FQDN_LOOKUP_IF_MISS) {
515  }
516 
517  return NULL;
518 }
519 
525 void
527 {
528  fqdncache_entry *f = NULL;
529  int k;
530  int ttl;
531 
532  if (fqdn_table == NULL)
533  return;
534 
535  storeAppendPrintf(sentry, "FQDN Cache Statistics:\n");
536 
537  storeAppendPrintf(sentry, "FQDNcache Entries In Use: %d\n",
539 
540  storeAppendPrintf(sentry, "FQDNcache Entries Cached: %d\n",
541  fqdncacheCount());
542 
543  storeAppendPrintf(sentry, "FQDNcache Requests: %d\n",
545 
546  storeAppendPrintf(sentry, "FQDNcache Hits: %d\n",
548 
549  storeAppendPrintf(sentry, "FQDNcache Negative Hits: %d\n",
551 
552  storeAppendPrintf(sentry, "FQDNcache Misses: %d\n",
554 
555  storeAppendPrintf(sentry, "FQDN Cache Contents:\n\n");
556 
557  storeAppendPrintf(sentry, "%-45.45s %3s %3s %3s %s\n",
558  "Address", "Flg", "TTL", "Cnt", "Hostnames");
559 
560  hash_first(fqdn_table);
561 
562  while ((f = (fqdncache_entry *) hash_next(fqdn_table))) {
563  ttl = (f->flags.fromhosts ? -1 : (f->expires - squid_curtime));
564  storeAppendPrintf(sentry, "%-45.45s %c%c %3.3d % 3d",
565  hashKeyStr(&f->hash),
566  f->flags.negcached ? 'N' : ' ',
567  f->flags.fromhosts ? 'H' : ' ',
568  ttl,
569  (int) f->name_count);
570 
571  for (k = 0; k < (int) f->name_count; ++k)
572  storeAppendPrintf(sentry, " %s", f->names[k]);
573 
574  storeAppendPrintf(sentry, "\n");
575  }
576 }
577 
579 static void
581 {
582  if (f->locks++ == 0) {
583  dlinkDelete(&f->lru, &lru_list);
584  dlinkAdd(f, &f->lru, &lru_list);
585  }
586 }
587 
589 static void
591 {
592  assert(f->locks > 0);
593  -- f->locks;
594 
595  if (fqdncacheExpiredEntry(f))
596  fqdncacheRelease(f);
597 }
598 
600 static void
602 {
603  fqdncache_entry *f = (fqdncache_entry *)data;
604  delete f;
605 }
606 
608 {
609  for (int k = 0; k < (int)name_count; ++k)
610  xfree(names[k]);
611 
612  xfree(hash.key);
614 }
615 
617 void
619 {
620  hashFreeItems(fqdn_table, fqdncacheFreeEntry);
621  hashFreeMemory(fqdn_table);
622  fqdn_table = NULL;
623 }
624 
632 void
634 {
635  fqdncache_high = (long) (((float) Config.fqdncache.size *
636  (float) FQDN_HIGH_WATER) / (float) 100);
637  fqdncache_low = (long) (((float) Config.fqdncache.size *
638  (float) FQDN_LOW_WATER) / (float) 100);
640 }
641 
648 void
650 {
651  fqdncache_entry *fce= fqdncache_get(addr);
652  if (fce) {
653  if (1 == fce->flags.fromhosts) {
655  } else if (fce->locks > 0) {
656  debugs(35, DBG_IMPORTANT, "WARNING: can't add static entry for locked address '" << addr << "'");
657  return;
658  } else {
659  fqdncacheRelease(fce);
660  }
661  }
662 
663  fce = new fqdncache_entry(addr);
664 
665  int j = 0;
666  for (auto &h : hostnames) {
667  fce->names[j] = xstrdup(h.c_str());
668  Tolower(fce->names[j]);
669  ++j;
670 
671  if (j >= FQDN_MAX_NAMES)
672  break;
673  }
674 
675  fce->name_count = j;
676  fce->names[j] = NULL; /* it's safe */
677  fce->flags.fromhosts = true;
678  fqdncacheAddEntry(fce);
679  fqdncacheLockEntry(fce);
680 }
681 
683 static void
685 {
686  Mgr::RegisterAction("fqdncache", "FQDN Cache Stats and Contents",
687  fqdnStats, 0, 1);
688 
689 }
690 
697 void
699 {
700  int n;
701 
703 
704  if (fqdn_table)
705  return;
706 
707  debugs(35, 3, "Initializing FQDN Cache...");
708 
709  memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
710  lru_list = dlink_list();
711 
712  fqdncache_high = (long) (((float) Config.fqdncache.size *
713  (float) FQDN_HIGH_WATER) / (float) 100);
714 
715  fqdncache_low = (long) (((float) Config.fqdncache.size *
716  (float) FQDN_LOW_WATER) / (float) 100);
717 
718  n = hashPrime(fqdncache_high / 4);
719 
720  fqdn_table = hash_create((HASHCMP *) strcmp, n, hash4);
721 }
722 
723 #if SQUID_SNMP
724 
730 {
731  variable_list *Answer = NULL;
732  MemBuf tmp;
733  debugs(49, 5, "snmp_netFqdnFn: Processing request:" << snmpDebugOid(Var->name, Var->name_length, tmp));
734  *ErrP = SNMP_ERR_NOERROR;
735 
736  switch (Var->name[LEN_SQ_NET + 1]) {
737 
738  case FQDN_ENT:
739  Answer = snmp_var_new_integer(Var->name, Var->name_length,
740  fqdncacheCount(),
741  SMI_GAUGE32);
742  break;
743 
744  case FQDN_REQ:
745  Answer = snmp_var_new_integer(Var->name, Var->name_length,
747  SMI_COUNTER32);
748  break;
749 
750  case FQDN_HITS:
751  Answer = snmp_var_new_integer(Var->name, Var->name_length,
753  SMI_COUNTER32);
754  break;
755 
756  case FQDN_PENDHIT:
757  /* this is now worthless */
758  Answer = snmp_var_new_integer(Var->name, Var->name_length,
759  0,
760  SMI_GAUGE32);
761  break;
762 
763  case FQDN_NEGHIT:
764  Answer = snmp_var_new_integer(Var->name, Var->name_length,
766  SMI_COUNTER32);
767  break;
768 
769  case FQDN_MISS:
770  Answer = snmp_var_new_integer(Var->name, Var->name_length,
772  SMI_COUNTER32);
773  break;
774 
775  case FQDN_GHBN:
776  Answer = snmp_var_new_integer(Var->name, Var->name_length,
777  0, /* deprecated */
778  SMI_COUNTER32);
779  break;
780 
781  default:
782  *ErrP = SNMP_ERR_NOSUCHNAME;
783  break;
784  }
785 
786  return Answer;
787 }
788 
789 #endif /*SQUID_SNMP */
790 
time_t negativeDnsTtl
Definition: SquidConfig.h:99
void fqdncache_restart(void)
Definition: fqdncache.cc:633
#define cbdataReferenceValidDone(var, ptr)
Definition: cbdata.h:256
void count(double val)
Definition: StatHist.cc:57
static int fqdncacheExpiredEntry(const fqdncache_entry *)
Definition: fqdncache.cc:184
StatCounters statCounter
Definition: StatCounters.cc:12
#define FQDN_HIGH_WATER
Definition: fqdncache.cc:69
#define assert(EX)
Definition: assert.h:17
SQUIDCEXTERN void hash_first(hash_table *)
Definition: hash.cc:176
void const char HLPCB * callback
Definition: stub_helper.cc:16
bool fromhosts
Definition: fqdncache.cc:102
Definition: fqdncache.cc:98
SQUIDCEXTERN void hashFreeMemory(hash_table *)
Definition: hash.cc:272
struct SquidConfig::@109 fqdncache
static fqdncache_entry * fqdncache_get(const char *)
Definition: fqdncache.cc:168
struct StatCounters::@133 dns
#define MEMPROXY_CLASS(CLASS)
#define SNMP_ERR_NOSUCHNAME
Definition: snmp_error.h:44
Definition: cbdata.cc:60
struct timeval request_time
Definition: fqdncache.cc:94
struct fqdncache_entry::Flags flags
int type
Definition: errorpage.cc:78
bool isNoAddr() const
Definition: Address.cc:277
char * names[FQDN_MAX_NAMES+1]
Definition: fqdncache.cc:89
fqdncache_entry(const char *name)
Definition: fqdncache.cc:252
void fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH *handler, void *handlerData)
Definition: fqdncache.cc:413
int i
Definition: membanger.c:49
#define xstrdup
int name_length
Definition: snmp_vars.h:47
variable_list * snmp_netFqdnFn(variable_list *Var, snint *ErrP)
Definition: fqdncache.cc:729
#define RFC1035_TYPE_CNAME
Definition: rfc1035.h:94
encapsulates DNS lookup results
Definition: LookupDetails.h:20
SQUIDCEXTERN void hash_join(hash_table *, hash_link *)
Definition: hash.cc:132
int age() const
time passed since request_time or -1 if unknown
Definition: fqdncache.cc:144
time_t lastref
Definition: fqdncache.cc:86
static long fqdncache_low
Definition: fqdncache.cc:135
void IDNSCB(void *cbdata, const rfc1035_rr *answer, const int recordsInAnswer, const char *error, bool lastAnswer)
Definition: forward.h:16
static struct _fqdn_cache_stats FqdncacheStats
StatHist svcTime
Definition: StatCounters.h:98
void FREE(void *)
Definition: forward.h:36
SQUIDCEXTERN void Tolower(char *)
Definition: util.c:28
struct timeval current_time
Definition: stub_time.cc:15
time_t squid_curtime
Definition: stub_time.cc:17
bool isAnyAddr() const
Definition: Address.cc:163
static dlink_list lru_list
Definition: fqdncache.cc:118
static void fqdncacheLockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:580
unsigned char name_count
Definition: fqdncache.cc:88
void FQDNH(const char *, const Dns::LookupDetails &details, void *)
Definition: fqdncache.h:23
static int UseCount()
Definition: fqdncache.cc:79
int tvSubMsec(struct timeval, struct timeval)
Definition: stub_time.cc:20
time_t expires
Definition: fqdncache.cc:87
void const char HLPCB void * data
Definition: stub_helper.cc:16
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:124
#define cbdataReference(var)
Definition: cbdata.h:341
#define DBG_IMPORTANT
Definition: Debug.h:46
static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message)
Definition: fqdncache.cc:315
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
int64_t snint
Definition: cache_snmp.h:14
void fqdncache_init(void)
Definition: fqdncache.cc:698
#define RFC1035_CLASS_IN
Definition: rfc1035.h:96
static IDNSCB fqdncacheHandleReply
Definition: fqdncache.cc:120
SQUIDCEXTERN hash_link * hash_lookup(hash_table *, const void *)
Definition: hash.cc:147
void * addr
Definition: membanger.c:46
#define RFC1035_TYPE_PTR
Definition: rfc1035.h:95
unsigned short locks
Definition: fqdncache.cc:96
#define SNMP_ERR_NOERROR
Definition: snmp_error.h:42
bool negcached
Definition: fqdncache.cc:101
static void fqdncacheRegisterWithCacheManager(void)
Definition: fqdncache.cc:684
static void fqdncacheAddEntry(fqdncache_entry *f)
Definition: fqdncache.cc:269
SQUIDCEXTERN hash_table * hash_create(HASHCMP *, int, HASHHASH *)
Definition: hash.cc:109
hash_link hash
Definition: fqdncache.cc:85
Definition: fqdncache.cc:77
SQUIDCEXTERN void hashFreeItems(hash_table *, HASHFREE *)
Definition: hash.cc:256
#define FQDN_LOW_WATER
Definition: fqdncache.cc:66
void fqdncache_purgelru(void *)
Definition: fqdncache.cc:199
Flags()
Definition: fqdncache.cc:99
#define FQDN_LOOKUP_IF_MISS
Definition: defines.h:48
static hash_table * fqdn_table
Definition: fqdncache.cc:132
static void handler(int signo)
Definition: purge.cc:860
oid * name
Definition: snmp_vars.h:46
static void fqdncacheRelease(fqdncache_entry *)
Definition: fqdncache.cc:154
void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *)
std::list< SBuf > SBufList
Definition: forward.h:22
void * handlerData
Definition: fqdncache.cc:91
void fqdncacheFreeMemory(void)
Definition: fqdncache.cc:618
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
Definition: fqdncache.cc:480
~fqdncache_entry()
Definition: fqdncache.cc:607
SQUIDCEXTERN hash_link * hash_next(hash_table *)
Definition: hash.cc:192
bool SIGHDLR int STUB void int
Definition: stub_tools.cc:68
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:109
SQUIDCEXTERN int hashPrime(int n)
Definition: hash.cc:297
FQDNH * handler
Definition: fqdncache.cc:90
static long fqdncache_high
Definition: fqdncache.cc:138
void fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
Definition: fqdncache.cc:649
dlink_node lru
Definition: fqdncache.cc:95
SQUIDCEXTERN const char * hashKeyStr(const hash_link *)
Definition: hash.cc:317
static void fqdncacheUnlockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:590
struct variable_list * snmp_var_new_integer(oid *, int, int, unsigned char)
Definition: snmp_vars.c:154
#define SMI_COUNTER32
Definition: snmp_vars.h:76
SQUIDCEXTERN void hash_remove_link(hash_table *, hash_link *)
Definition: hash.cc:224
Definition: MemBuf.h:23
static FREE fqdncacheFreeEntry
Definition: fqdncache.cc:128
static void purge_entries_fromhosts(void)
Definition: fqdncache.cc:228
void fqdnStats(StoreEntry *sentry)
Definition: fqdncache.cc:526
int fqdncacheCount()
Definition: fqdncache.cc:141
int count
Definition: hash.h:31
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:23
char * error_message
Definition: fqdncache.cc:92
SQUIDCEXTERN HASHHASH hash4
Definition: hash.h:46
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:795
time_t positiveDnsTtl
Definition: SquidConfig.h:100
#define xfree
#define FQDN_MAX_NAMES
Definition: defines.h:49
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:875
#define LEN_SQ_NET
Definition: cache_snmp.h:49
static void fqdncacheCallback(fqdncache_entry *, int wait)
Definition: fqdncache.cc:290
#define SMI_GAUGE32
Definition: snmp_vars.h:77
class SquidConfig Config
Definition: SquidConfig.cc:12
#define NULL
Definition: types.h:166
const char * snmpDebugOid(oid *Name, snint Len, MemBuf &outbuf)
Definition: snmp_core.cc:1052
#define false
Definition: GnuRegex.c:233
int HASHCMP(const void *, const void *)
Definition: hash.h:13
unsigned int ttl
Definition: rfc1035.h:42

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors