]> 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 02:38:37 +0000 (02:38 +0000)
A BADVERS response can also include EDNS SERVER COOKIE.  Extract
that from the OPT record and use it when resending the request.

bin/dig/dighost.c

index 0bc839c121c8dd3216483992e1fccb16469dbf62..e9696ab1d2c184dc59d744fbcd3a85a4e611f380 100644 (file)
@@ -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;