From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonatan Schlag To: network@lists.ipfire.org Subject: [PATCH 3/5] dhcp: check the config indide the hook_parse_cmdline() function Date: Mon, 17 Jul 2017 17:24:24 +0200 Message-ID: <1500305066-12510-3-git-send-email-jonatan.schlag@ipfire.org> In-Reply-To: <1500305066-12510-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4395766145946961206==" List-Id: --===============4395766145946961206== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit We now check the config inside the hook_parse_cmdline function. This mae it possible ti use this function in a generic edit function. Signed-off-by: Jonatan Schlag --- src/hooks/configs/dhcp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/hooks/configs/dhcp b/src/hooks/configs/dhcp index 8bb6aa9..7f6780b 100644 --- a/src/hooks/configs/dhcp +++ b/src/hooks/configs/dhcp @@ -55,6 +55,12 @@ hook_parse_cmdline() { esac shift done + + # Check if the user disabled ipv6 and ipv4 + if ! enabled ENABLE_IPV6 && ! enabled ENABLE_IPV4; then + log ERROR "You disabled IPv6 and IPv4. At least one must be enabled" + return ${EXIT_ERROR} + fi } hook_new() { @@ -71,13 +77,6 @@ hook_new() { return ${EXIT_ERROR} fi - # Check if the user disabled ipv4 and ipv6 - - if ! enabled ENABLE_IPV6 && ! enabled ENABLE_IPV4; then - log ERROR "You disabled IPv6 and IPv4. At least one must be enabled" - return ${EXIT_ERROR} - fi - zone_config_settings_write "${zone}" "${HOOK}" exit ${EXIT_OK} -- 2.6.3 --===============4395766145946961206==--