Tobias Brunner [Fri, 15 Aug 2025 16:32:24 +0000 (18:32 +0200)]
testing: Add option to run tests without leak detective
The runtime overhead increased again, so this new option allows to disable
leak detective to reduce the runtime during development. Either only for
the command line (swanctl, pki etc.) or optionally also for the daemon(s).
Disabling leak detective only for the CLI tools already brings a
significant reduction in runtime (75m to 48m on my dev host). And any
leaks in those tools are a lot less of an issue than leaks in the daemon.
So using that during development should be fine as long as a full test
run is done occasionally (in particular before releases). Disabling leak
detective completely further reduces the runtime a lot, to 30m on my dev
host. But that should only be used for functional regression tests after
verifying new code didn't introduce new leaks.
This also fixes the service script which is used for charon-tkm since 16fcdb460afd ("charon-tkm: Don't use starter/stroke with charon-tkm anymore").
Tobias Brunner [Fri, 15 Aug 2025 12:48:49 +0000 (14:48 +0200)]
testing: Increase memory for guest hosts to run Debian trixie
While some increase was necessary anyway because the idle system requires
about 5-10 MiB more memory, the main issue is resolving symbols to
whitelist memory leaks. This requires a lot more memory than before (the
trigger is the bfd_find_nearest_line() call). For instance, the idle
daemon requires less than 20 MiB of memory after the start, but due to
swanctl that's used to load the config, the peak reported by systemd
is 50-60 MiB after the start. Terminating the daemon then has a peak
of over 80 MiB due to the leaks that are whitelisted (most of them are
from dlopen() it seems, however, ignoring these outright doesn't make a
difference).
Note that disabling BFD backtraces won't work as we couldn't whitelist
many functions (and the called addr2line to print the backtraces in this
case requires a lot of memory as well).
I tested switching to ASAN/LSAN. While the peak is only slightly higher,
enabling it increased the runtime overhead a lot (the daemon and swanctl
both required about 10-20 MiB more memory, not just during the
termination).
Tobias Brunner [Fri, 15 Aug 2025 12:45:13 +0000 (14:45 +0200)]
testing: Install required packages in venv of updated strongTNC
Update revision for some dependency updates. While python3-setuptools is
installed on the system, the venv apparently can't use it. legacy-cgi is
required to use that old Django version with newer Python releases.
Tobias Brunner [Fri, 15 Aug 2025 12:40:38 +0000 (14:40 +0200)]
wip: testing: Use different version of TKM on trixie
The API for libgmpada has change with 1.6 in a way that's not
backwards-compatible. So we use a different revision that includes
the required changes depending on the Debian version.
wip: update rev, the xfrm-ada change is currenty necessary because of
another commit in the tkm branch (to implement esa_select())
Tobias Brunner [Wed, 13 Aug 2025 11:54:01 +0000 (13:54 +0200)]
testing: Use new recommended approach to install key for custom apt repository
apt-key add is deprecated (and not available in trixie) as it makes the
available for all sources. The recommended approach makes the key very
specifically available for just our repository.
Tobias Brunner [Wed, 13 Aug 2025 11:38:52 +0000 (13:38 +0200)]
testing: Move sysctl settings to sysctl.d and add some memory settings
Debian trixie doesn't provide a 99-sysctl.conf symlink in that directory
anymore. The memory settings are also useful there as the default of
one changed and overbooking helps when forking a process with large
memory footprint (e.g. the IKE daemon).
Rob Shearman [Mon, 14 Jul 2025 11:14:57 +0000 (12:14 +0100)]
ml: Disable versioning for shared object
Avoid generating versioned shared objects which would need to be
installed along with the version-independent symlink by specifying
"-avoid-version" in the libtool LDFLAGS for the plugin. Avoid any
unwanted surprises by also specifying the "-module" option, making the
LDFLAGS consistent with all other libstrongswan plugins.
whitelist: Add error handling to socket reads and fix a memory leak
This now adds some state (basically a message buffer), but simplifies
error handling as we don't have to handle two potential failure paths
and could avoid some potential issues by still calling the blocking
read_all().
It also fixes a memory leak when clients disconnect.
Rob Shearman [Wed, 1 Jun 2022 18:41:08 +0000 (19:41 +0100)]
whitelist: Use a watcher for control socket reading rather than blocking
Performing a stream read_all call (which is a blocking read) from
within the accept callback has the issue that if a whitelist client is
still connected whilst a shutdown of the charon deamon is triggered
then that shutdown won't complete gracefully due to the accept task
never exiting.
So fix shutting down gracefully by using the socket watcher rather than
a blocking read upon connection accept. Fall back to a blocking read
for partial messages to avoid the complexity associated (i.e. storing
state) for incomplete reads, which shouldn't block and cause the
original problem if the client only sends whole messages.
testing: Use alternative approach for retransmits in ikev1/dpd-restart scenario
With a long delay, the retransmit might not get sent before further tests
are evaluated on faster machines, while more retransmits should still allow
the scenario to succeed on slower ones.
orbea [Tue, 5 Mar 2024 23:46:30 +0000 (15:46 -0800)]
nm: Don't set DL_LIBS to 'none required' in configure script
This copies the AC_SEARCH_LIBS check from the main strongSwan
configure.ac.
When building networkmanager-strongswan with slibtool if fails.
ld: cannot find none: No such file or directory
ld: cannot find required: No such file or directory
This is because configure.ac uses AC_SEARCH_LIBS to find dlopen which
sets the value of $ac_cv_search_dlopen to 'none required' which then
gets set in DL_LIBS and passed to slibtool.
With GNU libtool it silently ignores the unknown arguments.
Tobias Brunner [Mon, 2 Jun 2025 12:58:36 +0000 (14:58 +0200)]
android: Don't mention IKEv1 and L2TP in app description
Also removed on Play so the app does not show up when people search
for these keywords (they tend to not read the actual description and
then are surprised that neither protocol is supported).
Tobias Brunner [Fri, 6 Jun 2025 09:17:38 +0000 (11:17 +0200)]
testing: Make sure ML-KEM scenarios use our ml plugin
We now support OpenSSL's implementation in the openssl plugin. This
makes sure our plugin is used on at least one of the hosts if we ever
switch to an OpenSSL version that supports ML-KEM.
In the ikev2/rw-mlkem scenario the logic is reversed. There the ml plugin
is preferred on moon to test the responder side (and carol for the
initiator) and dave will switch to OpenSSL if it ever provides ML-KEM.
wolfssl: Unlock keys if necessary when using FIPS module
Wrap the functions that require it in PRIVATE_KEY_UNLOCK/PRIVATE_KEY_LOCK.
This can't be done at plugin initialization because it needs to be done
for every thread. strongSwan currently doesn't provide on-thread-create
callbacks for plugins so we need to wrap each direct call. Another reason
to do so is that some functions we call (e.g. wc_EccKeyToDer) internally
call PRIVATE_KEY_UNLOCK/PRIVATE_KEY_LOCK and would leave the keys locked
for that particular thread.
Tobias Brunner [Tue, 18 Feb 2025 13:24:08 +0000 (14:24 +0100)]
test-vectors: Remove HMAC PRF test vectors with key size 4
Some implementations enforce a minimum key size (e.g. wolfSSL in FIPS
mode) and in practice, the keys will be longer anyway (e.g. our nonces
are 32 bytes).
Tobias Brunner [Wed, 28 May 2025 14:48:42 +0000 (16:48 +0200)]
Merge branch 'iptfs'
This adds basic support for IP-TFS/AGGFRAG (RFC 9347). The Linux kernel,
since 6.14, only supports aggregation/fragmentation so far. The actual
TFS features will get added later.
Tests transport mode and UDP encapsulation with random source ports.
Interestingly, the responder always uses the same SA to respond (maybe
due to the cache on the policy).
kernel-netlink: Suppress NAT mapping updates for per-CPU SAs
As we set the remote port to 0, we'd get a mapping change message with
every packet. Setting the threshold avoids all kernel messages after the
first, which we suppress explicitly as well.