Skip to content

Commit

Permalink
v4.1.2
Browse files Browse the repository at this point in the history
1.优化双线路负载均衡模式下路由器重启时,PPPoE 
  连接失败后的一次性自动重拨恢复机制,最大限度
  地保证设备非故障状态下的线路畅通。
2.完善前后台任务执行过程中的同步机制。
3.更新运营商 IP 地址数据文件。
  • Loading branch information
larsonzh authored Aug 26, 2023
1 parent b7ccf4e commit 83f4ea3
Show file tree
Hide file tree
Showing 20 changed files with 129 additions and 54 deletions.
9 changes: 5 additions & 4 deletions source_codes/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# install.sh v4.1.1
# install.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

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

#BEIGIN

LZ_VERSION=v4.1.1
LZ_VERSION=v4.1.2
TIMEOUT=10
CURRENT_PATH="${0%/*}"
[ "${CURRENT_PATH:0:1}" != '/' ] && CURRENT_PATH="$( pwd )${CURRENT_PATH#*.}"
Expand Down Expand Up @@ -240,9 +240,9 @@ EOF_SERVICE_INTERFACE
&& sed -i 'l1 s:^.*\(#!/bin/sh.*$\):\1/g' "/jffs/scripts/service-event"
fi
sed -i -e '/lz_rule[\.]sh/d' -e '/lz_update_ispip_data[\.]sh/d' -e '/lz_rule_service[\.]sh/d' "/jffs/scripts/service-event"
sed -i -e "\$a ${PATH_INTERFACE}/lz_rule_service.sh \"\$\{1\}\" \"\$\{2\}\" # Added by LZRule" -e "/^[ \t]*$/d" "/jffs/scripts/service-event"
sed -i -e "\$a ${PATH_INTERFACE}/lz_rule_service.sh \$\{@\} # Added by LZRule" -e "/^[ \t]*$/d" "/jffs/scripts/service-event"
chmod +x "/jffs/scripts/service-event"
! grep -q "${PATH_INTERFACE}/lz_rule_service[\.]sh \"\$[\{]1[\}]\" \"\$[\{]2[\}]\"" "/jffs/scripts/service-event" && return "1"
! grep -q "${PATH_INTERFACE}/lz_rule_service[\.]sh \$[\{]@[\}]" "/jffs/scripts/service-event" && return "1"
return "0"
}

Expand Down Expand Up @@ -309,6 +309,7 @@ lz_mount_web_ui() {
ln -s "${PATH_TMP}/address.log" "${PATH_WEB_LZR}/LZRAddress.html" > /dev/null 2>&1
ln -s "${PATH_TMP}/crontab.log" "${PATH_WEB_LZR}/LZRCrontab.html" > /dev/null 2>&1
ln -s "${PATH_TMP}/unlock.log" "${PATH_WEB_LZR}/LZRUnlock.html" > /dev/null 2>&1
ln -s "/var/lock/lz_rule_instance.lock" "${PATH_WEB_LZR}/LZRInstance.html" > /dev/null 2>&1
! which md5sum > /dev/null 2>&1 && break
local page_name="$( lz_get_webui_page )"
[ -z "${page_name}" ] && break
Expand Down
7 changes: 7 additions & 0 deletions source_codes/lz/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v4.1.2 (2023/8/26)
1.优化双线路负载均衡模式下路由器重启时,PPPoE
连接失败后的一次性自动重拨恢复机制,最大限度
地保证设备非故障状态下的线路畅通。
2.完善前后台任务执行过程中的同步机制。
3.更新运营商 IP 地址数据文件。

v4.1.1 (2023/8/24)
1.在 Web UI 中增加「外部网络(WAN) - 策略路由
- 工具」标签页面,新增如下实用功能「命令」:
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.1.1
# lz_rule_config.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

# 本软件采用CIDR(无类别域间路由,Classless Inter-Domain Routing)技术,是一个在Internet上创建附加地
Expand Down
3 changes: 2 additions & 1 deletion source_codes/lz/data/lz_all_cn_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,8 @@
103.20.128.0/22
103.20.160.0/22
103.20.248.0/22
103.21.98.0/23
103.21.102.0/23
103.21.112.0/21
103.21.136.0/21
103.21.176.0/22
Expand Down Expand Up @@ -1949,7 +1951,6 @@
103.119.12.0/22
103.119.16.0/22
103.119.28.0/22
103.119.44.0/22
103.119.104.0/22
103.119.115.0/24
103.119.156.0/22
Expand Down
1 change: 1 addition & 0 deletions source_codes/lz/data/lz_gwbn_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
101.40.0.0/15
101.104.0.0/14
101.130.0.0/15
103.21.98.0/23
103.23.56.0/22
103.24.184.0/22
103.38.0.0/22
Expand Down
3 changes: 2 additions & 1 deletion source_codes/lz/data/lz_hk_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@
45.249.92.0/22
45.249.96.0/22
45.249.244.0/22
45.250.60.0/22
45.250.196.0/22
45.251.64.0/23
45.251.66.0/24
Expand Down Expand Up @@ -433,6 +432,7 @@
103.19.188.0/22
103.19.236.0/22
103.20.60.0/22
103.20.101.0/24
103.20.165.0/24
103.20.192.0/22
103.20.220.0/22
Expand Down Expand Up @@ -820,6 +820,7 @@
103.117.248.0/22
103.118.40.0/22
103.118.48.0/23
103.119.44.0/22
103.119.128.0/22
103.119.132.0/23
103.119.137.0/24
Expand Down
6 changes: 2 additions & 4 deletions source_codes/lz/data/lz_othernet_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@
103.20.128.0/22
103.20.160.0/22
103.20.248.0/22
103.21.102.0/23
103.21.112.0/21
103.21.136.0/21
103.21.208.0/22
Expand Down Expand Up @@ -1299,13 +1300,11 @@
103.96.208.0/21
103.96.216.0/22
103.96.224.0/23
103.97.8.0/21
103.97.16.0/20
103.97.12.0/22
103.97.32.0/21
103.97.40.0/22
103.97.56.0/21
103.97.64.0/21
103.97.72.0/22
103.97.80.0/22
103.97.112.0/21
103.97.128.0/22
Expand Down Expand Up @@ -1511,7 +1510,6 @@
103.119.12.0/22
103.119.16.0/22
103.119.28.0/22
103.119.44.0/22
103.119.104.0/22
103.119.115.0/24
103.119.156.0/22
Expand Down
1 change: 1 addition & 0 deletions source_codes/lz/data/lz_tw_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
103.17.240.0/22
103.18.128.0/22
103.20.40.0/22
103.20.98.0/23
103.20.176.0/22
103.21.60.0/22
103.21.196.0/22
Expand Down
3 changes: 3 additions & 0 deletions source_codes/lz/data/lz_unicom_cnc_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@
103.92.132.0/22
103.93.180.0/22
103.95.220.0/22
103.97.8.0/22
103.97.16.0/20
103.97.72.0/22
103.98.44.0/22
103.98.168.0/22
103.98.220.0/22
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.1.1
# lz_clear_custom_scripts_data.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 清除用户自定义脚本数据
Expand Down
2 changes: 1 addition & 1 deletion 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.1.1
# lz_define_global_variables.sh v4.1.2
# By LZ 妙妙呜 ([email protected])
# QnkgTFog5aaZ5aaZ5ZGc77yI6Juk6J+G5aKp5YS/77yJ(首次运行标识,切勿修改)

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.1.1
# lz_initialize_config.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 初始化脚本配置
Expand Down
2 changes: 1 addition & 1 deletion 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.1.1
# lz_rule_address_query.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 网址信息查询脚本
Expand Down
15 changes: 10 additions & 5 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.1.1
# lz_rule_func.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

#BEIGIN
Expand Down Expand Up @@ -5255,12 +5255,14 @@ lz_deployment_routing_policy() {
[ -z "${local_info}" ] && echo "$(lzdate)" [$$]: --------------------------------------------- | tee -ai "${SYSLOG}" 2> /dev/null
echo "$(lzdate)" [$$]: Primary WAN \( "${iptv_wan0_ifname}" "${iptv_wan0_pppoe_ifname}" \) fault. | tee -ai "${SYSLOG}" 2> /dev/null
local_info="1"
restart_ppp0="0"
}
[ -n "${iptv_wan0_pppoe_ifname}" ] \
&& ! lz_show_routing_table "${rt_wan1}" | awk '$1 == "default" && $5 == "'"${iptv_wan0_pppoe_ifname}"'" {exit(1)}' && {
[ -z "${local_info}" ] && echo "$(lzdate)" [$$]: --------------------------------------------- | tee -ai "${SYSLOG}" 2> /dev/null
echo "$(lzdate)" [$$]: Primary WAN \( "${iptv_wan0_pppoe_ifname}" \) fault. | tee -ai "${SYSLOG}" 2> /dev/null
local_info="1"
restart_ppp0="0"
}
if [ -z "${iptv_wan1_ifname}" ]; then
[ -z "${local_info}" ] && echo "$(lzdate)" [$$]: --------------------------------------------- | tee -ai "${SYSLOG}" 2> /dev/null
Expand All @@ -5278,12 +5280,14 @@ lz_deployment_routing_policy() {
[ -z "${local_info}" ] && echo "$(lzdate)" [$$]: --------------------------------------------- | tee -ai "${SYSLOG}" 2> /dev/null
echo "$(lzdate)" [$$]: Secondary WAN \( "${iptv_wan1_ifname}" "${iptv_wan1_pppoe_ifname}" \) fault. | tee -ai "${SYSLOG}" 2> /dev/null
local_info="1"
restart_ppp1="1"
}
[ -n "${iptv_wan1_pppoe_ifname}" ] \
&& ! lz_show_routing_table "${rt_wan0}" | awk '$1 == "default" && $5 == "'"${iptv_wan1_pppoe_ifname}"'" {exit(1)}' && {
[ -z "${local_info}" ] && echo "$(lzdate)" [$$]: --------------------------------------------- | tee -ai "${SYSLOG}" 2> /dev/null
echo "$(lzdate)" [$$]: Secondary WAN \( "${iptv_wan1_pppoe_ifname}" \) fault. | tee -ai "${SYSLOG}" 2> /dev/null
local_info="1"
restart_ppp1="1"
}

## 获取IPTV接口ID标识和网关地址
Expand Down Expand Up @@ -5893,7 +5897,7 @@ lz_start_single_net_iptv_box_services() {
local rt_main="$( ip route show )"

local local_info=
local local_ppp_fault="none"
local local_ppp0_fault="none" local_ppp1_fault="none"
[ -n "${iptv_wan0_ifname}" ] && [ -n "${iptv_wan1_ifname}" ] \
&& ! lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan0_ifname}"'" {exit(1)}' \
&& ! lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan1_ifname}"'" {exit(1)}' && {
Expand All @@ -5919,7 +5923,7 @@ lz_start_single_net_iptv_box_services() {
&& ! lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan0_ifname}"'" {exit(1)}' \
&& lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan0_pppoe_ifname}"'" {exit(1)}' \
&& local_info="1" \
&& local_ppp_fault="0" \
&& local_ppp0_fault="0" \
&& echo "$(lzdate)" [$$]: Primary WAN \( "${iptv_wan0_pppoe_ifname}" \) PPPoE fault. | tee -ai "${SYSLOG}" 2> /dev/null
if [ "$( nvram get "wan1_enable" )" = "1" ] && ! nvram get "wans_dualwan" | grep -qw "none"; then
[ -z "${iptv_wan1_ifname}" ] && {
Expand All @@ -5940,14 +5944,15 @@ lz_start_single_net_iptv_box_services() {
&& ! lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan1_ifname}"'" {exit(1)}' \
&& lz_show_routing_table "${rt_main}" | awk '$1 == "default" && $5 == "'"${iptv_wan1_pppoe_ifname}"'" {exit(1)}' \
&& local_info="1" \
&& local_ppp_fault="1" \
&& local_ppp1_fault="1" \
&& echo "$(lzdate)" [$$]: Secondary WAN \( "${iptv_wan1_pppoe_ifname}" \) PPPoE fault. | tee -ai "${SYSLOG}" 2> /dev/null
[ "$( nvram get "wans_mode" )" = "lb" ] \
&& [ "$( nvram get "wan0_enable" )" = "1" ] && [ "$( nvram get "wan1_enable" )" = "1" ] \
&& [ -n "$( nvram get "wan0_proto_t" )" ] && [ -n "$( nvram get "wan1_proto_t" )" ] \
&& local_info="1" \
&& {
[ "${local_ppp_fault}" != "none" ] && restart_pppoe="${local_ppp_fault}"
[ "${local_ppp0_fault}" != "none" ] && restart_ppp0="${local_ppp0_fault}"
[ "${local_ppp1_fault}" != "none" ] && restart_ppp1="${local_ppp1_fault}"
echo "$(lzdate)" [$$]: Dual WAN \( "$( nvram get "wan0_proto" )" -- "$( nvram get "wan1_proto" )" \) startup failed. | tee -ai "${SYSLOG}" 2> /dev/null
}

Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_rule_status.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_rule_status.sh v4.1.1
# lz_rule_status.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 显示脚本运行状态脚本
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_vpn_daemon.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_vpn_daemon.sh v4.1.1
# lz_vpn_daemon.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 虚拟专网客户端路由刷新处理后台守护进程脚本
Expand Down
6 changes: 3 additions & 3 deletions source_codes/lz/interface/lz_rule_service.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lz_rule_service.sh v4.1.1
# lz_rule_service.sh v4.1.2
# By LZ 妙妙呜 ([email protected])

## 服务接口脚本
Expand Down Expand Up @@ -47,11 +47,11 @@ case "${2}" in
printf "\nTotal: %s\n" "${count}" >> "${PATH_LZ}/tmp/routing.log"
;;
LZRtRules)
ip rule show | awk 'BEGIN{system("printf \"%s %s \n\n\" \"$( date +\"%F %T\")\" \"[$$]:\"")} \
ip rule show | awk -v pid="[${$}]:" 'BEGIN{system("printf \"%s %s \n\n\" \"$( date +\"%F %T\")\" "pid)} \
{print $0} END{printf "\nTotal: %s\n", NR}' > "${PATH_LZ}/tmp/rules.log"
;;
LZCrontab)
crontab -l | awk 'BEGIN{system("printf \"%s %s \n\n\" \"$( date +\"%F %T\")\" \"[$$]:\"")} {print $0} END{printf "\nTotal: %s\n", NR}' > "${PATH_LZ}/tmp/crontab.log"
crontab -l | awk -v pid="[${$}]:" 'BEGIN{system("printf \"%s %s \n\n\" \"$( date +\"%F %T\")\" "pid)} {print $0} END{printf "\nTotal: %s\n", NR}' > "${PATH_LZ}/tmp/crontab.log"
;;
LZUpdate)
[ -f "${PATH_LZ}/lz_update_ispip_data.sh" ] && "${PATH_LZ}/lz_update_ispip_data.sh"
Expand Down
Loading

0 comments on commit 83f4ea3

Please sign in to comment.