]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Extract and send server cookie with BADVERS retry
authorMark Andrews <marka@isc.org>
Thu, 27 Mar 2025 05:37:02 +0000 (16:37 +1100)
committerMark Andrews <marka@isc.org>
Tue, 15 Apr 2025 03:13:20 +0000 (03:13 +0000)
A BADVERS response can also include EDNS SERVER COOKIE.  Extract
that from the OPT record and use it when resending the request.

(cherry picked from commit 44140cad3b8e6567ec77175332f9da58da9d0617)

bin/dig/dighost.c

index 90e8f0c0ad46308578c1b8729dff8be8599aaaeb..ebd796ec6590a925b2467b48a6532750d594996f 100644 (file)
@@ -4341,6 +4341,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;