luci: add hint when set dnsmasq failure.

This commit is contained in:
Nick Peng
2022-09-14 23:45:39 +08:00
parent 1f1fd118de
commit 1991a0b102
6 changed files with 482 additions and 446 deletions

View File

@@ -37,6 +37,20 @@ end
function act_status()
local e={}
local ipv6_server;
local dnsmasq_server = luci.sys.exec("uci get dhcp.@dnsmasq[0].server")
local auto_set_dnsmasq = smartdns.get_config_option("smartdns", "smartdns", "auto_set_dnsmasq", nil);
e.auto_set_dnsmasq = auto_set_dnsmasq
e.dnsmasq_server = dnsmasq_server
e.local_port = smartdns.get_config_option("smartdns", "smartdns", "port", nil);
if e.local_port ~= nil and e.local_port ~= "53" and auto_set_dnsmasq ~= nil and auto_set_dnsmasq == "1" then
local str;
str = "127.0.0.1#" .. e.local_port
if string.sub(dnsmasq_server,1,string.len(str)) ~= str then
e.dnsmasq_redirect_failure = 1
end
end
e.running = is_running()
luci.http.prepare_content("application/json")
luci.http.write_json(e)