summaryrefslogtreecommitdiffstats
path: root/examples/dumpdns2pcap.lua
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2023-12-10 09:45:31 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2023-12-10 09:45:31 +0000
commitf5b47f1a6e9048e72f1e3b0e0f7c03459e20ca66 (patch)
treeb0042536e5ff6047564d27d25470dcec2b92f258 /examples/dumpdns2pcap.lua
parentReleasing debian version 1.2.3-3. (diff)
downloaddnsjit-f5b47f1a6e9048e72f1e3b0e0f7c03459e20ca66.tar.xz
dnsjit-f5b47f1a6e9048e72f1e3b0e0f7c03459e20ca66.zip
Merging upstream version 1.3.0.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'examples/dumpdns2pcap.lua')
-rwxr-xr-xexamples/dumpdns2pcap.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/dumpdns2pcap.lua b/examples/dumpdns2pcap.lua
index 08656cc..03cc21f 100755
--- a/examples/dumpdns2pcap.lua
+++ b/examples/dumpdns2pcap.lua
@@ -26,6 +26,18 @@ while true do
if obj == nil then break end
local pl = obj:cast()
if obj:type() == "payload" and pl.len > 0 then
+ local protocol = obj.obj_prev
+ while protocol ~= nil do
+ if protocol.obj_type == object.UDP or protocol.obj_type == object.TCP then
+ break
+ end
+ protocol = protocol.obj_prev
+ end
+
+ dns:reset()
+ if protocol ~= nil and protocol.obj_type == object.TCP then
+ dns.includes_dnslen = 1
+ end
dns.obj_prev = obj
if dns:parse_header() == 0 then
receiver(rctx, obj)