mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 18:19:42 +00:00
make lameness work, now. Grr.
This commit is contained in:
parent
f36a81c884
commit
f00d96a15c
@ -92,6 +92,8 @@ main(int argc, char **argv)
|
||||
dns_view_t *view;
|
||||
dns_adb_t *adb;
|
||||
dns_adbhandle_t *handle;
|
||||
dns_adbaddrinfo_t *ai;
|
||||
isc_stdtime_t now;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
@ -100,6 +102,9 @@ main(int argc, char **argv)
|
||||
result = isc_app_start();
|
||||
check_result(result, "isc_app_start()");
|
||||
|
||||
result = isc_stdtime_get(&now);
|
||||
check_result(result, "isc_stdtime_get()");
|
||||
|
||||
/*
|
||||
* EVERYTHING needs a memory context.
|
||||
*/
|
||||
@ -194,6 +199,30 @@ main(int argc, char **argv)
|
||||
dns_adb_dump(adb, stderr);
|
||||
dns_adb_dumphandle(adb, handle, stderr);
|
||||
|
||||
/*
|
||||
* Mark one entry as lame, then look this name up again.
|
||||
*/
|
||||
|
||||
ai = ISC_LIST_HEAD(handle->list);
|
||||
INSIST(ai != NULL);
|
||||
ai = ISC_LIST_NEXT(ai, link);
|
||||
INSIST(ai != NULL);
|
||||
result = dns_adb_marklame(adb, ai, &name1, now + 10 * 60);
|
||||
check_result(result, "dns_adb_marklame()");
|
||||
|
||||
dns_adb_done(adb, &handle);
|
||||
|
||||
/*
|
||||
* look it up again
|
||||
*/
|
||||
result = dns_adb_lookup(adb, t2, lookup_callback, &name1,
|
||||
&name1, &name1, &handle);
|
||||
check_result(result, "dns_adb_lookup name1");
|
||||
check_result(handle->result, "handle->result");
|
||||
|
||||
dns_adb_dump(adb, stderr);
|
||||
dns_adb_dumphandle(adb, handle, stderr);
|
||||
|
||||
/*
|
||||
* delete one of the names, and kill the adb
|
||||
*/
|
||||
@ -201,7 +230,6 @@ main(int argc, char **argv)
|
||||
check_result(result, "dns_adb_deletename name2");
|
||||
|
||||
dns_adb_dump(adb, stderr);
|
||||
dns_adb_dumphandle(adb, handle, stderr);
|
||||
|
||||
dns_adb_done(adb, &handle);
|
||||
isc_task_detach(&t1);
|
||||
|
@ -60,8 +60,8 @@
|
||||
/*
|
||||
* Lengths of lists needs to be powers of two.
|
||||
*/
|
||||
#define DNS_ADBNAMELIST_LENGTH 16 /* how many buckets for names */
|
||||
#define DNS_ADBENTRYLIST_LENGTH 16 /* how many buckets for addresses */
|
||||
#define DNS_ADBNAMELIST_LENGTH 32 /* how many buckets for names */
|
||||
#define DNS_ADBENTRYLIST_LENGTH 32 /* how many buckets for addresses */
|
||||
|
||||
#define FREE_ITEMS 16 /* free count for memory pools */
|
||||
#define FILL_COUNT 8 /* fill count for memory pools */
|
||||
@ -1699,9 +1699,11 @@ construct_name(dns_adb_t *adb, dns_adbhandle_t *handle, dns_name_t *name,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone)
|
||||
dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone,
|
||||
isc_stdtime_t expire_time)
|
||||
{
|
||||
dns_adbzoneinfo_t *zi;
|
||||
int bucket;
|
||||
|
||||
REQUIRE(DNS_ADB_VALID(adb));
|
||||
REQUIRE(DNS_ADBADDRINFO_VALID(addr));
|
||||
@ -1711,5 +1713,13 @@ dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone)
|
||||
if (zi == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
zi->lame_timer = expire_time;
|
||||
|
||||
bucket = addr->entry->lock_bucket;
|
||||
|
||||
LOCK(&adb->entrylocks[bucket]);
|
||||
ISC_LIST_PREPEND(addr->entry->zoneinfo, zi, link);
|
||||
UNLOCK(&adb->entrylocks[bucket]);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
@ -366,9 +366,12 @@ dns_adb_dumphandle(dns_adb_t *adb, dns_adbhandle_t *handle, FILE *f);
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone);
|
||||
dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone,
|
||||
isc_stdtime_t expire_time);
|
||||
/*
|
||||
* Mark the given address as lame for the zone "zone".
|
||||
* Mark the given address as lame for the zone "zone". expire_time should
|
||||
* be set to the time when the entry should expire. That is, if it is to
|
||||
* expire 10 minutes in the future, it should set it to (now + 10 * 60).
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
@ -392,8 +395,6 @@ dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone);
|
||||
*
|
||||
* Adjust the goodness, both local and globally.
|
||||
*
|
||||
* Mark an entry as lame.
|
||||
*
|
||||
* set/clear various flags. (Which flags?)
|
||||
*
|
||||
* Mix in measured RTT values.
|
||||
|
Loading…
x
Reference in New Issue
Block a user