From 089e7410edd98d232381cdbcde58b89fff797eb0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 8 Sep 2016 18:42:41 +0200 Subject: [PATCH] DHCP: Check if subnet range already exists before creating Signed-off-by: Michael Tremer --- src/functions/functions.dhcpd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/functions/functions.dhcpd b/src/functions/functions.dhcpd index b112eed6..5e44cd6a 100644 --- a/src/functions/functions.dhcpd +++ b/src/functions/functions.dhcpd @@ -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 -- 2.47.3