Merge: * dhcp: validate range_start/range_end values

Close #848

* commit '625b22a8d7bece655216b926f1b4ce35e14ccb07':
  * dhcp: validate range_start/range_end values
This commit is contained in:
Simon Zolin 2019-08-23 17:18:30 +03:00
commit c7b5b00d14
1 changed files with 3 additions and 0 deletions

View File

@ -129,6 +129,9 @@ func (s *Server) setConfig(config ServerConfig) error {
if err != nil { if err != nil {
return wrapErrPrint(err, "Failed to parse range end address %s", config.RangeEnd) return wrapErrPrint(err, "Failed to parse range end address %s", config.RangeEnd)
} }
if dhcp4.IPRange(s.leaseStart, s.leaseStop) <= 0 {
return wrapErrPrint(err, "DHCP: Incorrect range_start/range_end values")
}
subnet, err := parseIPv4(config.SubnetMask) subnet, err := parseIPv4(config.SubnetMask)
if err != nil || !isValidSubnetMask(subnet) { if err != nil || !isValidSubnetMask(subnet) {