]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
dns: add test with rrtype keyword and index
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 9 Sep 2025 13:01:58 +0000 (15:01 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Sep 2025 13:32:23 +0000 (15:32 +0200)
Ticket: 7480

tests/dns/dns-rrtype-index/README.md [new file with mode: 0644]
tests/dns/dns-rrtype-index/test.rules [new file with mode: 0644]
tests/dns/dns-rrtype-index/test.yaml [new file with mode: 0644]

diff --git a/tests/dns/dns-rrtype-index/README.md b/tests/dns/dns-rrtype-index/README.md
new file mode 100644 (file)
index 0000000..de1e9c7
--- /dev/null
@@ -0,0 +1,5 @@
+Test the `dns.rrtype` keyword with index.
+
+The PCAP here was reused from ./tests/dns/dns-eve-empty-format/input.pcap
+
+Redmine ticket: https://redmine.openinfosecfoundation.org/issues/7480
diff --git a/tests/dns/dns-rrtype-index/test.rules b/tests/dns/dns-rrtype-index/test.rules
new file mode 100644 (file)
index 0000000..949e8b5
--- /dev/null
@@ -0,0 +1,8 @@
+# Only alert on requests.
+alert dns any any -> any any (dns.rrtype:1,0; flow:to_client; sid:1; rev:1;)
+
+# Only alert on responses.
+alert dns any any -> any any (dns.rrtype:1,all; flow:to_client; sid:2; rev:1;)
+
+# Only alert on responses.
+alert dns any any -> any any (dns.rrtype:1,-1; flow:to_client; sid:3; rev:1;)
diff --git a/tests/dns/dns-rrtype-index/test.yaml b/tests/dns/dns-rrtype-index/test.yaml
new file mode 100644 (file)
index 0000000..7e20f1f
--- /dev/null
@@ -0,0 +1,21 @@
+requires:
+  min-version: 9
+
+pcap: ../dns-eve-empty-format/input.pcap
+
+checks:
+  - filter:
+      count: 3
+      match:
+        alert.signature_id: 1
+        event_type: alert
+  - filter:
+      count: 3
+      match:
+        alert.signature_id: 2
+        event_type: alert
+  - filter:
+      count: 4
+      match:
+        alert.signature_id: 3
+        event_type: alert