mirror of
https://github.com/openwrt/packages.git
synced 2026-12-06 00:05:31 +04:00
strongswan: skip ipsec migration if no ipsec section exists
migrate_ipsec() only returned if ipsec.globals existed. Otherwise it renamed the last ipsec section, even if none was present. Return if ipsec.@ipsec[0] does not exist instead, so the migration only runs when there is a section to rename, and rename the first ipsec section to 'globals'. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
1 parent
66a981f1bf
commit
897e373ea9
1 file changed
+4
-4
@@ -4,12 +4,12 @@
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
migrate_ipsec() {
|
||||
# Skip migration if the 'globals' section already exists
|
||||
uci show ipsec.globals 1>/dev/null 2>/dev/null
|
||||
[ "$?" = "0" ] && return
|
||||
# Skip migration if there is no 'ipsec' section to rename
|
||||
uci show ipsec.@ipsec[0] 1>/dev/null 2>/dev/null
|
||||
[ "$?" = "0" ] || return
|
||||
|
||||
# Rename last ipsec section to 'globals'
|
||||
uci -q rename ipsec.@ipsec[-1]=globals
|
||||
uci -q rename ipsec.@ipsec[0]=globals
|
||||
uci -q set ipsec.globals=globals
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user