gluon-wan-dnsmasq: read interfaces to update from flag-files (#2060)

This commit changes the behavior for the wan-dnsmasq to read the
interfaces to update the DNS servers on from flag-files.

This way, external custom packages which add a custom VPN WAN interface
can update the DNS server gluon is using for WAN resolving.
This commit is contained in:
David Bauer 2020-06-30 16:37:09 +02:00 committed by GitHub
parent 2be6fe32e6
commit 9be7a5cad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -16,6 +16,19 @@ local function append_server(server)
end
local function handled_interfaces()
local interfaces = {}
for _, path in ipairs(util.glob('/lib/gluon/wan-dnsmasq/interface.d/*')) do
for interface in io.lines(path) do
table.insert(interfaces, interface)
end
end
return interfaces
end
local function handle_interface(status)
local ifname = status.device
local servers = status.inactive['dns-server']
@ -41,8 +54,9 @@ if type(static) == 'table' and #static > 0 then
append_server(server)
end
else
pcall(append_interface_servers, 'wan6')
pcall(append_interface_servers, 'wan')
for _, interface in ipairs(handled_interfaces()) do
pcall(append_interface_servers, interface)
end
end