mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-09-04 13:36:35 +02:00
dns intercept: port DNS-less network recovery to master
Port !997 from v1.0 onto the context-aware master recovery lifecycle. Preserve master logging and resolver APIs while adding macOS default-route DHCP detection, temporary DNS-target cleanup, and atomic recovery ownership. Includes parser, lifecycle, failure, and concurrency regressions plus the corrected macOS QA helper. Relates to #533 and #597.
This commit is contained in:
@@ -528,6 +528,11 @@ func (p *prog) checkAnchorOrdering(filterLines []string, ourAnchorRef string) {
|
||||
|
||||
// stopDNSIntercept removes all pf rules and cleans up the DNS interception.
|
||||
func (p *prog) stopDNSIntercept() error {
|
||||
// Remove a loopback DNS target set for a DNS-less network (issue #533)
|
||||
// before tearing down pf, so the service is returned to its saved or
|
||||
// empty DNS state.
|
||||
p.removeInterceptDNSTarget("intercept shutdown")
|
||||
|
||||
state, ok := p.dnsInterceptState.(*pfState)
|
||||
if !ok || state == nil {
|
||||
mainLog.Load().Debug().Msg("DNS intercept: no pf state to clean up")
|
||||
@@ -1734,6 +1739,11 @@ func (p *prog) pfWatchdog() {
|
||||
return
|
||||
}
|
||||
|
||||
// Reconcile the temporary service DNS target even when macOS emits no
|
||||
// major network delta. This converges both DHCP-return cleanup and a
|
||||
// later return to a DNS-less network.
|
||||
ensureInterceptDNSTargetFn(p, []string{})
|
||||
|
||||
result := p.ensurePFAnchorActive()
|
||||
if result == pfAnchorCheckIntact {
|
||||
// Only an authoritative intact result may trigger the functional probe.
|
||||
|
||||
Reference in New Issue
Block a user