--- /dev/null
+Test that the engine correctly issues a wrong ip version event and flags packet
+as invalid when decoding an IPv4-in-IPv6 packet with wrong/ invalid IP version.
+
+PCAP
+----
+
+Created by using bug-4571-06 pcap and replacing IPv4 version with invalid value.
+
+Ticket
+------
+
+https://redmine.openinfosecfoundation.org/issues/7964
--- /dev/null
+0000 0a 00 27 00 00 01 0a 00 27 00 00 00 86 dd 60 00 ..'.....'.....`.
+0010 00 00 00 34 04 7f 20 01 0d b8 85 a3 00 00 00 00 ...4.. .........
+0020 8a 2e 03 70 73 34 20 01 0d b8 85 a3 00 00 00 00 ...ps4 .........
+0030 8a 2e 03 70 73 35 56 80 00 34 04 d2 00 00 7f 06 ...ps5E..4......
+0040 22 6e 0a 01 00 01 0a 01 00 02 00 50 00 50 00 01 "n.........P.P..
+0050 f7 fa 00 00 00 00 50 00 04 00 5e ec 00 00 68 65 ......P...^...he
+0060 6c 6c 6f 2c 20 77 6f 72 6c 64 llo, world
--- /dev/null
+alert pkthdr any any -> any any (msg:"SURICATA IPv4-in-IPv6 invalid protocol"; decode-event:ipv6.ipv4_in_ipv6_wrong_version; classtype:protocol-command-decode; sid:2200083; rev:2;)
--- /dev/null
+requires:
+ min-version: 9
+
+args:
+- -k none
+- --set stream.midstream=true
+
+checks:
+ - filter:
+ count: 1
+ match:
+ event_type: alert
+ alert.signature_id: 2200083
+ proto: IP-in-IP
+ ip_v: 6
+ - filter:
+ count: 1
+ match:
+ event_type: stats
+ stats.decoder.pkts: 1
+ stats.decoder.invalid: 1
+ stats.decoder.ipv6: 1
+ stats.decoder.event.ipv6.ipv4_in_ipv6_wrong_version: 1
--- /dev/null
+Test that the engine correctly issues a wrong ip version event and flags packet
+as invalid when decoding an IPv6-in-IPv6 packet with wrong/ invalid IP version.
+
+PCAP
+----
+
+Created by using bug-4571-03 pcap and replacing IPv6 version with invalid value.
+
+Ticket
+------
+
+https://redmine.openinfosecfoundation.org/issues/7964
--- /dev/null
+0000 0a 00 27 00 00 01 0a 00 27 00 00 00 86 dd 60 00 ..'.....'.....`.
+0010 00 00 00 48 29 7f 20 01 0d b8 85 a3 00 00 00 00 ...H). .........
+0020 8a 2e 03 70 73 34 20 01 0d b8 85 a3 00 00 00 00 ...ps4 .........
+0030 8a 2e 03 70 73 35 45 00 00 00 00 20 06 7f 20 01 ...ps5`.... .. .
+0040 0d b8 85 a3 00 00 00 00 8a 2e 03 70 83 34 20 01 ...........p.4 .
+0050 0d b8 85 a3 00 00 00 00 8a 2e 03 70 83 35 00 50 ...........p.5.P
+0060 00 50 00 01 f7 fa 00 00 00 00 50 00 04 00 ea 90 .P........P.....
+0070 00 00 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64 ..hello, world
--- /dev/null
+alert pkthdr any any -> any any (msg:"SURICATA IPv6-in-IPv6 invalid protocol"; decode-event:ipv6.ipv6_in_ipv6_wrong_version; classtype:protocol-command-decode; sid:2200085; rev:2;)
--- /dev/null
+requires:
+ min-version: 9
+
+args:
+- -k none
+- --set stream.midstream=true
+
+checks:
+ - filter:
+ count: 1
+ match:
+ event_type: alert
+ alert.signature_id: 2200085
+ proto: IPv6
+ ip_v: 6
+ - filter:
+ count: 1
+ match:
+ event_type: stats
+ stats.decoder.pkts: 1
+ stats.decoder.invalid: 1
+ stats.decoder.ipv6: 1
+ stats.decoder.event.ipv6.ipv6_in_ipv6_wrong_version: 1