aboutsummaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-02-27 22:04:10 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2019-02-28 18:53:45 -0500
commit5c3cf87d477a461274452cb46f7654c5b6ae6294 (patch)
tree29fa9024249fc4ab34e527ccfd11882d9487b494 /samples
parentebace0e981b2aa6b2c0eb9bee0df3676fd690d8b (diff)
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: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/sock_example.c2
-rw-r--r--samples/bpf/sockex1_user.c2
-rw-r--r--samples/bpf/sockex2_user.c2
-rw-r--r--samples/bpf/sockex3_user.c2
-rw-r--r--samples/bpf/tracex2_user.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/samples/bpf/sock_example.c b/samples/bpf/sock_example.c
index 60ec467c78ab..00aae1d33fca 100644
--- a/samples/bpf/sock_example.c
+++ b/samples/bpf/sock_example.c
@@ -99,7 +99,7 @@ int main(void)
99{ 99{
100 FILE *f; 100 FILE *f;
101 101
102 f = popen("ping -c5 localhost", "r"); 102 f = popen("ping -4 -c5 localhost", "r");
103 (void)f; 103 (void)f;
104 104
105 return test_sock(); 105 return test_sock();
diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c
index 93ec01c56104..be8ba5686924 100644
--- a/samples/bpf/sockex1_user.c
+++ b/samples/bpf/sockex1_user.c
@@ -26,7 +26,7 @@ int main(int ac, char **argv)
26 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, 26 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd,
27 sizeof(prog_fd[0])) == 0); 27 sizeof(prog_fd[0])) == 0);
28 28
29 f = popen("ping -c5 localhost", "r"); 29 f = popen("ping -4 -c5 localhost", "r");
30 (void) f; 30 (void) f;
31 31
32 for (i = 0; i < 5; i++) { 32 for (i = 0; i < 5; i++) {
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c
index 1d5c6e9a6d27..125ee6efc913 100644
--- a/samples/bpf/sockex2_user.c
+++ b/samples/bpf/sockex2_user.c
@@ -34,7 +34,7 @@ int main(int ac, char **argv)
34 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, 34 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd,
35 sizeof(prog_fd[0])) == 0); 35 sizeof(prog_fd[0])) == 0);
36 36
37 f = popen("ping -c5 localhost", "r"); 37 f = popen("ping -4 -c5 localhost", "r");
38 (void) f; 38 (void) f;
39 39
40 for (i = 0; i < 5; i++) { 40 for (i = 0; i < 5; i++) {
diff --git a/samples/bpf/sockex3_user.c b/samples/bpf/sockex3_user.c
index 9d02e0404719..bbb1cd0666a9 100644
--- a/samples/bpf/sockex3_user.c
+++ b/samples/bpf/sockex3_user.c
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
58 sizeof(__u32)) == 0); 58 sizeof(__u32)) == 0);
59 59
60 if (argc > 1) 60 if (argc > 1)
61 f = popen("ping -c5 localhost", "r"); 61 f = popen("ping -4 -c5 localhost", "r");
62 else 62 else
63 f = popen("netperf -l 4 localhost", "r"); 63 f = popen("netperf -l 4 localhost", "r");
64 (void) f; 64 (void) f;
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c
index 1a81e6a5c2ea..c9544a4ce61a 100644
--- a/samples/bpf/tracex2_user.c
+++ b/samples/bpf/tracex2_user.c
@@ -131,7 +131,7 @@ int main(int ac, char **argv)
131 signal(SIGTERM, int_exit); 131 signal(SIGTERM, int_exit);
132 132
133 /* start 'ping' in the background to have some kfree_skb events */ 133 /* start 'ping' in the background to have some kfree_skb events */
134 f = popen("ping -c5 localhost", "r"); 134 f = popen("ping -4 -c5 localhost", "r");
135 (void) f; 135 (void) f;
136 136
137 /* start 'dd' in the background to have plenty of 'write' syscalls */ 137 /* start 'dd' in the background to have plenty of 'write' syscalls */