]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Name the values "interface_localaddr" and "interface_remoteaddr" instead of "phys_..."
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 8 Apr 2024 08:07:05 +0000 (10:07 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 8 Apr 2024 08:07:05 +0000 (10:07 +0200)
pdns/recursordist/docs/lua-scripting/dq.rst
pdns/recursordist/lua-recursor4-ffi.hh
pdns/recursordist/lua-recursor4.cc
pdns/recursordist/lua-recursor4.hh
regression-tests.recursor-dnssec/test_ProxyProtocol.py

index aa8fd9641c11f9a5a6f724f4765849a91a0477be..b06b268107dc1133c10c2d54070ab7873ce9354c 100644 (file)
@@ -57,13 +57,13 @@ The DNSQuestion object contains at least the following fields:
       :class:`ComboAddress` where this query was received on.
       If the proxy protocol is used, this will contain the destination address from the proxy protocol header.
 
-  .. attribute:: DNSQuestion.phys_remoteaddr
+  .. attribute:: DNSQuestion.interface_remoteaddr
 
-      :class:`ComboAddress` of the physical requestor, that is, the physical network source address of the request.
+      :class:`ComboAddress` of the interface the requestor used, that is, the network source address of the request.
 
-  .. attribute:: DNSQuestion.phys_localaddr
+  .. attribute:: DNSQuestion.interface_localaddr
 
-      The physical :class:`ComboAddress` where this query was received on, which is one of the listening addresses of the recursor.
+      The :class:`ComboAddress` of the interface where this query was received on, which is one of the listening addresses of the recursor.
 
   .. attribute:: DNSQuestion.variable
 
index 71149517319a6a86721d7d97641c2c168a030f54..12b8bf2538b1297a12502e9fee894908dd391b79 100644 (file)
@@ -77,12 +77,12 @@ extern "C"
   void pdns_ffi_param_get_local_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
   uint16_t pdns_ffi_param_get_local_port(const pdns_ffi_param_t* ref) __attribute__((visibility("default")));
 
-  const char* pdns_ffi_param_get_phys_remote(pdns_ffi_param_t* ref) __attribute__((visibility("default")));
-  void pdns_ffi_param_get_phys_remote_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
-  uint16_t pdns_ffi_param_get_phys_remote_port(const pdns_ffi_param_t* ref) __attribute__((visibility("default")));
-  const char* pdns_ffi_param_get_phys_local(pdns_ffi_param_t* ref) __attribute__((visibility("default")));
-  void pdns_ffi_param_get_phys_local_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
-  uint16_t pdns_ffi_param_get_phys_local_port(const pdns_ffi_param_t* ref) __attribute__((visibility("default")));
+  const char* pdns_ffi_param_get_interface_remote(pdns_ffi_param_t* ref) __attribute__((visibility("default")));
+  void pdns_ffi_param_get_interface_remote_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
+  uint16_t pdns_ffi_param_get_interface_remote_port(const pdns_ffi_param_t* ref) __attribute__((visibility("default")));
+  const char* pdns_ffi_param_get_interface_local(pdns_ffi_param_t* ref) __attribute__((visibility("default")));
+  void pdns_ffi_param_get_interface_local_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
+  uint16_t pdns_ffi_param_get_interface_local_port(const pdns_ffi_param_t* ref) __attribute__((visibility("default")));
 
   const char* pdns_ffi_param_get_edns_cs(pdns_ffi_param_t* ref) __attribute__((visibility("default")));
   void pdns_ffi_param_get_edns_cs_raw(pdns_ffi_param_t* ref, const void** net, size_t* netSize) __attribute__((visibility("default")));
index bc0c80c05a1181f5b83210c6cf7fc09b30a73860..af5308ad7b2972c171b680019bf56d89767b8b2a 100644 (file)
@@ -167,8 +167,8 @@ void RecursorLua4::postPrepareContext()
   d_lw->registerMember<bool (DNSQuestion::*)>("isTcp", [](const DNSQuestion& dnsQuestion) -> bool { return dnsQuestion.isTcp; }, [](DNSQuestion& /* dnsQuestion */, bool newTcp) { (void) newTcp; });
   d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("localaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.local; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newLocal) { (void) newLocal; });
   d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("remoteaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.remote; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newRemote) { (void) newRemote; });
-  d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("phys_localaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.phys_local; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newLocal) { (void) newLocal; });
-  d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("phys_remoteaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.phys_remote; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newRemote) { (void) newRemote; });
+  d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("interface_localaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.interface_local; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newLocal) { (void) newLocal; });
+  d_lw->registerMember<const ComboAddress (DNSQuestion::*)>("interface_remoteaddr", [](const DNSQuestion& dnsQuestion) -> const ComboAddress& { return dnsQuestion.interface_remote; }, [](DNSQuestion& /* dnsQuestion */, const ComboAddress& newRemote) { (void) newRemote; });
   d_lw->registerMember<uint8_t (DNSQuestion::*)>("validationState", [](const DNSQuestion& dnsQuestion) -> uint8_t { return (vStateIsBogus(dnsQuestion.validationState) ? /* in order not to break older scripts */ static_cast<uint8_t>(255) : static_cast<uint8_t>(dnsQuestion.validationState)); }, [](DNSQuestion& /* dnsQuestion */, uint8_t newState) { (void) newState; });
   d_lw->registerMember<vState (DNSQuestion::*)>("detailedValidationState", [](const DNSQuestion& dnsQuestion) -> vState { return dnsQuestion.validationState; }, [](DNSQuestion& /* dnsQuestion */, vState newState) { (void) newState; });
 
@@ -708,8 +708,8 @@ public:
   std::unique_ptr<std::string> qnameStr{nullptr};
   std::unique_ptr<std::string> localStr{nullptr};
   std::unique_ptr<std::string> remoteStr{nullptr};
-  std::unique_ptr<std::string> physLocalStr{nullptr};
-  std::unique_ptr<std::string> physRemoteStr{nullptr};
+  std::unique_ptr<std::string> interfaceLocalStr{nullptr};
+  std::unique_ptr<std::string> interfaceRemoteStr{nullptr};
   std::unique_ptr<std::string> ednssubnetStr{nullptr};
   std::vector<pdns_ednsoption_t> ednsOptionsVect;
   std::vector<pdns_proxyprotocol_value_t> proxyProtocolValuesVect;
@@ -870,42 +870,42 @@ uint16_t pdns_ffi_param_get_local_port(const pdns_ffi_param_t* ref)
   return ref->params.local.getPort();
 }
 
-const char* pdns_ffi_param_get_phys_remote(pdns_ffi_param_t* ref)
+const char* pdns_ffi_param_get_interface_remote(pdns_ffi_param_t* ref)
 {
-  if (!ref->physRemoteStr) {
-    ref->physRemoteStr = std::make_unique<std::string>(ref->params.phys_remote.toString());
+  if (!ref->interfaceRemoteStr) {
+    ref->interfaceRemoteStr = std::make_unique<std::string>(ref->params.interface_remote.toString());
   }
 
-  return ref->physRemoteStr->c_str();
+  return ref->interfaceRemoteStr->c_str();
 }
 
-void pdns_ffi_param_get_phys_remote_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize)
+void pdns_ffi_param_get_interface_remote_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize)
 {
-  pdns_ffi_comboaddress_to_raw(ref->params.phys_remote, addr, addrSize);
+  pdns_ffi_comboaddress_to_raw(ref->params.interface_remote, addr, addrSize);
 }
 
-uint16_t pdns_ffi_param_get_phys_remote_port(const pdns_ffi_param_t* ref)
+uint16_t pdns_ffi_param_get_interface_remote_port(const pdns_ffi_param_t* ref)
 {
-  return ref->params.phys_remote.getPort();
+  return ref->params.interface_remote.getPort();
 }
 
-const char* pdns_ffi_param_get_phys_local(pdns_ffi_param_t* ref)
+const char* pdns_ffi_param_get_interface_local(pdns_ffi_param_t* ref)
 {
-  if (!ref->physLocalStr) {
-    ref->physLocalStr = std::make_unique<std::string>(ref->params.phys_local.toString());
+  if (!ref->interfaceLocalStr) {
+    ref->interfaceLocalStr = std::make_unique<std::string>(ref->params.interface_local.toString());
   }
 
-  return ref->physLocalStr->c_str();
+  return ref->interfaceLocalStr->c_str();
 }
 
-void pdns_ffi_param_get_phys_local_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize)
+void pdns_ffi_param_get_interface_local_raw(pdns_ffi_param_t* ref, const void** addr, size_t* addrSize)
 {
-  pdns_ffi_comboaddress_to_raw(ref->params.phys_local, addr, addrSize);
+  pdns_ffi_comboaddress_to_raw(ref->params.interface_local, addr, addrSize);
 }
 
-uint16_t pdns_ffi_param_get_phys_local_port(const pdns_ffi_param_t* ref)
+uint16_t pdns_ffi_param_get_interface_local_port(const pdns_ffi_param_t* ref)
 {
-  return ref->params.phys_local.getPort();
+  return ref->params.interface_local.getPort();
 }
 
 const char* pdns_ffi_param_get_edns_cs(pdns_ffi_param_t* ref)
index 263d2a9392bbac2e8ba01673dd25ab6d75cb1d4a..a275184510d4bbf1977e843be5600d93df4b02f1 100644 (file)
@@ -88,12 +88,12 @@ public:
   {
     // NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
     DNSQuestion(const ComboAddress& prem, const ComboAddress& ploc, const ComboAddress& rem, const ComboAddress& loc, const DNSName& query, uint16_t type, bool tcp, bool& variable_, bool& wantsRPZ_, bool& logResponse_, bool& addPaddingToResponse_, const struct timeval& queryTime_) :
-      qname(query), phys_local(ploc), phys_remote(prem), local(loc), remote(rem), variable(variable_), wantsRPZ(wantsRPZ_), logResponse(logResponse_), addPaddingToResponse(addPaddingToResponse_), queryTime(queryTime_), qtype(type), isTcp(tcp)
+      qname(query), interface_local(ploc), interface_remote(prem), local(loc), remote(rem), variable(variable_), wantsRPZ(wantsRPZ_), logResponse(logResponse_), addPaddingToResponse(addPaddingToResponse_), queryTime(queryTime_), qtype(type), isTcp(tcp)
     {
     }
     const DNSName& qname;
-    const ComboAddress& phys_local;
-    const ComboAddress& phys_remote;
+    const ComboAddress& interface_local;
+    const ComboAddress& interface_remote;
     const ComboAddress& local;
     const ComboAddress& remote;
     const ComboAddress* fromAuthIP{nullptr};
@@ -169,14 +169,14 @@ public:
   public:
     // NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
     FFIParams(const DNSName& qname_, uint16_t qtype_, const ComboAddress& plocal_, const ComboAddress& premote_, const ComboAddress& local_, const ComboAddress& remote_, const Netmask& ednssubnet_, LuaContext::LuaObject& data_, std::unordered_set<std::string>& policyTags_, std::vector<DNSRecord>& records_, const EDNSOptionViewMap& ednsOptions_, const std::vector<ProxyProtocolValue>& proxyProtocolValues_, std::string& requestorId_, std::string& deviceId_, std::string& deviceName_, std::string& routingTag_, boost::optional<int>& rcode_, uint32_t& ttlCap_, bool& variable_, bool tcp_, bool& logQuery_, bool& logResponse_, bool& followCNAMERecords_, boost::optional<uint16_t>& extendedErrorCode_, std::string& extendedErrorExtra_, bool& disablePadding_, std::map<std::string, MetaValue>& meta_) :
-      data(data_), qname(qname_), phys_local(plocal_), phys_remote(premote_), local(local_), remote(remote_), ednssubnet(ednssubnet_), policyTags(policyTags_), records(records_), ednsOptions(ednsOptions_), proxyProtocolValues(proxyProtocolValues_), requestorId(requestorId_), deviceId(deviceId_), deviceName(deviceName_), routingTag(routingTag_), extendedErrorExtra(extendedErrorExtra_), rcode(rcode_), extendedErrorCode(extendedErrorCode_), ttlCap(ttlCap_), variable(variable_), logQuery(logQuery_), logResponse(logResponse_), followCNAMERecords(followCNAMERecords_), disablePadding(disablePadding_), qtype(qtype_), tcp(tcp_), meta(meta_)
+      data(data_), qname(qname_), interface_local(plocal_), interface_remote(premote_), local(local_), remote(remote_), ednssubnet(ednssubnet_), policyTags(policyTags_), records(records_), ednsOptions(ednsOptions_), proxyProtocolValues(proxyProtocolValues_), requestorId(requestorId_), deviceId(deviceId_), deviceName(deviceName_), routingTag(routingTag_), extendedErrorExtra(extendedErrorExtra_), rcode(rcode_), extendedErrorCode(extendedErrorCode_), ttlCap(ttlCap_), variable(variable_), logQuery(logQuery_), logResponse(logResponse_), followCNAMERecords(followCNAMERecords_), disablePadding(disablePadding_), qtype(qtype_), tcp(tcp_), meta(meta_)
     {
     }
 
     LuaContext::LuaObject& data;
     const DNSName& qname;
-    const ComboAddress& phys_local;
-    const ComboAddress& phys_remote;
+    const ComboAddress& interface_local;
+    const ComboAddress& interface_remote;
     const ComboAddress& local;
     const ComboAddress& remote;
     const Netmask& ednssubnet;
index ffc491811fd8554277426c87e3d1b4076f8db5c0..5f100fe13eba3b6dd545dd081c1911f05a6995ad 100644 (file)
@@ -111,16 +111,16 @@ class ProxyProtocolAllowedRecursorTest(ProxyProtocolRecursorTest):
         return true
       end
 
-      local physremoteaddr = dq.phys_remoteaddr:toString()
-      local physlocaladdr = dq.phys_localaddr:toStringWithPort()
+      local interfaceremoteaddr = dq.interface_remoteaddr:toString()
+      local interfacelocaladdr = dq.interface_localaddr:toStringWithPort()
 
-      if physremoteaddr ~= '127.0.0.1' and physremoteaddr ~= '[::]' then
-        pdnslog('invalid phys source '..physremoteaddr)
+      if interfaceremoteaddr ~= '127.0.0.1' and interfaceremoteaddr ~= '[::]' then
+        pdnslog('invalid interface source '..interfaceremoteaddr)
         dq:addAnswer(pdns.A, '192.0.2.131', 60)
         return true
       end
-      if physlocaladdr ~= '127.0.0.1:%d' and physlocaladdr ~= '[::1]:%d' then
-        pdnslog('invalid physdest '..physlocaladdr)
+      if interfacelocaladdr ~= '127.0.0.1:%d' and interfacelocaladdr ~= '[::1]:%d' then
+        pdnslog('invalid interfacedest '..interfacelocaladdr)
         dq:addAnswer(pdns.A, '192.0.2.132', 60)
         return true
       end
@@ -478,10 +478,10 @@ class ProxyProtocolAllowedFFIRecursorTest(ProxyProtocolAllowedRecursorTest):
       uint16_t pdns_ffi_param_get_remote_port(const pdns_ffi_param_t* ref);
       uint16_t pdns_ffi_param_get_local_port(const pdns_ffi_param_t* ref);
 
-      const char* pdns_ffi_param_get_phys_remote(pdns_ffi_param_t* ref);
-      const char* pdns_ffi_param_get_phys_local(pdns_ffi_param_t* ref);
-      uint16_t pdns_ffi_param_get_phys_remote_port(const pdns_ffi_param_t* ref);
-      uint16_t pdns_ffi_param_get_phys_local_port(const pdns_ffi_param_t* ref);
+      const char* pdns_ffi_param_get_interface_remote(pdns_ffi_param_t* ref);
+      const char* pdns_ffi_param_get_interface_local(pdns_ffi_param_t* ref);
+      uint16_t pdns_ffi_param_get_interface_remote_port(const pdns_ffi_param_t* ref);
+      uint16_t pdns_ffi_param_get_interface_local_port(const pdns_ffi_param_t* ref);
 
       void pdns_ffi_param_set_tag(pdns_ffi_param_t* ref, unsigned int tag);
     ]]
@@ -515,22 +515,22 @@ class ProxyProtocolAllowedFFIRecursorTest(ProxyProtocolAllowedRecursorTest):
         return
       end
 
-      local physremoteaddr = ffi.string(ffi.C.pdns_ffi_param_get_phys_remote(obj))
-      local physlocaladdr = ffi.string(ffi.C.pdns_ffi_param_get_phys_local(obj))
+      local interfaceremoteaddr = ffi.string(ffi.C.pdns_ffi_param_get_interface_remote(obj))
+      local interfacelocaladdr = ffi.string(ffi.C.pdns_ffi_param_get_interface_local(obj))
 
-      if physremoteaddr ~= '127.0.0.1' and remoteaddr ~= '::1' then
-        pdnslog('gettag-ffi: invalid phys source '..physremoteaddr)
+      if interfaceremoteaddr ~= '127.0.0.1' and remoteaddr ~= '::1' then
+        pdnslog('gettag-ffi: invalid interface source '..interfaceremoteaddr)
         ffi.C.pdns_ffi_param_set_tag(obj, 1)
         return
       end
-      if physlocaladdr ~= '127.0.0.1' and physlocaladdr ~= '::1' then
-        pdnslog('gettag-ffi: invalid phys dest '..physlocaladdr)
+      if interfacelocaladdr ~= '127.0.0.1' and interfacelocaladdr ~= '::1' then
+        pdnslog('gettag-ffi: invalid interface dest '..interfacelocaladdr)
         ffi.C.pdns_ffi_param_set_tag(obj, 2)
         return
       end
 
-      if ffi.C.pdns_ffi_param_get_phys_local_port(obj) ~= %d then
-        pdnslog('gettag-ffi: invalid phys source port '..ffi.C.pdns_ffi_param_get_phys_local_port(obj))
+      if ffi.C.pdns_ffi_param_get_interface_local_port(obj) ~= %d then
+        pdnslog('gettag-ffi: invalid interface source port '..ffi.C.pdns_ffi_param_get_interface_local_port(obj))
         ffi.C.pdns_ffi_param_set_tag(obj, 2)
         return
       end