]> git.99rst.org Git - openwrt-packages.git/commitdiff
strongswan: add one default named ipsec uci section 'globals'
authorFlorian Eckert <redacted>
Thu, 2 Jul 2026 06:28:58 +0000 (08:28 +0200)
committerFlorian Eckert <redacted>
Thu, 9 Jul 2026 08:51:13 +0000 (10:51 +0200)
The UCI section 'ipsec' should only be available once, as these are
general settings for 'strongswan.conf'. It makes no sense to configure them
more than once. To ensure that the general settings can also be configured
via LuCI, this section must be present at least once.

For configurations already in the field, a uci-default script is added
that assigns the name 'globals' to the last ipsec section type.

Signed-off-by: Florian Eckert <redacted>
net/strongswan/Makefile
net/strongswan/files/etc/uci-defaults/strongswan [new file with mode: 0644]
net/strongswan/files/ipsec.config

index ee5d013a90cc4134f1b765df8a9485c972fbd7ad..d9095506fe12085f3376220aa5d6b055b0f84abf 100644 (file)
@@ -566,6 +566,11 @@ define Package/strongswan-swanctl/install
        $(INSTALL_BIN) ./files/swanctl.init $(1)/etc/init.d/swanctl
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_CONF) ./files/ipsec.config $(1)/etc/config/ipsec
+
+       # Install migration from 'ipsec@ipsec[-1]' to 'ipsec.globals'
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_DATA) ./files/etc/uci-defaults/strongswan \
+               $(1)/etc/uci-defaults/strongswan
 endef
 
 define Package/strongswan-gencerts/install
diff --git a/net/strongswan/files/etc/uci-defaults/strongswan b/net/strongswan/files/etc/uci-defaults/strongswan
new file mode 100644 (file)
index 0000000..b11bd69
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+main() {
+       # Skip migration if the 'globals' section already exists
+       uci show ipsec.globals 1>/dev/null 2>/dev/null
+       [ "$?" = "0" ] && return
+
+       # Rename last ipsec section to 'globals'
+       uci -q rename ipsec.@ipsec[-1]=globals
+       uci -q commit ipsec
+}
+
+main
+
+exit 0
index 4e976063f80d08297388f86f56343f5caff90ef3..f4d1baa4066918051898a2ba6f307bb2e92ba95e 100644 (file)
@@ -1,2 +1,7 @@
 # For strongSwan ipsec config documentation see
 # https://openwrt.org/docs/guide-user/services/vpn/strongswan/start
+
+# This is the 'globals' config section for the 'strongswan.conf' file.
+# For LuCI the section type ipsec should only appear once. It must therefore
+# always be present and should not be added or removed manually.
+config ipsec 'globals'
git clone https://git.99rst.org/PROJECT