gluon-wan-dnsmasq: add interface name to link-local addresses

Fixes #854
This commit is contained in:
Matthias Schiffer 2016-08-28 22:04:47 +02:00
parent 639c12b8e2
commit 051fd926ef
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 8 additions and 2 deletions

View File

@ -12,14 +12,20 @@ local fs = require 'nixio.fs'
local new_servers = ''
local function append_servers(servers)
local function handle_interface(status)
local ifname = status.device
local servers = status.inactive['dns-server']
for _, server in ipairs(servers) do
if server:match('^fe80:') then
server = server .. '%' .. ifname
end
new_servers = new_servers .. 'nameserver ' .. server .. '\n'
end
end
local function append_interface_servers(iface)
append_servers(ubus:call('network.interface.' .. iface, 'status', {}).inactive['dns-server'])
handle_interface(ubus:call('network.interface.' .. iface, 'status', {}))
end