fix: accept host:port in validateResolverAddr; release v0.1.8

The root helper's resolver-address validator only accepted bare IPs,
so `resolvectl dns <bridge> 127.0.0.1:42069` — banger's own auto-wire
call to point systemd-resolved at the in-process DNS server — was
rejected before it ever reached resolvectl. The auto-wire is
best-effort and only logs a warning on failure, so .vm resolution
silently broke on the NSS path: dig @127.0.0.1 worked, curl <vm>.vm
didn't.

Validator now allows both bare IPs and IP:port (matching what
`resolvectl dns` itself accepts), with new test coverage for the
port'd form.

Existing installs need a one-time `sudo banger system restart` after
updating to v0.1.8 so the daemon re-runs the auto-wire with the
fixed validator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thales Maciel 2026-05-01 15:42:11 -03:00
parent 403f60dbbf
commit 9400bab6fd
No known key found for this signature in database
GPG key ID: 33112E6833C34679
3 changed files with 41 additions and 7 deletions

View file

@ -566,8 +566,11 @@ func TestValidateResolverAddr(t *testing.T) {
}{
{name: "ipv4", arg: "192.168.1.1", ok: true},
{name: "ipv6", arg: "fe80::1", ok: true},
{name: "ipv4_with_port", arg: "127.0.0.1:42069", ok: true},
{name: "ipv6_with_port", arg: "[fe80::1]:42069", ok: true},
{name: "empty", arg: "", ok: false},
{name: "garbage", arg: "resolver.example", ok: false},
{name: "garbage_with_port", arg: "resolver.example:53", ok: false},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {