Dynamic DNS

Irina Goble irinag at ims.com
Sat Aug 7 00:34:25 UTC 1999


> > > 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.
> 
> > 	You can try 1,2,3 in one request and 4,5,6 in another, should work,
> 
> So your reading of the RFC (or nsupdate code I guess) is that the update
> can contain more than one "command"?
> 
	If you mean by a "command" a Resource Record in the update section, 
then yes, I think it can have a several RRs in the update section as well 
as in the prerequisite section (it is in RFC 2136!).
My guess is from BIND implementation (resolver and named).

> > however there is no way to know if an update failed because of the
> > prerequsite
> > or update section.
> 
> Hmmmmm.  Wondering if I care.  I mean it should be reported, that there was
> an error, but there is nothing the DHCP server could do about either error.
> 
> b.
> 
	Sorry, I was thinking about the fix and didn't respond more detailed.
Here is another diff, it does not need nsupdate from BIND :-)

*** nsupdate.c  Fri Aug  6 16:50:02 1999
--- nsupdate.c.orig     Fri Aug  6 15:14:27 1999
***************
*** 306,312 ****
                return 0;
        u->r_opcode = opcode;
        u->r_data = hostname;
!       u->r_size = hostname ? strlen(u->r_data) : 0;
  #if 0
        z = res_update(u);
  #else
--- 306,312 ----
                return 0;
        u->r_opcode = opcode;
        u->r_data = hostname;
!       u->r_size = strlen(u->r_data);
  #if 0
        z = res_update(u);
  #else
***************
*** 487,505 ****
        
        /* 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) {
!               nsupdatePTR (lease -> ddns_rev_name, NULL, 0, DELETE);
!               /* 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;
!               return 1;
!       } else
!               return 0;
  }
  
  /* public function to update an A record if needed */
--- 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 */
***************
*** 518,527 ****
        strncat(hostname, rhs->data, rhs->len);
        hostname[rhs->len] = '\0';
        
!       /* delete an existing PTR if the one to be added is different 
!        * it is already done in updateA().
!        */
! 
        /* only update if there is no PTR record there already */
        if (!lease -> ddns_rev_name) {
                int y;
--- 530,548 ----
        strncat(hostname, rhs->data, rhs->len);
        hostname[rhs->len] = '\0';
        
!       /* 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) {
                int y;






More information about the dhcp-hackers mailing list