Commit bbebce8e authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Daniel Borkmann

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: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent c76e4c22
...@@ -148,17 +148,17 @@ int main(int argc, char **argv) ...@@ -148,17 +148,17 @@ int main(int argc, char **argv)
pthread_create(&tid, NULL, poller_thread, (void *)&pmu_fd); pthread_create(&tid, NULL, poller_thread, (void *)&pmu_fd);
sprintf(test_script, sprintf(test_script,
"/usr/sbin/iptables -A INPUT -p tcp --dport %d -j DROP", "iptables -A INPUT -p tcp --dport %d -j DROP",
TESTPORT); TESTPORT);
system(test_script); system(test_script);
sprintf(test_script, sprintf(test_script,
"/usr/bin/nc 127.0.0.1 %d < /etc/passwd > /dev/null 2>&1 ", "nc 127.0.0.1 %d < /etc/passwd > /dev/null 2>&1 ",
TESTPORT); TESTPORT);
system(test_script); system(test_script);
sprintf(test_script, sprintf(test_script,
"/usr/sbin/iptables -D INPUT -p tcp --dport %d -j DROP", "iptables -D INPUT -p tcp --dport %d -j DROP",
TESTPORT); TESTPORT);
system(test_script); system(test_script);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment