]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rename BPFFilter:unblockRange() to BPFFilter:allowRange()
authorY7n05h <Y7n05h@protonmail.com>
Fri, 22 Apr 2022 17:49:41 +0000 (01:49 +0800)
committerY7n05h <Y7n05h@protonmail.com>
Fri, 22 Apr 2022 18:32:34 +0000 (02:32 +0800)
Signed-off-by: Y7n05h <Y7n05h@protonmail.com>
pdns/bpf-filter.cc
pdns/bpf-filter.hh
pdns/dnsdist-lua-bindings.cc
pdns/dnsdistdist/docs/reference/ebpf.rst

index c7912fd39fdc0b25a72bbbe9737b802d345a3a82..00f93802dba53fe46c44e5a41492953619fb4a65 100644 (file)
@@ -565,7 +565,7 @@ void BPFFilter::block(const Netmask& addr, BPFFilter::MatchAction action)
   }
 }
 
-void BPFFilter::unblock(const Netmask& addr)
+void BPFFilter::allow(const Netmask& addr)
 {
   int res = 0;
   CounterAndActionValue value;
@@ -904,7 +904,7 @@ void BPFFilter::block(const Netmask&, BPFFilter::MatchAction)
 {
   throw std::runtime_error("eBPF support not enabled");
 }
-void BPFFilter::unblock(const Netmask&)
+void BPFFilter::allow(const Netmask&)
 {
   throw std::runtime_error("eBPF support not enabled");
 }
index 87e4a415574c230e23f1d147e30ffb40340ea938..6c04418ea6ebaa1c2d6d90b5b31319dcaf5e2552 100644 (file)
@@ -72,7 +72,7 @@ public:
   void block(const Netmask& address, BPFFilter::MatchAction action);
   void block(const DNSName& qname, MatchAction action, uint16_t qtype=255);
   void unblock(const ComboAddress& addr);
-  void unblock(const Netmask& address);
+  void allow(const Netmask& address);
   void unblock(const DNSName& qname, uint16_t qtype=255);
 
   std::vector<std::pair<ComboAddress, uint64_t> > getAddrStats();
index d9b84e6342d622f48c9dbe502849fd5696dfa03f..adba3e165f0f5a80a83113e757c52b8bc5e7fd63 100644 (file)
@@ -555,11 +555,11 @@ void setupLuaBindings(LuaContext& luaCtx, bool client)
         return bpf->unblock(ca);
       }
     });
-  luaCtx.registerFunction<void (std::shared_ptr<BPFFilter>::*)(const string& range)>("unblockRange", [](std::shared_ptr<BPFFilter> bpf, const string& range) {
+  luaCtx.registerFunction<void (std::shared_ptr<BPFFilter>::*)(const string& range)>("allowRange", [](std::shared_ptr<BPFFilter> bpf, const string& range) {
     if (!bpf) {
       return;
     }
-    bpf->unblock(Netmask(range));
+    bpf->allow(Netmask(range));
   });
   luaCtx.registerFunction<void(std::shared_ptr<BPFFilter>::*)(const DNSName& qname, boost::optional<uint16_t> qtype)>("unblockQName", [](std::shared_ptr<BPFFilter> bpf, const DNSName& qname, boost::optional<uint16_t> qtype) {
       if (bpf) {
index 37afdfee42fdb36bd1773197e382dfd10fc7716b..74eba1873e512ed5c06024168935fe49b4627b90 100644 (file)
@@ -108,12 +108,12 @@ These are all the functions, objects and methods related to the :doc:`../advance
 
     :param ComboAddress address: The address to unblock
 
-  .. method:: BPFFilter:unblockRange(Netmask)
+  .. method:: BPFFilter:allowRange(Netmask)
 
   .. versionchanged:: 1.8.0
 
-    Unblock this range. 
-
+    Allow all IP address in this range.
+    DNSDist will attempt to delete the item specified by Netmask first, and if no such item can be found, a new item will be inserted to indicate the exception for this subnet.
     DNSDist eBPF code first checks if an exact IP match is found, then if a range matches, and finally if a DNSName does.
     If a query coming from an IP or range marked as allowed, but is for a qname for which a DNSName block exists, the packet will be accepted as the first match wins.