Commit 5c3cf87d authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Daniel Borkmann

samples: bpf: force IPv4 in ping

ping localhost may default of IPv6 on modern systems, but
samples are trying to only parse IPv4.  Force IPv4.

samples/bpf/tracex1_user.c doesn't interpret the packet so
we don't care which IP version will be used there.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent ebace0e9
...@@ -99,7 +99,7 @@ int main(void) ...@@ -99,7 +99,7 @@ int main(void)
{ {
FILE *f; FILE *f;
f = popen("ping -c5 localhost", "r"); f = popen("ping -4 -c5 localhost", "r");
(void)f; (void)f;
return test_sock(); return test_sock();
......
...@@ -26,7 +26,7 @@ int main(int ac, char **argv) ...@@ -26,7 +26,7 @@ int main(int ac, char **argv)
assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd,
sizeof(prog_fd[0])) == 0); sizeof(prog_fd[0])) == 0);
f = popen("ping -c5 localhost", "r"); f = popen("ping -4 -c5 localhost", "r");
(void) f; (void) f;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
......
...@@ -34,7 +34,7 @@ int main(int ac, char **argv) ...@@ -34,7 +34,7 @@ int main(int ac, char **argv)
assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd,
sizeof(prog_fd[0])) == 0); sizeof(prog_fd[0])) == 0);
f = popen("ping -c5 localhost", "r"); f = popen("ping -4 -c5 localhost", "r");
(void) f; (void) f;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
......
...@@ -58,7 +58,7 @@ int main(int argc, char **argv) ...@@ -58,7 +58,7 @@ int main(int argc, char **argv)
sizeof(__u32)) == 0); sizeof(__u32)) == 0);
if (argc > 1) if (argc > 1)
f = popen("ping -c5 localhost", "r"); f = popen("ping -4 -c5 localhost", "r");
else else
f = popen("netperf -l 4 localhost", "r"); f = popen("netperf -l 4 localhost", "r");
(void) f; (void) f;
......
...@@ -131,7 +131,7 @@ int main(int ac, char **argv) ...@@ -131,7 +131,7 @@ int main(int ac, char **argv)
signal(SIGTERM, int_exit); signal(SIGTERM, int_exit);
/* start 'ping' in the background to have some kfree_skb events */ /* start 'ping' in the background to have some kfree_skb events */
f = popen("ping -c5 localhost", "r"); f = popen("ping -4 -c5 localhost", "r");
(void) f; (void) f;
/* start 'dd' in the background to have plenty of 'write' syscalls */ /* start 'dd' in the background to have plenty of 'write' syscalls */
......
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