]> git.ipfire.org Git - people/jschlag/network.git/commitdiff
DHCP: Check if subnet range already exists before creating
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Sep 2016 16:42:41 +0000 (18:42 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Sep 2016 16:42:41 +0000 (18:42 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.dhcpd

index b112eed62e0b5d10eb19e5dfcc12965a94aeda20..5e44cd6a6229be29a6241bdb6a3c2b984d9ad5f4 100644 (file)
@@ -755,6 +755,12 @@ dhcpd_subnet_range_new() {
                return ${EXIT_ERROR}
        fi
 
+       # Check if range already exists
+       if dhcpd_subnet_range_exists ${proto} ${subnet} ${range}; then
+               error "DHCP subnet range ${range} already exists"
+               return ${EXIT_ERROR}
+       fi
+
        # Write the configuration to file.
        local file=$(dhcpd_subnet_range_path ${proto} ${subnet} "${START}-${END}")
        assert isset file