Skip to content

Commit bbebce8

Browse files
fomichevborkmann
authored andcommitted
selftests/bpf: don't hardcode iptables/nc path in test_tcpnotify_user
system() is calling shell which should find the appropriate full path via $PATH. On some systems, full path to iptables and/or nc might be different that we one we have hardcoded. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent c76e4c2 commit bbebce8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/test_tcpnotify_user.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ int main(int argc, char **argv)
148148
pthread_create(&tid, NULL, poller_thread, (void *)&pmu_fd);
149149

150150
sprintf(test_script,
151-
"/usr/sbin/iptables -A INPUT -p tcp --dport %d -j DROP",
151+
"iptables -A INPUT -p tcp --dport %d -j DROP",
152152
TESTPORT);
153153
system(test_script);
154154

155155
sprintf(test_script,
156-
"/usr/bin/nc 127.0.0.1 %d < /etc/passwd > /dev/null 2>&1 ",
156+
"nc 127.0.0.1 %d < /etc/passwd > /dev/null 2>&1 ",
157157
TESTPORT);
158158
system(test_script);
159159

160160
sprintf(test_script,
161-
"/usr/sbin/iptables -D INPUT -p tcp --dport %d -j DROP",
161+
"iptables -D INPUT -p tcp --dport %d -j DROP",
162162
TESTPORT);
163163
system(test_script);
164164

0 commit comments

Comments
 (0)