diff --git a/package/gluon-wan-dnsmasq/files/lib/gluon/wan-dnsmasq/interface.d/050-gluon-wan-dnsmasq b/package/gluon-wan-dnsmasq/files/lib/gluon/wan-dnsmasq/interface.d/050-gluon-wan-dnsmasq new file mode 100644 index 0000000000000000000000000000000000000000..585dd7a967aa0185e92ba09ac7ff379157858c27 --- /dev/null +++ b/package/gluon-wan-dnsmasq/files/lib/gluon/wan-dnsmasq/interface.d/050-gluon-wan-dnsmasq @@ -0,0 +1,2 @@ +wan6 +wan diff --git a/package/gluon-wan-dnsmasq/luasrc/lib/gluon/wan-dnsmasq/update.lua b/package/gluon-wan-dnsmasq/luasrc/lib/gluon/wan-dnsmasq/update.lua index edd33f2cbf976c4ecf9214a4c01ec957b33c51c8..196a0c2ff6de00d0c32acb4c414e22c6f4335ff8 100755 --- a/package/gluon-wan-dnsmasq/luasrc/lib/gluon/wan-dnsmasq/update.lua +++ b/package/gluon-wan-dnsmasq/luasrc/lib/gluon/wan-dnsmasq/update.lua @@ -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