update 2026-09-04 23:37:45

This commit is contained in:
action committed 2026-09-04 23:37:45 +08:00
1 parent b37f8cba7c
commit d0a6e27e6e
44 files changed
+572 -39

No files matched your search

@@ -857,14 +857,16 @@ acl_node() {
unset _error_log_file
continue
fi
local run_new_dnsmasq=1
local DNSMASQ_TUN_DNS="127.0.0.1#${dns_listen_port}"
local DNSMASQ_DEFAULT_DNS="${AUTO_DNS}"
local DNSMASQ_LOCAL_DNS="${LOCAL_DNS:-${AUTO_DNS}}"
[ -n "${DIRECT_DNS_DNSMASQ_SERVER}" ] && DNSMASQ_LOCAL_DNS="${DIRECT_DNS_DNSMASQ_SERVER}"
if [ "${flag}" = "default" ]; then
set_cache_var "GLOBAL_SOCKS_server" "127.0.0.1:$socks_port"
set_cache_var "ACL_GLOBAL_node" "$node"
local RUN_NEW_DNSMASQ=$(config_n_get @global[0] dns_redirect 1)
local DNSMASQ_DEFAULT_DNS="${AUTO_DNS}"
local DNSMASQ_LOCAL_DNS="${LOCAL_DNS:-${AUTO_DNS}}"
local DNSMASQ_TUN_DNS="127.0.0.1#${dns_listen_port}"
if [ "${RUN_NEW_DNSMASQ}" == "0" ]; then
run_new_dnsmasq=$(config_n_get @global[0] dns_redirect 1)
if [ "${run_new_dnsmasq}" != "1" ]; then
#Rewrite the default DNS service configuration
#Modify the default dnsmasq service
lua $APP_PATH/helper_dnsmasq.lua stretch
@@ -882,21 +884,16 @@ acl_node() {
uci -q commit dhcp
lua $APP_PATH/helper_dnsmasq.lua logic_restart
else
#Run a copy dnsmasq instance, DNS hijack for that need proxy devices.
dnsmasq_port=$(get_new_port auto)
run_copy_dnsmasq flag="default" listen_port=${dnsmasq_port} local_dns="${DNSMASQ_LOCAL_DNS}" tun_dns="${DNSMASQ_TUN_DNS}" default_dns="${DNSMASQ_DEFAULT_DNS}"
#dhcp.leases to hosts
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
log 2 "Dnsmasq[${dnsmasq_port}]:(127.0.0.1:${dns_listen_port})"
fi
else
fi
[ "${run_new_dnsmasq}" == "1" ] && {
#Run a copy dnsmasq instance, DNS hijack for that need proxy devices.
dnsmasq_port=$(get_new_port auto)
run_copy_dnsmasq flag="${flag}" listen_port=${dnsmasq_port} local_dns="${LOCAL_DNS:-${AUTO_DNS}}" tun_dns="127.0.0.1#${dns_listen_port}" default_dns="${AUTO_DNS}"
#dhcp.leases to hostsMore actions
run_copy_dnsmasq flag="${flag}" listen_port=${dnsmasq_port} local_dns="${DNSMASQ_LOCAL_DNS}" tun_dns="${DNSMASQ_TUN_DNS}" default_dns="${DNSMASQ_DEFAULT_DNS}"
#dhcp.leases to hosts
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
log 2 "Dnsmasq[${dnsmasq_port}]:(127.0.0.1:${dns_listen_port})"
fi
}
rm -f ${TMP_ACL_PATH}/acl_node_${nid}
done
}
@@ -1030,6 +1027,7 @@ get_direct_dns() {
DIRECT_DNS_PROTO="${direct_dns_protocol}"
DIRECT_DNS_SERVER=$(echo ${result} | awk '{print $1}')
DIRECT_DNS_PORT=$(echo ${result} | awk '{print $2}')
[ "${DIRECT_DNS_PROTO}" = "udp" ] && DIRECT_DNS_DNSMASQ_SERVER="${DIRECT_DNS_SERVER}#${DIRECT_DNS_PORT}"
RETURN_DNS="${RETURN_DNS},${DIRECT_DNS_SERVER}#${DIRECT_DNS_PORT}#${DIRECT_DNS_PROTO}"
}
fi
@@ -140,6 +140,10 @@ function copy_instance(var)
end
end
tinsert(conf_lines, "port=" .. LISTEN_PORT)
--dhcp.leases to hostsMore actions
local hosts = api.CACHE_PATH .. "/dhcp-hosts"
sys.call("touch " .. hosts)
tinsert(conf_lines, "addn-hosts=" .. hosts)
if TMP_DNSMASQ_PATH then
sys.call("rm -rf " .. TMP_DNSMASQ_PATH .. "/*passwall2*")
end
@@ -159,7 +163,6 @@ function add_rule(var)
local FLAG = var["FLAG"]
local TMP_DNSMASQ_PATH = var["TMP_DNSMASQ_PATH"]
local DNSMASQ_CONF_FILE = var["DNSMASQ_CONF_FILE"]
local LISTEN_PORT = var["LISTEN_PORT"]
local DEFAULT_DNS = var["DEFAULT_DNS"]
local LOCAL_DNS = var["LOCAL_DNS"]
local TUN_DNS = var["TUN_DNS"]
@@ -317,20 +320,6 @@ function add_rule(var)
if DNSMASQ_CONF_FILE ~= "nil" then
local conf_lines = {}
if LISTEN_PORT then
--Copy dnsmasq instance
conf_lines = copy_instance({
["LISTEN_PORT"] = LISTEN_PORT,
["TMP_DNSMASQ_PATH"] = TMP_DNSMASQ_PATH,
["return"] = "1"
})
--dhcp.leases to hostsMore actions
local hosts = api.CACHE_PATH .. "/dhcp-hosts"
sys.call("touch " .. hosts)
tinsert(conf_lines, "addn-hosts=" .. hosts)
else
--Modify the default dnsmasq service
end
tinsert(conf_lines, string.format("conf-dir=%s", TMP_DNSMASQ_PATH))
if dnsmasq_default_dns then
for s in string.gmatch(dnsmasq_default_dns, '[^' .. "," .. ']+') do