Skip to content

Commit de9c8d8

Browse files
Martin KaFai Lauanakryiko
Martin KaFai Lau
authored andcommitted
selftests/bpf: S/iptables/iptables-legacy/ in the bpf_nf and xdp_synproxy test
The recent vm image in CI has reported error in selftests that use the iptables command. Manu Bretelle has pointed out the difference in the recent vm image that the iptables is sym-linked to the iptables-nft. With this knowledge, I can also reproduce the CI error by manually running with the 'iptables-nft'. This patch is to replace the iptables command with iptables-legacy to unblock the CI tests. Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: David Vernet <void@manifault.com> Link: https://lore.kernel.org/bpf/20221012221235.3529719-1-martin.lau@linux.dev
1 parent d31ada3 commit de9c8d8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_nf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ static int connect_to_server(int srv_fd)
4949

5050
static void test_bpf_nf_ct(int mode)
5151
{
52-
const char *iptables = "iptables -t raw %s PREROUTING -j CONNMARK --set-mark 42/0";
52+
const char *iptables = "iptables-legacy -t raw %s PREROUTING -j CONNMARK --set-mark 42/0";
5353
int srv_fd = -1, client_fd = -1, srv_client_fd = -1;
5454
struct sockaddr_in peer_addr = {};
5555
struct test_bpf_nf *skel;
5656
int prog_fd, err;
5757
socklen_t len;
5858
u16 srv_port;
59-
char cmd[64];
59+
char cmd[128];
6060
LIBBPF_OPTS(bpf_test_run_opts, topts,
6161
.data_in = &pkt_v4,
6262
.data_size_in = sizeof(pkt_v4),
@@ -69,7 +69,7 @@ static void test_bpf_nf_ct(int mode)
6969

7070
/* Enable connection tracking */
7171
snprintf(cmd, sizeof(cmd), iptables, "-A");
72-
if (!ASSERT_OK(system(cmd), "iptables"))
72+
if (!ASSERT_OK(system(cmd), cmd))
7373
goto end;
7474

7575
srv_port = (mode == TEST_XDP) ? 5005 : 5006;

tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ static void test_synproxy(bool xdp)
9494
SYS("sysctl -w net.ipv4.tcp_syncookies=2");
9595
SYS("sysctl -w net.ipv4.tcp_timestamps=1");
9696
SYS("sysctl -w net.netfilter.nf_conntrack_tcp_loose=0");
97-
SYS("iptables -t raw -I PREROUTING \
97+
SYS("iptables-legacy -t raw -I PREROUTING \
9898
-i tmp1 -p tcp -m tcp --syn --dport 8080 -j CT --notrack");
99-
SYS("iptables -t filter -A INPUT \
99+
SYS("iptables-legacy -t filter -A INPUT \
100100
-i tmp1 -p tcp -m tcp --dport 8080 -m state --state INVALID,UNTRACKED \
101101
-j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460");
102-
SYS("iptables -t filter -A INPUT \
102+
SYS("iptables-legacy -t filter -A INPUT \
103103
-i tmp1 -m state --state INVALID -j DROP");
104104

105105
ctrl_file = SYS_OUT("./xdp_synproxy --iface tmp1 --ports 8080 \

0 commit comments

Comments
 (0)