Dynamic DNS

Irina Goble irinag at ims.com
Fri Aug 6 22:40:56 UTC 1999


Brian,

	Really it should not be too hard to fix, as the sequence of
updates is known (first A, then PTR). See below, but I didn't test it.
It takes some updates by hand (bind/nsupdate) to remove all dangling
RRs for the first time (Turn on debug for updates on named and catch
all "update: debug 1: process_prereq: a.example.com exists" or dig dhcpd
log file) ?


> On another note... I have not done much with prereqs in DDNS.  Does a
> prereq apply to all updates in the same transaction or just to the RR
> update immediatly following?
> 
> I am seeing a need to send the following in order to update a given name
> address pair of h.example.com @ 192.168.1.1:
> 
> 1	prereq: {yxdomain} h.example.com. IN A 
> 2	update: {delete} h.example.com IN A
> 3	update: {add} h.example.com. 600 IN A 192.168.1.1
> 4	prereq: {yxdomain} 1.1.168.192.in-addr.arpa. IN PTR 
> 5	update: {delete} 1.1.168.192.in-addr.arpa. IN PTR 
> 6	update: {add} 1.1.168.192.in-addr.arpa. 600 IN PTR h.example.com.
> 
> The question is can I sent them all in one request, or do they have to be
> split 1, 2 & 3 in one request 4, 5 & 6 in another, or even worse 4 seperate
> requests made up of 1 & 2, then 3 then 4 & 5, and then 6?
> 
	You can try 1,2,3 in one request and 4,5,6 in another, should work,
however there is no way to know if an update failed because of the prerequsite
or update section.

Good luck

I'm not sure the list accepts attachments:
*** nsupdate.c.orig     Fri Aug  6 15:14:27 1999
--- nsupdate.c  Fri Aug  6 15:22:58 1999
***************
*** 487,517 ****
        
        /* delete an existing A if the one to be added is different */
        if (lease -> ddns_fwd_name &&
!           strcmp(hostname, lease -> ddns_fwd_name)) {
!               int y;
!               y=nsupdateA(lease -> ddns_fwd_name, ipaddr, 0, DELETE);
! 
!               if (y) {
!                       /* clear the forward DNS name pointer */
!                       if (lease -> ddns_fwd_name)
!                               dfree(lease -> ddns_fwd_name, "nsupdate");
!                       lease -> ddns_fwd_name = 0;
!               }
!       }
!       /* only update if there is no A record there already */
!       if (!lease -> ddns_fwd_name) {
!               int y;
!               y=nsupdateA(hostname, ipaddr, ttl, ADD);
!               if (y < 1)
!                       return 0;
! 
!               /* remember this in the lease structure for release */
!               lease -> ddns_fwd_name = dmalloc(strlen(hostname) + 1,
!                                                "nsupdate");
!               strcpy (lease -> ddns_fwd_name, hostname);
!       }
! 
!       return 1;
  }
  
  /* public function to update an A record if needed */
--- 487,498 ----
        
        /* delete an existing A if the one to be added is different */
        if (lease -> ddns_fwd_name &&
!           strcmp(hostname, lease -> ddns_fwd_name) &&
!           nsupdateA (lease -> ddns_fwd_name, ipaddr, 0, DELETE) == 1 &&
!           nsupdateA (hostname, ipaddr, ttl, ADD) == 1) 
!               return 1;
!       else
!               return 0;
  }
  
  /* public function to update an A record if needed */
***************
*** 532,547 ****
        
        /* delete an existing PTR if the one to be added is different */
        if (lease -> ddns_rev_name &&
!           strcmp(revname, lease -> ddns_rev_name)) {
!               int y;
!               y=nsupdatePTR(revname, hostname, 0, DELETE);
! 
!               if (y) {
!                       /* clear the reverse DNS name pointer */
!                       if (lease -> ddns_rev_name)
!                               dfree(lease -> ddns_rev_name, "nsupdate");
!                       lease -> ddns_rev_name = 0;
!               }
        }
        /* only update if there is no PTR record there already */
        if (!lease -> ddns_rev_name) {
--- 513,526 ----
        
        /* delete an existing PTR if the one to be added is different */
        if (lease -> ddns_rev_name &&
!           strcmp(revname, lease -> ddns_rev_name)
!           nsupdatePTR (revname, lease -> ddns_fwd_name, 0, DELETE) == 1) {
!               /* clear the reverse DNS name pointer */
!               if (lease -> ddns_rev_name)
!                       dfree(lease -> ddns_rev_name, "nsupdate");
!               if (lease -> ddns_fwd_name) 
!                       dfree (lease -> ddns_fwd_name, "nsupdate");
!               lease -> ddns_rev_name = lease -> ddns_fwd_name = 0;
        }
        /* only update if there is no PTR record there already */
        if (!lease -> ddns_rev_name) {



More information about the dhcp-hackers mailing list