From: Mark Andrews Date: Mon, 23 Mar 2026 05:43:32 +0000 (+1100) Subject: Add switch to disable cookie checking in delv X-Git-Tag: v9.21.21~10^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed15b6cb26154b540febf47dd6854ca40e0a7fca;p=thirdparty%2Fbind9.git Add switch to disable cookie checking in delv 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. --- diff --git a/bin/delv/delv.c b/bin/delv/delv.c index c149eedaf4a..6ddef282d00 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -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)); diff --git a/lib/dns/client.c b/lib/dns/client.c index 565c4d8ce90..c50126895e4 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -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; diff --git a/lib/dns/include/dns/client.h b/lib/dns/include/dns/client.h index 695c8298806..0751e2983f8 100644 --- a/lib/dns/include/dns/client.h +++ b/lib/dns/include/dns/client.h @@ -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,