summaryrefslogtreecommitdiffstats
path: root/examples/filter_rcode.lua
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2023-12-10 09:45:27 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2023-12-10 09:45:27 +0000
commit38b6c8c8ca8294c87bce5325fbba50fba1a40465 (patch)
tree14f869a6270a904547a6abcb113c5425554d8331 /examples/filter_rcode.lua
parentAdding upstream version 1.2.3. (diff)
downloaddnsjit-upstream.tar.xz
dnsjit-upstream.zip
Adding upstream version 1.3.0.upstream/1.3.0upstream
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'examples/filter_rcode.lua')
-rwxr-xr-xexamples/filter_rcode.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/filter_rcode.lua b/examples/filter_rcode.lua
index c3f0254..729cb8e 100755
--- a/examples/filter_rcode.lua
+++ b/examples/filter_rcode.lua
@@ -28,9 +28,20 @@ while true do
end
transport = transport.obj_prev
end
+ 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 transport and dns and dns:parse_header() == 0 and dns.have_rcode == 1 and dns.rcode == rcode then
+ if transport ~= nil and dns:parse_header() == 0 and dns.have_rcode == 1 and dns.rcode == rcode then
transport = transport:cast()
print(dns.id, transport:source().." -> "..transport:destination())
end