mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
don't ignore updates that change only the TTL
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
|
||||
#include <isc/types.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/types.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/rdata.h>
|
||||
|
||||
/***
|
||||
*** Types
|
||||
@@ -43,12 +46,16 @@ ISC_LANG_BEGINDECLS
|
||||
* A dns_difftuple_t represents a single RR being added or deleted.
|
||||
* The RR type and class are in the 'rdata' member; the class is always
|
||||
* the real one, not a DynDNS meta-class, so that the rdatas can be
|
||||
* compared using dns_rdata_compare(). The TTL is ignored for
|
||||
* RRs to be deleted.
|
||||
* compared using dns_rdata_compare(). The TTL is significant
|
||||
* even for deletions, because a deletion/addition pair cannot
|
||||
* be canceled out if the TTL differs (it might be an explicit
|
||||
* TTL update).
|
||||
*
|
||||
* Tuples are also used to represent the individual RRs of a
|
||||
* a "RRset exists (value dependent)" prerequisite set. In this case,
|
||||
* op==DNS_DIFFOP_EXISTS, and the TTL is ignored.
|
||||
* Tuples are also used to represent complete RRs with owner
|
||||
* names for a couple of other purposes, such as the
|
||||
* individual RRs of a "RRset exists (value dependent)"
|
||||
* prerequisite set. In this case, op==DNS_DIFFOP_EXISTS,
|
||||
* and the TTL is ignored.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
|
@@ -293,10 +293,12 @@ dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuplep)
|
||||
REQUIRE(VALID_DIFFTUPLE(*tuplep));
|
||||
|
||||
/*
|
||||
* Look for an existing tuple with the same owner name
|
||||
* and rdata. If we are doing an addition and find a
|
||||
* Look for an existing tuple with the same owner name,
|
||||
* rdata, and TTL. If we are doing an addition and find a
|
||||
* deletion or vice versa, remove both the old and the
|
||||
* new tuple since they cancel each other out.
|
||||
* new tuple since they cancel each other out (assuming
|
||||
* that we never delete nonexistent data or add existing
|
||||
* data).
|
||||
*
|
||||
* If we find an old update of the same kind as
|
||||
* the one we are doing, there must be a programming
|
||||
@@ -307,7 +309,8 @@ dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuplep)
|
||||
{
|
||||
next_ot = ISC_LIST_NEXT(ot, link);
|
||||
if (dns_name_equal(&ot->name, &(*tuplep)->name) &&
|
||||
dns_rdata_compare(&ot->rdata, &(*tuplep)->rdata) == 0)
|
||||
dns_rdata_compare(&ot->rdata, &(*tuplep)->rdata) == 0 &&
|
||||
ot->ttl == (*tuplep)->ttl)
|
||||
{
|
||||
ISC_LIST_UNLINK(diff->tuples, ot, link);
|
||||
if ((*tuplep)->op == ot->op) {
|
||||
@@ -388,7 +391,14 @@ dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver)
|
||||
ISC_LINK_INIT(&rdl, link);
|
||||
|
||||
while (t != NULL && dns_name_equal(&t->name, name) &&
|
||||
t->op == op && t->rdata.type == type) {
|
||||
t->op == op && t->rdata.type == type)
|
||||
{
|
||||
if (t->ttl != rdl.ttl) {
|
||||
printf("TTL differs in rdataset, "
|
||||
"adjusting %lu -> %lu\n",
|
||||
(unsigned long) t->ttl,
|
||||
(unsigned long) rdl.ttl);
|
||||
}
|
||||
ISC_LIST_APPEND(rdl.rdata, &t->rdata, link);
|
||||
t = ISC_LIST_NEXT(t, link);
|
||||
}
|
||||
@@ -412,8 +422,8 @@ dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver)
|
||||
if (result == DNS_R_UNCHANGED) {
|
||||
/*
|
||||
* This will not happen when executing a
|
||||
* dynamic * update, because that code will
|
||||
* generate strictly * minimal diffs.
|
||||
* dynamic update, because that code will
|
||||
* generate strictly minimal diffs.
|
||||
* It may happen when receiving an IXFR
|
||||
* from a server that is not as careful.
|
||||
* Issue a warning and continue.
|
||||
|
Reference in New Issue
Block a user