cmd/ctrld: add workaround for default iface name on Ubios

This commit is contained in:
Cuong Manh Le
2023-07-14 11:43:32 +00:00
committed by Cuong Manh Le
parent 28df551195
commit 48a780fc3e
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -43,6 +43,7 @@ import (
"github.com/Control-D-Inc/ctrld/internal/router/firewalla"
"github.com/Control-D-Inc/ctrld/internal/router/merlin"
"github.com/Control-D-Inc/ctrld/internal/router/tomato"
"github.com/Control-D-Inc/ctrld/internal/router/ubios"
)
var (
@@ -975,6 +976,10 @@ func defaultIfaceName() string {
if oi := osinfo.New(); strings.Contains(oi.String(), "Microsoft") {
return "lo"
}
// Same as WSL case above.
if router.Name() == ubios.Name {
return "lo"
}
mainLog.Fatal().Err(err).Msg("failed to get default route interface")
}
return dri
+1 -1
View File
@@ -249,7 +249,7 @@ func (p *prog) setDNS() {
// If ctrld is direct listener, use 127.0.0.1 as nameserver.
ns = "127.0.0.1"
} else if lc.Port != 53 {
ifaceName := defaultIfaceName()
ifaceName := iface
switch router.Name() {
case firewalla.Name:
// On Firewalla, the lo interface is excluded in all dnsmasq settings of all interfaces.