]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add switch to disable cookie checking in delv
authorMark Andrews <marka@isc.org>
Mon, 23 Mar 2026 05:43:32 +0000 (16:43 +1100)
committerMark Andrews <marka@isc.org>
Thu, 26 Mar 2026 00:18:26 +0000 (11:18 +1100)
This adds the switch +[no]cookie to delv to control the sending of
DNS COOKIE options when sending requests.  The default is to send
DNS COOKIE options.

bin/delv/delv.c
lib/dns/client.c
lib/dns/include/dns/client.h

index c149eedaf4ab8e66f066e8da0e4932bcea3d5076..6ddef282d003b33beac6a3dddd118d37a5515e8b 100644 (file)
@@ -141,6 +141,7 @@ static bool cdflag = false, no_sigs = false, root_validation = true;
 static bool qmin = false, qmin_strict = false;
 
 static bool use_tcp = false;
+static bool cookie = true;
 
 static char *anchorfile = NULL;
 static char *trust_anchor = NULL;
@@ -1081,9 +1082,19 @@ plus_option(char *option) {
                        FULLCHECK("class");
                        noclass = !state;
                        break;
-               case 'o': /* comments */
-                       FULLCHECK("comments");
-                       showcomments = state;
+               case 'o':
+                       switch (cmd[2]) {
+                       case 'm': /* comments */
+                               FULLCHECK("comments");
+                               showcomments = state;
+                               break;
+                       case 'o': /* cookie */
+                               FULLCHECK("cookie");
+                               cookie = state;
+                               break;
+                       default:
+                               goto invalid_option;
+                       }
                        break;
                case 'r': /* crypto */
                        FULLCHECK("crypto");
@@ -1870,6 +1881,7 @@ run_resolve(void *arg) {
                                srcaddr4, srcaddr6));
        dns_client_setmaxrestarts(client, restarts);
        dns_client_setmaxqueries(client, maxtotal);
+       dns_client_setsendcookie(client, cookie);
 
        /* Set the nameserver */
        if (server != NULL) {
@@ -2150,6 +2162,7 @@ run_server(void *arg) {
 
        view->qminimization = qmin;
        view->qmin_strict = qmin_strict;
+       view->sendcookie = cookie;
 
        dns_view_initsecroots(view);
        CHECK(setup_dnsseckeys(NULL, view));
index 565c4d8ce904b6a8f4131a28c8d7f6dafc63a293..c50126895e4d63773a31b442e82889bb754b2041 100644 (file)
@@ -375,6 +375,13 @@ dns_client_setmaxqueries(dns_client_t *client, uint8_t max_queries) {
        client->max_queries = max_queries;
 }
 
+void
+dns_client_setsendcookie(dns_client_t *client, bool sendcookie) {
+       REQUIRE(DNS_CLIENT_VALID(client));
+
+       client->view->sendcookie = sendcookie;
+}
+
 static isc_result_t
 getrdataset(isc_mem_t *mctx, dns_rdataset_t **rdatasetp) {
        dns_rdataset_t *rdataset;
index 695c82988064a88145fe6cc9db3f3444852590f2..0751e2983f8208fc593dd27e39850a91d983440e 100644 (file)
@@ -198,6 +198,16 @@ dns_client_setmaxqueries(dns_client_t *client, uint8_t max_queries);
  *\li  'max_queries' is greater than 0.
  */
 
+void
+dns_client_setsendcookie(dns_client_t *client, bool sendcookie);
+/*%<
+ * Add EDNS COOKIE options to the DNS request.
+ *
+ * Requires:
+ *
+ *\li  'client' is a valid client.
+ */
+
 typedef void (*dns_client_resolve_cb)(dns_client_t     *client,
                                      const dns_name_t *name,
                                      dns_namelist_t   *namelist,