Repository navigation
Release v1.5.11 - #363
Merged
Merged
Release v1.5.11#363
Conversation
…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.
… cleanup, or on a bad config file on mobile
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
force-pushed
the
release-branch-v1.5.11
branch
from
November 16, 2026 17:36
c30addb to
5f2943d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minor Release
This contains version-pinned upgrades and rollback, and bug fixes across intercept mode, reloads and logging.
Added
--versionand--branchtoctrld 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 newctrld rollbackcommand installs an older build the same way: by default the release before the installed one, or the build given by--versionor--branchctrld clients listno longer listed ubios as a source. When the UniFi Network PostgreSQL socket exists, ctrld reads the names withpsql, read-only and with a 10 second deadline. Otherwise it queries MongoDB as beforeStartWithOptionsandSetNameserversfor 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 clearExitline instead of crashing the app, and fixed state carrying over from one start to the nextChanged
log_pathfile, 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.comhosts, the resolver UID and the provisioning code, in any letter case. The error text in the reply toctrld log sendis redacted tooSIGUSR1when 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 reloadrestarts the service instead[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.mddescribes how to fix the config fileAllowedIPsso the kill switch stays offFixed
ctrld restartand 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 read127.0.0.1with 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 unlessallow_wan_clientsis setdisable_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/startedwith 200.ctrld upgradeandctrld restarttook 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