diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index 2409b0dc..cc6c63ca 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -301,7 +301,8 @@ function index_status() local e = {} local dns_shunt = uci:get(appname, "@global[0]", "dns_shunt") or "dnsmasq" if dns_shunt == "smartdns" then - e.dns_mode_status = luci.sys.call("pidof smartdns >/dev/null") == 0 + local port = api.get_cache_var("SMARTDNS_LOCAL_PORT") or 0 + e.dns_mode_status = (port ~= 0) and luci.sys.call(string.format("netstat -apn | grep ':%s ' >/dev/null", port)) == 0 or false elseif dns_shunt == "chinadns-ng" then e.dns_mode_status = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '/tmp/etc/passwall/bin/' | grep 'default' | grep 'chinadns_ng' >/dev/null") == 0 else diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 7647f741..d1668ad4 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -2038,6 +2038,7 @@ get_config() { SMARTDNS_LISTEN_PORT=${NEXT_DNS_LISTEN_PORT} NEXT_DNS_LISTEN_PORT=$(expr $NEXT_DNS_LISTEN_PORT + 1) LOCAL_DNS="127.0.0.1#${SMARTDNS_LOCAL_PORT}" + set_cache_var "SMARTDNS_LOCAL_PORT" "${SMARTDNS_LOCAL_PORT}" } }