From 27f11fbe6a01ca955a1b89bf699ea473bbf89689 Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:04:37 +0800 Subject: [PATCH] luci: let chinadns-ng support nftset --- luci-app-passwall/root/usr/share/passwall/app.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 0f86f573b..6032d7769 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -416,14 +416,22 @@ run_chinadns_ng() { [ -s "${RULES_PATH}/chnlist" ] && { local _chnlist_file="${TMP_PATH}/chinadns_chnlist" cp -a "${RULES_PATH}/chnlist" "${_chnlist_file}" - _extra_param="${_extra_param} -m ${_chnlist_file} -M -a" + local chnroute4_set="chnroute" + local chnroute6_set="chnroute6" + [ "$nftflag" = "1" ] && { + chnroute4_set="inet@fw4@chnroute" + chnroute6_set="inet@fw4@chnroute6" + } + _extra_param="${_extra_param} -4 ${chnroute4_set} -6 ${chnroute6_set} -m ${_chnlist_file} -M -a" } } ([ -n "$_chnlist" ] || [ -n "$_gfwlist" ]) && [ -s "${RULES_PATH}/gfwlist" ] && { local _gfwlist_file="${TMP_PATH}/chinadns_gfwlist" cp -a "${RULES_PATH}/gfwlist" "${_gfwlist_file}" - _extra_param="${_extra_param} -g ${_gfwlist_file} -A gfwlist,gfwlist6" + local gfwlist_set="gfwlist,gfwlist6" + [ "$nftflag" = "1" ] && gfwlist_set="inet@fw4@gfwlist,inet@fw4@gfwlist6" + _extra_param="${_extra_param} -g ${_gfwlist_file} -A ${gfwlist_set}" #当只有使用gfwlist模式时设置默认DNS为本地直连 [ -n "$_gfwlist" ] && [ -z "$_chnlist" ] && _default_tag="chn" }