mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#36145: qa: Use IP_PORTRANGE_HIGH on OpenBSD for dynamic port allocation
59ebf558f3qa: Use IP_PORTRANGE_HIGH on OpenBSD for dynamic port allocation (Hennadii Stepanov) Pull request description: The default ephemeral port range on OpenBSD (1024-49151) overlaps with the test framework's static port range starting at `TEST_RUNNER_PORT_MIN`, the same way FreeBSD's does (see #34346). Extend `set_ephemeral_port_range()` to OpenBSD. The socket option and its values are identical to FreeBSD's, so only the platform check changes. ACKs for top commit: maflcko: lgtm ACK59ebf558f3theStack: utACK59ebf558f3Tree-SHA512: 680235cf3e1799361796c0ff36d5f19bf74f79393057dbd7b38b0e92a7df3af669873c66ca1e82f1c78999c20351663b8960990f3f209af89ee18ce0773eb7de
This commit is contained in:
@@ -257,15 +257,16 @@ def format_sock(sock, *, local):
|
||||
|
||||
|
||||
def set_ephemeral_port_range(sock):
|
||||
'''On FreeBSD, set socket to use the high ephemeral port range (49152-65535).
|
||||
'''On FreeBSD and OpenBSD, set socket to use the high ephemeral port range (49152-65535).
|
||||
|
||||
FreeBSD's default ephemeral port range (10000-65535) overlaps with the test
|
||||
framework's static port range starting at TEST_RUNNER_PORT_MIN (default=11000).
|
||||
The default ephemeral port ranges on FreeBSD (10000-65535) and
|
||||
OpenBSD (1024-49151) overlap with the test framework's static port
|
||||
range starting at TEST_RUNNER_PORT_MIN (default=11000).
|
||||
Using IP_PORTRANGE_HIGH avoids this overlap when binding to port 0 for dynamic
|
||||
port allocation.
|
||||
'''
|
||||
if sys.platform.startswith('freebsd'):
|
||||
# Constants from FreeBSD's netinet/in.h and netinet6/in6.h
|
||||
if sys.platform.startswith(("freebsd", "openbsd")):
|
||||
# Constants from FreeBSD/OpenBSD's netinet/in.h and netinet6/in6.h
|
||||
IP_PORTRANGE = 19
|
||||
IPV6_PORTRANGE = 14
|
||||
IP_PORTRANGE_HIGH = 1 # Same value for both IPv4 and IPv6
|
||||
|
||||
Reference in New Issue
Block a user