From: Jonatan Schlag Date: Wed, 19 Jul 2017 08:52:36 +0000 (+0200) Subject: ipv6-static: create hook_parse_cmdline function X-Git-Tag: 009~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=465bd07efd0384ea6cca21275c170949a1cb8ed4;p=network.git ipv6-static: create hook_parse_cmdline function This patch just split the parsing of the cmd line into a separate function to allowing an edit with the generic hook_edit function. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/hooks/configs/ipv6-static b/src/hooks/configs/ipv6-static index f43ef7ec..4c1d7df9 100644 --- a/src/hooks/configs/ipv6-static +++ b/src/hooks/configs/ipv6-static @@ -33,10 +33,7 @@ hook_check_config_settings() { fi } -hook_new() { - local zone=${1} - shift - +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --address=*) @@ -58,6 +55,16 @@ hook_new() { if [ -n "${GATEWAY}" ]; then GATEWAY=$(ipv6_format "${GATEWAY}") fi +} + +hook_new() { + local zone=${1} + shift + + if ! hook_parse_cmdline $@; then + # Return an error if the parsing of the cmd line fails + return ${EXIT_ERROR} + fi zone_config_settings_write "${zone}" "${HOOK}"