nta.c revision 2dd6ffb5cb356956685484160b0fdf157e2e9787
/*
* Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*! \file */
#include <config.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/resolver.h>
struct dns_nta {
unsigned int magic;
};
/*
* Obtain a reference to the nta object. Released by
* nta_detach.
*/
static void
}
static void
unsigned int refs;
if (refs == 0) {
}
}
}
}
static void
}
{
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
goto cleanup_ntatable;
if (result != ISC_R_SUCCESS)
goto cleanup_task;
if (result != ISC_R_SUCCESS)
goto cleanup_rbt;
return (ISC_R_SUCCESS);
return (result);
}
void
source->references++;
}
void
ntatable->references--;
if (ntatable->references == 0)
if (destroy) {
}
}
static void
switch (eresult) {
case ISC_R_SUCCESS:
case DNS_R_NCACHENXDOMAIN:
case DNS_R_NXDOMAIN:
case DNS_R_NCACHENXRRSET:
case DNS_R_NXRRSET:
break;
default:
break;
}
/*
* If we're expiring before the next recheck, we might
* as well stop the timer now.
*/
}
static void
}
&nta->sigrdataset,
if (result != ISC_R_SUCCESS)
}
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (result);
}
static isc_result_t
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (ISC_R_SUCCESS);
}
{
if (result != ISC_R_SUCCESS)
return (result);
if (result == ISC_R_SUCCESS) {
if (!force)
} else if (result == ISC_R_EXISTS) {
if (n == NULL) {
if (!force)
} else {
}
}
return (result);
}
/*
* Caller must hold a write lock on rwlock.
*/
static isc_result_t
if (result == ISC_R_SUCCESS) {
else
} else if (result == DNS_R_PARTIALMATCH)
return (result);
}
return (result);
}
{
return (ISC_FALSE);
if (result == DNS_R_PARTIALMATCH) {
}
if (result == ISC_R_SUCCESS) {
}
/* Deal with expired NTA */
char nb[DNS_NAME_FORMATSIZE];
if (locktype == isc_rwlocktype_read) {
goto relock;
}
"deleting expired NTA at %s", nb);
}
if (result != ISC_R_SUCCESS) {
"deleting NTA failed: %s",
}
goto again;
}
return (answer);
}
goto cleanup;
for (;;) {
isc_time_t t;
isc_time_set(&t, n->expiry, 0);
tbuf);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
}
if (result == ISC_R_NOMORE)
break;
}
}
if (isc_buffer_availablelength(*buf) != 0)
isc_buffer_putuint8(*buf, 0);
return (result);
}
goto cleanup;
for (;;) {
isc_time_t t;
isc_time_set(&t, n->expiry, 0);
tbuf);
}
if (result == ISC_R_NOMORE)
break;
}
}
return (result);
}
goto cleanup;
for (;;) {
isc_buffer_t b;
if (result != ISC_R_SUCCESS)
goto skip;
/* Zero terminate. */
isc_buffer_putuint8(&b, 0);
dns_time32_totext(n->expiry, &b);
tbuf);
}
}
skip:
if (result == ISC_R_NOMORE)
break;
}
}
if (result != ISC_R_SUCCESS)
return (result);
else
}