luci: fix lost logic

This commit is contained in:
xiaorouji 2023-04-04 12:19:16 +08:00 committed by sbwml
parent ab8bdd4926
commit 521efc0ee9
3 changed files with 29 additions and 27 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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