@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-TEST_BOTH_AF := connect icmps-discard
+TEST_BOTH_AF := connect icmps-discard icmps-accept
TEST_IPV4_PROGS := $(TEST_BOTH_AF:%=%_ipv4)
TEST_IPV6_PROGS := $(TEST_BOTH_AF:%=%_ipv6)
@@ -43,3 +43,5 @@ $(OUTPUT)/%_ipv4: %.c
$(OUTPUT)/%_ipv6: %.c
$(LINK.c) -DIPV6_TEST $^ $(LDLIBS) -o $@
+$(OUTPUT)/icmps-accept_ipv4: CFLAGS+= -DTEST_ICMPS_ACCEPT
+$(OUTPUT)/icmps-accept_ipv6: CFLAGS+= -DTEST_ICMPS_ACCEPT
new file mode 120000
@@ -0,0 +1 @@
+icmps-discard.c
\ No newline at end of file
@@ -43,8 +43,17 @@ const int sk_ip_level = SOL_IP;
const int sk_recverr = IP_RECVERR;
#endif
-#define test_icmps_fail test_fail
-#define test_icmps_ok test_ok
+/*
+ * Server is expected to fail with hard error if
+ * TCP_AO_CMDF_ACCEPT_ICMP is set
+ */
+#ifdef TEST_ICMPS_ACCEPT
+# define test_icmps_fail test_ok
+# define test_icmps_ok test_fail
+#else
+# define test_icmps_fail test_fail
+# define test_icmps_ok test_ok
+#endif
static void serve_interfered(int sk)
{
@@ -98,6 +107,10 @@ static void *server_fn(void *arg)
lsk = test_listen_socket(this_ip_addr, test_server_port, 1);
+#ifdef TEST_ICMPS_ACCEPT
+ flags = TCP_AO_CMDF_ACCEPT_ICMP;
+#endif
+
if (test_set_ao(lsk, "password", flags, this_ip_dest, -1, 100, 100))
test_error("setsockopt(TCP_AO)");
synchronize_threads();