From: Mark Andrews Date: Thu, 27 Mar 2025 05:37:02 +0000 (+1100) Subject: Extract and send server cookie with BADVERS retry X-Git-Tag: v9.21.8~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44140cad3b8e6567ec77175332f9da58da9d0617;p=thirdparty%2Fbind9.git Extract and send server cookie with BADVERS retry A BADVERS response can also include EDNS SERVER COOKIE. Extract that from the OPT record and use it when resending the request. --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 0bc839c121c..e9696ab1d2c 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4269,6 +4269,12 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, dighost_comments(l, "BADVERS, retrying with EDNS version %u.", (unsigned int)newedns); l->edns = newedns; + /* + * Extract the server cookie so it can be sent in the retry. + */ + if (l->cookie == NULL && l->sendcookie) { + process_opt(l, msg); + } n = requeue_lookup(l, true); if (l->trace && l->trace_root) { n->rdtype = l->qrdtype;