From 815aee7a22c749b0e4729318d66af311f5137314 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 20 Apr 2022 14:32:14 +0200 Subject: [PATCH] dnsdist: Fix wrong eBPF values (qtype, counter) being inserted for qnames --- pdns/bpf-filter.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pdns/bpf-filter.cc b/pdns/bpf-filter.cc index d0ec0f6172..877f5f8a46 100644 --- a/pdns/bpf-filter.cc +++ b/pdns/bpf-filter.cc @@ -503,12 +503,11 @@ void BPFFilter::block(const DNSName& qname, BPFFilter::MatchAction action, uint1 throw std::runtime_error("Table full when trying to block " + qname.toLogString()); } - int res = bpf_lookup_elem(map.d_fd.getHandle(), &key, &value); + int res = bpf_lookup_elem(map.d_fd.getHandle(), &key, value); if (res != -1) { throw std::runtime_error("Trying to block an already blocked qname: " + qname.toLogString()); } - - res = bpf_update_elem(map.d_fd.getHandle(), &key, &value, BPF_NOEXIST); + res = bpf_update_elem(map.d_fd.getHandle(), &key, value, BPF_NOEXIST); if (res == 0) { ++map.d_count; } -- 2.47.2