]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
process review comments
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 22 Jun 2022 09:13:01 +0000 (11:13 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 22 Jun 2022 14:04:25 +0000 (16:04 +0200)
pdns/dnsdist-tcp.cc
pdns/dnsdistdist/doh.cc

index d7b444c22a075dad4091358d7e57d778bd347930..e4a872aa8cd4d0d07a39f1e2d685b3a91c63b8e7 100644 (file)
@@ -259,8 +259,7 @@ static void handleResponseSent(std::shared_ptr<IncomingTCPConnectionState>& stat
     ::handleResponseSent(ids, udiff, state->d_ci.remote, ds->d_config.remote, static_cast<unsigned int>(currentResponse.d_buffer.size()), currentResponse.d_cleartextDH, backendProtocol);
   } else {
     const auto& ids = currentResponse.d_idstate;
-    double udiff = ids.sentTime.udiff();
-    ::handleResponseSent(ids, udiff, state->d_ci.remote, ComboAddress(), static_cast<unsigned int>(currentResponse.d_buffer.size()), currentResponse.d_cleartextDH, ids.protocol);
+    ::handleResponseSent(ids, 0., state->d_ci.remote, ComboAddress(), static_cast<unsigned int>(currentResponse.d_buffer.size()), currentResponse.d_cleartextDH, ids.protocol);
   }
 }
 
@@ -746,13 +745,12 @@ static void handleQuery(std::shared_ptr<IncomingTCPConnectionState>& state, cons
   if (result == ProcessQueryResult::SendAnswer) {
     TCPResponse response;
     response.d_selfGenerated = true;
-    response.d_buffer = std::move(state->d_buffer);
-    setIDStateFromDNSQuestion(response.d_idstate, dq, std::move(qname));
     response.d_idstate.origID = dh->id;
     response.d_idstate.cs = state->d_ci.cs;
+    setIDStateFromDNSQuestion(response.d_idstate, dq, std::move(qname));
 
-    DNSResponse dr = makeDNSResponseFromIDState(response.d_idstate, response.d_buffer);
-    memcpy(&response.d_cleartextDH, dr.getHeader(), sizeof(response.d_cleartextDH));
+    memcpy(&response.d_cleartextDH, dh, sizeof(response.d_cleartextDH));
+    response.d_buffer = std::move(state->d_buffer);
 
     state->d_state = IncomingTCPConnectionState::State::idle;
     ++state->d_currentQueriesCount;
index d0d09211a6ba81501d42640b8843e9a803ec1cb6..1d206b30478a0cdc3d8ccac830853d5a213d482a 100644 (file)
@@ -622,7 +622,7 @@ static void processDOHQuery(DOHUnitUniquePtr&& du)
       }
       auto dh = const_cast<struct dnsheader*>(reinterpret_cast<const struct dnsheader*>(du->response.data()));
 
-      handleResponseSent(qname, QType(qtype), 0., du->downstream->d_config.remote, ComboAddress(), du->response.size(), *dh, du->downstream->getProtocol());
+      handleResponseSent(qname, QType(qtype), 0., du->ids.origDest, ComboAddress(), du->response.size(), *dh, dnsdist::Protocol::DoH);
       sendDoHUnitToTheMainThread(std::move(du), "DoH self-answered response");
       return;
     }