From 7b6e1bb8af930c9f2cf90e8df009438bf13d1d05 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 7 Dec 2022 14:09:56 +0100 Subject: [PATCH] Only raise the limit to 1M if the current is lower than 1M --- 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 435c0f16f7..bb0c58e01d 100644 --- a/pdns/bpf-filter.cc +++ b/pdns/bpf-filter.cc @@ -361,11 +361,10 @@ BPFFilter::BPFFilter(std::unordered_map& configs, throw std::runtime_error("Unable to get memory lock limit: " + stringerror()); } - const rlim_t minimal_limit_size = 64 * 124; const rlim_t new_limit_size = 1024 * 1024; - /* Check if the current soft memlock limit is at least minimal_limit */ - if (old_limit.rlim_cur < minimal_limit_size) { + /* Check if the current soft memlock limit is at least the limit */ + if (old_limit.rlim_cur < new_limit_size) { infolog("The current limit of locked memory (soft: %d, hard: %d) is too low for eBPF, trying to raise it to %d", old_limit.rlim_cur, old_limit.rlim_max, new_limit_size); struct rlimit new_limit; -- 2.47.2