Skip to content

Commit

Permalink
v4.6.5
Browse files Browse the repository at this point in the history
1.优化代码。
  • Loading branch information
larsonzh authored Oct 27, 2024
1 parent e879944 commit c6b3271
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 59 deletions.
4 changes: 2 additions & 2 deletions source_codes/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# install.sh v4.6.4
# install.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

# LZ RULE script for Asuswrt-Merlin Router
Expand All @@ -11,7 +11,7 @@

#BEGIN

LZ_VERSION=v4.6.4
LZ_VERSION=v4.6.5
TIMEOUT=10
CURRENT_PATH="${0%/*}"
[ "${CURRENT_PATH:0:1}" != '/' ] && CURRENT_PATH="$( pwd )${CURRENT_PATH#*.}"
Expand Down
3 changes: 3 additions & 0 deletions source_codes/lz/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.6.5 (2024/10/27)
1.优化代码。

v4.6.4 (2024/10/27)
1.新增 CIDR 网段地址数据校验及错误自动修正机制。
2.完善「在线检测新版本」代码逻辑,适配相关站点网络访
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/configs/lz_rule_config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_rule_config.sh v4.6.4
# lz_rule_config.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

# 本软件采用CIDR(无类别域间路由,Classless Inter-Domain Routing)技术,是一个在Internet上创建附加地
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_clear_custom_scripts_data.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_clear_custom_scripts_data.sh v4.6.4
# lz_clear_custom_scripts_data.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

## 清除用户自定义脚本数据
Expand Down
7 changes: 2 additions & 5 deletions source_codes/lz/func/lz_define_global_variables.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_define_global_variables.sh v4.6.4
# lz_define_global_variables.sh v4.6.5
# By LZ 妙妙呜 ([email protected])
# QnkgTFog5aaZ5aaZ5ZGc77yI6Juk6J+G5aKp5YS/77yJ(首次运行标识,切勿修改)

Expand Down Expand Up @@ -415,9 +415,7 @@ route_static_subnet="$( ip -o -4 address list | awk '$2 == "br0" {print $4; exit
route_local_ip="${route_static_subnet%/*}"

## 路由器本地子网
route_local_subnet=""
if [ -n "${route_static_subnet}" ]; then
route_local_subnet="$( awk -v ipv="${route_static_subnet}" 'function fix_cidr(ipa) {
route_local_subnet="$( awk -v ipv="${route_static_subnet}" 'function fix_cidr(ipa) {
if (ipa ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/) {
if (split(ipa, arr, /\.|\//) == 5) {
pos = int(arr[5] / 8) + 1;
Expand All @@ -438,7 +436,6 @@ if [ -n "${route_static_subnet}" ]; then
return ipa;
} \
BEGIN{print fix_cidr(ipv);}' )"
fi

## 静态分流模式整体通道推送命令是否执行(0--未执行;1--已执行)
command_from_all_executed="0"
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_initialize_config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_initialize_config.sh v4.6.4
# lz_initialize_config.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

## 初始化脚本配置
Expand Down
21 changes: 9 additions & 12 deletions source_codes/lz/func/lz_rule_address_query.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_rule_address_query.sh v4.6.4
# lz_rule_address_query.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

## 网址信息查询脚本
Expand Down Expand Up @@ -94,7 +94,7 @@ lz_aq_print_ipv4_address_list() {
-e '/^\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?$/!d' \
-e '/[3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -143,7 +143,7 @@ lz_aq_print_src_to_dst_ipv4_address_list() {
-e '/^\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?[[:space:]]\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?$/!d' \
-e '/[3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -181,7 +181,7 @@ lz_aq_print_src_to_dst_port_ipv4_address_list() {
-e 's/\(^\|[^[:digit:]]\)[0]\+\([[:digit:]]\)/\1\2/g' \
-e '/^\([^[:space:]]\+[[:space:]]\)\?[^[:space:]]*\([3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]\)[^[:space:]]*\([[:space:]]\|$\)/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${aq_route_local_ip}\)\([[:space:]]\|$\)/d" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -696,9 +696,7 @@ lz_aq_get_route_local_address_info() {
[ -n "$aq_route_local_ip_cidr_mask" ] && aq_route_local_ip_cidr_mask="$( lz_aq_netmask2cdr "${aq_route_local_ip_cidr_mask}" )"

aq_route_static_subnet="$( ip -o -4 address list | awk '$2 == "br0" {print $4; exit;}' | grep -Eo '^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$' )"
aq_route_local_subnet=""
if [ -n "${aq_route_static_subnet}" ]; then
aq_route_local_subnet="$( awk -v ipv="${aq_route_static_subnet}" 'function fix_cidr(ipa) {
aq_route_local_subnet="$( awk -v ipv="${aq_route_static_subnet}" 'function fix_cidr(ipa) {
if (ipa ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/) {
if (split(ipa, arr, /\.|\//) == 5) {
pos = int(arr[5] / 8) + 1;
Expand All @@ -719,7 +717,6 @@ lz_aq_get_route_local_address_info() {
return ipa;
} \
BEGIN{print fix_cidr(ipv);}' )"
fi
}

## 设置网址信息查询用变量函数
Expand Down Expand Up @@ -1261,9 +1258,9 @@ lz_query_address() {
ipset -q flush lz_aq_ispip_tmp_sets
## 第一WAN口的DNS解析服务器网址
eval "$( nvram get "wan0_dns" | awk 'NF >= "1" {
if ($1 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $1 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($1 != "0.0.0.0" && $1 != "127.0.0.1" && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "ipset -q add lz_aq_ispip_tmp_sets "$1;
if ($2 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $2 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($2 != "0.0.0.0" && $2 != "127.0.0.1" && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "ipset -q add lz_aq_ispip_tmp_sets "$2;
exit;
}' )"
Expand All @@ -1284,9 +1281,9 @@ lz_query_address() {
ipset -q flush lz_aq_ispip_tmp_sets
## 第二WAN口的DNS解析服务器网址
eval "$( nvram get "wan1_dns" | awk 'NF >= "1" {
if ($1 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $1 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($1 != "0.0.0.0" && $1 != "127.0.0.1" && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "ipset -q add lz_aq_ispip_tmp_sets "$1;
if ($2 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $2 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($2 != "0.0.0.0" && $2 != "127.0.0.1" && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "ipset -q add lz_aq_ispip_tmp_sets "$2;
exit;
}' )"
Expand Down
34 changes: 16 additions & 18 deletions source_codes/lz/func/lz_rule_func.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_rule_func.sh v4.6.4
# lz_rule_func.sh v4.6.5
# By LZ 妙妙呜 ([email protected])

#BEGIN
Expand Down Expand Up @@ -64,7 +64,7 @@ lz_print_ipv4_address_list() {
-e '/^\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?$/!d' \
-e '/[3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -113,7 +113,7 @@ lz_print_src_to_dst_ipv4_address_list() {
-e '/^\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?[[:space:]]\([0-9]\{1,3\}[\.]\)\{3\}[0-9]\{1,3\}\([\/][0-9]\{1,2\}\)\?$/!d' \
-e '/[3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${route_local_ip}\)\([[:space:]]\|$\)/d" "${1}" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -151,7 +151,7 @@ lz_print_src_to_dst_port_ipv4_address_list() {
-e 's/\(^\|[^[:digit:]]\)[0]\+\([[:digit:]]\)/\1\2/g' \
-e '/^\([^[:space:]]\+[[:space:]]\)\?[^[:space:]]*\([3-9][0-9][0-9]\|[2][6-9][0-9]\|[2][5][6-9]\|[\/][4-9][0-9]\|[\/][3][3-9]\)[^[:space:]]*\([[:space:]]\|$\)/d' \
-e 's/[\/]32//g' \
-e "/\(^\|[[:space:]]\)\(0\+[\.]0\+[\.]0\+[\.]0\+\|${route_local_ip}\)\([[:space:]]\|$\)/d" \
-e "/\(^\|[[:space:]]\)\(0\([\.]0\)\{3\}\|${route_local_ip}\)\([[:space:]]\|$\)/d" \
| awk 'function fix_cidr(ipa) {
split(ipa, arr, /\.|\//);
if (arr[5] !~ /^[0-9][0-9]?$/)
Expand Down Expand Up @@ -233,7 +233,7 @@ lz_get_custom_hosts_list() {
-e 's/^\([^[:space:]]\+[[:space:]][^[:space:]]\+\)\([[:space:]].*\|\)$/\1/g' \
-e '/^[[:alnum:]]\([[:alnum:]-]\{0,61\}[[:alnum:]]\)\?\([\.][[:alnum:]]\([[:alnum:]-]\{0,61\}[[:alnum:]]\)\?\)*[[:space:]][[:alnum:]]\([[:alnum:]-]\{0,61\}[[:alnum:]]\)\?\([\.][[:alnum:]]\([[:alnum:]-]\{0,61\}[[:alnum:]]\)\?\)*$/!d' \
-e '/[^[:space:]]\{256,\}\|[-]\{2,\}/d' \
-e "/^0\+[\.]0\+[\.]0\+[\.]0\+[[:space:]]/d" "${1}" 2> /dev/null | tr '[:A-Z:]' '[:a-z:]'
-e "/^0\+\([\.]0\+\)\{3\}[[:space:]]/d" "${1}" 2> /dev/null | tr '[:A-Z:]' '[:a-z:]'
}

## 获取自定义域名地址解析条目列表数据文件总有效条目数函数
Expand Down Expand Up @@ -3358,16 +3358,16 @@ lz_initialize_ip_data_policy() {
## 获取WAN口的DNS解析服务器网址
local local_ifip_wan0_dns1="" local_ifip_wan0_dns2="" local_ifip_wan1_dns1="" local_ifip_wan1_dns2=""
eval "$( nvram get "wan0_dns" | awk 'NF >= "1" {
if ($1 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $1 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($1 != "0.0.0.0" && $1 != "127.0.0.1" && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "local_ifip_wan0_dns1="$1;
if ($2 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $2 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($2 != "0.0.0.0" && $2 != "127.0.0.1" && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "local_ifip_wan0_dns2="$2;
exit;
}' )"
eval "$( nvram get "wan1_dns" | awk 'NF >= "1" {
if ($1 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $1 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($1 != "0.0.0.0" && $1 != "127.0.0.1" && $1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "local_ifip_wan1_dns1="$1;
if ($2 !~ /^0+[\.]0+[\.]0+[\.]0+$/ && $2 !~ /^127[\.]0+[\.]0+[\.]0*1$/ && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
if ($2 != "0.0.0.0" && $2 != "127.0.0.1" && $2 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}([\/][0-9]{1,2})?$/)
print "local_ifip_wan1_dns2="$2;
exit;
}' )"
Expand Down Expand Up @@ -3682,16 +3682,16 @@ lz_proxy_route_support() {
ip rule add from "${line}" to "0.0.0.0" table "${wan_no}" prio "${IP_RULE_PRIO_TOPEST}" > /dev/null 2>&1
else
if [ "${dn_pre_resolved}" = "0" ]; then
nslookup "${line}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 !~ /^0+[\.]0+[\.]0+[\.]0+$/ \
nslookup "${line}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 != "0.0.0.0" \
{system("ip rule add from 0.0.0.0 to "$3"'" table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1; ip rule add from "'"$3"'" to 0.0.0.0 table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1"'")}'
elif [ "${dn_pre_resolved}" = "1" ]; then
[ "${pre_dns_enable}" = "0" ] \
&& nslookup "${line}" "${pre_dns}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 !~ /^0+[\.]0+[\.]0+[\.]0+$/ \
&& nslookup "${line}" "${pre_dns}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 != "0.0.0.0" \
{system("ip rule add from 0.0.0.0 to "$3"'" table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1; ip rule add from "'"$3"'" to 0.0.0.0 table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1"'")}'
elif [ "${dn_pre_resolved}" = "2" ]; then
node_list="$( nslookup "${line}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 !~ /^0+[\.]0+[\.]0+[\.]0+$/ {print $3}' )"
node_list="$( nslookup "${line}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 != "0.0.0.0" {print $3}' )"
[ "${pre_dns_enable}" = "0" ] \
&& eval "$( nslookup "${line}" "${pre_dns}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 !~ /^0+[\.]0+[\.]0+[\.]0+$/ \
&& eval "$( nslookup "${line}" "${pre_dns}" 2> /dev/null | awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && $3 != "0.0.0.0" \
{printf "node_list=\"\$\( echo \"\${node_list}\" \| sed -e \"\\\$a %s\" -e \"\/\^[[:space:]]\*\$\/d\" \)\"\n", $3}' )"
echo "${node_list}" | awk '$1 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ && !i[$1]++ \
{system("ip rule add from 0.0.0.0 to "$1"'" table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1; ip rule add from "'"$1"'" to 0.0.0.0 table ${wan_no} prio ${IP_RULE_PRIO_TOPEST} > /dev/null 2>&1"'")}'
Expand Down Expand Up @@ -4989,7 +4989,7 @@ lz_output_dport_policy_info_to_system_records() {
if ip rule show | grep -q "^[[:space:]]*${1}:[[:space:]]*from[[:space:]]*all[[:space:]]*fwmark[[:space:]]*${2}[[:space:]]*lookup"; then
iptables -t mangle -L "${CUSTOM_PREROUTING_CONNMARK_CHAIN}" -n 2> /dev/null \
| sed -n "/CONNMARK[[:space:]]*set[[:space:]]*${2}$/p" \
| sed -e 's/^.*[[:space:]]\(tcp\|udp\|udplite\|sctp\|dccp\)[^[:alpha:]].*[[:space:]]0\+[\.]0\+[\.]0\+[\.]0\+[\/]0\+[[:space:]]\+0\+[\.]0\+[\.]0\+[\.]0\+[\/]0\+[[:space:]].*dports[[:space:]]\+\([^[:space:]]\+\)[[:space:]].*$/\1 \2/g' \
| sed -e 's/^.*[[:space:]]\(tcp\|udp\|udplite\|sctp\|dccp\)[^[:alpha:]].*[[:space:]]0\([\.]0\)\{3\}[\/]0[[:space:]]\+0\([\.]0\)\{3\}[\/]0[[:space:]].*dports[[:space:]]\+\([^[:space:]]\+\)[[:space:]].*$/\1 \4/g' \
-e '/CONNMARK/d' \
| tr '[:a-z:]' '[:A-Z:]' \
| awk -v count="0" -v wan_name="${wan_name}" 'NF == "2" {print "'"$(lzdate) [${$}]: "'"wan_name" "$1": "$2; count++;} \
Expand Down Expand Up @@ -5069,8 +5069,7 @@ lz_add_dual_ip_rules() {
## 返回值:无
lz_add_src_to_dst_sets_ip_rules() {
if [ -z "${1}" ] || [ ! -s "${2}" ]; then return; fi;
{ echo "${1}" | grep -qEw '0+[\.]0+[\.]0+[\.]0+[\/]0+' || echo "${1}" | grep -qEw '0+[\.]0+[\.]0+[\.]0+' \
|| [ "${1}" = "${route_local_ip}" ]; } && return
{ [ "${1}" = "0.0.0.0/0" ] || [ "${1}" = "0.0.0.0" ] || [ "${1}" = "${route_local_ip}" ]; } && return
lz_print_valid_ipv4_address_list "${2}" | awk 'NF >= "1" && $1 != "'"${1}"'" \
{system("'"ip rule add from ${1} to "'"$1"'" table ${3} prio ${4} > /dev/null 2>&1"'");}'
}
Expand All @@ -5084,8 +5083,7 @@ lz_add_src_to_dst_sets_ip_rules() {
## 返回值:无
lz_add_src_sets_to_dst_ip_rules() {
if [ ! -s "${1}" ] || [ -z "${2}" ]; then return; fi;
{ echo "${2}" | grep -qEw '0+[\.]0+[\.]0+[\.]0+[\/]0+' || echo "${2}" | grep -qEw '0+[\.]0+[\.]0+[\.]0+' \
|| [ "${2}" = "${route_local_ip}" ]; } && return
{ [ "${2}" = "0.0.0.0/0" ] || [ "${2}" = "0.0.0.0" ] || [ "${2}" = "${route_local_ip}" ]; } && return
lz_print_valid_ipv4_address_list "${1}" | awk 'NF >= "1" && $1 != "'"${2}"'" \
{system("ip rule add from "$1"'" to ${2} table ${3} prio ${4} > /dev/null 2>&1"'");}'
}
Expand Down
Loading

0 comments on commit c6b3271

Please sign in to comment.