]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
eve/flow: add vlan and double-tagged vlan test 48/head
authorMark Janssen <mark@praseodym.net>
Thu, 28 Feb 2019 15:15:25 +0000 (16:15 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 23 Apr 2019 08:25:24 +0000 (10:25 +0200)
tests/eve-flow-vlan/input.pcap [new file with mode: 0644]
tests/eve-flow-vlan/suricata.yaml [new file with mode: 0644]
tests/eve-flow-vlan/test.yaml [new file with mode: 0644]
tests/eve-flow-vlan/writepcap.py [new file with mode: 0755]

diff --git a/tests/eve-flow-vlan/input.pcap b/tests/eve-flow-vlan/input.pcap
new file mode 100644 (file)
index 0000000..6cfd80f
Binary files /dev/null and b/tests/eve-flow-vlan/input.pcap differ
diff --git a/tests/eve-flow-vlan/suricata.yaml b/tests/eve-flow-vlan/suricata.yaml
new file mode 100644 (file)
index 0000000..04706a5
--- /dev/null
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      filetype: regular
+      filename: eve.json
+      types:
+        - flow
diff --git a/tests/eve-flow-vlan/test.yaml b/tests/eve-flow-vlan/test.yaml
new file mode 100644 (file)
index 0000000..8a255d5
--- /dev/null
@@ -0,0 +1,19 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+  min-version: 5.0.0
+
+checks:
+  - filter:
+      comment: single vlan
+      count: 1
+      match:
+        event_type: flow
+        vlan: [6]
+
+  - filter:
+      comment: double-tagged vlan
+      count: 1
+      match:
+        event_type: flow
+        vlan: [1, 10]
diff --git a/tests/eve-flow-vlan/writepcap.py b/tests/eve-flow-vlan/writepcap.py
new file mode 100755 (executable)
index 0000000..bb6b7f1
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+from scapy.all import *
+
+pkts = []
+
+# VLAN tagged packet
+pkts += Ether(dst='ff:ff:ff:ff:ff:ff', src='00:01:02:03:04:05')/ \
+    Dot1Q(vlan=6)/ \
+    IP(dst='255.255.255.255', src='192.168.0.1')/ICMP()
+
+# Double-tagged VLAN (QinQ) packet
+pkts += Ether(dst='ff:ff:ff:ff:ff:ff', src='00:01:02:03:04:05')/ \
+    Dot1Q(vlan=1)/Dot1Q(vlan=10)/ \
+    IP(dst='255.255.255.255', src='192.168.0.1')/ICMP()
+
+wrpcap('input.pcap', pkts)