Merge pull request #1347 from ehazlett/fix-vbox-panic
vbox: fix panic with custom cidr
This commit is contained in:
@@ -27,7 +27,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
isoFilename = "boot2docker.iso"
|
||||
isoFilename = "boot2docker.iso"
|
||||
defaultHostOnlyCIDR = "192.168.99.1/24"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -96,7 +97,7 @@ func GetCreateFlags() []cli.Flag {
|
||||
cli.StringFlag{
|
||||
Name: "virtualbox-hostonly-cidr",
|
||||
Usage: "Specify the Host Only CIDR",
|
||||
Value: "192.168.99.1/24",
|
||||
Value: defaultHostOnlyCIDR,
|
||||
EnvVar: "VIRTUALBOX_HOSTONLY_CIDR",
|
||||
},
|
||||
}
|
||||
@@ -579,7 +580,20 @@ func (d *Driver) generateDiskImage(size int) error {
|
||||
}
|
||||
|
||||
func (d *Driver) setupHostOnlyNetwork(machineName string) error {
|
||||
ip, network, err := net.ParseCIDR(d.HostOnlyCIDR)
|
||||
hostOnlyCIDR := d.HostOnlyCIDR
|
||||
|
||||
// This is to assist in migrating from version 0.2 to 0.3 format
|
||||
// it should be removed in a later release
|
||||
if hostOnlyCIDR == "" {
|
||||
hostOnlyCIDR = defaultHostOnlyCIDR
|
||||
}
|
||||
|
||||
ip, network, err := net.ParseCIDR(hostOnlyCIDR)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nAddr := network.IP.To4()
|
||||
|
||||
dhcpAddr, err := getRandomIPinSubnet(network.IP)
|
||||
|
||||
Reference in New Issue
Block a user