]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
datasets: test unix socket ipv6 operations
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 27 Aug 2024 13:26:22 +0000 (15:26 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 30 Aug 2024 13:19:00 +0000 (15:19 +0200)
Ticket: 6969

.github/workflows/live/icmp.rules
.github/workflows/live/pcap.sh

index 2003c46531646f8cd14ca3c54fb43f8e54961717..a938596a81a795afa711fcc049a0a28d435a2d43 100644 (file)
@@ -1,2 +1,3 @@
 alert icmp any any -> any any (itype:8; sid:1;)
 alert icmp any any -> any any (itype:8; ip.dst; dataset:set,ipv4-list,type ipv4; sid:222;)
+alert icmp any any -> any any (itype:8; ip.dst; dataset:set,ipv6-list,type ipv6; sid:226;)
index decdb692de0ade7722eb3225ec8bc58c4404fb13..24119d8af6860b029e326a619bd5193586105f65 100755 (executable)
@@ -75,6 +75,29 @@ if [ $CHECK -ne 2 ]; then
     RES=1
 fi
 
+JSON=$(python3 python/bin/suricatasc -c "dataset-add ipv6-list ip 192.168.1.1" /var/run/suricata/suricata-command.socket)
+echo $JSON
+if [ "$(echo $JSON | jq -r .message)" != "data added" ]; then
+    echo "ERROR unix socket dataset add failed"
+    RES=1
+fi
+
+# look it up in IPv4 in IPv6 notation
+JSON=$(python3 python/bin/suricatasc -c "dataset-lookup ipv6-list ip ::ffff:c0a8:0101" /var/run/suricata/suricata-command.socket)
+echo $JSON
+if [ "$(echo $JSON | jq -r .message)" != "item found in set" ]; then
+    echo "ERROR unix socket dataset lookup failed"
+    RES=1
+fi
+
+# fail to add junk
+JSON=$(python3 python/bin/suricatasc -c "dataset-add ipv6-list ip ::ffff:c0a8:0z0z" /var/run/suricata/suricata-command.socket)
+echo $JSON
+if [ "$(echo $JSON | jq -r .message)" != "failed to add data" ]; then
+    echo "ERROR unix socket dataset added junk"
+    RES=1
+fi
+
 echo "SURIPID $SURIPID PINGPID $PINGPID"
 
 # set second rule file for the reload