summaryrefslogtreecommitdiff
path: root/common/dns.c
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2009-02-12 00:15:33 +0000
committerDavid Hankins <dhankins@isc.org>2009-02-12 00:15:33 +0000
commitefa5e6b99f2ff97ee1ec2f54904477f7c8f6375a (patch)
treef9cfc0eefa9f8b4e693bfb34eab95bd3ade0859b /common/dns.c
parent70ea9345cd1a0d6fc57b1af2602688f088dce3a9 (diff)
downloadisc-dhcp-efa5e6b99f2ff97ee1ec2f54904477f7c8f6375a.tar.gz
- DDNS removal routines were updated so that the DHCID is not removed until
the client has been deprived of all A and AAAA records (not only the last one of either of those). This resolves a bug where dual stack clients would not be able to regain their names after either expiration event. [ISC-Bugs #18716]
Diffstat (limited to 'common/dns.c')
-rw-r--r--common/dns.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/common/dns.c b/common/dns.c
index 878caf5b..25cfb598 100644
--- a/common/dns.c
+++ b/common/dns.c
@@ -859,7 +859,7 @@ ddns_remove_fwd(struct data_string *ddns_fwd_name,
/*
- * A RR matches the expiring lease.
+ * Address RR (A/AAAA) matches the expiring lease.
*/
updrec = minires_mkupdrec (S_PREREQ,
(const char *)ddns_fwd_name -> data,
@@ -877,7 +877,7 @@ ddns_remove_fwd(struct data_string *ddns_fwd_name,
/*
- * Delete appropriate A RR.
+ * Delete appropriate Address RR (A/AAAA).
*/
updrec = minires_mkupdrec (S_UPDATE,
(const char *)ddns_fwd_name -> data,
@@ -926,20 +926,27 @@ ddns_remove_fwd(struct data_string *ddns_fwd_name,
minires_freeupdrec (updrec);
}
- /* If the deletion of the A succeeded, and there are no A records
- left for this domain, then we can blow away the DHCID record
- as well. We can't blow away the DHCID record above because
- it's possible that more than one A has been added to this
- domain name. */
+ /*
+ * If the deletion of the desired address succeeded (its A or AAAA
+ * RR was removed above), and there are zero other A or AAAA records
+ * left for this domain, then we can delete the DHCID record as well.
+ * We can't delete the DHCID record above because it's possible the
+ * client has more than one valid address added to this domain name,
+ * by this or other DHCP servers.
+ *
+ * Essentially, this final update is a cleanup operation that is only
+ * intended to succeed after the last address has been removed from
+ * DNS (which is only expected to happen after the client is not
+ * reasonably in possession of those addresses).
+ */
ISC_LIST_INIT (updqueue);
/*
* A RR does not exist.
*/
- updrec = minires_mkupdrec (S_PREREQ,
- (const char *)ddns_fwd_name -> data,
- C_IN, ddns_address_type, 0);
- if (!updrec) {
+ updrec = minires_mkupdrec(S_PREREQ, (const char *)ddns_fwd_name->data,
+ C_IN, T_A, 0);
+ if (updrec == NULL) {
result = ISC_R_NOMEMORY;
goto error;
}
@@ -951,6 +958,23 @@ ddns_remove_fwd(struct data_string *ddns_fwd_name,
ISC_LIST_APPEND (updqueue, updrec, r_link);
/*
+ * AAAA RR does not exist.
+ */
+ updrec = minires_mkupdrec(S_PREREQ, (const char *)ddns_fwd_name->data,
+ C_IN, T_AAAA, 0);
+
+ if (updrec == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto error;
+ }
+
+ updrec->r_data = NULL;
+ updrec->r_size = 0;
+ updrec->r_opcode = NXRRSET;
+
+ ISC_LIST_APPEND(updqueue, updrec, r_link);
+
+ /*
* Delete appropriate DHCID RR.
*/
updrec = minires_mkupdrec (S_UPDATE,