/[smeserver]/rpms/djbdns/sme9/110-dnscache-cachestats.patch
ViewVC logotype

Annotation of /rpms/djbdns/sme9/110-dnscache-cachestats.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Wed Jul 12 04:56:18 2017 UTC (7 years, 3 months ago) by unnilennium
Branch: MAIN
CVS Tags: djbdns-1_05-11_el6_sme, djbdns-1_05-9_el6_sme, djbdns-1_05-10_el6_sme, HEAD
* Tue Jul 11 2017 Jean-Philipe Pialasse <tests@pialasse.com> 1.05-9.sme
-- backport SME10 fixes [SME: 10381]
--import patches from openwrt and rename already applied patches
--fix security issues [SME: 10374]
- 020-dnsroots-update.patch: update list of root DNS servers
- 070-dnscache-dpos-tcp-servfail.patch: SERVFAIL rename previous patch dns_transmit-bug.patch
- 210-dnscache-strict-forwardonly.patch: rename previous patch dnscache-strict-forwardonly.patch
- 270-dnscache-sigpipe-fix.patch: SIGPIPE
- 300-bugfix-dnscache-dempsky-poison.patch: CVE-2009-0858
- 310-bugfix-dnscache-merge-outgoing-requests.patch: CVE-2008-4392
- 320-bugfix-dnscache-cache-soa-records.patch: CVE-2008-4392
- 450-dnscache-ghost-domain-CVE-2012-1191.patch: CVE-2012-1191 http://marc.info/?l=djbdns&m=134190748729079&w=2
--bug fixes [SME: 10374]
- 060-dnscache-big-udp-packets.patch: accept and handle longer than 512 bytes UDP packets
- 230-tinydns-data-semantic-error.patch: handle semantic error to avoid publishing false dns records
- 240-tinydns-alias-chain-truncation.patch: rename previous patch tinydns-alias-chain-truncation.patch
--fix issue with short ttl cname like akamaid [SME: 8362]
- 200-dnscache-cname-handling.patch: rename previous patch dnscache-cname-handling.patch
- 330-fix-dnscache-cname-handling.patch: fix dnscache cname for short ttl
- 500-cutom-dnscache-maxloop.patch: set max loop to 200
--needed for previous patches to apply cleanly
- 030-srv-records-and-axfrget.patch: add SRV record type and axfr-get decompose SRC and PTR records (for 230-*.patch)
- 080-dnscache-cache-negatives.patch: rfc2308 ? (for 200-*.patch)
- 090-tinydns-one-second.patch: improve tinydns with 8 or more  concurent connections (for 240-*.patch)
- 120-compiler-temporary-filename.patch: change tmp filename to avoid conflicts (for 230-*.patch)
--not backported from SME10 branch
- 050-tinydns-mmap-leak.patch: report cdb leak

1 unnilennium 1.1 #
2     # This patch to djbdns 1.05 modifies the dnscache program to keep a
3     # counter of cache hits and cache misses.
4     #
5     # Two new fields are added to the ``stats'' output line:
6     # . the fifth number is the number of cache hits
7     # . the sixth number is the number of cache misses
8     # e.g.
9     # @400000003fa92ccc317d70f4 stats 3 1201 1 0 21 49
10     # indicates 21 hits and 49 misses.
11     #
12     # James Raftery <james@now.ie> 6 Nov. 2003
13     #
14     --- a/cache.c
15     +++ b/cache.c
16     @@ -7,6 +7,11 @@
17    
18     uint64 cache_motion = 0;
19    
20     +/* record cache stats */
21     +/* James Raftery <james@now.ie> 6 Nov. 2003 */
22     +uint64 cache_hit = 0;
23     +uint64 cache_miss = 0;
24     +
25     static char *x = 0;
26     static uint32 size;
27     static uint32 hsize;
28     @@ -112,15 +117,20 @@ char *cache_get(const char *key,unsigned
29     if (u > size - pos - 20 - keylen) cache_impossible();
30     *datalen = u;
31    
32     + cache_hit++;
33     return x + pos + 20 + keylen;
34     }
35     }
36     nextpos = prevpos ^ get4(pos);
37     prevpos = pos;
38     pos = nextpos;
39     - if (++loop > 100) return 0; /* to protect against hash flooding */
40     + if (++loop > 100) { /* to protect against hash flooding */
41     + cache_miss++;
42     + return 0;
43     + }
44     }
45    
46     + cache_miss++;
47     return 0;
48     }
49    
50     --- a/cache.h
51     +++ b/cache.h
52     @@ -5,6 +5,12 @@
53     #include "uint64.h"
54    
55     extern uint64 cache_motion;
56     +
57     +/* record cache stats */
58     +/* James Raftery <james@now.ie> 6 Nov. 2003 */
59     +extern uint64 cache_hit;
60     +extern uint64 cache_miss;
61     +
62     extern int cache_init(unsigned int);
63     extern void cache_set(const char *,unsigned int,const char *,unsigned int,uint32);
64     extern char *cache_get(const char *,unsigned int,unsigned int *,uint32 *);
65     --- a/log.c
66     +++ b/log.c
67     @@ -279,6 +279,12 @@ void log_stats(void)
68     time_t cur = time(NULL);
69     extern uint64 numqueries;
70     extern uint64 cache_motion;
71     +
72     + /* record cache stats */
73     + /* James Raftery <james@now.ie> 6 Nov. 2003 */
74     + extern uint64 cache_hit;
75     + extern uint64 cache_miss;
76     +
77     extern int uactive;
78     extern int tactive;
79    
80     @@ -290,6 +296,8 @@ void log_stats(void)
81     number(numqueries); space();
82     number(cache_motion); space();
83     number(uactive); space();
84     - number(tactive);
85     + number(tactive); space();
86     + number(cache_hit); space();
87     + number(cache_miss);
88     line();
89     }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed