Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e8a5903 authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Daniel Borkmann
Browse files

selftests/bpf: use localhost in tcp_{server,client}.py



Bind and connect to localhost. There is no reason for this test to
use non-localhost interface. This lets us run this test in a network
namespace.

Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent ecc15f11
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -30,12 +30,11 @@ def send(sock, s):


serverPort = int(sys.argv[1])
HostName = socket.gethostname()

# create active socket
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
try:
    sock.connect((HostName, serverPort))
    sock.connect(('localhost', serverPort))
except socket.error as e:
    sys.exit(1)

+1 −4
Original line number Diff line number Diff line
@@ -35,13 +35,10 @@ MAX_PORTS = 2
serverPort = SERVER_PORT
serverSocket = None

HostName = socket.gethostname()

# create passive socket
serverSocket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
host = socket.gethostname()

try: serverSocket.bind((host, 0))
try: serverSocket.bind(('localhost', 0))
except socket.error as msg:
    print('bind fails: ' + str(msg))