Files
Zoltan Papp be8ec8e802 Fix DoT, keep the tunnel resolver when Private DNS is in Automatic mode (#266)
* Keep the tunnel resolver when Private DNS is in Automatic mode

The tunnel builder left the NetBird resolver out of the VPN whenever
Android reported Private DNS as active. That flag is also true in
Automatic mode on any network whose own resolver speaks TLS, which on
many carriers and some home networks is the default state. NetBird names
and custom DNS zones then stopped resolving with no visible reason, and
whether they worked at all depended on the network the phone was on at
the moment the tunnel was last rebuilt.

Only a configured Private DNS hostname actually conflicts with a plain
resolver in the tunnel: the OS then sends every query over TLS to that
host and refuses plain DNS, so offering our resolver would make every
lookup fail. In Automatic mode the OS probes a resolver for TLS and
falls back to plain DNS when the probe fails, and with Private DNS off
it never asks. In both cases the tunnel resolver works.

Decide on the hostname instead. DNSWatch now reads the Private DNS
server name next to the active flag, and IFace leaves the resolver out
only when one is set, logging which host it yields to. The hostname
setting is global, so the decision no longer depends on which network
happens to be active during a rebuild.

* Make the Private DNS resolver decision a testable function

The previous commit switched the tunnel resolver decision from the
Private DNS active flag to the configured hostname, which left the flag
with no reader. Drop the field, its getter and both assignments.

The decision itself now lives in a static function on DNSWatch that
takes only the hostname, so it can be unit tested without a
ConnectivityManager. IFace calls it directly and isPrivateDnsStrict goes
away. A null or empty name keeps the resolver; a hostname leaves it out.

The message logged when the resolver is left out drops from info to
debug, matching the level of the line it replaced.
2026-09-15 10:39:54 +02:00
..
2025-06-05 20:37:51 +02:00
2025-06-05 20:37:51 +02:00
2025-06-05 20:37:51 +02:00