2 * DEBUG: section 35 FQDN Cache
3 * AUTHOR: Harvest Derived
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
35 #include "DnsLookupDetails.h"
38 #include "mgr/Registration.h"
40 #include "SquidTime.h"
41 #include "StatCounters.h"
46 #include "snmp_core.h"
50 \defgroup FQDNCacheAPI FQDN Cache API
52 \section Introduction Introduction
54 * The FQDN cache is a built-in component of squid providing
55 * Hostname to IP-Number translation functionality and managing
56 * the involved data-structures. Efficiency concerns require
57 * mechanisms that allow non-blocking access to these mappings.
58 * The FQDN cache usually doesn't block on a request except for
59 * special cases where this is desired (see below).
61 \todo FQDN Cache should have its own API *.h file.
65 \defgroup FQDNCacheInternal FQDN Cache Internals
68 * Internally, the execution flow is as follows:
69 * On a miss, fqdncache_nbgethostbyaddr() checks whether a request
70 * for this name is already pending, and if positive, it creates a
71 * new entry using fqdncacheAddEntry(). Then it calls
72 * fqdncacheAddPending() to add a request to the queue together
73 * with data and handler. Else, ifqdncache_dnsDispatch() is called
74 * to directly create a DNS query or to fqdncacheEnqueue() if all
75 * no DNS port is free.
78 * fqdncacheCallback() is called regularly to walk down the pending
79 * list and call handlers.
82 * LRU clean-up is performed through fqdncache_purgelru() according
83 * to the fqdncache_high threshold.
86 /// \ingroup FQDNCacheInternal
87 #define FQDN_LOW_WATER 90
89 /// \ingroup FQDNCacheInternal
90 #define FQDN_HIGH_WATER 95
94 * The data structure used for storing name-address mappings
95 * is a small hashtable (static hash_table *fqdn_table),
96 * where structures of type fqdncache_entry whose most
97 * interesting members are:
102 hash_link hash
; /* must be first */
105 unsigned char name_count
;
106 char *names
[FQDN_MAX_NAMES
+ 1];
111 struct timeval request_time
;
113 unsigned short locks
;
116 unsigned int negcached
:1;
117 unsigned int fromhosts
:1;
120 int age() const; ///< time passed since request_time or -1 if unknown
123 /// \ingroup FQDNCacheInternal
124 static struct _fqdn_cache_stats
{
132 /// \ingroup FQDNCacheInternal
133 static dlink_list lru_list
;
136 static HLPCB fqdncacheHandleReply
;
137 static int fqdncacheParse(fqdncache_entry
*, const char *buf
);
139 static IDNSCB fqdncacheHandleReply
;
140 static int fqdncacheParse(fqdncache_entry
*, const rfc1035_rr
*, int, const char *error_message
);
142 static void fqdncacheRelease(fqdncache_entry
*);
143 static fqdncache_entry
*fqdncacheCreateEntry(const char *name
);
144 static void fqdncacheCallback(fqdncache_entry
*, int wait
);
145 static fqdncache_entry
*fqdncache_get(const char *);
146 static int fqdncacheExpiredEntry(const fqdncache_entry
*);
147 static void fqdncacheLockEntry(fqdncache_entry
* f
);
148 static void fqdncacheUnlockEntry(fqdncache_entry
* f
);
149 static FREE fqdncacheFreeEntry
;
150 static void fqdncacheAddEntry(fqdncache_entry
* f
);
152 /// \ingroup FQDNCacheInternal
153 static hash_table
*fqdn_table
= NULL
;
155 /// \ingroup FQDNCacheInternal
156 static long fqdncache_low
= 180;
158 /// \ingroup FQDNCacheInternal
159 static long fqdncache_high
= 200;
161 /// \ingroup FQDNCacheInternal
162 inline int fqdncacheCount() { return fqdn_table
? fqdn_table
->count
: 0; }
165 fqdncache_entry::age() const
167 return request_time
.tv_sec
? tvSubMsec(request_time
, current_time
) : -1;
171 \ingroup FQDNCacheInternal
172 * Removes the given fqdncache entry
175 fqdncacheRelease(fqdncache_entry
* f
)
178 hash_remove_link(fqdn_table
, (hash_link
*) f
);
180 for (k
= 0; k
< (int) f
->name_count
; ++k
)
181 safe_free(f
->names
[k
]);
183 debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f
->hash
) << "'.");
185 dlinkDelete(&f
->lru
, &lru_list
);
187 safe_free(f
->hash
.key
);
189 safe_free(f
->error_message
);
191 memFree(f
, MEM_FQDNCACHE_ENTRY
);
195 \ingroup FQDNCacheInternal
196 \param name FQDN hash string.
197 \retval Match for given name
199 static fqdncache_entry
*
200 fqdncache_get(const char *name
)
203 static fqdncache_entry
*f
;
207 if ((e
= (hash_link
*)hash_lookup(fqdn_table
, name
)) != NULL
)
208 f
= (fqdncache_entry
*) e
;
214 /// \ingroup FQDNCacheInternal
216 fqdncacheExpiredEntry(const fqdncache_entry
* f
)
218 /* all static entries are locked, so this takes care of them too */
223 if (f
->expires
> squid_curtime
)
229 /// \ingroup FQDNCacheAPI
231 fqdncache_purgelru(void *notused
)
234 dlink_node
*prev
= NULL
;
237 eventAdd("fqdncache_purgelru", fqdncache_purgelru
, NULL
, 10.0, 1);
239 for (m
= lru_list
.tail
; m
; m
= prev
) {
240 if (fqdncacheCount() < fqdncache_low
)
245 f
= (fqdncache_entry
*)m
->data
;
255 debugs(35, 9, "fqdncache_purgelru: removed " << removed
<< " entries");
258 /// \ingroup FQDNCacheAPI
260 purge_entries_fromhosts(void)
262 dlink_node
*m
= lru_list
.head
;
263 fqdncache_entry
*i
= NULL
;
267 if (i
!= NULL
) { /* need to delay deletion */
268 fqdncacheRelease(i
); /* we just override locks */
272 t
= (fqdncache_entry
*)m
->data
;
274 if (t
->flags
.fromhosts
)
285 \ingroup FQDNCacheInternal
287 * Create blank fqdncache_entry
289 static fqdncache_entry
*
290 fqdncacheCreateEntry(const char *name
)
292 static fqdncache_entry
*f
;
293 f
= (fqdncache_entry
*)memAllocate(MEM_FQDNCACHE_ENTRY
);
294 f
->hash
.key
= xstrdup(name
);
295 f
->expires
= squid_curtime
+ Config
.negativeDnsTtl
;
299 /// \ingroup FQDNCacheInternal
301 fqdncacheAddEntry(fqdncache_entry
* f
)
303 hash_link
*e
= (hash_link
*)hash_lookup(fqdn_table
, f
->hash
.key
);
306 /* avoid colission */
307 fqdncache_entry
*q
= (fqdncache_entry
*) e
;
311 hash_join(fqdn_table
, &f
->hash
);
312 dlinkAdd(f
, &f
->lru
, &lru_list
);
313 f
->lastref
= squid_curtime
;
317 \ingroup FQDNCacheInternal
319 * Walks down the pending list, calling handlers
322 fqdncacheCallback(fqdncache_entry
* f
, int wait
)
326 f
->lastref
= squid_curtime
;
331 fqdncacheLockEntry(f
);
333 callback
= f
->handler
;
337 if (cbdataReferenceValidDone(f
->handlerData
, &cbdata
)) {
338 const DnsLookupDetails
details(f
->error_message
, wait
);
339 callback(f
->name_count
? f
->names
[0] : NULL
, details
, cbdata
);
342 fqdncacheUnlockEntry(f
);
345 /// \ingroup FQDNCacheInternal
348 fqdncacheParse(fqdncache_entry
*f
, const char *inbuf
)
350 LOCAL_ARRAY(char, buf
, DNS_INBUF_SZ
);
353 const char *name
= (const char *)f
->hash
.key
;
354 f
->expires
= squid_curtime
+ Config
.negativeDnsTtl
;
355 f
->flags
.negcached
= 1;
358 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: Got <NULL> reply in response to '" << name
<< "'");
359 f
->error_message
= xstrdup("Internal Error");
363 xstrncpy(buf
, inbuf
, DNS_INBUF_SZ
);
364 debugs(35, 5, "fqdncacheParse: parsing: {" << buf
<< "}");
365 token
= strtok(buf
, w_space
);
368 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: Got <NULL>, expecting '$name' in response to '" << name
<< "'");
369 f
->error_message
= xstrdup("Internal Error");
373 if (0 == strcmp(token
, "$fail")) {
374 token
= strtok(NULL
, "\n");
375 assert(NULL
!= token
);
376 f
->error_message
= xstrdup(token
);
380 if (0 != strcmp(token
, "$name")) {
381 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: Got '" << inbuf
<< "', expecting '$name' in response to '" << name
<< "'");
382 f
->error_message
= xstrdup("Internal Error");
386 token
= strtok(NULL
, w_space
);
389 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: Got '" << inbuf
<< "', expecting TTL in response to '" << name
<< "'");
390 f
->error_message
= xstrdup("Internal Error");
396 token
= strtok(NULL
, w_space
);
399 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: Got '" << inbuf
<< "', expecting hostname in response to '" << name
<< "'");
400 f
->error_message
= xstrdup("Internal Error");
404 f
->names
[0] = xstrdup(token
);
407 if (ttl
== 0 || ttl
> Config
.positiveDnsTtl
)
408 ttl
= Config
.positiveDnsTtl
;
410 if (ttl
< Config
.negativeDnsTtl
)
411 ttl
= Config
.negativeDnsTtl
;
413 f
->expires
= squid_curtime
+ ttl
;
415 f
->flags
.negcached
= 0;
417 return f
->name_count
;
422 fqdncacheParse(fqdncache_entry
*f
, const rfc1035_rr
* answers
, int nr
, const char *error_message
)
426 const char *name
= (const char *)f
->hash
.key
;
427 f
->expires
= squid_curtime
+ Config
.negativeDnsTtl
;
428 f
->flags
.negcached
= 1;
431 debugs(35, 3, "fqdncacheParse: Lookup of '" << name
<< "' failed (" << error_message
<< ")");
432 f
->error_message
= xstrdup(error_message
);
437 debugs(35, 3, "fqdncacheParse: No DNS records for '" << name
<< "'");
438 f
->error_message
= xstrdup("No DNS records");
442 debugs(35, 3, "fqdncacheParse: " << nr
<< " answers for '" << name
<< "'");
445 for (k
= 0; k
< nr
; ++k
) {
446 if (answers
[k
]._class
!= RFC1035_CLASS_IN
)
449 if (answers
[k
].type
== RFC1035_TYPE_PTR
) {
450 if (!answers
[k
].rdata
[0]) {
451 debugs(35, 2, "fqdncacheParse: blank PTR record for '" << name
<< "'");
455 if (strchr(answers
[k
].rdata
, ' ')) {
456 debugs(35, 2, "fqdncacheParse: invalid PTR record '" << answers
[k
].rdata
<< "' for '" << name
<< "'");
460 f
->names
[f
->name_count
] = xstrdup(answers
[k
].rdata
);
462 } else if (answers
[k
].type
!= RFC1035_TYPE_CNAME
)
465 if (ttl
== 0 || (int) answers
[k
].ttl
< ttl
)
466 ttl
= answers
[k
].ttl
;
468 if (f
->name_count
>= FQDN_MAX_NAMES
)
472 if (f
->name_count
== 0) {
473 debugs(35, DBG_IMPORTANT
, "fqdncacheParse: No PTR record for '" << name
<< "'");
477 if (ttl
> Config
.positiveDnsTtl
)
478 ttl
= Config
.positiveDnsTtl
;
480 if (ttl
< Config
.negativeDnsTtl
)
481 ttl
= Config
.negativeDnsTtl
;
483 f
->expires
= squid_curtime
+ ttl
;
485 f
->flags
.negcached
= 0;
487 return f
->name_count
;
493 \ingroup FQDNCacheAPI
495 * Callback for handling DNS results.
499 fqdncacheHandleReply(void *data
, char *reply
)
501 fqdncacheHandleReply(void *data
, const rfc1035_rr
* answers
, int na
, const char *error_message
)
505 static_cast<generic_cbdata
*>(data
)->unwrap(&f
);
506 ++FqdncacheStats
.replies
;
507 const int age
= f
->age();
508 statCounter
.dns
.svcTime
.count(age
);
511 fqdncacheParse(f
, reply
);
514 fqdncacheParse(f
, answers
, na
, error_message
);
517 fqdncacheAddEntry(f
);
519 fqdncacheCallback(f
, age
);
523 \ingroup FQDNCacheAPI
525 \param addr IP address of domain to resolve.
526 \param handler A pointer to the function to be called when
527 * the reply from the FQDN cache
528 * (or the DNS if the FQDN cache misses)
529 \param handlerData Information that is passed to the handler
530 * and does not affect the FQDN cache.
533 fqdncache_nbgethostbyaddr(const Ip::Address
&addr
, FQDNH
* handler
, void *handlerData
)
535 fqdncache_entry
*f
= NULL
;
536 char name
[MAX_IPSTRLEN
];
538 addr
.NtoA(name
,MAX_IPSTRLEN
);
539 debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name
<< "'.");
540 ++FqdncacheStats
.requests
;
542 if (name
[0] == '\0') {
543 debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!");
544 const DnsLookupDetails
details("Invalid hostname", -1); // error, no lookup
546 handler(NULL
, details
, handlerData
);
550 f
= fqdncache_get(name
);
555 } else if (fqdncacheExpiredEntry(f
)) {
556 /* hit, but expired -- bummer */
561 debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name
<< "'");
563 if (f
->flags
.negcached
)
564 ++ FqdncacheStats
.negative_hits
;
566 ++ FqdncacheStats
.hits
;
568 f
->handler
= handler
;
570 f
->handlerData
= cbdataReference(handlerData
);
572 fqdncacheCallback(f
, -1); // no lookup
577 debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name
<< "'");
578 ++ FqdncacheStats
.misses
;
579 f
= fqdncacheCreateEntry(name
);
580 f
->handler
= handler
;
581 f
->handlerData
= cbdataReference(handlerData
);
582 f
->request_time
= current_time
;
583 c
= new generic_cbdata(f
);
585 dnsSubmit(hashKeyStr(&f
->hash
), fqdncacheHandleReply
, c
);
587 idnsPTRLookup(addr
, fqdncacheHandleReply
, c
);
592 \ingroup FQDNCacheAPI
594 * Is different in that it only checks if an entry exists in
595 * it's data-structures and does not by default contact the
596 * DNS, unless this is requested, by setting the flags
597 * to FQDN_LOOKUP_IF_MISS.
599 \param addr address of the FQDN being resolved
600 \param flags values are NULL or FQDN_LOOKUP_IF_MISS. default is NULL.
604 fqdncache_gethostbyaddr(const Ip::Address
&addr
, int flags
)
606 char name
[MAX_IPSTRLEN
];
607 fqdncache_entry
*f
= NULL
;
609 if (addr
.IsAnyAddr() || addr
.IsNoAddr()) {
613 addr
.NtoA(name
,MAX_IPSTRLEN
);
614 ++ FqdncacheStats
.requests
;
615 f
= fqdncache_get(name
);
619 } else if (fqdncacheExpiredEntry(f
)) {
622 } else if (f
->flags
.negcached
) {
623 ++ FqdncacheStats
.negative_hits
;
624 // ignore f->error_message: the caller just checks FQDN cache presence
627 ++ FqdncacheStats
.hits
;
628 f
->lastref
= squid_curtime
;
629 // ignore f->error_message: the caller just checks FQDN cache presence
633 /* no entry [any more] */
635 ++ FqdncacheStats
.misses
;
637 if (flags
& FQDN_LOOKUP_IF_MISS
) {
638 fqdncache_nbgethostbyaddr(addr
, NULL
, NULL
);
645 \ingroup FQDNCacheInternal
647 * Process objects list
650 fqdnStats(StoreEntry
* sentry
)
652 fqdncache_entry
*f
= NULL
;
656 if (fqdn_table
== NULL
)
659 storeAppendPrintf(sentry
, "FQDN Cache Statistics:\n");
661 storeAppendPrintf(sentry
, "FQDNcache Entries In Use: %d\n",
662 memInUse(MEM_FQDNCACHE_ENTRY
));
664 storeAppendPrintf(sentry
, "FQDNcache Entries Cached: %d\n",
667 storeAppendPrintf(sentry
, "FQDNcache Requests: %d\n",
668 FqdncacheStats
.requests
);
670 storeAppendPrintf(sentry
, "FQDNcache Hits: %d\n",
671 FqdncacheStats
.hits
);
673 storeAppendPrintf(sentry
, "FQDNcache Negative Hits: %d\n",
674 FqdncacheStats
.negative_hits
);
676 storeAppendPrintf(sentry
, "FQDNcache Misses: %d\n",
677 FqdncacheStats
.misses
);
679 storeAppendPrintf(sentry
, "FQDN Cache Contents:\n\n");
681 storeAppendPrintf(sentry
, "%-45.45s %3s %3s %3s %s\n",
682 "Address", "Flg", "TTL", "Cnt", "Hostnames");
684 hash_first(fqdn_table
);
686 while ((f
= (fqdncache_entry
*) hash_next(fqdn_table
))) {
687 ttl
= (f
->flags
.fromhosts
? -1 : (f
->expires
- squid_curtime
));
688 storeAppendPrintf(sentry
, "%-45.45s %c%c %3.3d % 3d",
689 hashKeyStr(&f
->hash
),
690 f
->flags
.negcached
? 'N' : ' ',
691 f
->flags
.fromhosts
? 'H' : ' ',
693 (int) f
->name_count
);
695 for (k
= 0; k
< (int) f
->name_count
; ++k
)
696 storeAppendPrintf(sentry
, " %s", f
->names
[k
]);
698 storeAppendPrintf(sentry
, "\n");
702 /// \ingroup FQDNCacheAPI
705 fqdnFromAddr(const Ip::Address
&addr
)
708 static char buf
[MAX_IPSTRLEN
];
710 if (Config
.onoff
.log_fqdn
&& (n
= fqdncache_gethostbyaddr(addr
, 0)))
713 /// \todo Perhapse this should use toHostname() instead of straight NtoA.
714 /// that would wrap the IPv6 properly when raw.
715 addr
.NtoA(buf
, MAX_IPSTRLEN
);
721 /// \ingroup FQDNCacheInternal
723 fqdncacheLockEntry(fqdncache_entry
* f
)
725 if (f
->locks
++ == 0) {
726 dlinkDelete(&f
->lru
, &lru_list
);
727 dlinkAdd(f
, &f
->lru
, &lru_list
);
731 /// \ingroup FQDNCacheInternal
733 fqdncacheUnlockEntry(fqdncache_entry
* f
)
735 assert(f
->locks
> 0);
738 if (fqdncacheExpiredEntry(f
))
742 /// \ingroup FQDNCacheInternal
744 fqdncacheFreeEntry(void *data
)
746 fqdncache_entry
*f
= (fqdncache_entry
*)data
;
749 for (k
= 0; k
< (int) f
->name_count
; ++k
)
750 safe_free(f
->names
[k
]);
752 safe_free(f
->hash
.key
);
754 safe_free(f
->error_message
);
756 memFree(f
, MEM_FQDNCACHE_ENTRY
);
759 /// \ingroup FQDNCacheAPI
761 fqdncacheFreeMemory(void)
763 hashFreeItems(fqdn_table
, fqdncacheFreeEntry
);
764 hashFreeMemory(fqdn_table
);
769 \ingroup FQDNCacheAPI
771 * Recalculate FQDN cache size upon reconfigure.
772 * Is called to clear the FQDN cache's data structures,
773 * cancel all pending requests.
776 fqdncache_restart(void)
778 fqdncache_high
= (long) (((float) Config
.fqdncache
.size
*
779 (float) FQDN_HIGH_WATER
) / (float) 100);
780 fqdncache_low
= (long) (((float) Config
.fqdncache
.size
*
781 (float) FQDN_LOW_WATER
) / (float) 100);
782 purge_entries_fromhosts();
786 \ingroup FQDNCacheAPI
788 * Adds a "static" entry from /etc/hosts.
790 * The worldist is to be managed by the caller,
791 * including pointed-to strings
793 \param addr FQDN name to be added.
797 fqdncacheAddEntryFromHosts(char *addr
, wordlist
* hostnames
)
799 fqdncache_entry
*fce
;
802 if ((fce
= fqdncache_get(addr
))) {
803 if (1 == fce
->flags
.fromhosts
) {
804 fqdncacheUnlockEntry(fce
);
805 } else if (fce
->locks
> 0) {
806 debugs(35, DBG_IMPORTANT
, "fqdncacheAddEntryFromHosts: can't add static entry for locked address '" << addr
<< "'");
809 fqdncacheRelease(fce
);
813 fce
= fqdncacheCreateEntry(addr
);
816 fce
->names
[j
] = xstrdup(hostnames
->key
);
817 Tolower(fce
->names
[j
]);
819 hostnames
= hostnames
->next
;
821 if (j
>= FQDN_MAX_NAMES
)
826 fce
->names
[j
] = NULL
; /* it's safe */
827 fce
->flags
.fromhosts
= 1;
828 fqdncacheAddEntry(fce
);
829 fqdncacheLockEntry(fce
);
832 /// \ingroup FQDNCacheInternal
834 fqdncacheRegisterWithCacheManager(void)
836 Mgr::RegisterAction("fqdncache", "FQDN Cache Stats and Contents",
842 \ingroup FQDNCacheAPI
844 * Initialize the fqdncache.
845 * Called after IP cache initialization.
852 fqdncacheRegisterWithCacheManager();
857 debugs(35, 3, "Initializing FQDN Cache...");
859 memset(&FqdncacheStats
, '\0', sizeof(FqdncacheStats
));
861 memset(&lru_list
, '\0', sizeof(lru_list
));
863 fqdncache_high
= (long) (((float) Config
.fqdncache
.size
*
864 (float) FQDN_HIGH_WATER
) / (float) 100);
866 fqdncache_low
= (long) (((float) Config
.fqdncache
.size
*
867 (float) FQDN_LOW_WATER
) / (float) 100);
869 n
= hashPrime(fqdncache_high
/ 4);
871 fqdn_table
= hash_create((HASHCMP
*) strcmp
, n
, hash4
);
873 memDataInit(MEM_FQDNCACHE_ENTRY
, "fqdncache_entry",
874 sizeof(fqdncache_entry
), 0);
879 * \ingroup FQDNCacheAPI
880 * The function to return the FQDN statistics via SNMP
883 snmp_netFqdnFn(variable_list
* Var
, snint
* ErrP
)
885 variable_list
*Answer
= NULL
;
887 debugs(49, 5, "snmp_netFqdnFn: Processing request:" << snmpDebugOid(Var
->name
, Var
->name_length
, tmp
));
888 *ErrP
= SNMP_ERR_NOERROR
;
890 switch (Var
->name
[LEN_SQ_NET
+ 1]) {
893 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
899 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
900 FqdncacheStats
.requests
,
905 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
911 /* this is now worthless */
912 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
918 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
919 FqdncacheStats
.negative_hits
,
924 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
925 FqdncacheStats
.misses
,
930 Answer
= snmp_var_new_integer(Var
->name
, Var
->name_length
,
936 *ErrP
= SNMP_ERR_NOSUCHNAME
;
943 #endif /*SQUID_SNMP */