diff --git a/controllers/network.go b/controllers/network.go index 9fc6bc6d0..d2ab881d6 100644 --- a/controllers/network.go +++ b/controllers/network.go @@ -442,36 +442,22 @@ func createNetwork(w http.ResponseWriter, r *http.Request) { // validate address ranges: must be private if network.AddressRange != "" { - _, ipNet, err := net.ParseCIDR(network.AddressRange) + _, _, err := net.ParseCIDR(network.AddressRange) if err != nil { logger.Log(0, r.Header.Get("user"), "failed to create network: ", err.Error()) logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest")) return } - if !ipNet.IP.IsPrivate() { - err := errors.New("address range must be private") - logger.Log(0, r.Header.Get("user"), "failed to create network: ", - err.Error()) - logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest")) - return - } } if network.AddressRange6 != "" { - _, ipNet, err := net.ParseCIDR(network.AddressRange6) + _, _, err := net.ParseCIDR(network.AddressRange6) if err != nil { logger.Log(0, r.Header.Get("user"), "failed to create network: ", err.Error()) logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest")) return } - if !ipNet.IP.IsPrivate() { - err := errors.New("address range must be private") - logger.Log(0, r.Header.Get("user"), "failed to create network: ", - err.Error()) - logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest")) - return - } } network, err = logic.CreateNetwork(network)