Просмотр исходного кода

Remove check virtual nic (#3797)

* Allow veth and vlans in NIC verification - See https://forum.hestiacp.com/t/complete-new-reinstall/10109/10
Jaap Marcus 2 лет назад
Родитель
Сommit
bbea1adfa8
2 измененных файлов с 7 добавлено и 14 удалено
  1. 6 8
      bin/v-update-sys-ip
  2. 1 6
      func/main.sh

+ 6 - 8
bin/v-update-sys-ip

@@ -37,15 +37,13 @@ check_hestia_demo_mode
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Listing system IP addresses
 # Listing system IP addresses
-# Detect "physical" NICs only (virtual NICs created by Docker, WireGuard etc. are excluded)
-physical_nics="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" // .linkinfo.info_kind then empty else .ifname end')"
+nics="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" then empty else .ifname end')"
 
 
-# Proxmox return empty value for $physical_nics.
-if [ -z "$physical_nics" ]; then
-	physical_nics="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" then empty else .ifname end')"
-fi
-
-for nic in $physical_nics; do
+for nic in $nics; do
+	nic_type="$(ip -d -j link show "$nic" | jq -r '.[].linkinfo.info_kind')"
+	if [ "$nic_type" = "bridge" ]; then
+		break
+	fi
 	nic_ipv4s="$(ip -4 -d -j addr show "$nic" | jq -r '.[] | select(length > 0) | .addr_info[] | if .scope == "global" then .local else empty end')"
 	nic_ipv4s="$(ip -4 -d -j addr show "$nic" | jq -r '.[] | select(length > 0) | .addr_info[] | if .scope == "global" then .local else empty end')"
 	if [ -z "$ips" ]; then
 	if [ -z "$ips" ]; then
 		ips="$nic_ipv4s"
 		ips="$nic_ipv4s"

+ 1 - 6
func/main.sh

@@ -1025,12 +1025,7 @@ is_int_format_valid() {
 
 
 # Interface validator
 # Interface validator
 is_interface_format_valid() {
 is_interface_format_valid() {
-	# Detect "physical" NICs only (virtual NICs created by Docker, WireGuard etc. are excluded)
-	nic_names="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" // .linkinfo.info_kind then empty else .ifname, if .altnames then .altnames[] else empty end end')"
-	# Proxmox return empty value for $physical_nics
-	if [ -z "$nic_names" ]; then
-		nic_names="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" then empty else .ifname, if .altnames then .altnames[] else empty end end')"
-	fi
+	nic_names="$(ip -d -j link show | jq -r '.[] | if .link_type == "loopback" then empty else .ifname, if .altnames then .altnames[] else empty end end')"
 	if [ -z "$(echo "$nic_names" | grep -x "$1")" ]; then
 	if [ -z "$(echo "$nic_names" | grep -x "$1")" ]; then
 		check_result "$E_INVALID" "invalid interface format :: $1"
 		check_result "$E_INVALID" "invalid interface format :: $1"
 	fi
 	fi