[dnsdist] LUA DNS Parser

japantoday at gmail.com japantoday at gmail.com
Fri Jun 20 07:43:04 UTC 2025


I was attempting to run this sample code I found on the website.

function dumpPacket(dq)
  local packet = dq:getContent()
  local overlay = newDNSPacketOverlay(packet)
  print(overlay.qname)
  print(overlay.qtype)
  print(overlay.qclass)
  local count = overlay:getRecordsCountInSection(DNSSection.Answer)
  print(count)
  for idx=0, count-1 do
    local record = overlay:getRecord(idx)
    print(record.name)
    print(record.type)
    print(record.class)
    print(record.ttl)
    print(record.place)
    print(record.contentLength)
    print(record.contentOffset)
  end
  return DNSAction.None
end

addAction(AllRule(), LuaAction(dumpPacket))




Essentially, it should print out details about the DNS answer it received.

On my machine, I get nothing.  It thinks count is always 0, when in fact
that is not true.  At this point I am trying to figure out why this code
does not work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/dnsdist/attachments/20250620/56710318/attachment.htm>


More information about the dnsdist mailing list