net/py-ephemeral_port_reserve - The NetBSD Packages Collection

Bind to ephemeral port, force it into TIME_WAIT state, and unbind it

Sometimes you need a networked program to bind to a port that can't
be hard-coded. Generally this is when you want to run several of
them in parallel; if they all bind to port 8080, only one of them
can succeed.

The usual solution is the "port 0 trick". If you bind to port 0,
your kernel will find some arbitrary high-numbered port that's
unused and bind to that. Afterward you can query the actual port
that was bound to if you need to use the port number elsewhere.
However, there are cases where the port 0 trick won't work. For
example, mysqld takes port 0 to mean "the port configured in my.cnf".
Docker can bind your containers to port 0, but uses its own
implementation to find a free port which races and fails in the
face of parallelism.

ephemeral-port-reserve provides an implementation of the port 0
trick which is reliable and race-free.

Build dependencies

devel/py-setuptools pkgtools/mktools pkgtools/cwrappers

Runtime dependencies

lang/python312 lang/python312

Binary packages

OSArchitectureVersion
NetBSD 10.0aarch64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0aarch64ebpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0alphapy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv4py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv6hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0earmv7hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0i386py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sh3elpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparc64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0sparcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 10.0x86_64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0aarch64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0alphapy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv6hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0earmv7hfpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0i386py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0m68kpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0m68kpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0m68kpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy27-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy37-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0powerpcpy39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0sparc64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0sparc64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0sparc64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0sparc64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0sparc64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py312-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py38-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.0x86_64py39-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.3x86_64py310-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.3x86_64py311-ephemeral_port_reserve-1.1.4.tgz
NetBSD 9.3x86_64py312-ephemeral_port_reserve-1.1.4.tgz

Binary packages can be installed with the high-level tool pkgin (which can be installed with pkg_add) or pkg_add(1) (installed by default). The NetBSD packages collection is also designed to permit easy installation from source.

Available build options

(none)

Known vulnerabilities

The pkg_admin audit command locates any installed package which has been mentioned in security advisories as having vulnerabilities.

Please note the vulnerabilities database might not be fully accurate, and not every bug is exploitable with every configuration.


Problem reports, updates or suggestions for this package should be reported with send-pr.