Skip to contentSkip to conversation

package/strongswan: enable kernel-libipsec

PATCH Applied Wei Dai 2 participants 10 messages Sep 20 – Oct 22

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

PATCH 1/3 package/strongswan: enable kernel-libipsec

The kernel-libipsec plugin for libcharon provides an IPsec backend that runs entirely in userland, using TUN devices and strongSwan's own libipsec implementation.

Unlike the default kernel-netlink and kernel-pfkey backends, which install SAs into the OS IPsec stack, this plugin is a useful alternative when the kernel IPsec stack does not support a required algorithm (e.g. AES-GCM on platforms lacking it). It generally performs worse than the kernel stack, so it is not recommended for high-throughput security gateways.

Enable it with --enable-kernel-libipsec. A network kernel backend (kernel-netlink or kernel-pfroute) is still required.

---
 package/strongswan/strongswan.mk | 1 +
 1 file changed, 1 insertion(+)
package/strongswan/strongswan.mk +1 -0
index 2e20b244ad..0823732d1b 100644
@@ -17,6 +17,7 @@ STRONGSWAN_CONF_OPTS += \
 	--enable-led \
 	--enable-pkcs11=yes \
 	--enable-kernel-netlink=yes \
+	--enable-kernel-libipsec=yes \
 	--enable-socket-default=yes \
 	--enable-botan=$(if $(BR2_PACKAGE_STRONGSWAN_BOTAN),yes,no) \
 	--enable-openssl=$(if $(BR2_PACKAGE_STRONGSWAN_OPENSSL),yes,no) \
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#1 lore raw

PATCH 2/3 package/strongswan: add eap-aka-3gpp support

Add the eap-aka-3gpp plugin, an EAP-AKA backend implementing the 3GPP MILENAGE algorithms in software. Select the EAP-AKA plugin it depends on.

---
 package/strongswan/Config.in     | 5 +++++
 package/strongswan/strongswan.mk | 1 +
 2 files changed, 6 insertions(+)
package/strongswan/Config.in +5 -0
index 6847ca4f62..827634c071 100644
@@ -135,6 +135,11 @@ config BR2_PACKAGE_STRONGSWAN_EAP_AKA
 	bool "Enable EAP-AKA"
 	default y if BR2_PACKAGE_STRONGSWAN_EAP # legacy
 
+config BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP
+	bool "Enable EAP AKA backend plugin implementing 3GPP MILENAGE algorithms"
+	default y if BR2_PACKAGE_STRONGSWAN_EAP # legacy
+	select BR2_PACKAGE_STRONGSWAN_EAP_AKA
+
 config BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP2
 	bool "Enable EAP-AKA 3GPP2 algorithms"
 	default y if BR2_PACKAGE_STRONGSWAN_EAP # legacy
package/strongswan/strongswan.mk +1 -0
index 0823732d1b..78c1ec535d 100644
@@ -43,6 +43,7 @@ STRONGSWAN_CONF_OPTS += \
 	--enable-eap-sim=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_SIM),yes,no) \
 	--enable-eap-sim-file=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_SIM_FILE),yes,no) \
 	--enable-eap-aka=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_AKA),yes,no) \
+	--enable-eap-aka-3gpp=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP),yes,no) \
 	--enable-eap-aka-3gpp2=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP2),yes,no) \
 	--enable-eap-simaka-sql=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_SIMAKA_SQL),yes,no) \
 	--enable-eap-simaka-pseudonym=$(if $(BR2_PACKAGE_STRONGSWAN_EAP_SIMAKA_PSEUDONYM),yes,no) \
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/3] package/strongswan: add eap-aka-3gpp support

HJello,

Quoted 15 lines · Wei Dai

Add the eap-aka-3gpp plugin, an EAP-AKA backend implementing the 3GPP MILENAGE algorithms in software. Select the EAP-AKA plugin it depends on.

---
 package/strongswan/Config.in     | 5 +++++
 package/strongswan/strongswan.mk | 1 +
 2 files changed, 6 insertions(+)
package/strongswan/Config.in +0 -0
index 6847ca4f62..827634c071 100644

package/strongswan/Config.in config BR2_PACKAGE_STRONGSWAN_EAP_AKA · line 140

Quoted 6 lines
package/strongswan/Config.in +3 -0
@@ -135,6 +135,11 @@ config BR2_PACKAGE_STRONGSWAN_EAP_AKA
 	bool "Enable EAP-AKA"
 	default y if BR2_PACKAGE_STRONGSWAN_EAP # legacy
 
+config BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP
+	bool "Enable EAP AKA backend plugin implementing 3GPP MILENAGE algorithms"
+	default y if BR2_PACKAGE_STRONGSWAN_EAP # legacy

Since BR2_PACKAGE_STRONGSWAN_EAP_AKA_3GPP is new, there's no point is bothering with legacy handling, so I've dropped this line, and applied your patch. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#3 lore raw

PATCH 3/3 package/strongswan: add systemd support

In reply to Wei Dai

When systemd is enabled, configure strongswan with --enable-systemd and add the systemd dependency. This builds the charon-systemd IKE daemon, which is designed for native systemd integration (using the systemd libraries) and is managed by systemd through a service file, with configuration handled by the swanctl backend.

Pass --disable-systemd when systemd is not selected to keep the build deterministic.

---
 package/strongswan/strongswan.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/strongswan/strongswan.mk +7 -0
index 78c1ec535d..ab4300cf14 100644
@@ -71,6 +71,13 @@ endif
 # setup piddir if BR2_PACKAGE_STRONGSWAN_PIDDIR is not empty
 STRONGSWAN_CONF_OPTS += $(if $(call qstrip,$(BR2_PACKAGE_STRONGSWAN_PIDDIR)),--with-piddir=$(BR2_PACKAGE_STRONGSWAN_PIDDIR))
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+STRONGSWAN_DEPENDENCIES += systemd
+STRONGSWAN_CONF_OPTS += --enable-systemd
+else
+STRONGSWAN_CONF_OPTS += --disable-systemd
+endif
+
 ifeq ($(BR2_PACKAGE_STRONGSWAN_NONROOT),y)
 STRONGSWAN_CONF_OPTS += \
 	--with-user=charon \
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 3/3] package/strongswan: add systemd support

Quoted 10 lines · Wei Dai

When systemd is enabled, configure strongswan with --enable-systemd and add the systemd dependency. This builds the charon-systemd IKE daemon, which is designed for native systemd integration (using the systemd libraries) and is managed by systemd through a service file, with configuration handled by the swanctl backend.

Pass --disable-systemd when systemd is not selected to keep the build deterministic.

Applied to master, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Wei Dai

Hello,

Quoted 11 lines · Wei Dai

The kernel-libipsec plugin for libcharon provides an IPsec backend that runs entirely in userland, using TUN devices and strongSwan's own libipsec implementation.

Unlike the default kernel-netlink and kernel-pfkey backends, which install SAs into the OS IPsec stack, this plugin is a useful alternative when the kernel IPsec stack does not support a required algorithm (e.g. AES-GCM on platforms lacking it). It generally performs worse than the kernel stack, so it is not recommended for high-throughput security gateways.

Quoted 4 lines

Enable it with --enable-kernel-libipsec. A network kernel backend (kernel-netlink or kernel-pfroute) is still required.

Thanks for your patch. I'm curious to understand why you enable this new feature unconditionally, while in PATCH 2/3 you propose to enable another feature by way of an option. Note that I'm not very familiar with Strongswan/IPsec, so maybe the answer is obvious, but your commit message doesn't really clarify why we would want this enabled unconditionally, even though it was not enabled since package/strongswan was added in Buildroot.

It might also be relevant to comment about the additional footprint added by this option enable unconditionally.

Thanks for your feedback!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hello Wei,

Gentle ping on the question below regarding your patch. Thanks for your feedback!

Thomas

Quoted 41 lines · Thomas Petazzoni via buildroot

Hello,

Quoted 11 lines · Wei Dai

The kernel-libipsec plugin for libcharon provides an IPsec backend that runs entirely in userland, using TUN devices and strongSwan's own libipsec implementation.

Unlike the default kernel-netlink and kernel-pfkey backends, which install SAs into the OS IPsec stack, this plugin is a useful alternative when the kernel IPsec stack does not support a required algorithm (e.g. AES-GCM on platforms lacking it). It generally performs worse than the kernel stack, so it is not recommended for high-throughput security gateways.

Quoted 4 lines

Enable it with --enable-kernel-libipsec. A network kernel backend (kernel-netlink or kernel-pfroute) is still required.

Thanks for your patch. I'm curious to understand why you enable this new feature unconditionally, while in PATCH 2/3 you propose to enable another feature by way of an option. Note that I'm not very familiar with Strongswan/IPsec, so maybe the answer is obvious, but your commit message doesn't really clarify why we would want this enabled unconditionally, even though it was not enabled since package/strongswan was added in Buildroot.

It might also be relevant to comment about the additional footprint added by this option enable unconditionally.

Thanks for your feedback!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#7 lore raw

Sorry for the late reply over the holiday. After checking the official docs, I believe Patch 1 should be reverted and kept out of master for now. StrongSwan explicitly notes:
libipsec is not intended for scenarios with high amounts of traffic or high burst traffic. It is not optimized for performance and buffers each packet in memory. In combination with insufficient processor power this will lead to a out of memory condition and a crash of charon or the whole device.
SA and policy lookups are also not particularly optimized.
I primarily use this plugin to prevent installing SAs into the kernel IPsec stack. In standard XFRM,
sensitive state materials like K and XRES stored in the kernel SPD/SAD can be read in real time (e.g., via ip xfrm),
introducing major security risks for traffic decryption. Still, given official warnings about OOM risks and poor performance,
we should wait for this feature to stabilize before adding it to master.
------------------------------------------------------------------
发件人:Thomas Petazzoni <[email protected]>
发送时间:2026年9月29日(周二) 15:21
收件人:"戴维"<[email protected]>; buildroot<[email protected]>; "Jérôme Pouiller"<[email protected]>
主 题:Re: [Buildroot] [PATCH 1/3] package/strongswan: enable kernel-libipsec
Hello Wei,
Gentle ping on the question below regarding your patch. Thanks for
your feedback!
Thomas

Quoted 41 lines · Thomas Petazzoni via buildroot

Hello,

Quoted 11 lines · Wei Dai

The kernel-libipsec plugin for libcharon provides an IPsec backend that runs entirely in userland, using TUN devices and strongSwan's own libipsec implementation.

Unlike the default kernel-netlink and kernel-pfkey backends, which install SAs into the OS IPsec stack, this plugin is a useful alternative when the kernel IPsec stack does not support a required algorithm (e.g. AES-GCM on platforms lacking it). It generally performs worse than the kernel stack, so it is not recommended for high-throughput security gateways.

Quoted 4 lines

Enable it with --enable-kernel-libipsec. A network kernel backend (kernel-netlink or kernel-pfroute) is still required.

Thanks for your patch. I'm curious to understand why you enable this new feature unconditionally, while in PATCH 2/3 you propose to enable another feature by way of an option. Note that I'm not very familiar with Strongswan/IPsec, so maybe the answer is obvious, but your commit message doesn't really clarify why we would want this enabled unconditionally, even though it was not enabled since package/strongswan was added in Buildroot.

It might also be relevant to comment about the additional footprint added by this option enable unconditionally.

Thanks for your feedback!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com <https://bootlin.com >
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot <https://lists.buildroot.org/mailman/listinfo/buildroot >
Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com <https://bootlin.com >

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw

Hello!

Quoted 11 lines · 戴维

Sorry for the late reply over the holiday. After checking the official docs, I believe Patch 1 should be reverted and kept out of master for now. StrongSwan explicitly notes:

libipsec is not intended for scenarios with high amounts of traffic or high burst traffic. It is not optimized for performance and buffers each packet in memory.
In combination with insufficient processor power this will lead to a out of memory condition and a crash of charon or the whole device.
SA and policy lookups are also not particularly optimized.

Quoted 7 lines

I primarily use this plugin to prevent installing SAs into the kernel IPsec stack. In standard XFRM,
sensitive state materials like K and XRES stored in the kernel SPD/SAD can be read in real time (e.g., via ip xfrm),
introducing major security risks for traffic decryption. Still, given official warnings about OOM risks and poor performance,
we should wait for this feature to stabilize before adding it to master.

Thanks for the feedback. Based on this feedback, I've marked the patch as Rejected in our patch tracking system.

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw
In reply to 戴维

Hello,

Quoted 11 lines · 戴维

Sorry for the late reply over the holiday. After checking the official docs, I believe Patch 1 should be reverted and kept out of master for now. StrongSwan explicitly notes:

libipsec is not intended for scenarios with high amounts of traffic or high burst traffic. It is not optimized for performance and buffers each packet in memory.
In combination with insufficient processor power this will lead to a out of memory condition and a crash of charon or the whole device.
SA and policy lookups are also not particularly optimized.

Quoted 7 lines

I primarily use this plugin to prevent installing SAs into the kernel IPsec stack. In standard XFRM,
sensitive state materials like K and XRES stored in the kernel SPD/SAD can be read in real time (e.g., via ip xfrm),
introducing major security risks for traffic decryption. Still, given official warnings about OOM risks and poor performance,
we should wait for this feature to stabilize before adding it to master.

Thanks for your feedback. I have updated the status of your patch in patchwork accordingly.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot