Skip to content

Commit

Permalink
fix HostIP
Browse files Browse the repository at this point in the history
  • Loading branch information
prezha committed Apr 18, 2023
1 parent d009476 commit a0897c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/minikube/cluster/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ func HostIP(host *host.Host, clusterName string) (net.IP, error) {
// user network case
return net.ParseIP("10.0.2.2"), nil
}
// "socket_vmnet" and "vmnet-*" network case
return net.ParseIP(ipString), nil
// "socket_vmnet" and "vmnet-*" network case: host ip should be start address of subnet
vmIP := net.ParseIP(ipString).To4()
if vmIP == nil {
return []byte{}, errors.Wrap(err, "Error converting VM IP address to IPv4 address")
}
return net.IPv4(vmIP[0], vmIP[1], vmIP[2], byte(1)), nil
case driver.HyperV:
v := reflect.ValueOf(host.Driver).Elem()
var hypervVirtualSwitch string
Expand Down

0 comments on commit a0897c7

Please sign in to comment.