Skip to content

Release v1.5.11 - #363

Merged
cuonglm merged 31 commits into
v1.0from
release-branch-v1.5.11
Nov 17, 2026
Merged

cuonglm merged 31 commits into
v1.0from
release-branch-v1.5.11

Conversation

@cuonglm

@cuonglm cuonglm commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Minor Release

This contains version-pinned upgrades and rollback, and bug fixes across intercept mode, reloads and logging.

Added

  • Added --version and --branch to ctrld upgrade, to install a specific release or the latest build of a branch. The downloaded binary must report the requested version before it is installed. The new ctrld rollback command installs an older build the same way: by default the release before the installed one, or the build given by --version or --branch
  • Read UniFi client names from PostgreSQL on UniFi Network 11. Network 11 moved its database from MongoDB, so names set in UniFi stopped reaching Control D, and ctrld clients list no longer listed ubios as a source. When the UniFi Network PostgreSQL socket exists, ctrld reads the names with psql, read-only and with a 10 second deadline. Otherwise it queries MongoDB as before
  • Improved iOS support in the mobile library: StartWithOptions and SetNameservers for the iOS DNS proxy, with no system tools run on iOS and no device DNS changes. Also fixed bad configs, busy listeners and API errors on mobile, so they fail the start with a clear Exit line instead of crashing the app, and fixed state carrying over from one start to the next

Changed

  • Redacted every log line in one step, before it reaches any output: the console, the log_path file, the debug stream and the journal, on every platform. Earlier only the journal and mobile log files were redacted, while the console output that launchd, systemd or init scripts keep on disk was not. ctrld removes URL userinfo, paths, queries and fragments, the resolver ID in *.dns.controld.com hosts, the resolver UID and the provisioning code, in any letter case. The error text in the reply to ctrld log send is redacted too
  • Refused a reload from the Control D API or SIGUSR1 when the new config removes a running listener. A reload does not stop DNS servers, so the dropped listener's server used to keep running with no config. ctrld now keeps the running config and logs which listener is missing. ctrld reload restarts the service instead
  • Rejected listener keys that are not numbers, such as [listener.main] or [listener.01]. Earlier versions started with some of these configs and then crashed. Now a start fails with exit code 59 (UNCLASSIFIED) and names the bad key, a reload of the file keeps the running config, and a Control D custom config with a bad key is not applied. docs/config.md describes how to fix the config file
  • Documented a known issue on Windows in DNS intercept mode: a WireGuard full tunnel connected before ctrld starts blocks DNS to the loopback listener with its kill switch filters, and the start self-check rolls the install back. Start ctrld before connecting, or use split AllowedIPs so the kill switch stays off

Fixed

  • Left adapter DNS that ctrld did not set alone when starting in DNS intercept mode on Windows. Start, ctrld restart and upgrades reset every adapter to DHCP, which cleared the DNS a full-tunnel VPN pushed to its adapter and static DNS an administrator set. ctrld now resets an adapter only when its static DNS still points at a loopback listener left by an earlier interface DNS mode run, or when the adapter's DNS cannot be read
  • Asked Internal Domain resolvers again once a VPN settles on macOS in Intercept mode. A fallback-mode resolver reachable only through the VPN stayed marked down after the VPN connected, in one field log for hours to days, so lookups got the LAN resolver's NXDOMAIN and macOS cached it
  • Capped the negative TTL of an Internal Domain fallback answer at 5 seconds. When the Internal Domain resolvers could not be reached, ctrld passed on the network's own NXDOMAIN with its negative-cache lifetime, often 3600 seconds from the root zone SOA. macOS cached it that long, so the name stayed broken after the VPN came back
  • Served lookups with a public source address on loopback listeners. On a network that gives the Mac a public IPv4 address with no NAT, pf redirects the Mac's own lookups to 127.0.0.1 with their public source, and the WAN-client check refused all of them, including the watchdog's probe, which reloaded pf about every 30 seconds. Listeners on LAN, public or wildcard addresses still refuse WAN clients unless allow_wan_clients is set
  • Stopped repeated mDNS IPv6 probe warnings on interfaces without IPv6, such as bridge member ports with disable_ipv6=1. ctrld now opens IPv6 mDNS sockets only on interfaces with an IPv6 address, and drops sockets that fail permanently instead of warning every 20 to 40 seconds
  • Kept the configuration reload from hanging the desktop stop. A reload that found a deleted device waited for the uninstall, which itself waited for the process to stop, until the service manager killed it. The uninstall now starts without blocking, and the reload's metadata collection no longer holds up a stop
  • Kept REFUSED answers from waiting on the device check. Each REFUSED answer took the device check lock, which is held for the whole API fetch, so answers stalled while a check ran
  • Ended waiting control server handlers when the server stops, so a stopping process no longer answers /started with 200. ctrld upgrade and ctrld restart took that answer to mean the new binary was ready, so an upgrade to a build that never became ready could be reported successful instead of rolled back
  • Fixed data races between the DNS handler and config reload in reading the listener config, the intercept mode and the client ID preference, and a data race in the chassis lookup for host metadata
  • Fixed several crashes: on an upstream or listener key that is not a number, on a config with no listener, in router cleanup, and when a reload drops a running listener's key

cuonglm and others added 30 commits November 16, 2026 23:29
…er build

"ctrld upgrade" takes --version to install a specific release, or
--branch to install the latest build of a branch. The downloaded binary
must report the requested version before it is installed.

The new "ctrld rollback" command installs an older build the same way:
the release before the installed one by default, or the one given by
--version or --branch.
On macOS in Intercept mode, a fallback-mode Internal Domain resolver
that is reachable only through a VPN is marked down while the VPN is
off. proxy() then skips it and goes straight to the network fallback,
and only an answer to a background re-check marks it up again. That
re-check runs at most every 30 seconds and only after a lookup has
already skipped the resolver, so nothing brings the resolver back when
the VPN connects. A field log showed resolvers staying down for hours
to days across dozens of reconnects.

The first Internal Domain lookups after the VPN came back therefore got
the LAN resolver's NXDOMAIN for a VPN-only name, and macOS cached it.

refreshDNSAfterVPNSettle now marks every down fallback-mode Internal
Domain resolver up, so the next lookup asks it. Explicit-only resolvers
are never skipped and keep their state, as do the Control D upstream
and the OS resolver. A resolver that is still unreachable costs the
next lookup one timeout before the monitor marks it down again, so the
off-network shortcut from b5d7fec3 still applies after that.
On a network that gives the Mac a public IPv4 address with no NAT, pf
redirects the Mac's own lookups to the 127.0.0.1 listener and keeps their
public source address. The WAN-client check then refused every one of them
(REFUSED), and refused the watchdog's pf probe too, which turned into a pf
reload about every 30 s.

The existing exemption covered only a [::1] listener, for the same reason:
queries on it always come from this machine. Other hosts cannot send packets
to a loopback address, so widen the exemption to any loopback listener
(127.0.0.0/8 and [::1]). Listeners on LAN, public or wildcard addresses
still refuse WAN sources unless allow_wan_clients is set.
The DNS handler read p.cfg.Listener with no lock, while a reload writes
p.cfg under p.mu. Under -race, TestReloadThatDropsARunningListener found
it: the read of the handler raced with the write of runWait, and with the
decode of the reload config into the same map. On v1.0 the Linux test job
failed with this race in about 6 of 8 local runs, and in the first attempt
of each of the last four v1.0 pipelines. The handler now reads the config
of its listener under p.mu.

TestDeviceCheckCountStartsAgainAfterTheCoolOff set the package variable
deviceCheckCoolOff, while the cool-off goroutine of an earlier device
check test could still read it. The cool-off is now a field of the prog
that a test sets before the run, and deviceCheckCoolOff is a constant.
…eload

serveDNS read p.cfg.Service.InterceptMode with no lock when it started the
local IPv6 listener, and the DNS handler read p.cfg.Service.ClientIDPref
with no lock for each query. A reload writes *p.cfg under p.mu in runWait,
so under -race TestReloadThatDropsARunningListener/control-server-accepted
failed with the write of runWait against the read at dns_proxy.go:315.

serveDNS now reads the listener config and the intercept mode once under
p.mu, before the listener goroutines start, and the handler reads the
client ID preference under p.mu, as it already does for the listener
config.
UniFi Network 11 moved its application database from MongoDB to
PostgreSQL. The ubios discover only queried MongoDB, so the client
names set in UniFi stopped reaching Control D, and `ctrld clients list`
no longer shows ubios as a source.

When the UniFi Network PostgreSQL socket exists
(/run/postgresql/.s.PGSQL.5434), read the names from
config.user_client in the unifi-network database with psql. MongoDB is
not used then: its pre-migration data stays on disk and is stale.
Without the socket, MongoDB is queried as before.

psql runs with no password prompt, a 10 s deadline, a connect and a
statement timeout, and read-only transactions.

Each record is now decoded into a new value, so a record with a missing
field does not take the previous record's name or MAC.
… without IPv6

On a bridge whose member ports have disable_ipv6=1, ctrld opened an IPv6
mDNS socket on every multicast interface. Writes on the member ports failed
with EACCES, probe() returned the last error even though br-lan sent fine,
and EACCES was not a stop error, so probeLoop retried and warned every
20 to 40 seconds for the life of the process.

- Open IPv6 mDNS sockets only on interfaces with an IPv6 address, as NDP
  discovery already does.
- probe() judges each socket: the round succeeds if any socket sent, and
  sockets with a permanent send error are dropped from later retries.
- EACCES is a permanent send error. probeLoop stops, with one warning,
  only when no socket is left.
A fallback-mode Internal Domain whose resolvers cannot be reached (VPN
off or still connecting) ends with the network's own negative answer.
ctrld passed it on with that network's negative-cache lifetime; a home
router forwarding to public DNS gives the root zone's SOA, TTL 3600.
macOS caches the NXDOMAIN for that long, so the name stays broken after
the VPN is back, and the cached lookups never reach ctrld to be fixed.

Cap the SOA TTL and MINIMUM (RFC 2308 section 5) of that negative
answer at 5 seconds. Positive answers, final answers from the
configured resolvers, explicit-only mode and every other name keep
their TTLs.
… DNS

On Windows in dns intercept mode, a WireGuard full tunnel connected
before ctrld starts blocks DNS to the loopback listener (its kill switch
WFP filters), and the start self-check rolls the install back. ctrld
started first keeps working. Workarounds: start ctrld before connecting,
or use split AllowedIPs so the kill switch stays off.
@cuonglm
cuonglm force-pushed the release-branch-v1.5.11 branch from c30addb to 5f2943d Compare November 16, 2026 17:36
@cuonglm
cuonglm merged commit efe7318 into v1.0 Nov 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants