Forráskód Böngészése

优化修改代码, 不在对DHCP返回的IPV4地址做合法性检查, 返回得到啥就是啥

niujiuru 1 hónapja
szülő
commit
0991ac104a
2 módosított fájl, 2 hozzáadás és 10 törlés
  1. 1 5
      air720u/eth2net.go
  2. 1 5
      netmgrd/eth0net.go

+ 1 - 5
air720u/eth2net.go

@@ -147,11 +147,7 @@ func getEth2Addr() (ip, mask string, err error) {
 			continue
 		}
 
-		if ip4.IsPrivate() { // 判断得到IP地址是否合法
-			return ip4.String(), net.IP(ipNet.Mask).String(), nil
-		} else {
-			return "", "", fmt.Errorf("分配给\"eth2\"的地址\"%s\"无效", ip4.String())
-		}
+		return ip4.String(), net.IP(ipNet.Mask).String(), nil
 	}
 
 	return "", "", fmt.Errorf("在\"eth2\"上未找到有效的IPv4 地址")

+ 1 - 5
netmgrd/eth0net.go

@@ -148,11 +148,7 @@ func getEth0Addr() (ip, mask string, err error) {
 			continue
 		}
 
-		if ip4.IsPrivate() { // 判断得到IP地址是否合法
-			return ip4.String(), net.IP(ipNet.Mask).String(), nil
-		} else {
-			return "", "", fmt.Errorf("分配给\"eth0\"的地址\"%s\"无效", ip4.String())
-		}
+		return ip4.String(), net.IP(ipNet.Mask).String(), nil
 	}
 
 	return "", "", fmt.Errorf("在\"eth0\"上未找到有效的IPv4 地址")