]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Modify dns/client.c:dns_client_createx() to only require one of IPv6 or
authorShawn Routhier <sar@isc.org>
Tue, 13 Apr 2010 19:06:48 +0000 (19:06 +0000)
committerShawn Routhier <sar@isc.org>
Tue, 13 Apr 2010 19:06:48 +0000 (19:06 +0000)
IPv6 rather than both.  [RT #21122]

CHANGES
lib/dns/client.c

diff --git a/CHANGES b/CHANGES
index abd2a5c1407d6bc834731b698bb4a0d5fe47d66a..30408ea6eb0593395604671166682aac1978b73a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+2872.  [bug]           Modify dns/client.c:dns_client_createx() to only
+                       require one of IPv4 or IPv6 rather than both.
+                       [RT #21122]
+
 2871.  [bug]           Type mismatch in mem_api.c between the definition and
                        the header file, causing build failure with
                        --enable-exportlib. [RT #21138]
index 4e218b716db29f04637dc9f40faac2ef4345320a..09ad57a9aa5468bce8ea6932533d356bc485927f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2009-2010  Internet Systems Consortium, Inc. ("ISC")
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: client.c,v 1.6 2009/10/27 22:46:13 each Exp $ */
+/* $Id: client.c,v 1.7 2010/04/13 19:06:48 sar Exp $ */
 
 #include <config.h>
 
@@ -385,12 +385,12 @@ dns_client_create(dns_client_t **clientp, unsigned int options) {
        return (ISC_R_SUCCESS);
 
  cleanup:
+       if (taskmgr != NULL)
+               isc_taskmgr_destroy(&taskmgr);
        if (timermgr != NULL)
                isc_timermgr_destroy(&timermgr);
        if (socketmgr != NULL)
                isc_socketmgr_destroy(&socketmgr);
-       if (taskmgr != NULL)
-               isc_taskmgr_destroy(&taskmgr);
        if (actx != NULL)
                isc_appctx_destroy(&actx);
        isc_mem_detach(&mctx);
@@ -442,16 +442,22 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
        client->dispatchmgr = dispatchmgr;
 
        /* TODO: whether to use dispatch v4 or v6 should be configurable */
+       client->dispatchv4 = NULL;
+       client->dispatchv6 = NULL;
        result = getudpdispatch(AF_INET, dispatchmgr, socketmgr,
                                taskmgr, ISC_TRUE, &dispatchv4);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup;
-       client->dispatchv4 = dispatchv4;
+       if (result == ISC_R_SUCCESS)
+               client->dispatchv4 = dispatchv4;
        result = getudpdispatch(AF_INET6, dispatchmgr, socketmgr,
                                taskmgr, ISC_TRUE, &dispatchv6);
-       if (result != ISC_R_SUCCESS)
+       if (result == ISC_R_SUCCESS)
+               client->dispatchv6 = dispatchv6;
+
+       /* We need at least one of the dispatchers */
+       if (dispatchv4 == NULL && dispatchv6 == NULL) {
+               INSIST(result != ISC_R_SUCCESS);
                goto cleanup;
-       client->dispatchv6 = dispatchv6;
+       }
 
        /* Create the default view for class IN */
        result = dns_client_createview(mctx, dns_rdataclass_in, options,