fix: advisory + exit(1) when port 53 is already in use (#45) #47

Merged
razvandimescu merged 2 commits from fix/port53-diagnostic into main 2026-04-09 20:03:58 +08:00
razvandimescu commented 2026-04-09 17:42:14 +08:00 (Migrated from github.com)

Summary

  • Detects AddrInUse on the UDP socket bind and, when the target port is 53, prints a human-readable advisory explaining the likely cause (systemd-resolved on Linux, Dnscache on Windows, generic otherwise) and two concrete fixes — instead of surfacing a raw OS error
  • Adds is_port_53 and port53_conflict_advisory helpers in system_dns.rs; is_systemd_resolved_active made pub for Linux
  • Adds tests/docker/smoke-port53.sh: end-to-end Docker test that pre-binds port 53 with a Python UDP socket and asserts exit code 1 + advisory content (cannot bind to, numa install, bind_addr)

Closes #45.

Test plan

  • make all passes locally (134 unit tests, clippy clean)
  • ./tests/docker/smoke-port53.sh — builds numa inside debian:bookworm, pre-binds port 53, verifies exit code 1 and all three advisory assertions pass
  • Manual: run sudo numa on a system with systemd-resolved active — should see the advisory instead of a raw error

🤖 Generated with Claude Code

## Summary - Detects `AddrInUse` on the UDP socket bind and, when the target port is 53, prints a human-readable advisory explaining the likely cause (systemd-resolved on Linux, Dnscache on Windows, generic otherwise) and two concrete fixes — instead of surfacing a raw OS error - Adds `is_port_53` and `port53_conflict_advisory` helpers in `system_dns.rs`; `is_systemd_resolved_active` made `pub` for Linux - Adds `tests/docker/smoke-port53.sh`: end-to-end Docker test that pre-binds port 53 with a Python UDP socket and asserts exit code 1 + advisory content (`cannot bind to`, `numa install`, `bind_addr`) Closes #45. ## Test plan - [ ] `make all` passes locally (134 unit tests, clippy clean) - [ ] `./tests/docker/smoke-port53.sh` — builds numa inside `debian:bookworm`, pre-binds port 53, verifies exit code 1 and all three advisory assertions pass - [ ] Manual: run `sudo numa` on a system with systemd-resolved active — should see the advisory instead of a raw error 🤖 Generated with [Claude Code](https://claude.com/claude-code)
xplosionmind commented 2026-04-09 20:51:10 +08:00 (Migrated from github.com)

Thank you!

Thank you!
Sign in to join this conversation.