Handle bad netmask returned by virtualbox after hostonlyif creation. Fixes #1843

Signed-off-by: Ron Williams <ron.a.williams@gmail.com>
This commit is contained in:
Ron Williams 2015-09-19 00:04:52 -07:00
parent 0540e5e295
commit 0b5f4c8454
1 changed files with 4 additions and 1 deletions

View File

@ -127,8 +127,11 @@ func getHostOnlyNetwork(hostIP net.IP, netmask net.IPMask) (*hostOnlyNetwork, er
return nil, err
}
for _, n := range nets {
//handle known issue where vbox throws us a bad netmask
//if the value returned is "0f000000" it's the newly
//created adpater and should be the right one
if hostIP.Equal(n.IPv4.IP) &&
netmask.String() == n.IPv4.Mask.String() {
(netmask.String() == n.IPv4.Mask.String() || n.IPv4.Mask.String() == "0f000000") {
return n, nil
}
}