From: Remi Gacogne Date: Wed, 20 Apr 2022 12:32:14 +0000 (+0200) Subject: dnsdist: Fix wrong eBPF values (qtype, counter) being inserted for qnames X-Git-Tag: auth-4.8.0-alpha0~128^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11565%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Fix wrong eBPF values (qtype, counter) being inserted for qnames --- 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; }