f-81: api: default_route sans gateway réservé au mode bridge #81

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-25 11:53:33 +01:00
commit dd9844284d
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
3 changed files with 49 additions and 3 deletions

View file

@ -78,6 +78,11 @@ func (s *Server) postSubnet(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(ErrorResponse{Error: "interface_ip is computed for vxlan subnets, do not set it"})
return
}
if req.DefaultRoute && req.Gateway == "" && req.Mode != subnet.ModeBridge {
w.WriteHeader(http.StatusBadRequest)
json.NewEncoder(w).Encode(ErrorResponse{Error: "default_route without gateway is only allowed for bridge subnets: the host gateway is not on the subnet"})
return
}
cmd := dispatcher.CreateSubnetCommand{
Name: req.Name,
VPC: req.VPC,