strongswan: rename rekeytime to rekey_time in child

Rename uci option 'rekeytime' to 'rekey_time' in child via upgrade script to
match the 'swanctl.conf' '<child>.rekey_time' key.

The migration function 'migrate_option' in 'uci-defaults' is designed to
be generic, since 'rekeytime' is not the only option that does not conform
to the swanctl naming scheme and should also be migrated.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert authored and Florian Eckert committed 2026-09-30 11:58:51 +02:00
1 parent d4d0fdc9a1
commit 2d4c8ac5b7
2 files changed
+23 -5

No files matched your search

@@ -330,6 +330,23 @@ migrate_start_action() {
config_foreach migrate_start_action_value child
}
migrate_option_child_values() {
local cfg="$1"
local value
config_get value "$cfg" rekeytime ""
[ -z "$value" ] || {
uci -q rename "ipsec.${cfg}.rekeytime=rekey_time"
}
}
migrate_options() {
config_load ipsec
config_foreach migrate_option_child_values child
uci commit ipsec
}
main() {
migrate_ipsec
migrate_ignore_routing_tables
@@ -343,6 +360,7 @@ main() {
migrate_dpd_action
migrate_close_action
migrate_start_action
migrate_options
}
main
+5 -5
View File
@@ -255,7 +255,7 @@ config_child() {
local dpd_action
local close_action
local if_id
local rekeytime
local rekey_time
local ipcomp
local interface
local hw_offload
@@ -276,7 +276,7 @@ config_child() {
config_get dpd_action "$conf" dpd_action "clear"
config_get close_action "$conf" close_action "none"
config_get if_id "$conf" if_id ""
config_get rekeytime "$conf" rekeytime ""
config_get rekey_time "$conf" rekey_time ""
config_get_bool ipcomp "$conf" ipcomp 0
config_get interface "$conf" interface ""
config_get hw_offload "$conf" hw_offload ""
@@ -357,10 +357,10 @@ config_child() {
if [ -n "$lifetime" ]; then
swanctl_xappend4 "life_time = $lifetime"
elif [ -n "$rekeytime" ]; then
swanctl_xappend4 "life_time = $(seconds2time $(((110 * $(time2seconds $rekeytime)) / 100)))"
elif [ -n "$rekey_time" ]; then
swanctl_xappend4 "life_time = $(seconds2time $(((110 * $(time2seconds $rekey_time)) / 100)))"
fi
[ -n "$rekeytime" ] && swanctl_xappend4 "rekey_time = $rekeytime"
[ -n "$rekey_time" ] && swanctl_xappend4 "rekey_time = $rekey_time"
if [ -n "$lifebytes" ]; then
swanctl_xappend4 "life_bytes = $lifebytes"
elif [ -n "$rekeybytes" ]; then