core: 在 windows 下找到 ip 时才获取网关

This commit is contained in:
bin456789 2023-11-04 12:42:09 +08:00
parent 1b9069272d
commit 8dfdce23e3
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -808,9 +808,9 @@ collect_netconf() {
# 网关
# shellcheck disable=SC2154
for gateway in "${gateways[@]}"; do
if [[ "$gateway" = *.* ]]; then
if [ -n "$ipv4_addr" ] && [[ "$gateway" = *.* ]]; then
ipv4_gateway="$gateway"
elif [[ "$gateway" = *:* ]]; then
elif [ -n "$ipv6_addr" ] && [[ "$gateway" = *:* ]]; then
ipv6_gateway="$gateway"
fi
done