diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 3566e4903..54ba46035 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=4.62 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 2b8a2da92..9028a5d1f 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -1063,29 +1063,31 @@ start_dns() { DNSMASQ_FILTER_IPV6=$FILTER_PROXY_IPV6 echolog "过滤服务配置:准备接管域名解析..." - local items=$(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1) - [ -n "$items" ] && { - for item in $items; do - [ "$(config_n_get $item enabled)" = "1" ] || continue - [ "$(config_n_get $item tcp_node)" = "default" ] && [ "$TCP_NODE" != "nil" ] && { - local item_tcp_proxy_mode=$(config_n_get $item tcp_proxy_mode default) - [ "$item_tcp_proxy_mode" = "default" ] && item_tcp_proxy_mode=$TCP_PROXY_MODE - global=$(echo "${global}${item_tcp_proxy_mode}" | grep "global") - returnhome=$(echo "${returnhome}${item_tcp_proxy_mode}" | grep "returnhome") - chnlist=$(echo "${chnlist}${item_tcp_proxy_mode}" | grep "chnroute") - gfwlist=$(echo "${gfwlist}${item_tcp_proxy_mode}" | grep "gfwlist") - ACL_TCP_PROXY_MODE=${ACL_TCP_PROXY_MODE}${item_tcp_proxy_mode} - } - [ "$(config_n_get $item udp_node)" = "default" ] && [ "$UDP_NODE" != "nil" ] && { - local item_udp_proxy_mode=$(config_n_get $item udp_proxy_mode default) - [ "$item_udp_proxy_mode" = "default" ] && item_udp_proxy_mode=$UDP_PROXY_MODE - global=$(echo "${global}${item_udp_proxy_mode}" | grep "global") - returnhome=$(echo "${returnhome}${item_udp_proxy_mode}" | grep "returnhome") - chnlist=$(echo "${chnlist}${item_udp_proxy_mode}" | grep "chnroute") - gfwlist=$(echo "${gfwlist}${item_udp_proxy_mode}" | grep "gfwlist") - ACL_UDP_PROXY_MODE=${ACL_UDP_PROXY_MODE}${item_udp_proxy_mode} - } - done + [ "$ENABLED_ACLS" == 1 ] && { + local items=$(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1) + [ -n "$items" ] && { + for item in $items; do + [ "$(config_n_get $item enabled)" = "1" ] || continue + [ "$(config_n_get $item tcp_node)" = "default" ] && [ "$TCP_NODE" != "nil" ] && { + local item_tcp_proxy_mode=$(config_n_get $item tcp_proxy_mode default) + [ "$item_tcp_proxy_mode" = "default" ] && item_tcp_proxy_mode=$TCP_PROXY_MODE + global=$(echo "${global}${item_tcp_proxy_mode}" | grep "global") + returnhome=$(echo "${returnhome}${item_tcp_proxy_mode}" | grep "returnhome") + chnlist=$(echo "${chnlist}${item_tcp_proxy_mode}" | grep "chnroute") + gfwlist=$(echo "${gfwlist}${item_tcp_proxy_mode}" | grep "gfwlist") + ACL_TCP_PROXY_MODE=${ACL_TCP_PROXY_MODE}${item_tcp_proxy_mode} + } + [ "$(config_n_get $item udp_node)" = "default" ] && [ "$UDP_NODE" != "nil" ] && { + local item_udp_proxy_mode=$(config_n_get $item udp_proxy_mode default) + [ "$item_udp_proxy_mode" = "default" ] && item_udp_proxy_mode=$UDP_PROXY_MODE + global=$(echo "${global}${item_udp_proxy_mode}" | grep "global") + returnhome=$(echo "${returnhome}${item_udp_proxy_mode}" | grep "returnhome") + chnlist=$(echo "${chnlist}${item_udp_proxy_mode}" | grep "chnroute") + gfwlist=$(echo "${gfwlist}${item_udp_proxy_mode}" | grep "gfwlist") + ACL_UDP_PROXY_MODE=${ACL_UDP_PROXY_MODE}${item_udp_proxy_mode} + } + done + } } case "$DNS_MODE" in diff --git a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq_add.lua b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq_add.lua index 02e913206..22359b94f 100644 --- a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq_add.lua +++ b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq_add.lua @@ -163,11 +163,11 @@ local gfwlist = PROXY_MODE:find("gfwlist") local only_global local dnsmasq_default_dns -if CHNROUTE_MODE_DEFAULT_DNS ~= "nil" and (chnlist or gfwlist) then - if CHNROUTE_MODE_DEFAULT_DNS == "remote" then +if CHNROUTE_MODE_DEFAULT_DNS ~= "nil" then + if chnlist and CHNROUTE_MODE_DEFAULT_DNS == "remote" then dnsmasq_default_dns = TUN_DNS end - if CHNROUTE_MODE_DEFAULT_DNS == "chinadns_ng" and CHINADNS_DNS ~= "0" then + if (chnlist or gfwlist) and CHNROUTE_MODE_DEFAULT_DNS == "chinadns_ng" and CHINADNS_DNS ~= "0" then dnsmasq_default_dns = CHINADNS_DNS end end