* Fetches are broken out into A and AAAA types. In some cases,
* however, it makes more sense to test for a particular class of fetches,
* like V4 or V6 above.
- * Note: since we have removed the support of A6 in adb, FETCH_A and FETCH_AAAA
- * are now equal to FETCH_V4 and FETCH_V6, respectively.
*/
#define NAME_FETCH_A(n) ((n)->fetch_a != NULL)
#define NAME_FETCH_AAAA(n) ((n)->fetch_aaaa != NULL)
-#define NAME_FETCH_V4(n) (NAME_FETCH_A(n))
-#define NAME_FETCH_V6(n) (NAME_FETCH_AAAA(n))
-#define NAME_FETCH(n) (NAME_FETCH_V4(n) || NAME_FETCH_V6(n))
+#define NAME_FETCH(n) (NAME_FETCH_A(n) || NAME_FETCH_AAAA(n))
/*
* Find options and tests to see if there are addresses on the list.
import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
isc_stdtime_t now) {
isc_result_t result;
- dns_adb_t *adb;
- dns_adbnamehook_t *nh;
- dns_adbnamehook_t *anh;
+ dns_adb_t *adb = NULL;
+ dns_adbnamehook_t *nh = NULL;
+ dns_adbnamehook_t *anh = NULL;
dns_rdata_t rdata = DNS_RDATA_INIT;
struct in_addr ina;
struct in6_addr in6a;
isc_sockaddr_t sockaddr;
- dns_adbentry_t *foundentry; /* NO CLEAN UP! */
+ dns_adbentry_t *foundentry = NULL; /* NO CLEAN UP! */
int addr_bucket;
bool new_addresses_added;
dns_rdatatype_t rdtype;
- dns_adbnamehooklist_t *hookhead;
+ dns_adbnamehooklist_t *hookhead = NULL;
INSIST(DNS_ADBNAME_VALID(adbname));
adb = adbname->adb;
addr_bucket = DNS_ADB_INVALIDBUCKET;
new_addresses_added = false;
- nh = NULL;
result = dns_rdataset_first(rdataset);
while (result == ISC_R_SUCCESS) {
dns_rdata_reset(&rdata);
result = dns_rdataset_next(rdataset);
}
- if (nh != NULL) {
- free_adbnamehook(adb, &nh);
- }
-
if (addr_bucket != DNS_ADB_INVALIDBUCKET) {
UNLOCK(&adb->entrylocks[addr_bucket]);
}
/*
* Check to see if we need to remove the v4 addresses
*/
- if (!NAME_FETCH_V4(name) && EXPIRE_OK(name->expire_v4, now)) {
+ if (!NAME_FETCH_A(name) && EXPIRE_OK(name->expire_v4, now)) {
if (NAME_HAS_V4(name)) {
DP(DEF_LEVEL, "expiring v4 for name %p", name);
result4 = clean_namehooks(adb, &name->v4);
/*
* Check to see if we need to remove the v6 addresses
*/
- if (!NAME_FETCH_V6(name) && EXPIRE_OK(name->expire_v6, now)) {
+ if (!NAME_FETCH_AAAA(name) && EXPIRE_OK(name->expire_v6, now)) {
if (NAME_HAS_V6(name)) {
DP(DEF_LEVEL, "expiring v6 for name %p", name);
result6 = clean_namehooks(adb, &name->v6);
isc_stdtime_t now, dns_name_t *target, in_port_t port,
unsigned int depth, isc_counter_t *qc,
dns_adbfind_t **findp) {
- dns_adbfind_t *find;
- dns_adbname_t *adbname;
+ dns_adbfind_t *find = NULL;
+ dns_adbname_t *adbname = NULL;
int bucket;
- bool want_event, start_at_zone, alias, have_address;
+ bool want_event = true;
+ bool start_at_zone = false;
+ bool alias = false;
+ bool have_address = false;
isc_result_t result;
- unsigned int wanted_addresses;
- unsigned int wanted_fetches;
- unsigned int query_pending;
+ unsigned int wanted_addresses = (options & DNS_ADBFIND_ADDRESSMASK);
+ unsigned int wanted_fetches = 0;
+ unsigned int query_pending = 0;
char namebuf[DNS_NAME_FORMATSIZE];
REQUIRE(DNS_ADB_VALID(adb));
result = ISC_R_UNEXPECTED;
POST(result);
- wanted_addresses = (options & DNS_ADBFIND_ADDRESSMASK);
- wanted_fetches = 0;
- query_pending = 0;
- want_event = false;
- start_at_zone = false;
- alias = false;
if (now == 0) {
isc_stdtime_get(&now);
goto v6;
}
- if (!NAME_FETCH_V4(adbname)) {
+ if (!NAME_FETCH_A(adbname)) {
wanted_fetches |= DNS_ADBFIND_INET;
}
}
goto fetch;
}
- if (!NAME_FETCH_V6(adbname)) {
+ if (!NAME_FETCH_AAAA(adbname)) {
wanted_fetches |= DNS_ADBFIND_INET6;
}
}
copy_namehook_lists(adb, find, qname, qtype, adbname, now);
post_copy:
- if (NAME_FETCH_V4(adbname)) {
+ if (NAME_FETCH_A(adbname)) {
query_pending |= DNS_ADBFIND_INET;
}
- if (NAME_FETCH_V6(adbname)) {
+ if (NAME_FETCH_AAAA(adbname)) {
query_pending |= DNS_ADBFIND_INET6;
}
* Attach to the name's query list if there are queries
* already running, and we have been asked to.
*/
- want_event = true;
if (!FIND_WANTEVENT(find)) {
want_event = false;
}
want_event = false;
}
if (want_event) {
+ bool empty;
find->adbname = adbname;
find->name_bucket = bucket;
- bool empty = ISC_LIST_EMPTY(adbname->finds);
+ empty = ISC_LIST_EMPTY(adbname->finds);
ISC_LIST_APPEND(adbname->finds, find, plink);
find->query_pending = (query_pending & wanted_addresses);
find->flags &= ~DNS_ADBFIND_ADDRESSMASK;
find->flags |= (find->query_pending & DNS_ADBFIND_ADDRESSMASK);
- DP(DEF_LEVEL,
- "createfind: attaching find %p to adbname "
- "%p %d",
+ DP(DEF_LEVEL, "createfind: attaching find %p to adbname %p %d",
find, adbname, empty);
} else {
/*
out:
if (find != NULL) {
- *findp = find;
-
if (want_event) {
- isc_task_t *taskp;
+ isc_task_t *taskp = NULL;
INSIST((find->flags & DNS_ADBFIND_ADDRESSMASK) != 0);
- taskp = NULL;
isc_task_attach(task, &taskp);
find->event.ev_sender = taskp;
find->event.ev_action = action;
find->event.ev_arg = arg;
}
+
+ *findp = find;
}
UNLOCK(&adb->namelocks[bucket]);
-
return (result);
}
adb = adbname->adb;
INSIST(DNS_ADB_VALID(adb));
- INSIST((type == dns_rdatatype_a && !NAME_FETCH_V4(adbname)) ||
- (type == dns_rdatatype_aaaa && !NAME_FETCH_V6(adbname)));
+ INSIST((type == dns_rdatatype_a && !NAME_FETCH_A(adbname)) ||
+ (type == dns_rdatatype_aaaa && !NAME_FETCH_AAAA(adbname)));
adbname->fetch_err = FIND_ERR_NOTFOUND;