]> git.ipfire.org Git - thirdparty/bind9.git/commit
Simplify cachedb rrset statistic counters
authorMatthijs Mekking <github@pletterpet.nl>
Fri, 17 Jan 2020 07:41:06 +0000 (08:41 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 4 Feb 2020 10:58:34 +0000 (11:58 +0100)
commit37b41ff6932fa73361634bc735a0c2d17ef2718c
tree41d4708f0e4f45da521425fa2a09d8be381f63f3
parent3079956ff7d925c32fb52907f6e7a1ad53cba9e5
Simplify cachedb rrset statistic counters

This commit simplifies the cachedb rrset statistics in two ways:
- Introduce new rdtypecounter arithmetics, allowing bitwise
  operations.
- Remove the special DLV statistic counter.

New rdtypecounter arithmetics
-----------------------------
"The rdtypecounter arithmetics is a brain twister".  Replace the
enum counters with some defines.  A rdtypecounter is now 8 bits for
RRtypes and 3 bits for flags:

      0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |  |  |  |  |  |  S  |NX|         RRType        |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

If the 8 bits for RRtype are all zero, this is an Other RRtype.

Bit 7 is the NXRRSET (NX) flag and indicates whether this is a
positive (0) or a negative (1) RRset.

Then bit 5 and 6 mostly tell you if this counter is for an active,
stale, or ancient RRtype:

    S = 0x00 means Active
    S = 0x01 means Stale
    S = 0x10 means Ancient

Since a counter cannot be stale and ancient at the same time, we
treat S = 0x11 as a special case to deal with NXDOMAIN counters.

S = 0x11 indicates an NXDOMAIN counter and in this case the RRtype
field signals the expiry of this cached item:

    RRType = 0 means Active
    RRType = 1 means Stale
    RRType = 2 means Ancient
lib/dns/rbtdb.c
lib/dns/stats.c
lib/dns/tests/rdatasetstats_test.c