]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Merging rt14930 - Use ISC_R codes as returned rather than DNS codes.
authorDavid Hankins <dhankins@isc.org>
Tue, 2 Aug 2005 09:04:45 +0000 (09:04 +0000)
committerDavid Hankins <dhankins@isc.org>
Tue, 2 Aug 2005 09:04:45 +0000 (09:04 +0000)
RELNOTES
common/dns.c

index ffdbf81022e1f2edca0cc2f4ef4cb1753ca3d5b6..cbd555a1af5d7ca63a7bb4ce0c5fd4c98025d059 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -43,6 +43,13 @@ Murrell at BC Tel Advanced Communications.  I'd like to express my
 thanks to all of these good people here, both for working on the code
 and for prodding me into improving it.
 
+
+                       Changes since 3.0.3
+
+- A DDNS update handling function was misusing the DNS error codes, rather
+  than the internal generic result enumeration.  The result is a confusing
+  syslog line, logging the wrong condition.
+
                        Changes since 3.0.3b3
 
 - dhclient.conf documentation for interface {} was updated to reflect recent
index e80df9ab7caa91d703a882fb5e4608f06d476135..90008797191eff93164cee859cc56c5658d9451d 100644 (file)
@@ -3,7 +3,7 @@
    Domain Name Service subroutines. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 2001-2003 by Internet Software Consortium
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dns.c,v 1.35.2.16 2004/06/17 20:54:38 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dns.c,v 1.35.2.17 2005/08/02 09:04:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -526,7 +526,7 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
        ns_updque updqueue;
        ns_updrec *updrec;
        isc_result_t result;
-       char ddns_address [16];
+       char ddns_address [16], *logstr;
 
        if (ddns_addr.len != 4)
                return ISC_R_INVALIDARG;
@@ -712,24 +712,36 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
         */
        result = minires_nupdate (&resolver_state, ISC_LIST_HEAD (updqueue));
 
-       if (result != ISC_R_SUCCESS) {
-               if (result == YXRRSET || result == YXDOMAIN ||
-                   result == NXRRSET || result == NXDOMAIN)
-                       log_error ("Forward map from %.*s to %s already in use",
-                                  (int)ddns_fwd_name -> len,
-                                  (const char *)ddns_fwd_name -> data,
-                                  ddns_address);
-               else
-                       log_error ("Can't update forward map %.*s to %s: %s",
+       switch (result) {
+           case ISC_R_SUCCESS:
+               logstr = NULL;
+               break;
+
+           case ISC_R_YXRRSET:
+           case ISC_R_YXDOMAIN:
+               logstr = "DHCID mismatch, belongs to another client.";
+               break;
+
+           case ISC_R_NXRRSET:
+           case ISC_R_NXDOMAIN:
+               logstr = "Has an A record but no DHCID, not mine.";
+               break;
+
+           default:
+               logstr = isc_result_totext(result);
+               break;
+       }
+
+       if (logstr != NULL)
+               log_error("Forward map from %.*s to %s FAILED: %s",
                                   (int)ddns_fwd_name -> len,
                                   (const char *)ddns_fwd_name -> data,
-                                  ddns_address, isc_result_totext (result));
-
-       } else {
-               log_info ("Added new forward map from %.*s to %s",
+                                  ddns_address, logstr);
+       else
+               log_info("Added new forward map from %.*s to %s",
                          (int)ddns_fwd_name -> len,
                          (const char *)ddns_fwd_name -> data, ddns_address);
-       }
+
 #if defined (DEBUG_DNS_UPDATES)
        print_dns_status ((int)result, &updqueue);
 #endif