all: dealing with VLAN config on Firewalla

Firewalla ignores 127.0.0.1 in all VLAN config, so making 127.0.0.1 as
dnsmasq upstream would break thing when multiple VLAN presents.

To deal with this, we need to gather all interfaces available, and
making them as upstream of dnsmasq. Then changing ctrld to listen on all
interfaces, too.

It also leads to better improvement for dnsmasq configuration template,
as the upstream server can now be generated dynamically instead of hard
coding to 127.0.0.1:5354.
This commit is contained in:
Cuong Manh Le
2023-06-27 01:22:32 +07:00
committed by Cuong Manh Le
parent a4c1983657
commit f3a3227f21
4 changed files with 56 additions and 4 deletions

View File

@@ -236,10 +236,14 @@ func (p *prog) setDNS() {
}
logger.Debug().Msg("setting DNS for interface")
ns := cfg.Listener["0"].IP
if router.Name() == router.Firewalla && ns == "127.0.0.1" {
if router.Name() == router.Firewalla && (ns == "127.0.0.1" || ns == "0.0.0.0" || ns == "") {
// On Firewalla, the lo interface is excluded in all dnsmasq settings of all interfaces.
// Thus, we use "br0" as the nameserver in /etc/resolv.conf file.
logger.Warn().Msg("127.0.0.1 won't work on Firewalla")
if ns == "127.0.0.1" {
logger.Warn().Msg("127.0.0.1 as DNS server won't work on Firewalla")
} else {
logger.Warn().Msgf("%q could not be used as DNS server", ns)
}
if netIface, err := net.InterfaceByName("br0"); err == nil {
addrs, _ := netIface.Addrs()
for _, addr := range addrs {