From e85a25a0e0ec98f3aa34ad2d042ed4d0581e8bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BA=8C?= <66155308+miaoermua@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:09:22 +0800 Subject: [PATCH] fix: bypass_gateway BUG --- cattools.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cattools.sh b/cattools.sh index 0fad245..c219239 100644 --- a/cattools.sh +++ b/cattools.sh @@ -287,20 +287,12 @@ network_wizard() { # BypassGateway bypass_gateway() { - ip="$1" - if echo "$ip" | grep -Eq '^(10|172\.(1[6-9]|2[0-9]|3[01])|192\.168)\.'; then - return 0 - else - return 1 - fi - } - # 输入主路由的 IP 地址 while true; do read -p "请输入主路由的 IP 地址(例如 192.168.31.1):" router_ip if [ -z "$router_ip" ]; then echo "主路由 IP 地址不能为空,请重新输入。" - elif ! is_private_ip "$router_ip"; then + elif ! echo "$router_ip" | grep -Eq '^(10|172\.(1[6-9]|2[0-9]|3[01])|192\.168)\.'; then echo "输入的 IP 地址无效,请输入有效的 IP 地址" else break @@ -316,7 +308,7 @@ bypass_gateway() { if [ -z "$device_ip" ]; then device_ip="$default_device_ip" break - elif ! is_private_ip "$device_ip"; then + elif ! echo "$device_ip" | grep -Eq '^(10|172\.(1[6-9]|2[0-9]|3[01])|192\.168)\.'; then echo "输入的 IP 地址无效,请输入有效的 IP 地址。" else break