Tidy address-union handling: move class into explicit argument.
This moves the class argument to cache-insert into an argument,
rather then overloading a union in the address argument. Note that
tha class is NOT stored in the cache other than for DS/DNSKEY entries,
so must always be C_IN except for these. The data-extraction code
ensures this as it only attempts to cache C_IN class records.
diff --git a/src/dnssec.c b/src/dnssec.c
index dcb3f15..4fdc027 100644
--- a/src/dnssec.c
+++ b/src/dnssec.c
@@ -798,12 +798,9 @@
algo = *p++;
keytag = dnskey_keytag(algo, flags, p, rdlen - 4);
- /* Cache needs to known class for DNSSEC stuff */
- a.addr.dnssec.class = class;
-
if ((key = blockdata_alloc((char*)p, rdlen - 4)))
{
- if (!(recp1 = cache_insert(name, &a, now, ttl, F_FORWARD | F_DNSKEY | F_DNSSECOK)))
+ if (!(recp1 = cache_insert(name, &a, class, now, ttl, F_FORWARD | F_DNSKEY | F_DNSSECOK)))
{
blockdata_free(key);
return STAT_BOGUS;
@@ -927,12 +924,9 @@
algo = *p++;
digest = *p++;
- /* Cache needs to known class for DNSSEC stuff */
- a.addr.dnssec.class = class;
-
if ((key = blockdata_alloc((char*)p, rdlen - 4)))
{
- if (!(crecp = cache_insert(name, &a, now, ttl, F_FORWARD | F_DS | F_DNSSECOK)))
+ if (!(crecp = cache_insert(name, NULL, class, now, ttl, F_FORWARD | F_DS | F_DNSSECOK)))
{
blockdata_free(key);
return STAT_BOGUS;
@@ -1021,8 +1015,7 @@
{
cache_start_insert();
- a.addr.dnssec.class = class;
- if (!cache_insert(name, &a, now, ttl, flags))
+ if (!cache_insert(name, NULL, class, now, ttl, flags))
return STAT_BOGUS;
cache_end_insert();