From 1e6b4787fe27d450db1bc346d56593c1162d5669 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 23 Dec 2024 23:00:23 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/17bbfc50b5938d81d2d857a3eada7c8daae5e993 --- .../root/usr/share/passwall2/app.sh | 43 +++++++++++-------- .../root/usr/share/passwall2/iptables.sh | 4 ++ .../root/usr/share/passwall2/nftables.sh | 4 ++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index 199f820ee..9a3e6457a 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -1121,27 +1121,32 @@ acl_app() { [ "$enabled" = "1" ] || continue - for s in $sources; do - local s2 - is_iprange=$(lua_api "iprange(\"${s}\")") - if [ "${is_iprange}" = "true" ]; then - s2="iprange:${s}" - elif [ -n "$(echo ${s} | grep '^ipset:')" ]; then - s2="ipset:${s}" - else - _ip_or_mac=$(lua_api "ip_or_mac(\"${s}\")") - if [ "${_ip_or_mac}" = "ip" ]; then - s2="ip:${s}" - elif [ "${_ip_or_mac}" = "mac" ]; then - s2="mac:${s}" + if [ -n "${sources}" ]; then + for s in $sources; do + local s2 + is_iprange=$(lua_api "iprange(\"${s}\")") + if [ "${is_iprange}" = "true" ]; then + s2="iprange:${s}" + elif [ -n "$(echo ${s} | grep '^ipset:')" ]; then + s2="ipset:${s}" + else + _ip_or_mac=$(lua_api "ip_or_mac(\"${s}\")") + if [ "${_ip_or_mac}" = "ip" ]; then + s2="ip:${s}" + elif [ "${_ip_or_mac}" = "mac" ]; then + s2="mac:${s}" + fi fi - fi - [ -n "${s2}" ] && source_list="${source_list}\n${s2}" - unset s2 - done + [ -n "${s2}" ] && source_list="${source_list}\n${s2}" + unset s2 + done + else + source_list="any" + fi - mkdir -p $TMP_ACL_PATH/$sid - [ ! -z "${source_list}" ] && echo -e "${source_list}" | sed '/^$/d' > $TMP_ACL_PATH/$sid/source_list + local acl_path=${TMP_ACL_PATH}/$sid + mkdir -p ${acl_path} + [ -n "${source_list}" ] && echo -e "${source_list}" | sed '/^$/d' > ${acl_path}/source_list node=${node:-default} tcp_no_redir_ports=${tcp_no_redir_ports:-default} diff --git a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh index 9f352ee57..db88fc7a9 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh @@ -329,6 +329,8 @@ load_acl() { [ -z "${device}" ] && device="${interface}" _ipt_source="-i ${device} " msg="源接口【${device}】," + else + msg="源接口【所有】," fi if [ -n "$(echo ${i} | grep '^iprange:')" ]; then _iprange=$(echo ${i} | sed 's#iprange:##g') @@ -357,6 +359,8 @@ load_acl() { _ipt_source=$(factor ${_mac} "${_ipt_source}-m mac --mac-source") msg="${msg}MAC【${_mac}】," unset _mac + elif [ -n "$(echo ${i} | grep '^any')" ]; then + msg="${msg}所有设备," else continue fi diff --git a/luci-app-passwall2/root/usr/share/passwall2/nftables.sh b/luci-app-passwall2/root/usr/share/passwall2/nftables.sh index 3711b56cf..7987ebded 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/nftables.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/nftables.sh @@ -384,6 +384,8 @@ load_acl() { [ -z "${device}" ] && device="${interface}" _ipt_source="iifname ${device} " msg="源接口【${device}】," + else + msg="源接口【所有】," fi if [ -n "$(echo ${i} | grep '^iprange:')" ]; then _iprange=$(echo ${i} | sed 's#iprange:##g') @@ -405,6 +407,8 @@ load_acl() { _ipt_source=$(factor ${_mac} "${_ipt_source}ether saddr") msg="${msg}MAC【${_mac}】," unset _mac + elif [ -n "$(echo ${i} | grep '^any')" ]; then + msg="${msg}所有设备," else continue fi