Skip to content

Commit b99f47d

Browse files
committed
decoder/tunnels: add test for tunnel ids
Ticket: 7674
1 parent 267fcda commit b99f47d

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed

tests/decoder-tunnels-01/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Description
2+
3+
Test tunnel identifiers
4+
5+
# Ticket
6+
7+
https://redmine.openinfosecfoundation.org/issues/7674
8+
9+
# PCAP
10+
11+
Crafter with scapy script.py

tests/decoder-tunnels-01/script.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python
2+
from scapy.all import *
3+
from scapy.contrib.erspan import *
4+
5+
pkts = []
6+
7+
pkt1 = Ether()/IP(dst='192.168.1.2', src='192.168.1.3')/UDP()/VXLAN(vni=123)/Ether()/IP(dst='10.1.2.3', src='10.1.2.4')/ICMP(type=8)/"pxng"
8+
pkt2 = Ether()/IP(dst='192.168.1.2', src='192.168.1.4')/GRE()/ERSPAN_II(session_id=321)/Ether()/IP(dst='10.1.2.3', src='10.1.2.4')/ICMP(type=8)/"peng"
9+
10+
11+
pkts += pkt1
12+
pkts += pkt2
13+
14+
wrpcap('tunnels.pcap', pkts)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%YAML 1.1
2+
---
3+
4+
outputs:
5+
- eve-log:
6+
enabled: yes
7+
filetype: regular
8+
filename: eve.json
9+
types:
10+
- alert
11+
- flow
12+
13+
decoder:
14+
tunnels:
15+
- id: 1
16+
type: erspan2
17+
src: 192.168.1.4
18+
dst: 192.168.1.2
19+
session: 321
20+
- id: 2
21+
type: vxlan
22+
src: 192.168.1.3
23+
dst: 192.168.1.2
24+
session: 123
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
alert icmp any any -> any any (itype:8; sid:1;)
2+

tests/decoder-tunnels-01/test.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
requires:
2+
min-version: 8
3+
4+
args:
5+
- --set decoder.vxlan.enabled=true
6+
7+
checks:
8+
- filter:
9+
count: 1
10+
match:
11+
event_type: flow
12+
proto: "ICMP"
13+
tunnel_id: 1
14+
- filter:
15+
count: 1
16+
match:
17+
event_type: flow
18+
proto: "ICMP"
19+
tunnel_id: 2
248 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)