mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
fix(darwin): handle mDNSResponder on port 53 to avoid bind conflicts
When mDNSResponder is using port 53 on macOS, adjust listener config to use 0.0.0.0:53, stop mDNSResponder before binding, and run cleanup on install and uninstall so the DNS server can start reliably.
This commit is contained in:
committed by
Cuong Manh Le
parent
40c68a13a1
commit
a4f0418811
@@ -359,6 +359,10 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
|
||||
initInteractiveLogging()
|
||||
tasks := []task{
|
||||
{func() error {
|
||||
doMdnsResponderCleanup()
|
||||
return nil
|
||||
}, false, "Cleanup service before installation"},
|
||||
{func() error {
|
||||
// Save current DNS so we can restore later.
|
||||
withEachPhysicalInterfaces("", "saveCurrentStaticDNS", func(i *net.Interface) error {
|
||||
@@ -374,6 +378,10 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
}, false, "Configure service failure actions"},
|
||||
{s.Start, true, "Start"},
|
||||
{noticeWritingControlDConfig, false, "Notice writing ControlD config"},
|
||||
{func() error {
|
||||
doMdnsResponderHackPostInstall()
|
||||
return nil
|
||||
}, false, "Configure service post installation"},
|
||||
}
|
||||
mainLog.Load().Notice().Msg("Starting existing ctrld service")
|
||||
if doTasks(tasks) {
|
||||
@@ -437,6 +445,10 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
}
|
||||
|
||||
tasks := []task{
|
||||
{func() error {
|
||||
doMdnsResponderCleanup()
|
||||
return nil
|
||||
}, false, "Cleanup service before installation"},
|
||||
{s.Stop, false, "Stop"},
|
||||
{func() error { return doGenerateNextDNSConfig(nextdns) }, true, "Checking config"},
|
||||
{func() error { return ensureUninstall(s) }, false, "Ensure uninstall"},
|
||||
@@ -459,6 +471,10 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
// Note that startCmd do not actually write ControlD config, but the config file was
|
||||
// generated after s.Start, so we notice users here for consistent with nextdns mode.
|
||||
{noticeWritingControlDConfig, false, "Notice writing ControlD config"},
|
||||
{func() error {
|
||||
doMdnsResponderHackPostInstall()
|
||||
return nil
|
||||
}, false, "Configure service post installation"},
|
||||
}
|
||||
mainLog.Load().Notice().Msg("Starting service")
|
||||
if doTasks(tasks) {
|
||||
|
||||
Reference in New Issue
Block a user