summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/libknot/test_xdp_tcp.c17
-rw-r--r--tests/libzscanner/TESTS1
-rw-r--r--tests/libzscanner/data/57_SVCB.in9
-rw-r--r--tests/libzscanner/data/57_SVCB.out28
-rw-r--r--tests/libzscanner/data/59_WALLET.in14
-rw-r--r--tests/libzscanner/data/59_WALLET.out32
-rw-r--r--tests/libzscanner/test_zscanner.in2
7 files changed, 99 insertions, 4 deletions
diff --git a/tests/libknot/test_xdp_tcp.c b/tests/libknot/test_xdp_tcp.c
index 3059ac1ea..4e02f57dc 100644
--- a/tests/libknot/test_xdp_tcp.c
+++ b/tests/libknot/test_xdp_tcp.c
@@ -236,6 +236,20 @@ void test_syn(void)
test_conn = conn;
}
+void test_syn_ack_no(void)
+{
+ knot_xdp_msg_t msg;
+ knot_tcp_relay_t rl = { 0 };
+ prepare_msg(&msg, KNOT_XDP_MSG_SYN | KNOT_XDP_MSG_ACK, 1, 2);
+ int ret = knot_tcp_recv(&rl, &msg, test_table, test_syn_table, XDP_TCP_IGNORE_NONE);
+ is_int(KNOT_EOK, ret, "SYN+ACK deny: relay OK");
+ is_int(XDP_TCP_NOOP, rl.auto_answer, "SYN+ACK deny: no auto answer");
+ is_int(XDP_TCP_NOOP, rl.answer, "SYN+ACK deny: no answer");
+ is_int(0, test_table->usage, "SYN+ACK deny: no connection in normal table");
+ is_int(1, test_syn_table->usage, "SYN+ACK deny: one connection in SYN table");
+ knot_tcp_cleanup(test_syn_table, &rl, 1);
+}
+
void test_establish(void)
{
knot_xdp_msg_t msg;
@@ -260,7 +274,7 @@ void test_syn_ack(void)
knot_xdp_msg_t msg;
knot_tcp_relay_t rl = { 0 };
prepare_msg(&msg, KNOT_XDP_MSG_SYN | KNOT_XDP_MSG_ACK, 1000, 2000);
- int ret = knot_tcp_recv(&rl, &msg, test_table, test_syn_table, XDP_TCP_IGNORE_NONE);
+ int ret = knot_tcp_recv(&rl, &msg, test_table, NULL, XDP_TCP_IGNORE_NONE);
is_int(KNOT_EOK, ret, "SYN+ACK: relay OK");
ret = knot_tcp_send(test_sock, &rl, 1, 1);
is_int(KNOT_EOK, ret, "SYN+ACK: send OK");
@@ -626,6 +640,7 @@ int main(int argc, char *argv[])
init_mock(&test_sock, mock_send);
test_syn();
+ test_syn_ack_no();
test_establish();
test_syn_ack();
diff --git a/tests/libzscanner/TESTS b/tests/libzscanner/TESTS
index 227cdb4c1..1ac5755b6 100644
--- a/tests/libzscanner/TESTS
+++ b/tests/libzscanner/TESTS
@@ -84,3 +84,4 @@
56_ZONEMD
57_SVCB
58_HTTPS
+59_WALLET
diff --git a/tests/libzscanner/data/57_SVCB.in b/tests/libzscanner/data/57_SVCB.in
index 78c07a613..e726aa496 100644
--- a/tests/libzscanner/data/57_SVCB.in
+++ b/tests/libzscanner/data/57_SVCB.in
@@ -20,7 +20,10 @@ $TTL 1
@ SVCB 1 . ech="Zm9vYg=="
@ SVCB 1 . ipv6hint=::1
@ SVCB 1 . ipv6hint="::1"
-@ SVCB 1 . key7
+@ SVCB 1 . dohpath=/q{?dns}
+@ SVCB 1 . dohpath="/dns-query{?dns}"
+@ SVCB 1 . ohttp
+@ SVCB 1 . key707
@ SVCB 1 . key65535
@ SVCB 1 . key65535=a
@ SVCB 1 . key65535="a"
@@ -90,6 +93,10 @@ example.com. SVCB 16 foo.example.org. alpn=f\\\092oo\092,bar,h2
@ SVCB 1 . ipv6hint=
@ SVCB 1 . ipv6hint=::1,,::2
@ SVCB 1 . ipv6hint=::W
+@ SVCB 1 . dohpath
+@ SVCB 1 . dohpath=
+@ SVCB 1 . ohttp=
+@ SVCB 1 . ohttp=x
; RFC KO examples
example.com. SVCB 1 foo.example.com. (
diff --git a/tests/libzscanner/data/57_SVCB.out b/tests/libzscanner/data/57_SVCB.out
index 3b701d217..33e1ffb4f 100644
--- a/tests/libzscanner/data/57_SVCB.out
+++ b/tests/libzscanner/data/57_SVCB.out
@@ -110,7 +110,25 @@ OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0040
-RDATA=00010000070000
+RDATA=000100000700082F717B3F646E737D
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0040
+RDATA=000100000700102F646E732D71756572797B3F646E737D
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0040
+RDATA=00010000080000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0040
+RDATA=00010002C30000
------
OWNER=00
CLASS=0001
@@ -300,6 +318,14 @@ WARNG=ZS_BAD_ADDRESS_CHAR
------
WARNG=ZS_BAD_ADDRESS_CHAR
------
+WARNG=ZS_BAD_SVCB_PARAM
+------
+WARNG=ZS_BAD_SVCB_PARAM
+------
+WARNG=ZS_BAD_SVCB_PARAM
+------
+WARNG=ZS_BAD_SVCB_PARAM
+------
WARNG=ZS_DUPLICATE_SVCB_KEY
------
WARNG=ZS_BAD_SVCB_PARAM
diff --git a/tests/libzscanner/data/59_WALLET.in b/tests/libzscanner/data/59_WALLET.in
new file mode 100644
index 000000000..976750659
--- /dev/null
+++ b/tests/libzscanner/data/59_WALLET.in
@@ -0,0 +1,14 @@
+$ORIGIN .
+$TTL 1
+
+; The WALLET is the same as the TXT, so there are the differences and basics only.
+
+; OK
+@ WALLET "" "test1" "\255" test2 ; Array of text strings
+@ WALLET \# 1 00 ; Hexadecimal rdata
+@ TYPE262 \# 1 00 ; TYPE + Hexadecimal rdata
+@ TYPE262 "" ; TYPE
+@ wallet "" ; Type in lower-case
+
+; KO
+@ WALLET
diff --git a/tests/libzscanner/data/59_WALLET.out b/tests/libzscanner/data/59_WALLET.out
new file mode 100644
index 000000000..11e642559
--- /dev/null
+++ b/tests/libzscanner/data/59_WALLET.out
@@ -0,0 +1,32 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0106
+RDATA=0005746573743101FF057465737432
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0106
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0106
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0106
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0106
+RDATA=00
+------
+WARNG=ZS_BAD_RDATA
+------
diff --git a/tests/libzscanner/test_zscanner.in b/tests/libzscanner/test_zscanner.in
index 10d2b5ce8..8cc9008e6 100644
--- a/tests/libzscanner/test_zscanner.in
+++ b/tests/libzscanner/test_zscanner.in
@@ -11,7 +11,7 @@ TMPDIR=$(test_tmpdir)
TESTS_DIR="$SOURCE"/data
ZSCANNER_TOOL="$BUILD"/zscanner-tool
-plan 86
+plan 87
mkdir -p "$TMPDIR"/includes/
for a in 1 2 3 4 5 6; do