]> granicus.if.org Git - pdns/commitdiff
Merge pull request #3233 from rgacogne/dnsdist-dq
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 15 Jan 2016 20:23:50 +0000 (21:23 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 15 Jan 2016 20:23:50 +0000 (21:23 +0100)
dnsdist: Replace the Lua params with a DNSQuestion `dq` object

1  2 
pdns/README-dnsdist.md
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistconf.lua
pdns/dnsrulactions.hh

Simple merge
Simple merge
Simple merge
diff --cc pdns/dnsdist.cc
Simple merge
diff --cc pdns/dnsdist.hh
index 81dc83f32f9a206f41bb666d4bd4d67ff9cafafb,06c1ff503a215956d92e1c0576f90ccf36c4fe7d..49fab7cd1366ca4a2c19d6a0722bd38e014258eb
@@@ -433,14 -447,13 +447,14 @@@ void controlThread(int fd, ComboAddres
  vector<std::function<void(void)>> setupLua(bool client, const std::string& config);
  NumberedServerVector getDownstreamCandidates(const servers_t& servers, const std::string& pool);
  
- std::shared_ptr<DownstreamState> firstAvailable(const NumberedServerVector& servers, const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh);
+ std::shared_ptr<DownstreamState> firstAvailable(const NumberedServerVector& servers, const DNSQuestion* dq);
  
- std::shared_ptr<DownstreamState> leastOutstanding(const NumberedServerVector& servers, const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh);
- std::shared_ptr<DownstreamState> wrandom(const NumberedServerVector& servers, const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh);
- std::shared_ptr<DownstreamState> whashed(const NumberedServerVector& servers, const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh);
- std::shared_ptr<DownstreamState> roundrobin(const NumberedServerVector& servers, const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh);
+ std::shared_ptr<DownstreamState> leastOutstanding(const NumberedServerVector& servers, const DNSQuestion* dq);
+ std::shared_ptr<DownstreamState> wrandom(const NumberedServerVector& servers, const DNSQuestion* dq);
+ std::shared_ptr<DownstreamState> whashed(const NumberedServerVector& servers, const DNSQuestion* dq);
+ std::shared_ptr<DownstreamState> roundrobin(const NumberedServerVector& servers, const DNSQuestion* dq);
  int getEDNSZ(const char* packet, unsigned int len);
 +void spoofResponseFromString(const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh, uint16_t& len, uint16_t querySize, const string& spoofContent);
  uint16_t getEDNSOptionCode(const char * packet, size_t len);
  void dnsdistWebserverThread(int sock, const ComboAddress& local, const string& password);
  bool getMsgLen32(int fd, uint32_t* len);
Simple merge
index 3b14651df844a6791e917d079b9801c8ffa25c91,d04d83d1ccae1b4ce1ce66eca0f1371f98f3696b..9f065502a167acd6290308b1f5b05ddeddf08f00
@@@ -356,20 -356,12 +356,21 @@@ public
  class SpoofAction : public DNSAction
  {
  public:
 -  SpoofAction(const ComboAddress& a) : d_a(a) { d_aaaa.sin4.sin_family = 0;}
 +  SpoofAction(const ComboAddress& a)
 +  {
 +    if (a.sin4.sin_family == AF_INET) {
 +      d_a = a;
 +      d_aaaa.sin4.sin_family = 0;
 +    } else {
 +      d_a.sin4.sin_family = 0;
 +      d_aaaa = a;
 +    }
 +  }
    SpoofAction(const ComboAddress& a, const ComboAddress& aaaa) : d_a(a), d_aaaa(aaaa) {}
    SpoofAction(const string& cname): d_cname(cname) { d_a.sin4.sin_family = 0; d_aaaa.sin4.sin_family = 0; }
-   DNSAction::Action operator()(const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh, uint16_t& len, uint16_t bufferSize, string* ruleresult) const override
+   DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
    {
+     uint16_t qtype = dq->qtype;
      if(d_cname.empty() &&
         ((qtype == QType::A && d_a.sin4.sin_family == 0) ||
          (qtype == QType::AAAA && d_aaaa.sin4.sin_family == 0) || (qtype != QType::A && qtype != QType::AAAA)))