mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Merge remote-tracking branch 'origin/topic/awelzel/4474-cluster-websocket-ipv6'
* origin/topic/awelzel/4474-cluster-websocket-ipv6:
IXWebsocket: Bump to version with memset() sock addr fix
cluster/websocket: Deprecate $listen_host, introduce $listen_addr
cluster/websocket-ixwebsocket: Determine proper address_family
(cherry picked from commit f16ebd34b3
)
This commit is contained in:
parent
5b09f8cb47
commit
2ee2e3b062
43 changed files with 356 additions and 42 deletions
41
testing/scripts/can-listen-tcp
Executable file
41
testing/scripts/can-listen-tcp
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Try binding on the given family with addr and a port of 0 so that an
|
||||
# ephemeral port is allocated. This can be used to guard IPv6 tests.
|
||||
|
||||
import socket
|
||||
import sys
|
||||
|
||||
|
||||
def usage():
|
||||
print(f"Usage: {sys.argv[0]} 4|6 <addr>", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
usage()
|
||||
|
||||
family = 0
|
||||
|
||||
if sys.argv[1] == "4":
|
||||
family = socket.AF_INET
|
||||
elif sys.argv[1] == "6":
|
||||
family = socket.AF_INET6
|
||||
else:
|
||||
usage()
|
||||
|
||||
addr = sys.argv[2]
|
||||
port = 0
|
||||
|
||||
s = socket.socket(family)
|
||||
|
||||
try:
|
||||
s.bind((addr, port))
|
||||
except Exception as e:
|
||||
print(f"cannot listen on {addr}:{port} ({e!r})")
|
||||
sys.exit(1)
|
||||
finally:
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue