mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-12 16:30:00 -04:00
parent
db06cd726c
commit
b15dde2889
7 changed files with 95 additions and 102 deletions
|
|
@ -497,7 +497,7 @@ query_getnamebuf(ns_client_t *client) {
|
|||
dbuf = ISC_LIST_TAIL(client->query.namebufs);
|
||||
INSIST(dbuf != NULL);
|
||||
isc_buffer_availableregion(dbuf, &r);
|
||||
if (r.length < 255) {
|
||||
if (r.length < DNS_NAME_MAXWIRE) {
|
||||
result = query_newnamebuf(client);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
CTRACE(ISC_LOG_DEBUG(3),
|
||||
|
|
@ -1133,12 +1133,9 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||
unsigned int namelabels;
|
||||
unsigned int zonelabels;
|
||||
dns_zone_t *zone = NULL;
|
||||
dns_db_t *tdbp;
|
||||
|
||||
REQUIRE(zonep != NULL && *zonep == NULL);
|
||||
|
||||
tdbp = NULL;
|
||||
|
||||
/* Calculate how many labels are in name. */
|
||||
namelabels = dns_name_countlabels(name);
|
||||
zonelabels = 0;
|
||||
|
|
@ -1155,15 +1152,17 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||
* If # zone labels < # name labels, try to find an even better match
|
||||
* Only try if DLZ drivers are loaded for this view
|
||||
*/
|
||||
if (zonelabels < namelabels &&
|
||||
!ISC_LIST_EMPTY(client->view->dlz_searched))
|
||||
if (ISC_UNLIKELY(zonelabels < namelabels &&
|
||||
!ISC_LIST_EMPTY(client->view->dlz_searched)))
|
||||
{
|
||||
dns_clientinfomethods_t cm;
|
||||
dns_clientinfo_t ci;
|
||||
dns_db_t *tdbp;
|
||||
|
||||
dns_clientinfomethods_init(&cm, ns_client_sourceip);
|
||||
dns_clientinfo_init(&ci, client);
|
||||
|
||||
tdbp = NULL;
|
||||
tresult = dns_view_searchdlz(client->view, name,
|
||||
zonelabels, &cm, &ci, &tdbp);
|
||||
/* If we successful, we found a better match. */
|
||||
|
|
@ -6496,11 +6495,14 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||
options |= DNS_GETDB_NOEXACT;
|
||||
result = query_getdb(client, client->query.qname, qtype, options,
|
||||
&zone, &db, &version, &is_zone);
|
||||
if ((result != ISC_R_SUCCESS || !is_zone) && !RECURSIONOK(client) &&
|
||||
(options & DNS_GETDB_NOEXACT) != 0 && qtype == dns_rdatatype_ds) {
|
||||
if (ISC_UNLIKELY((result != ISC_R_SUCCESS || !is_zone) &&
|
||||
qtype == dns_rdatatype_ds &&
|
||||
!RECURSIONOK(client) &&
|
||||
(options & DNS_GETDB_NOEXACT) != 0))
|
||||
{
|
||||
/*
|
||||
* Look to see if we are authoritative for the
|
||||
* child zone if the query type is DS.
|
||||
* If the query type is DS, look to see if we are
|
||||
* authoritative for the child zone.
|
||||
*/
|
||||
dns_db_t *tdb = NULL;
|
||||
dns_zone_t *tzone = NULL;
|
||||
|
|
@ -6579,7 +6581,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||
* We'll need some resources...
|
||||
*/
|
||||
dbuf = query_getnamebuf(client);
|
||||
if (dbuf == NULL) {
|
||||
if (ISC_UNLIKELY(dbuf == NULL)) {
|
||||
CTRACE(ISC_LOG_ERROR,
|
||||
"query_find: query_getnamebuf failed (2)");
|
||||
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||
|
|
@ -6587,7 +6589,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||
}
|
||||
fname = query_newname(client, dbuf, &b);
|
||||
rdataset = query_newrdataset(client);
|
||||
if (fname == NULL || rdataset == NULL) {
|
||||
if (ISC_UNLIKELY(fname == NULL || rdataset == NULL)) {
|
||||
CTRACE(ISC_LOG_ERROR,
|
||||
"query_find: query_newname failed (2)");
|
||||
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||
|
|
@ -6610,7 +6612,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||
client->query.dboptions, client->now,
|
||||
&node, fname, &cm, &ci, rdataset, sigrdataset);
|
||||
|
||||
if (db == client->view->cachedb)
|
||||
if (!is_zone)
|
||||
dns_cache_updatestats(client->view->cache, result);
|
||||
|
||||
resume:
|
||||
|
|
@ -8543,6 +8545,14 @@ ns_query_start(ns_client_t *client) {
|
|||
client->query.attributes &= ~NS_QUERYATTR_RECURSIONOK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for multiple question queries, since edns1 is dead.
|
||||
*/
|
||||
if (message->counts[DNS_SECTION_QUESTION] > 1) {
|
||||
query_error(client, DNS_R_FORMERR, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the question name.
|
||||
*/
|
||||
|
|
@ -8570,14 +8580,6 @@ ns_query_start(ns_client_t *client) {
|
|||
if (ns_g_server->log_queries)
|
||||
log_query(client, saved_flags, saved_extflags);
|
||||
|
||||
/*
|
||||
* Check for multiple question queries, since edns1 is dead.
|
||||
*/
|
||||
if (message->counts[DNS_SECTION_QUESTION] > 1) {
|
||||
query_error(client, DNS_R_FORMERR, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for meta-queries like IXFR and AXFR.
|
||||
*/
|
||||
|
|
|
|||
6
configure
vendored
6
configure
vendored
|
|
@ -19577,8 +19577,6 @@ ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM"
|
|||
ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM"
|
||||
ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM"
|
||||
if test "$use_atomic" = "yes"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking architecture type for atomic operations" >&5
|
||||
$as_echo_n "checking architecture type for atomic operations... " >&6; }
|
||||
have_atomic=yes # set default
|
||||
case "$host" in
|
||||
i[3456]86-*)
|
||||
|
|
@ -19682,6 +19680,8 @@ _ACEOF
|
|||
arch=noatomic
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking architecture type for atomic operations" >&5
|
||||
$as_echo_n "checking architecture type for atomic operations... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $arch" >&5
|
||||
$as_echo "$arch" >&6; }
|
||||
fi
|
||||
|
|
@ -20917,6 +20917,8 @@ else
|
|||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable query trace logging" >&5
|
||||
$as_echo_n "checking whether to enable query trace logging... " >&6; }
|
||||
case "$want_querytrace" in
|
||||
yes)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
|
|
|
|||
|
|
@ -3729,7 +3729,6 @@ ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM"
|
|||
ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM"
|
||||
ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM"
|
||||
if test "$use_atomic" = "yes"; then
|
||||
AC_MSG_CHECKING([architecture type for atomic operations])
|
||||
have_atomic=yes # set default
|
||||
case "$host" in
|
||||
[i[3456]86-*])
|
||||
|
|
@ -3769,6 +3768,7 @@ if test "$use_atomic" = "yes"; then
|
|||
arch=noatomic
|
||||
;;
|
||||
esac
|
||||
AC_MSG_CHECKING([architecture type for atomic operations])
|
||||
AC_MSG_RESULT($arch)
|
||||
fi
|
||||
|
||||
|
|
@ -4282,6 +4282,7 @@ AC_ARG_ENABLE(querytrace,
|
|||
[ --enable-querytrace enable very verbose query trace logging [[default=no]]],
|
||||
want_querytrace="$enableval", want_querytrace="no")
|
||||
|
||||
AC_MSG_CHECKING([whether to enable query trace logging])
|
||||
case "$want_querytrace" in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
|
|
|||
|
|
@ -836,9 +836,8 @@ dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass,
|
|||
{
|
||||
dns_rdataset_t *curr;
|
||||
|
||||
if (rdataset != NULL) {
|
||||
REQUIRE(*rdataset == NULL);
|
||||
}
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(rdataset == NULL || *rdataset == NULL);
|
||||
|
||||
for (curr = ISC_LIST_TAIL(name->list);
|
||||
curr != NULL;
|
||||
|
|
@ -861,15 +860,13 @@ dns_message_findtype(dns_name_t *name, dns_rdatatype_t type,
|
|||
dns_rdataset_t *curr;
|
||||
|
||||
REQUIRE(name != NULL);
|
||||
if (rdataset != NULL) {
|
||||
REQUIRE(*rdataset == NULL);
|
||||
}
|
||||
REQUIRE(rdataset == NULL || *rdataset == NULL);
|
||||
|
||||
for (curr = ISC_LIST_TAIL(name->list);
|
||||
curr != NULL;
|
||||
curr = ISC_LIST_PREV(curr, link)) {
|
||||
if (curr->type == type && curr->covers == covers) {
|
||||
if (rdataset != NULL)
|
||||
if (ISC_UNLIKELY(rdataset != NULL))
|
||||
*rdataset = curr;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
|
@ -2347,13 +2344,12 @@ dns_message_findname(dns_message_t *msg, dns_section_t section,
|
|||
REQUIRE(msg != NULL);
|
||||
REQUIRE(VALID_SECTION(section));
|
||||
REQUIRE(target != NULL);
|
||||
if (name != NULL)
|
||||
REQUIRE(*name == NULL);
|
||||
REQUIRE(name == NULL || *name == NULL);
|
||||
|
||||
if (type == dns_rdatatype_any) {
|
||||
REQUIRE(rdataset == NULL);
|
||||
} else {
|
||||
if (rdataset != NULL)
|
||||
REQUIRE(*rdataset == NULL);
|
||||
REQUIRE(rdataset == NULL || *rdataset == NULL);
|
||||
}
|
||||
|
||||
result = findname(&foundname, target,
|
||||
|
|
@ -2370,7 +2366,7 @@ dns_message_findname(dns_message_t *msg, dns_section_t section,
|
|||
/*
|
||||
* And now look for the type.
|
||||
*/
|
||||
if (type == dns_rdatatype_any)
|
||||
if (ISC_UNLIKELY(type == dns_rdatatype_any))
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
result = dns_message_findtype(foundname, type, covers, rdataset);
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ isc__hash_setvec(const isc_uint16_t *vec) {
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned int fnv_offset_basis;
|
||||
static isc_uint32_t fnv_offset_basis;
|
||||
static isc_once_t fnv_once = ISC_ONCE_INIT;
|
||||
|
||||
static void
|
||||
|
|
@ -419,19 +419,20 @@ fnv_initialize(void) {
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_uint32_t
|
||||
isc_hash_function(const void *data, size_t length,
|
||||
isc_boolean_t case_sensitive,
|
||||
unsigned int *previous_hashp)
|
||||
const isc_uint32_t *previous_hashp)
|
||||
{
|
||||
unsigned int hval;
|
||||
isc_uint32_t hval;
|
||||
const unsigned char *bp;
|
||||
const unsigned char *be;
|
||||
|
||||
INSIST(data == NULL || length > 0);
|
||||
RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS);
|
||||
|
||||
hval = previous_hashp != NULL ? *previous_hashp : fnv_offset_basis;
|
||||
hval = ISC_UNLIKELY(previous_hashp != NULL) ?
|
||||
*previous_hashp : fnv_offset_basis;
|
||||
|
||||
if (length == 0)
|
||||
return (hval);
|
||||
|
|
@ -450,34 +451,34 @@ isc_hash_function(const void *data, size_t length,
|
|||
|
||||
if (case_sensitive) {
|
||||
while (bp < be - 4) {
|
||||
hval ^= (unsigned int) bp[0];
|
||||
hval ^= (isc_uint32_t) bp[0];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) bp[1];
|
||||
hval ^= (isc_uint32_t) bp[1];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) bp[2];
|
||||
hval ^= (isc_uint32_t) bp[2];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) bp[3];
|
||||
hval ^= (isc_uint32_t) bp[3];
|
||||
hval *= 16777619;
|
||||
bp += 4;
|
||||
}
|
||||
while (bp < be) {
|
||||
hval ^= (unsigned int) *bp++;
|
||||
hval ^= (isc_uint32_t) *bp++;
|
||||
hval *= 16777619;
|
||||
}
|
||||
} else {
|
||||
while (bp < be - 4) {
|
||||
hval ^= (unsigned int) maptolower[bp[0]];
|
||||
hval ^= (isc_uint32_t) maptolower[bp[0]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[bp[1]];
|
||||
hval ^= (isc_uint32_t) maptolower[bp[1]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[bp[2]];
|
||||
hval ^= (isc_uint32_t) maptolower[bp[2]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[bp[3]];
|
||||
hval ^= (isc_uint32_t) maptolower[bp[3]];
|
||||
hval *= 16777619;
|
||||
bp += 4;
|
||||
}
|
||||
while (bp < be) {
|
||||
hval ^= (unsigned int) maptolower[*bp++];
|
||||
hval ^= (isc_uint32_t) maptolower[*bp++];
|
||||
hval *= 16777619;
|
||||
}
|
||||
}
|
||||
|
|
@ -485,19 +486,20 @@ isc_hash_function(const void *data, size_t length,
|
|||
return (hval);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_uint32_t
|
||||
isc_hash_function_reverse(const void *data, size_t length,
|
||||
isc_boolean_t case_sensitive,
|
||||
unsigned int *previous_hashp)
|
||||
const isc_uint32_t *previous_hashp)
|
||||
{
|
||||
unsigned int hval;
|
||||
isc_uint32_t hval;
|
||||
const unsigned char *bp;
|
||||
const unsigned char *be;
|
||||
|
||||
INSIST(data == NULL || length > 0);
|
||||
RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS);
|
||||
|
||||
hval = ISC_UNLIKELY(previous_hashp != NULL) ? *previous_hashp : fnv_offset_basis;
|
||||
hval = ISC_UNLIKELY(previous_hashp != NULL) ?
|
||||
*previous_hashp : fnv_offset_basis;
|
||||
|
||||
if (length == 0)
|
||||
return (hval);
|
||||
|
|
@ -517,33 +519,33 @@ isc_hash_function_reverse(const void *data, size_t length,
|
|||
if (case_sensitive) {
|
||||
while (be >= bp + 4) {
|
||||
be -= 4;
|
||||
hval ^= (unsigned int) be[3];
|
||||
hval ^= (isc_uint32_t) be[3];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) be[2];
|
||||
hval ^= (isc_uint32_t) be[2];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) be[1];
|
||||
hval ^= (isc_uint32_t) be[1];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) be[0];
|
||||
hval ^= (isc_uint32_t) be[0];
|
||||
hval *= 16777619;
|
||||
}
|
||||
while (--be >= bp) {
|
||||
hval ^= (unsigned int) *be;
|
||||
hval ^= (isc_uint32_t) *be;
|
||||
hval *= 16777619;
|
||||
}
|
||||
} else {
|
||||
while (be >= bp + 4) {
|
||||
be -= 4;
|
||||
hval ^= (unsigned int) maptolower[be[3]];
|
||||
hval ^= (isc_uint32_t) maptolower[be[3]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[be[2]];
|
||||
hval ^= (isc_uint32_t) maptolower[be[2]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[be[1]];
|
||||
hval ^= (isc_uint32_t) maptolower[be[1]];
|
||||
hval *= 16777619;
|
||||
hval ^= (unsigned int) maptolower[be[0]];
|
||||
hval ^= (isc_uint32_t) maptolower[be[0]];
|
||||
hval *= 16777619;
|
||||
}
|
||||
while (--be >= bp) {
|
||||
hval ^= (unsigned int) maptolower[*be];
|
||||
hval ^= (isc_uint32_t) maptolower[*be];
|
||||
hval *= 16777619;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,14 +198,14 @@ isc__hash_setvec(const isc_uint16_t *vec);
|
|||
* doing before using this function.
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
isc_uint32_t
|
||||
isc_hash_function(const void *data, size_t length,
|
||||
isc_boolean_t case_sensitive,
|
||||
unsigned int *previous_hashp);
|
||||
unsigned int
|
||||
const isc_uint32_t *previous_hashp);
|
||||
isc_uint32_t
|
||||
isc_hash_function_reverse(const void *data, size_t length,
|
||||
isc_boolean_t case_sensitive,
|
||||
unsigned int *previous_hashp);
|
||||
const isc_uint32_t *previous_hashp);
|
||||
/*!<
|
||||
* \brief Calculate a hash over data.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1995,53 +1995,43 @@ isc___mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
|||
/*
|
||||
* Don't let the caller go over quota
|
||||
*/
|
||||
if (mpctx->allocated >= mpctx->maxalloc) {
|
||||
if (ISC_UNLIKELY(mpctx->allocated >= mpctx->maxalloc)) {
|
||||
item = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* if we have a free list item, return the first here
|
||||
*/
|
||||
item = mpctx->items;
|
||||
if (item != NULL) {
|
||||
mpctx->items = item->next;
|
||||
INSIST(mpctx->freecount > 0);
|
||||
mpctx->freecount--;
|
||||
mpctx->gets++;
|
||||
mpctx->allocated++;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to dip into the well. Lock the memory context here and
|
||||
* fill up our free list.
|
||||
*/
|
||||
MCTXLOCK(mctx, &mctx->lock);
|
||||
for (i = 0; i < mpctx->fillcount; i++) {
|
||||
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
|
||||
item = mem_getunlocked(mctx, mpctx->size);
|
||||
} else {
|
||||
item = mem_get(mctx, mpctx->size);
|
||||
if (item != NULL)
|
||||
mem_getstats(mctx, mpctx->size);
|
||||
if (ISC_UNLIKELY(mpctx->items == NULL)) {
|
||||
/*
|
||||
* We need to dip into the well. Lock the memory context here and
|
||||
* fill up our free list.
|
||||
*/
|
||||
MCTXLOCK(mctx, &mctx->lock);
|
||||
for (i = 0; i < mpctx->fillcount; i++) {
|
||||
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
|
||||
item = mem_getunlocked(mctx, mpctx->size);
|
||||
} else {
|
||||
item = mem_get(mctx, mpctx->size);
|
||||
if (item != NULL)
|
||||
mem_getstats(mctx, mpctx->size);
|
||||
}
|
||||
if (ISC_UNLIKELY(item == NULL))
|
||||
break;
|
||||
item->next = mpctx->items;
|
||||
mpctx->items = item;
|
||||
mpctx->freecount++;
|
||||
}
|
||||
if (item == NULL)
|
||||
break;
|
||||
item->next = mpctx->items;
|
||||
mpctx->items = item;
|
||||
mpctx->freecount++;
|
||||
MCTXUNLOCK(mctx, &mctx->lock);
|
||||
}
|
||||
MCTXUNLOCK(mctx, &mctx->lock);
|
||||
|
||||
/*
|
||||
* If we didn't get any items, return NULL.
|
||||
*/
|
||||
item = mpctx->items;
|
||||
if (item == NULL)
|
||||
if (ISC_UNLIKELY(item == NULL))
|
||||
goto out;
|
||||
|
||||
mpctx->items = item->next;
|
||||
INSIST(mpctx->freecount > 0);
|
||||
mpctx->freecount--;
|
||||
mpctx->gets++;
|
||||
mpctx->allocated++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue