]> git.ipfire.org Git - people/stevee/network.git/commitdiff
dhcp: check the config indide the hook_parse_cmdline() function
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Mon, 17 Jul 2017 15:24:24 +0000 (17:24 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Jul 2017 20:16:38 +0000 (16:16 -0400)
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 <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/configs/dhcp

index 8bb6aa9c028b4022c5895ca9b5d8ed384adbfce7..7f6780b5d34fc0b4b85e8e51b860c73db70d90a8 100644 (file)
@@ -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}