+ remove, list static leases

This commit is contained in:
Simon Zolin
2020-04-28 17:47:58 +03:00
parent a5727f8dcb
commit 9fa72cb7c0
3 changed files with 115 additions and 25 deletions

View File

@@ -300,7 +300,28 @@ func (s *Server) handleDHCPRemoveStaticLease(w http.ResponseWriter, r *http.Requ
return
}
ip, _ := parseIPv4(lj.IP)
ip := net.ParseIP(lj.IP)
if ip != nil && ip.To16() != nil {
mac, err := net.ParseMAC(lj.HWAddr)
if err != nil {
httpError(r, w, http.StatusBadRequest, "invalid MAC")
return
}
lease := Lease{
IP: ip,
HWAddr: mac,
}
err = s.v6RemoveStaticLease(lease)
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
return
}
return
}
ip, _ = parseIPv4(lj.IP)
if ip == nil {
httpError(r, w, http.StatusBadRequest, "invalid IP")
return