* [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py
@ 2020-07-28 14:39 John Fastabend
2020-07-28 17:44 ` Song Liu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: John Fastabend @ 2020-07-28 14:39 UTC (permalink / raw)
To: john.fastabend, guro, daniel, ast; +Cc: netdev, bpf
Using localhost requires the host to have a /etc/hosts file with that
specific line in it. By default my dev box did not, they used
ip6-localhost, so the test was failing. To fix remove the need for any
/etc/hosts and use ::1.
I could just add the line, but this seems easier.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
tools/testing/selftests/bpf/tcp_client.py | 2 +-
tools/testing/selftests/bpf/tcp_server.py | 2 +-
tools/testing/selftests/bpf/test_netcnt.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/tcp_client.py b/tools/testing/selftests/bpf/tcp_client.py
index a53ed58..bfff82b 100755
--- a/tools/testing/selftests/bpf/tcp_client.py
+++ b/tools/testing/selftests/bpf/tcp_client.py
@@ -34,7 +34,7 @@ serverPort = int(sys.argv[1])
# create active socket
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
try:
- sock.connect(('localhost', serverPort))
+ sock.connect(('::1', serverPort))
except socket.error as e:
sys.exit(1)
diff --git a/tools/testing/selftests/bpf/tcp_server.py b/tools/testing/selftests/bpf/tcp_server.py
index 0ca60d1..42ab888 100755
--- a/tools/testing/selftests/bpf/tcp_server.py
+++ b/tools/testing/selftests/bpf/tcp_server.py
@@ -38,7 +38,7 @@ serverSocket = None
# create passive socket
serverSocket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
-try: serverSocket.bind(('localhost', 0))
+try: serverSocket.bind(('::1', 0))
except socket.error as msg:
print('bind fails: ' + str(msg))
diff --git a/tools/testing/selftests/bpf/test_netcnt.c b/tools/testing/selftests/bpf/test_netcnt.c
index c1da540..7a68c90 100644
--- a/tools/testing/selftests/bpf/test_netcnt.c
+++ b/tools/testing/selftests/bpf/test_netcnt.c
@@ -82,9 +82,9 @@ int main(int argc, char **argv)
}
if (system("which ping6 &>/dev/null") == 0)
- assert(!system("ping6 localhost -c 10000 -f -q > /dev/null"));
+ assert(!system("ping6 ::1 -c 10000 -f -q > /dev/null"));
else
- assert(!system("ping -6 localhost -c 10000 -f -q > /dev/null"));
+ assert(!system("ping -6 ::1 -c 10000 -f -q > /dev/null"));
if (bpf_prog_query(cgroup_fd, BPF_CGROUP_INET_EGRESS, 0, NULL, NULL,
&prog_cnt)) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py
2020-07-28 14:39 [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py John Fastabend
@ 2020-07-28 17:44 ` Song Liu
2020-07-28 18:39 ` Andrii Nakryiko
2020-07-28 22:28 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Song Liu @ 2020-07-28 17:44 UTC (permalink / raw)
To: John Fastabend
Cc: Roman Gushchin, Daniel Borkmann, Alexei Starovoitov, Networking, bpf
On Tue, Jul 28, 2020 at 7:40 AM John Fastabend <john.fastabend@gmail.com> wrote:
>
> Using localhost requires the host to have a /etc/hosts file with that
> specific line in it. By default my dev box did not, they used
> ip6-localhost, so the test was failing. To fix remove the need for any
> /etc/hosts and use ::1.
>
> I could just add the line, but this seems easier.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py
2020-07-28 14:39 [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py John Fastabend
2020-07-28 17:44 ` Song Liu
@ 2020-07-28 18:39 ` Andrii Nakryiko
2020-07-28 22:28 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2020-07-28 18:39 UTC (permalink / raw)
To: John Fastabend
Cc: Roman Gushchin, Daniel Borkmann, Alexei Starovoitov, Networking, bpf
On Tue, Jul 28, 2020 at 7:40 AM John Fastabend <john.fastabend@gmail.com> wrote:
>
> Using localhost requires the host to have a /etc/hosts file with that
> specific line in it. By default my dev box did not, they used
> ip6-localhost, so the test was failing. To fix remove the need for any
> /etc/hosts and use ::1.
>
> I could just add the line, but this seems easier.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
Makes sense.
Acked-by: Andrii Nakryiko <andriin@fb.com>
> tools/testing/selftests/bpf/tcp_client.py | 2 +-
> tools/testing/selftests/bpf/tcp_server.py | 2 +-
> tools/testing/selftests/bpf/test_netcnt.c | 4 ++--
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py
2020-07-28 14:39 [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py John Fastabend
2020-07-28 17:44 ` Song Liu
2020-07-28 18:39 ` Andrii Nakryiko
@ 2020-07-28 22:28 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2020-07-28 22:28 UTC (permalink / raw)
To: John Fastabend, guro, ast; +Cc: netdev, bpf
On 7/28/20 4:39 PM, John Fastabend wrote:
> Using localhost requires the host to have a /etc/hosts file with that
> specific line in it. By default my dev box did not, they used
> ip6-localhost, so the test was failing. To fix remove the need for any
> /etc/hosts and use ::1.
>
> I could just add the line, but this seems easier.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-28 22:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 14:39 [bpf-next PATCH] bpf, selftests: use ::1 for localhost in tcp_server.py John Fastabend
2020-07-28 17:44 ` Song Liu
2020-07-28 18:39 ` Andrii Nakryiko
2020-07-28 22:28 ` Daniel Borkmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.