Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: expungeByName overwrites the output when called multiple times #12075

Closed
christofchen opened this issue Oct 7, 2022 · 1 comment
Closed
Labels

Comments

@christofchen
Copy link
Contributor

  • Program: dnsdist
  • Issue type: Bug report

Short description

When calling expungeByName multiple times on the same line, there is only one line of output (the last one)

Environment

  • Operating system: Linux
  • Software version: 1.7.x master
  • Software source: github, self compiled

Steps to reproduce

preload the cache with entries for www.google.com and www.amazon.com, and expunge the records from the cache in one line:

getPool(""):getCache():expungeByName("www.google.com") getPool(""):getCache():expungeByName("www.amazon.com")
Expunged 1 records

Expected behaviour

Expunged 1 records
Expunged 1 records

Actual behaviour

Expunged 1 records (single line)

Other information

The output should be appended, not overwritten here:

diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc
index fb560c568..184ff33c2 100644
--- a/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc
+++ b/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc
@@ -166,7 +166,7 @@ void setupLuaBindingsPacketCache(LuaContext& luaCtx, bool client)
                   qname = DNSName(boost::get<string>(dname));
                 }
                 if (cache) {
-                  g_outputBuffer="Expunged " + std::to_string(cache->expungeByName(qname, qtype ? *qtype : QType(QType::ANY).getCode(), suffixMatch ? *suffixMatch : false)) + " records\n";
+                  g_outputBuffer+="Expunged " + std::to_string(cache->expungeByName(qname, qtype ? *qtype : QType(QType::ANY).getCode(), suffixMatch ? *suffixMatch : false)) + " records\n";
                 }
     });
   luaCtx.registerFunction<void(std::shared_ptr<DNSDistPacketCache>::*)()const>("printStats", [](const std::shared_ptr<DNSDistPacketCache>& cache) {

@omoerbeek
Copy link
Member

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants