The hook_parse_cmdline function takes as first argument the id so we need to generate the id inside hook_new
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/hooks/configs/dhcp | 9 +++++++-- src/hooks/configs/ipv4-static | 9 +++++++-- src/hooks/configs/ipv6-auto | 9 +++++++-- src/hooks/configs/ipv6-static | 9 +++++++-- src/hooks/configs/pppoe-server | 9 +++++++-- 5 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/hooks/configs/dhcp b/src/hooks/configs/dhcp index f1c43f3..f2a3e56 100644 --- a/src/hooks/configs/dhcp +++ b/src/hooks/configs/dhcp @@ -76,12 +76,17 @@ hook_new() { return ${EXIT_ERROR} fi
- if ! hook_parse_cmdline $@; then + # Get a new id + local id=$(zone_config_get_new_id ${zone}) + assert isinteger id + log DEBUG "ID for the config is: ${id}" + + if ! hook_parse_cmdline ${id} $@; then # Return an error if the parsing of the cmd line fails return ${EXIT_ERROR} fi
- zone_config_settings_write "${zone}" "${HOOK}" + zone_config_settings_write "${zone}" "${HOOK}" ${id}
exit ${EXIT_OK} } diff --git a/src/hooks/configs/ipv4-static b/src/hooks/configs/ipv4-static index a6b010f..233fb10 100644 --- a/src/hooks/configs/ipv4-static +++ b/src/hooks/configs/ipv4-static @@ -120,12 +120,17 @@ hook_new() {
assert zone_exists "${zone}"
- if ! hook_parse_cmdline $@; then + # Get a new id + local id=$(zone_config_get_new_id ${zone}) + assert isinteger id + log DEBUG "ID for the config is: ${id}" + + if ! hook_parse_cmdline ${id} $@; then # Return an error if the parsing of the cmd line fails return ${EXIT_ERROR} fi
- zone_config_settings_write "${zone}" "${HOOK}" + zone_config_settings_write "${zone}" "${HOOK}" ${id}
exit ${EXIT_OK} } diff --git a/src/hooks/configs/ipv6-auto b/src/hooks/configs/ipv6-auto index e89af28..7c82d45 100644 --- a/src/hooks/configs/ipv6-auto +++ b/src/hooks/configs/ipv6-auto @@ -62,12 +62,17 @@ hook_new() { return ${EXIT_ERROR} fi
- if ! hook_parse_cmdline $@; then + # Get a new id + local id=$(zone_config_get_new_id ${zone}) + assert isinteger id + log DEBUG "ID for the config is: ${id}" + + if ! hook_parse_cmdline ${id} $@; then # Return an error if the parsing of the cmd line fails return ${EXIT_ERROR} fi
- zone_config_settings_write "${zone}" "${HOOK}" + zone_config_settings_write "${zone}" "${HOOK}" ${id}
exit ${EXIT_OK} } diff --git a/src/hooks/configs/ipv6-static b/src/hooks/configs/ipv6-static index bb75240..313adc0 100644 --- a/src/hooks/configs/ipv6-static +++ b/src/hooks/configs/ipv6-static @@ -71,12 +71,17 @@ hook_new() { local zone=${1} shift
- if ! hook_parse_cmdline $@; then + # Get a new id + local id=$(zone_config_get_new_id ${zone}) + assert isinteger id + log DEBUG "ID for the config is: ${id}" + + if ! hook_parse_cmdline ${id} $@; then # Return an error if the parsing of the cmd line fails return ${EXIT_ERROR} fi
- zone_config_settings_write "${zone}" "${HOOK}" + zone_config_settings_write "${zone}" "${HOOK}" ${id}
exit ${EXIT_OK} } diff --git a/src/hooks/configs/pppoe-server b/src/hooks/configs/pppoe-server index 5861e70..64d700b 100644 --- a/src/hooks/configs/pppoe-server +++ b/src/hooks/configs/pppoe-server @@ -110,12 +110,17 @@ hook_new() { return ${EXIT_ERROR} fi
- if ! hook_parse_cmdline $@; then + # Get a new id + local id=$(zone_config_get_new_id ${zone}) + assert isinteger id + log DEBUG "ID for the config is: ${id}" + + if ! hook_parse_cmdline ${id} $@; then # Return an error if the parsing of the cmd line fails return ${EXIT_ERROR} fi
- zone_config_settings_write "${zone}" "${HOOK}" + zone_config_settings_write "${zone}" "${HOOK}" ${id}
exit ${EXIT_OK} }