From 4a2c037497caf2b92a1dadb834f8d42c48b1fa8a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:07:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=A4=20Sync=202024-12-15=2010:07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-app-passwall/root/usr/share/passwall/app.sh | 2 ++ .../root/usr/share/passwall/helper_dnsmasq.sh | 5 +---- .../usr/share/passwall/helper_dnsmasq_add.lua | 16 ++++++++-------- .../root/usr/share/passwall2/app.sh | 4 +--- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index a3a90be0..e9036dc8 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -1558,6 +1558,7 @@ start_dns() { -USE_DIRECT_LIST "${USE_DIRECT_LIST}" -USE_PROXY_LIST "${USE_PROXY_LIST}" -USE_BLOCK_LIST "${USE_BLOCK_LIST}" -USE_GFW_LIST "${USE_GFW_LIST}" -CHN_LIST "${CHN_LIST}" \ -TCP_NODE ${TCP_NODE} -DEFAULT_PROXY_MODE ${TCP_PROXY_MODE} -NO_PROXY_IPV6 ${DNSMASQ_FILTER_PROXY_IPV6:-0} -NFTFLAG ${nftflag:-0} \ -NO_LOGIC_LOG ${NO_LOGIC_LOG:-0} + awk '!seen[$0]++' ${GLOBAL_DNSMASQ_CONF} > ${TMP_PATH}/dnsmasq_default.tmp && mv ${TMP_PATH}/dnsmasq_default.tmp ${GLOBAL_DNSMASQ_CONF} ln_run "$(first_type dnsmasq)" "dnsmasq_default" "/dev/null" -C ${GLOBAL_DNSMASQ_CONF} -x ${GLOBAL_ACL_PATH}/dnsmasq.pid echo "${GLOBAL_DNSMASQ_PORT}" > ${GLOBAL_ACL_PATH}/var_redirect_dns_port DNS_REDIRECT_PORT=${GLOBAL_DNSMASQ_PORT} @@ -1758,6 +1759,7 @@ acl_app() { -TUN_DNS "127.0.0.1#${_dns_port}" -REMOTE_FAKEDNS 0 -USE_DEFAULT_DNS "${use_default_dns:-direct}" -CHINADNS_DNS ${_china_ng_listen:-0} \ -TCP_NODE $tcp_node -DEFAULT_PROXY_MODE ${tcp_proxy_mode} -NO_PROXY_IPV6 ${dnsmasq_filter_proxy_ipv6:-0} -NFTFLAG ${nftflag:-0} \ -NO_LOGIC_LOG 1 + awk '!seen[$0]++' ${dnsmasq_conf} > ${TMP_PATH}/dnsmasq_${sid}.tmp && mv ${TMP_PATH}/dnsmasq_${sid}.tmp ${dnsmasq_conf} ln_run "$(first_type dnsmasq)" "dnsmasq_${sid}" "/dev/null" -C ${dnsmasq_conf} -x ${acl_path}/dnsmasq.pid echo "${dnsmasq_port}" > ${acl_path}/var_redirect_dns_port eval node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)=${dnsmasq_port} diff --git a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh index 1c6834f1..999c9ff5 100755 --- a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh +++ b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh @@ -5,16 +5,13 @@ copy_instance() { eval_set_val $@ [ -s "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}" ] && { cp -r /tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID} $dnsmasq_conf + sed -i "/passwall/d" $dnsmasq_conf sed -i "/ubus/d" $dnsmasq_conf sed -i "/dhcp/d" $dnsmasq_conf sed -i "/port=/d" $dnsmasq_conf - sed -i "/conf-dir/d" $dnsmasq_conf - sed -i "/no-poll/d" $dnsmasq_conf - sed -i "/no-resolv/d" $dnsmasq_conf sed -i "/server=/d" $dnsmasq_conf } echo "port=${listen_port}" >> $dnsmasq_conf - awk '!seen[$0]++' $dnsmasq_conf > /tmp/dnsmasq.tmp && mv /tmp/dnsmasq.tmp $dnsmasq_conf } DEFAULT_DNSMASQ_CFGID="$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')" 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 6c017660..4aa982b5 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 @@ -441,11 +441,11 @@ if not fs.access(CACHE_DNS_PATH) then if key == "#" then domain = key end - address_out:write(string.format("address=/%s/%s\n", domain, value.address)) + address_out:write(string.format("address=/%s/%s", domain, value.address) .. "\n") end if value.dns and #value.dns > 0 then for i, dns in ipairs(value.dns) do - server_out:write(string.format("server=/.%s/%s\n", key, dns)) + server_out:write(string.format("server=/.%s/%s", key, dns) .. "\n") end end if value.ipsets and #value.ipsets > 0 then @@ -454,7 +454,7 @@ if not fs.access(CACHE_DNS_PATH) then ipsets_str = ipsets_str .. ipset .. "," end ipsets_str = ipsets_str:sub(1, #ipsets_str - 1) - ipset_out:write(string.format("%s=/.%s/%s\n", set_name, key, ipsets_str)) + ipset_out:write(string.format("%s=/.%s/%s", set_name, key, ipsets_str) .. "\n") end end address_out:close() @@ -479,15 +479,15 @@ end if DNSMASQ_CONF_FILE ~= "nil" then local conf_out = io.open(DNSMASQ_CONF_FILE, "a") if USE_CHINADNS_NG == "0" then - conf_out:write(string.format("conf-dir=%s\n", TMP_DNSMASQ_PATH)) + conf_out:write(string.format("conf-dir=%s", TMP_DNSMASQ_PATH) .. "\n") end if dnsmasq_default_dns then for s in string.gmatch(dnsmasq_default_dns, '[^' .. "," .. ']+') do - conf_out:write(string.format("server=%s\n", s)) + conf_out:write(string.format("server=%s", s) .. "\n") end - conf_out:write("all-servers\n") - conf_out:write("no-poll\n") - conf_out:write("no-resolv\n") + conf_out:write("all-servers" .. "\n") + conf_out:write("no-poll" .. "\n") + conf_out:write("no-resolv" .. "\n") conf_out:close() if USE_CHINADNS_NG == "0" then log(string.format(" - 默认:%s", dnsmasq_default_dns)) diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index a735a54d..95be2085 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -990,12 +990,10 @@ run_copy_dnsmasq() { mkdir -p $dnsmasq_conf_path [ -s "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}" ] && { cp -r /tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID} $dnsmasq_conf + sed -i "/passwall2/d" $dnsmasq_conf sed -i "/ubus/d" $dnsmasq_conf sed -i "/dhcp/d" $dnsmasq_conf sed -i "/port=/d" $dnsmasq_conf - sed -i "/conf-dir/d" $dnsmasq_conf - sed -i "/no-poll/d" $dnsmasq_conf - sed -i "/no-resolv/d" $dnsmasq_conf sed -i "/server=/d" $dnsmasq_conf } local set_type="ipset"