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.
This commit is contained in:
Mark Andrews 2026-03-23 16:43:32 +11:00
parent 36597d52d1
commit ed15b6cb26
3 changed files with 33 additions and 3 deletions

View 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));

View 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;

View 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,