14.04.2026 Update
This commit is contained in:
@@ -2,11 +2,12 @@ package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"alpine-router/config"
|
||||
"alpine-router/dhcp"
|
||||
"alpine-router/network"
|
||||
"nano-router/config"
|
||||
"nano-router/dhcp"
|
||||
"nano-router/network"
|
||||
)
|
||||
|
||||
func HandleDHCPStatus(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -90,6 +91,14 @@ func HandleDHCPConfigSave(w http.ResponseWriter, r *http.Request) {
|
||||
if cfg.Pools == nil {
|
||||
cfg.Pools = []dhcp.Pool{}
|
||||
}
|
||||
for _, pool := range cfg.Pools {
|
||||
if pool.Subnet != "" && pool.Netmask != "" {
|
||||
if msg, overlaps := checkDHCPPoolOverlap(pool.Subnet, pool.Netmask, pool.Interface); overlaps {
|
||||
fail(w, http.StatusConflict, fmt.Sprintf("Пул интерфейса %s: %s", pool.Interface, msg))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := dhcp.Save(&cfg); err != nil {
|
||||
fail(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user