Linux installer: validate the listen address instead of reporting every port as busy.

An entry like "all" made every port probe fail and the installer said
"port in use" forever. Aliases (all/*, local) are normalized, other
values must be an IPv4 address of this host, and port-free now tells a
busy port (exit 1) from a bad address (exit 3). Same check for set-bind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
oliver 2026-10-14 15:05:54 +08:00
parent 72baceb8b1
commit 78db39eabe
3 changed files with 75 additions and 13 deletions

View file

@ -287,8 +287,9 @@ cmd_set_port() {
cmd_set_bind() {
need_root set-bind; need_install
local h="${1:-}"
[[ -n "${h}" ]] || die "usage: netxctl set-bind <0.0.0.0|127.0.0.1|ip>"
local h
[[ -n "${1:-}" ]] || die "usage: netxctl set-bind <0.0.0.0|127.0.0.1|ip>"
h="$(netx_admin norm-bind -- "$1")" || exit 1
local pairs=("NETX_HOST=${h}")
# Same prerequisites NetX enforces for a non-loopback bind (security_bootstrap.py).
if ! is_loopback "${h}"; then