diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 4af80e92f1..34823521b8 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -1752,19 +1752,21 @@ func validateDockerStorageDriver(drvName string) { viper.Set(preload, false) } +// validateSubnet checks that the subnet provided has a private IP +// and does not have a mask of more that /30 func validateSubnet(subnet string) error { ip, cidr, err := netutil.ParseAddr(subnet) if err != nil { return err } if !ip.IsPrivate() { - return errors.Errorf("Sorry, %s is not a private IP", ip) + return errors.Errorf("Sorry, the subnet %s is not a private IP", ip) } if cidr != nil { mask, _ := cidr.Mask.Size() if mask > 30 { - return errors.Errorf("Sorry, mask must be less than /30") + return errors.Errorf("Sorry, the subnet provided does not have a mask less than or equal to /30") } } return nil diff --git a/cmd/minikube/cmd/start_test.go b/cmd/minikube/cmd/start_test.go index 728b017125..ef4a1f854a 100644 --- a/cmd/minikube/cmd/start_test.go +++ b/cmd/minikube/cmd/start_test.go @@ -641,7 +641,7 @@ func TestValidateSubnet(t *testing.T) { }, { subnet: "193.169.1.1", - errorMsg: "Sorry, 193.169.1.1 is not a private IP", + errorMsg: "Sorry, the subnet 193.169.1.1 is not a private IP", }, { subnet: "192.168.1.1/24", @@ -649,7 +649,7 @@ func TestValidateSubnet(t *testing.T) { }, { subnet: "192.168.1.1/32", - errorMsg: "Sorry, mask must be less than /30", + errorMsg: "Sorry, the subnet provided does not have a mask less than or equal to /30", }, } for _, test := range tests {