Compare commits

...

249 Commits

Author SHA1 Message Date
Tobias Brunner
2560146204 github: Use provided actions for SonarQube installation and scan
Also switch to the cloud cache (which doesn't seem to work either way
anyway).
2025-08-05 10:27:32 +02:00
Tobias Brunner
ff06159099 certexpire: Double size of internal buffer for identities
The error-notify, lookip, and whitelist (previous commit) plugins already
use the same buffer size for identities.
2025-07-23 18:50:53 +02:00
seantywork
ae2e0b6cf2 whitelist: Double the length of the id field in the messages
Closes strongswan/strongswan#2842
2025-07-23 18:50:33 +02:00
Tobias Brunner
6c813ddc13 Use wolfSSL 5.8.2 for tests 2025-07-19 12:11:29 +02:00
Tobias Brunner
011c346b00 wolfssl: Store RNG on object for curve25519
5.8.2 enables blinding for curve25519 by default, so the RNG set when
making the key is also used later on.
2025-07-19 12:10:25 +02:00
Rob Shearman
1b62e88980 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.

Closes strongswan/strongswan#2844
2025-07-18 16:30:50 +02:00
Tobias Brunner
58c567da74 Merge branch 'whitelist-watcher'
Use watcher and non-blocking I/O for client connections to avoid issues
with clients that stay connected for a long time.

Closes strongswan/strongswan#2827
2025-07-18 16:16:17 +02:00
Tobias Brunner
85ebf6abd4 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.
2025-07-18 12:07:45 +02:00
Rob Shearman
412231eecd 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.
2025-07-15 14:50:56 +02:00
Tobias Brunner
e98ea89d99 nm: Version bump to 1.6.3 2025-07-14 11:01:14 +02:00
Andreas Steffen
23eb1e0945 Version bump to 6.0.2 2025-07-13 09:56:49 +02:00
Tobias Brunner
4c54550352 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.
2025-07-11 14:15:40 +02:00
Tobias Brunner
bab415ec0a child-cfg: Actually force narrowing TS in transport mode only as initiator
Closes strongswan/strongswan#2830

Fixes: ad1ad2159f0b ("child-cfg: Use traffic selector list")
2025-07-11 14:15:06 +02:00
Tobias Brunner
43b805b2da openssl: Don't allocate salt if PRF/hash is unknown
This can happen if e.g. AES-XCBC is selected.

Fixes: 2dbeecfc029b ("openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1")
2025-07-11 11:47:51 +02:00
Tobias Brunner
2c32412594 github: Shorten name for crypto-plugin job and reverse matrix arguments
This gives us more readable names in the UI.  Instead of

  crypto-plugins (ubuntu-latest, b...
  crypto-plugins (ubuntu-latest, b...
  crypto-plugins (ubuntu-latest, ...
  crypto-plugins (ubuntu-latest, ...
  crypto-plugins (ubuntu-latest, o...
  crypto-plugins (ubuntu-latest, o...

we now get

  crypto (botan, ubuntu-latest, no)
  crypto (botan, ubuntu-latest, yes)
  crypto (wolfssl, ubuntu-latest, no)
  crypto (wolfssl, ubuntu-latest, yes)
  crypto (openssl, ubuntu-latest, no)
  crypto (openssl, ubuntu-latest, yes)
2025-07-10 19:23:02 +02:00
Tobias Brunner
2dbeecfc02 openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1
Setting the salt to NULL now fails, so we set it to hash length's zeroes,
which is the default value for HKDF-Extract if no salt is passed.

Fixes strongswan/strongswan#2828
2025-07-10 19:22:22 +02:00
Tobias Brunner
a8c2d125f1 Doxyfile: Don't hide set_seed() method 2025-07-08 13:13:06 +02:00
Tobias Brunner
f88d824114 Fixed some typos, courtesy of codespell 2025-07-08 10:54:49 +02:00
Andreas Steffen
bd65a21ce0 Version bump to 6.0.2rc1 2025-07-07 18:25:37 +02:00
Tobias Brunner
85c6473a5e NEWS: Add news for 6.0.2 2025-07-07 18:04:34 +02:00
Tobias Brunner
36f7c98f4e github: Use AWS-LC 1.55.0 for tests 2025-07-07 18:04:19 +02:00
Tobias Brunner
b46960d80c github: Use OpenSSL 3.5.1 for tests 2025-07-07 18:04:19 +02:00
Thomas Egerer
a339468c93 vici: Allow backlog size configuration via compile option
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-07-07 14:20:13 +02:00
Tobias Brunner
9eb5fcd6b6 github: Make sure at least one run with the same content is not skipped 2025-07-07 11:55:01 +02:00
Andreas Steffen
1f42640c43 Version bump to 6.0.2dr3 2025-07-03 11:43:53 +02:00
orbea
979c57fc30 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.

Gentoo issue: https://bugs.gentoo.org/914100

Closes strongswan/strongswan#2141

Signed-off-by: orbea <orbea@riseup.net>
2025-07-01 07:45:12 +02:00
Tobias Brunner
a666944e65 Merge branch 'android-http-proxy'
Adds support for HTTP proxy server.

Closes strongswan/strongswan#2789
2025-06-27 09:13:38 +02:00
Tobias Brunner
bd4cee82ac android: New release after adding HTTP proxy configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
dbcba117ae android: Apply proxy server setting when creating TUN device
This is only available with Android 10+ (SDK 29+).
2025-06-27 08:57:45 +02:00
Tobias Brunner
b944159fcf android: Avoid proxy settings in the internal fetcher 2025-06-27 08:57:45 +02:00
Tobias Brunner
c7307ccc52 android: Allow setting proxy settings in managed profiles 2025-06-27 08:57:45 +02:00
Tobias Brunner
0f2cd032e1 android: Import proxy server settings 2025-06-27 08:57:45 +02:00
Tobias Brunner
c80819c0ad android: Make proxy server configurable 2025-06-27 08:57:45 +02:00
Tobias Brunner
a7cb2fcbf6 android: Add properties to VPN profiles for proxy server configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
059c70e556 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).
2025-06-27 08:57:45 +02:00
Tobias Brunner
4143e47462 android: Update dependencies 2025-06-27 08:57:38 +02:00
Tobias Brunner
a153626af7 identification: Clarify that ID_USER_FQDN is just an alias for ID_RFC822_ADDR
This means userfqdn: is a valid prefix for regular expressions.
2025-06-20 10:37:40 +02:00
Tobias Brunner
e58ef258b5 swanctl: Document that IP-TFS mode is subject to mode negotiation 2025-06-20 10:37:35 +02:00
Tobias Brunner
9a6aa2530e 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.
2025-06-20 10:37:24 +02:00
Andreas Steffen
faf7ad2331 Version bump to 6.0.2dr2 2025-06-05 13:43:21 +02:00
Andreas Steffen
f9985d72e4 testing: soup plugin removed from test environment 2025-06-05 13:42:41 +02:00
Andreas Steffen
2fa8f4a90f Version bump to 6.0.2dr1 2025-06-04 19:58:23 +02:00
Tobias Brunner
b39311e19e Merge branch 'libsoup3'
Ports the soup plugin to libsoup 3.

Closes strongswan/strongswan#2788
2025-06-04 19:09:33 +02:00
Tobias Brunner
b8108a4c3c github: Use libsoup 3 for tests
Requires installing libxml2-dev explicitly for the alpine build as
libsoup-dev had a dependency on it.
2025-06-04 19:08:57 +02:00
Tobias Brunner
9dbb15dea9 leak-detective: Remove whitelisted libsoup2.x functions
As mentioned in 0f141fb095a41a9fdfe5c111269eb643dc643494, we can't
really whitelist the "leaks" in GLib, so don't even try to do anything
with libsoup3.x.
2025-06-04 19:08:57 +02:00
Mike Gorse
6ddabf52d5 soup: Port to libsoup 3 2025-06-04 19:08:07 +02:00
Tobias Brunner
e864b8a8b1 fetcher: Remove unused FETCH_HTTP_VERSION_1_0 option
Was only used by the removed scepclient and does not serve any purpose
nowadays anyway.
2025-06-04 19:07:22 +02:00
Tobias Brunner
82adb5ce0f unit-tests: Serial number tests depend on X.509 certificate parsing
Requires additional plugin features, but if this is available, the
others are usually as well.
2025-06-04 19:07:22 +02:00
Tobias Brunner
71f1091129 wolfssl: Fix build if wolfSSL was built in OpenSSL-compat mode 2025-06-04 19:07:13 +02:00
Tobias Brunner
3d426cbfee Merge branch 'wolfssl-fips'
Fixes various issues when building the wolfssl plugin against wolfSSL's
FIPS module.

References strongswan/strongswan#2603
Closes strongswan/strongswan#2771
2025-06-02 11:31:03 +02:00
Juliusz Sosinowicz
f38bb91654 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.
2025-06-02 09:15:05 +02:00
Juliusz Sosinowicz
85eb5c7812 wolfssl: Properly initialize ECC private key object 2025-06-02 09:15:05 +02:00
Tobias Brunner
879e3ce05a wolfssl: Set a dummy key when testing KDF implementations
In FIPS mode, wolfSSL enforces a minimum key size for these algorithms.
2025-06-02 09:15:05 +02:00
Tobias Brunner
757e00c0ae 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).
2025-06-02 09:15:05 +02:00
Tobias Brunner
d0292a6f50 wolfssl: Include settings.h in case WOLFSSL_USER_SETTINGS is defined 2025-06-02 09:15:05 +02:00
Tobias Brunner
217049606b wolfssl: Use consistent defines for ECC public/private key loading
HAVE_ECC_KEY_IMPORT can be defined while HAVE_ECC_SIGN is not.
So just use the same defines we use when defining the load functions.
2025-06-02 09:15:04 +02:00
Tobias Brunner
7bfd81d78a wolfssl: Call wc_SetSeed_Cb() as required for FIPS-mode 2025-06-02 09:15:04 +02:00
Tobias Brunner
3a5f203958 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.
2025-05-28 16:48:42 +02:00
Tobias Brunner
dc4fef146a testing: Add ikev2/net2net-iptfs scenario 2025-05-28 16:37:47 +02:00
Tobias Brunner
b4a0eb3603 testing: Add config for Linux 6.14
This has IP-TFS enabled.
2025-05-28 16:37:46 +02:00
Tobias Brunner
a7a3c4a22a conf: Document global IP-TFS settings 2025-05-28 16:37:46 +02:00
Tobias Brunner
46525cdc4f child-create: Negotiate IP-TFS mode if configured 2025-05-28 16:37:46 +02:00
Tobias Brunner
f5f7424e1d notify-payload: Add notify type for IP-TFS/AGGFRAG 2025-05-28 16:37:46 +02:00
Tobias Brunner
6372b2890f kernel-netlink: Support IPTFS mode and attributes 2025-05-28 16:37:46 +02:00
Tobias Brunner
f32773b3a8 child-sa: Allow disabling fragmenting packets across AGGFRAG payloads
This is necessary if the peer isn't able to handle such fragments.
2025-05-28 16:37:46 +02:00
Tobias Brunner
33db7a200f kernel-ipsec: Add flag to disable sending fragments across AGGFRAG payloads
We have to set this if the peer indicates that it doesn't support
handling such fragments in the notify.
2025-05-28 16:37:46 +02:00
Tobias Brunner
1afc76dd56 vici: Make IP-TFS mode configurable 2025-05-28 16:37:46 +02:00
Tobias Brunner
e175abaf89 include: Add XFRM mode and attributes for IP-TFS 2025-05-28 16:37:46 +02:00
Tobias Brunner
419528f2ac ipsec-types: Add new mode for IP-TFS
Added at the end as the numeric mode is e.g. used in SQL databases.
2025-05-28 16:37:27 +02:00
Tobias Brunner
72e3b7dcc8 Merge branch 'per-cpu-sas'
This adds support for per-CPU SAs (RFC 9611).
2025-05-28 16:36:10 +02:00
Tobias Brunner
b7d3349000 testing: Add ikev2/per-cpu-sas-encap-transport scenario
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).
2025-05-28 16:35:27 +02:00
Tobias Brunner
3b2f8cf282 testing: Add ikev2/per-cpu-sas-encap scenario
Basically the same as the one without UDP encapsulation, but here the
outbound SAs use random source ports.
2025-05-28 16:35:27 +02:00
Tobias Brunner
d83fbe82e4 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.
2025-05-28 16:35:27 +02:00
Tobias Brunner
14e1ec2b77 child-sa: Configure UDP encapsulation for per-CPU SAs
As the kernel does not support processing UDP-encapsulated and plain ESP
for the same SA, we require forcing UDP encapsulation if there is no NAT.
2025-05-28 16:35:27 +02:00
Tobias Brunner
73083503f2 vici: Make UDP encapsulation for per-CPU SAs configurable 2025-05-28 16:35:27 +02:00
Tobias Brunner
d594171d9e child-cfg: Add flag to enable UDP encapsulation for per-CPU SAs 2025-05-28 16:35:27 +02:00
Tobias Brunner
bf34484d24 testing: Add per-CPU SA test scenario 2025-05-28 16:35:27 +02:00
Tobias Brunner
e24edb2991 testing: Configure multiple virtual CPUs for moon and sun
This allows testing per-CPU SAs by e.g. pinging over a specific CPU
via taskset.
2025-05-28 16:35:27 +02:00
Tobias Brunner
0edaadfc94 testing: Enable SMP support for latest kernels 2025-05-28 16:35:27 +02:00
Tobias Brunner
f95bdb6fb0 swanctl: Report per-CPU information in --list-sas 2025-05-28 16:35:27 +02:00
Tobias Brunner
c176d32a73 vici: Report per-CPU SA information 2025-05-28 16:35:27 +02:00
Tobias Brunner
fbfae44dd1 vici: Make per-CPU CHILD_SAs configurable 2025-05-28 16:35:27 +02:00
Tobias Brunner
a950ca3ec2 kernel-netlink: Forward CPU ID from acquires 2025-05-28 16:35:27 +02:00
Tobias Brunner
4a595508b7 trap-manager: Add support to handle acquires for per-CPU SAs 2025-05-28 16:35:27 +02:00
Tobias Brunner
65b7f9d563 kernel-handler: Log CPU ID that's passed with an acquire 2025-05-28 16:35:27 +02:00
Tobias Brunner
d6eed3979b kernel-interface: Optionally pass CPU ID for which an acquire was triggered 2025-05-28 16:35:27 +02:00
Tobias Brunner
2082fa5dd2 ike-sa: Accept optional CPU ID when initiating CHILD_SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
8e7f379f71 ike-sa: Sort CHILD_SAs by CPU ID
This might make debugging easier and also ensures that a possible
fallback SA without CPU ID is established first when reestablishing
an IKE_SA.  Because even if such an SA is established first initially,
that might change later depending on when per-CPU SAs are rekeyed.
2025-05-28 16:35:26 +02:00
Tobias Brunner
af34b5b1dc child-rekey: Maintain per-CPU values during rekeying 2025-05-28 16:35:26 +02:00
Tobias Brunner
bdf882d3af child-create: Add support to negotiate per-CPU SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
3a8bb93761 updown: Don't call the script for per-CPU SAs
Rules are installed for the fallback SA that has no CPU ID assigned.
2025-05-28 16:35:26 +02:00
Tobias Brunner
297be45275 ha: Ignore per-CPU CHILD_SAs
These only work on initiators (with trap policies), which is something
the plugin doesn't support.
2025-05-28 16:35:26 +02:00
Tobias Brunner
17f2188756 forecast: Ignore per-CPU CHILD_SAs
Not sure if this combination does make sense as the plugin itself would
be a major bottleneck.

Similar to the connmark plugin, PREROUTING rules list SPIs or UDP ports,
which would be necessary for all SAs while the OUTPUT rules would only be
required once.
2025-05-28 16:35:26 +02:00
Tobias Brunner
5faf884285 connmark: Ignore per-CPU CHILD_SAs
The combination probably doesn't make much sense.

The OUTPUT rules would definitely only be required once, while the INPUT
and PREROUTING rules list individual SPIs and/or UDP ports, which would
be necessary for all SAs.

By the way, the rules in PREROUTING might actually not be necessary
anymore if the set_mark_in option was used for such SAs.
2025-05-28 16:35:26 +02:00
Tobias Brunner
a505f4b9b0 child-sa: Add support for per-CPU SAs
The CPU ID is also set on inbound SAs as it can be used to configure RSS
or some eBPF program.
2025-05-28 16:35:26 +02:00
Tobias Brunner
bdfcfea1f2 kernel-netlink: Add support to enable per-CPU acquires on policies 2025-05-28 16:35:26 +02:00
Tobias Brunner
53be94d06c kernel-netlink: Add support to set CPU ID on SA 2025-05-28 16:35:26 +02:00
Tobias Brunner
12395cedf3 ipsec-types: Add identifier for the maximum (=no) CPU ID 2025-05-28 16:35:26 +02:00
Tobias Brunner
aa1322aed5 include: Add XFRM identifiers for per-CPU SAs/acquires 2025-05-28 16:35:26 +02:00
Tobias Brunner
d4575da53c child-cfg: Add flag to enable per-CPU SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
749814a75f notify-payload: Add notify types for per-resource CHILD_SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
8f6e3c164a testing: Include the kernel build number 2025-05-28 16:35:26 +02:00
Tobias Brunner
b6a4cfc705 Merge branch 'acquires-seq'
This uses the sequence number from acquires when installing the SA. This
allows handling narrowing properly by changing the reqid and still
removing the temporary state in the kernel.  It also changes that
traffic selectors are reused during rekeying/recreation/reauthentication,
so narrowed selectors won't return to the wider configured TS because
there won't be any TS from triggering packets to narrow again.
2025-05-28 16:30:56 +02:00
Tobias Brunner
8cb5918b0c testing: Add ikev2/net2net-route-narrow scenario 2025-05-28 16:01:00 +02:00
Tobias Brunner
6c7c539eaf child-create: Consider previous TS when checking for duplicates 2025-05-28 16:01:00 +02:00
Tobias Brunner
58d6778adb child-sa: Add helper to check if a list of TS match negotiated TS 2025-05-28 16:01:00 +02:00
Tobias Brunner
e7fc7a4ecc child-create: Maintain traffic selectors during rekeying/reauthentication
If we don't do this, narrowed SAs would default to the wide configured
traffic selectors and the peer won't know if/how to narrow.
2025-05-28 16:01:00 +02:00
Tobias Brunner
9205458355 child-create: Use more generic method to pass information from previous SA
Besides the previous key exchange method, this will allow us to also
reuse the previous traffic selectors.  Some data is still passed in
separate methods as some are set even when there is no previous SA and
others are not set in all cases.

The interface for queue_child() now optionally takes the previous
Child SA to handle both recreations and initiations from scratch.
2025-05-28 11:06:19 +02:00
Tobias Brunner
ad1ad2159f child-cfg: Use traffic selector list 2025-05-28 11:06:19 +02:00
Tobias Brunner
4b468126ca traffic-selector-list: Add helper class to manage a collection of TS
Provides functions to optionally resolve dynamic TS and to narrow
them based on a list of supplied TS.
2025-05-28 11:06:19 +02:00
Tobias Brunner
79815b4e67 trap-manager: Set seq. no. for CHILD_SAs not initiated by an acquire
This fixes cases where `start_action = trap|start` is used and an acquire
is triggered while the SA is initiated (granted if narrowing is expected,
that's not a recommended configuration as the responder can only use
the first config when there is no packet TS).  The resulting second
create-child task will potentially get dropped by the duplicate check,
so the temporary state won't get removed and traffic is blocked until
that expires, neither can acquires get triggered for traffic that doesn't
match the initial SA's policies.
2025-05-28 10:11:53 +02:00
Tobias Brunner
ac0c73a412 child-create: Trigger CHILD_INSTALLING event after setting traffic selectors
This was the case before bce0c5fd74a0 ("child-create: Update CHILD_SA IP
addresses before installation") and allows listeners to consider the
traffic selectors of the SA that's about to get installed.
2025-05-28 10:11:53 +02:00
Tobias Brunner
5bb6f636ad child-create: Use helper to compare packet TS against CHILD_SAs 2025-05-28 10:11:53 +02:00
Tobias Brunner
769d9a12aa child-sa: Add helper to check if two TS match negotiated TS 2025-05-28 10:11:53 +02:00
Tobias Brunner
65b810e9b0 acquire-job: Use helpers to manage acquire data 2025-05-28 10:11:53 +02:00
Tobias Brunner
c563b0d930 kernel-listener: Add helpers to clone/destroy acquire data 2025-05-28 10:11:53 +02:00
Tobias Brunner
6ae29af18b child-create: Consider triggering TS when checking for duplicate 2025-05-28 10:11:53 +02:00
Tobias Brunner
6e274271af vici: Include reqid when listing trap policies 2025-05-28 10:11:53 +02:00
Tobias Brunner
5624f7ffaa kernel-pfkey: Don't use TS from acquire in tunnel mode
The addresses are actually the endpoints of the SA, not information on
the matched packet (except that the RFC says to set the ports and
protocol of the packet in the source address, which the Linux kernel
doesn't do).  So these are useless, unless transport mode is used, where
the addresses are needed for the wildcard trap policy use case.

The RFC mentions a PROXY address (a single one, not two), that could
apparently be something like the source address in tunnel mode.
However, the description of how this is used in the RFC is quite weird
and neither Linux nor FreeBSD send such an attribute in SADB_ACQUIRE.
2025-05-28 10:11:53 +02:00
Tobias Brunner
b024b7e9a6 kernel-netlink: Add support for acquire sequence numbers
Note that while PF_KEYv2 also uses sequence numbers to identify acquires,
which we currently don't use correctly by the way, it does not include
information about the packet that triggered an acquire.  What we receive
in src and dst, and currently forward as traffic selectors, are actually
the designated endpoints of the SA. So especially in tunnel mode this is
useless to do narrowing on the responder (these addresses might not even
match the configured TS).
2025-05-28 10:01:19 +02:00
Tobias Brunner
46c338a78f kernel-interface: Change reqid if seq. nos. are supported and narrowing occurred
With the sequence numbers we don't have to maintain the reqid to delete
the temporary state.

One exception is with labels.  There we currently only install trap
policies with the generic label.  SAs created from those don't have
policies installed, so we have to reuse the reqid of the trap even if
narrowing occurs.

And as before, we reuse the reqid without checking traffic selectors if
sequence numbers are not supported.

Note that if a CHILD_SA is manually initiated (i.e. has no sequence
number assigned) right before an acquire is triggered, there are several
possible outcomes depending on whether narrowing occurs.  If there is no
narrowing, the same reqid is assigned and the kernel will remove the
temporary SA when the SA is installed (no seq => reqid match).
Afterwards, the queued duplicate CHILD_SA is destroyed and the acquire
state in the trap manager gets removed.  If there is narrowing, a new
reqid is allocated, so the installation of the SA will not remove the
temporary state.  However, due to the narrowing, the duplicate check
fails and when the duplicate is installed (with sequence number), the
temporary state is deleted (as is the state in the trap manager).
2025-05-28 10:01:19 +02:00
Tobias Brunner
c5b2a8eaa3 child-cfg: Use separate method to get configured traffic selectors
Optionally with "dynamic" traffic selectors resolved.  A new method
is added for those cases where we actually want to select potentially
narrowed traffic selectors using a supplied list.  The latter now also
always logs details, while the former does not.
2025-05-28 10:01:19 +02:00
Tobias Brunner
84da416082 trap-manager: Use sequence numbers to identify acquires
Either use the sequence number from the kernel (and potentially update
it if the acquire was retriggered), or generate our own sequence
numbers, which simplifies matching acquires to established/destroyed
CHILD_SAs.
2025-05-28 10:01:19 +02:00
Tobias Brunner
82c82cbbd6 ike: Support optional acquire sequence numbers when creating CHILD_SAs 2025-05-28 10:01:19 +02:00
Tobias Brunner
0c9bac73d9 child-sa: Store and propagate optional acquire sequence number 2025-05-28 10:01:19 +02:00
Tobias Brunner
3e6d7db5e3 kernel-interface: Add members for optional acquire sequence number 2025-05-28 10:01:19 +02:00
Tobias Brunner
301887b865 Merge branch 'regex-ids'
Adds support for POSIX regular expressions in configured identities,
which makes matching remote identities more flexible.
2025-05-28 09:58:46 +02:00
Tobias Brunner
981c82ab50 vici: Add support for POSIX regular expressions in identity fields 2025-05-28 09:58:17 +02:00
Tobias Brunner
10c2985cdd conf: Escape " and \ in man page output 2025-05-28 09:58:17 +02:00
Tobias Brunner
7de05b918c identification: Add support for POSIX regular expressions
When cross-compiling for Windows on Ubuntu, we don't have POSIX regular
expressions available (there does not seem to be any alternative libraries
either), but since the tests are not executed that's OK.  On AppVeyor,
MSYS2 has libgnurx installed, which works fine but requires explicit
linking with `-lregex`.

This is loosely based on a patch by Thomas Egerer.
2025-05-28 09:58:17 +02:00
Tobias Brunner
2b1f0e8c6e debug: Use separate log group for watcher_t
This component produces a lot of messages that make debugging job
handling difficult.
2025-05-27 17:41:02 +02:00
Tobias Brunner
4703ef00ce github: Use AWS-LC 1.52.0 for tests 2025-05-27 17:38:32 +02:00
Tobias Brunner
29986dd1e5 wolfssl: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
e3fa72b81a ml: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
07a9926464 botan: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
37ec770758 pki: Reduce indentation in usage output and print command description
Also print error message at the end of the output.
2025-05-27 17:38:32 +02:00
Tobias Brunner
5f4988eb7c swanctl: Reduce indentation in usage output and print command descriptions
Also print error message at the end of the output.
2025-05-27 17:38:24 +02:00
Tobias Brunner
9a9d0a0bf7 swanctl: Document maximum log level of messages received by --log 2025-05-22 14:24:43 +02:00
Tobias Brunner
362fa94ef5 vici: Document that the log event only receives messages on level 0 and 1 2025-05-22 14:05:51 +02:00
Tobias Brunner
688b9e27d5 Merge branch 'initiate-cancel'
Allow proper shutdown if a deadlock is caused by too many concurrent
blocking initiation requests.

References strongswan/strongswan#2776
2025-05-19 17:21:57 +02:00
Tobias Brunner
f8e5e38b12 vici: Make threads handling requests get canceled explicitly
Threads initiating SAs can get stuck on the semaphore in
wait_for_listener() during shutdown if the corresponding job is never
executed.  A particular case when this can happen is if more initiations
are triggered than worker threads are available.  This causes a (known)
deadlock as no workers are free anymore to process jobs (for inbound
messages or timeouts etc.), including the one to initiate an SA.
This change at least allows a proper shutdown.
2025-05-19 17:20:59 +02:00
Tobias Brunner
8d3855ba31 vici: Don't pass stack variable to thread cleanup handler
The variable seems to get overwritten during cleanup, causing a
segmentation fault because either the pointer and/or the length is
invalid.
2025-05-19 17:19:20 +02:00
Tobias Brunner
367e782054 controller: Avoid memory leak if initiate job is never executed
This can happen if the daemon is terminated while an initiation is
pending.
2025-05-19 17:19:20 +02:00
Tobias Brunner
94cc07cab4 uci: Remove obsolete and broken plugin
The plugin was apparently broken for years because it uses functions that
don't exist anymore.  It was quite limited anyway, so it was never really
used in OpenWrt to begin with (instead they generate configs in a custom
init script).
2025-05-19 17:17:45 +02:00
Tobias Brunner
2b3a5172d8 configure: Add missing dependency of lib-prefix.m4
Fixes: 7ec0101250bf ("Include lib-prefix.m4 directly and remove gettext dependency")
2025-05-13 18:45:45 +02:00
Tobias Brunner
e8e5e2d441 configure: Simplify inclusion of M4 macros 2025-05-13 18:45:45 +02:00
Gerardo Ravago
99fda969b4 openssl: Fix AWS-LC build
The `crypt` functions defined here conflict with the `crypt` function
defined in `unistd.h` and trigger compilation errors when building
against the latest version of AWS-LC, which introduced a new transitive
include of `unistd.h` via `bio.h`.

This simply renames the function to avoid the error.

Closes strongswan/strongswan#2786
2025-05-13 17:16:07 +02:00
Tobias Brunner
7ec0101250 Include lib-prefix.m4 directly and remove gettext dependency
A recent gettext release (0.25 via Homebrew) installs the M4 macros in a
different location (<prefix>/share/gettext/m4 instead of
<prefix>/share/aclocal). According to the commit messages to avoid "bad
interactions between autoreconf and autopoint".  Since we only depend
on gettext for that macro and this move makes it complicated, we can also
just integrate the macro from gnulib directly (which gettext 0.18+ relies
on anyway).
2025-05-13 17:15:23 +02:00
Tobias Brunner
198d112745 github: Use AWS-LC 1.51.2 for tests 2025-05-13 17:15:15 +02:00
Tobias Brunner
2ee768ec4e ha: Fix arguments in debug statement when destroying incomplete IKE_SAs
Closes strongswan/strongswan#2781

Fixes: 97bd0e2297ed ("ha: Destroy incomplete IKE_SAs after de-/activating a segment")
2025-05-13 17:15:05 +02:00
Tobias Brunner
a1a477528f Use wolfSSL 5.8.0 for tests 2025-05-13 17:14:54 +02:00
Tobias Brunner
5863b8d89b wolfssl: Update ML-KEM API for wolfSSL 5.8.0 release 2025-05-13 17:14:54 +02:00
Tobias Brunner
4249d721ec testing: Add rw-eap-id-switch scenario 2025-04-14 12:18:24 +02:00
Tobias Brunner
2f2e4abe3c ikev2: Add support to switch peer configs based on EAP-Identities
This changes how EAP identities are used from the config. Instead of
setting a statically configured identity != %any, an EAP-Identity
exchange is now always initiated (and required).  If the received identity
doesn't match, the peer config is switched to one with a matching
identity (wildcards are supported for that match).  This allows switching
to a config with a different EAP method or child settings based on the
EAP identity.

There is currently no "best" match.  The configs are evaluated based on
the order returned from the initial peer config lookup.

References strongswan/strongswan#2702
2025-04-14 12:05:24 +02:00
Tobias Brunner
651a5b0ded android: Only select default ABIs when building OpenSSL
This skips the experimental RISC-V ABI in newer NDKs.
2025-04-14 11:54:42 +02:00
Tobias Brunner
09edb565ba android: Skip unknown ABIs when building OpenSSL
Newer NDKs have RISC-V as experimental ABI (not enabled by default, see
next commit).  If we don't have a mapping for a specific target, OpenSSL
falls back to 'android-arm', so that won't really work (interestingly,
it does build).
2025-04-14 11:54:42 +02:00
Tobias Brunner
0f1f375a21 android: Protect but don't keep track of sockets used for source address lookups
These sockets are closed immediately again, so no need to re-protect them
during roaming events.

References strongswan/strongswan#1691

Fixes: 6d87a8651068 ("android: Use new sockets to determine source IP")
2025-04-14 11:54:42 +02:00
Tobias Brunner
77f99df656 android: Remove special handling of legacy Android versions in native code
Since minSdkVersion has been 21 for a while, we can remove some code
that was necessary for older versions.
2025-04-14 11:54:42 +02:00
Tobias Brunner
523067e6db init: Only install legacy service unit if starter/stroke is enabled
Closes strongswan/strongswan#2722
2025-04-14 11:54:42 +02:00
Tobias Brunner
8ae00c334a charon-nm: Mark VPN connection as persistent
If this is not set, it looks like NM shuts down the VPN connection and
calls disconnect() if there is any connectivity change.

References strongswan/strongswan#2707
2025-04-14 11:40:59 +02:00
Tobias Brunner
57e74f64b3 kernel-netlink: Enable UDP GRO
This enables GRO offload for inbound ESP-in-UDP packets if the
esp4|6_offload modules are loaded.  Note that inbound ESP or ESP-in-UDP
packets won't be visible on layer 3 in Netfilter or tcpdump.
2025-04-14 11:39:44 +02:00
Tobias Brunner
d54a29cc5c github: Use OpenSSL 3.5.0 to test ML-KEM 2025-04-14 11:38:48 +02:00
Tobias Brunner
b914333ab4 openssl: Add support for ML-KEM with OpenSSL 3.5 2025-04-14 11:38:48 +02:00
Tobias Brunner
f2e88b169f leak-detective: Whitelist OpenSSL 3.5 functions 2025-04-14 11:38:48 +02:00
Tobias Brunner
fd17d154e5 github: Build OpenSSL from the Git repository instead of a tarball
This is more flexible and allows test builds against branches.
2025-04-14 11:38:48 +02:00
Tobias Brunner
defbabd724 tty: Produce colored output in CI environments 2025-04-10 09:33:19 +02:00
Tobias Brunner
245ea0597d vici: Increase buffer to hold uint64_t when parsing packet limits 2025-04-10 08:31:10 +02:00
Thomas Egerer
ed8c08fbe7 vici: Improve byte lifetime parsing
Increase buffer to 32 bytes to hold uint64_t completely and check for
overflows after multiplication with size modifiers.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:10 +02:00
Tobias Brunner
9fe58c83fb proposal: Add supported KE methods to default ESP/AH proposals, but optional
This allows accepting clients that send proposals with non-optional KE
methods during rekeying, while still accepting clients that use the
previous non-KE default proposals.
2025-04-10 08:31:10 +02:00
Tobias Brunner
8cb36be188 swanctl: Document "none" keyword for ESP proposals 2025-04-10 08:31:10 +02:00
Tobias Brunner
46674e64c1 ha: Support sync of private IKE_SA extensions and conditions
This requires a new protocol version as private extensions would enable
unrelated regular extensions, even when sending the private extension
as second attribute (which would work for conditions as they are
explicitly enabled/disabled).
2025-04-10 08:31:09 +02:00
Tobias Brunner
8679d91c81 ike-sa: Remove redundant setting of IKE_SA conditions after a rekeying
This was originally added with b0e40caafbd7 ("NAT-T conditions were not
inherited during IKE_SA rekeying") in 2008 when there was only a single
inherit() method.  Later the inherit_pre() method was added and then
with 094963d1b160 ("ikev2: Apply extensions and conditions before
starting rekeying") in 2014 the extensions and conditions were set
already there.
2025-04-10 08:31:09 +02:00
Tobias Brunner
07978c16b3 ike-sa: Add possibility to store private extensions/conditions
This avoids conflicts with upstream changes if patched versions of
strongSwan require a number of private extensions and conditions.  For
example, the following extensions can be used as usual via the
`enable|supports_extension()` methods:

	#define PRIVATE_EXT_1 (EXT_PRIVATE_MARKER | (1<<0))
	#define PRIVATE_EXT_2 (EXT_PRIVATE_MARKER | (1<<1))

Defining an enum would also be possible but because the type won't match
the values would have to be cast to `ike_extension_t` when using the
methods.

Similarly, `COND_PRIVATE_MARKER` may be used to define private conditions
that can be used with the `set|has_condition()` methods.

Because the MSB is explicitly not set in `private_extensions|conditions`,
these members may directly be checked against private values, e.g.:

	if (this->private_extensions & PRIVATE_EXT_1)
	{
	}
2025-04-10 08:31:09 +02:00
Tobias Brunner
6ed63be612 peer-cfg: Use flags for boolean options
Makes it potentially easier to add new flags.

The mediation flag is not converted as the #ifdefs make it awkward.
2025-04-10 08:31:09 +02:00
Tobias Brunner
b0a4b7f2dd daemon: Add facility to register custom init/deinit functions
Same as the previous commit but with access to the daemon.
2025-04-10 08:31:09 +02:00
Tobias Brunner
a6f4146f45 library: Add facility to register custom init/deinit functions
These can be linked into the application to do initialization/cleanup
without having to modify the source code.
2025-04-10 08:31:09 +02:00
Tobias Brunner
1a20502573 github: Add compile test with --without-testable-ke option 2025-04-10 08:31:09 +02:00
Tobias Brunner
6cbd93838b Add configure option to disable testing key exchange methods
If this is used, the functionality to set a private key/value/seed for
key exchange methods is removed (including from the interface to avoid
accidentally forgetting to wrap implementations and uses of set_seed()).

The set_seed() method is assigned outside the INIT() macro to avoid
potentially undefined behavior (preprocessing directives in macro
arguments).

The test done by the crypto tester is a simple functionality test.
2025-04-10 08:31:09 +02:00
Thomas Egerer
a7c285bc50 auth-cfg: Add lower case enum names for auth_rule_t
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Thomas Egerer
af9095fdd9 ldap: Use timeout value for synchronous calls
So far, the timeout value was only used as connect timeout while a
malicious server could accept the connection and then starve us. So use
the timeout for LDAP_OPT_TIMEOUT, too, which affects all synchronous
calls.  In particular, ldap_simple_bind_s(), which has no timeout
argument like ldap_search_st().

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Thomas Egerer
ee4e93419b gitignore: Add *.i and *.s files
Ignore a couple of compiler generated temp files.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Tobias Brunner
0bccc287d6 Doxyfile: Exclude OpenSSL sources of Android app
They can produce warnings and we don't want to include documentation for
these anyway.
2025-04-10 08:31:09 +02:00
Tobias Brunner
cdefe52494 github: Set type in issue templates 2025-04-10 08:31:09 +02:00
Tobias Brunner
d7305a556f testing: Use blockdev instead of partprobe to load partitions
This avoids a dependency on parted as blockdev is in util-linux on
Debian/Ubuntu, which is installed by default.  And it might work more
reliably.
2025-04-10 08:31:09 +02:00
Tobias Brunner
353d5c130b testing: Use tar instead of recursive scp
It seems that scp is sometimes very slow (unclear what causes it as it's
not always the same).  Packing up the files with tar performs a lot
better in these situations.  And copying the files to multiple hosts
in parallel additionally helps to reduce the time required for these
steps.

Using --overwrite and -h preserves existing symlinks (e.g. for the users
file in /etc/freeradius/3.0) and overwrites the target file instead.
The -m option ignores timestamps when extracting the files as some target
files will be newer than the source.  Using -h when packing up files in
load-testconfig allows using symlinks in the test config dirs to files
on the host running the tests.
2025-04-07 14:54:48 +02:00
Tobias Brunner
d7eb3ed92e testing: Make ocsp.cgi in ikev2-multi-ca/ocsp-signers scenario executable 2025-04-07 14:54:48 +02:00
Tobias Brunner
a1ab256756 testing: Add some network utilities to the base image 2025-04-04 12:06:59 +02:00
Tobias Brunner
022f2d5f30 testing: Add option for a quick rebuild of strongSwan
This shaves off about 1 minute of build time on my machine.  We also
don't need the separate build step and can just run `make install`.
2025-04-04 12:06:59 +02:00
Tobias Brunner
02c43fa6e4 testing: Move removal of charon.pid into posttest section
Fixes: a103f3a2849f ("testing: Add options to only run pre- or posttest scripts of a scenario")
2025-04-04 12:06:59 +02:00
Tobias Brunner
08428f6b5d testing: Fix loading test config for tests that were never run
The file won't exist in the previous location until load-testconfig was
executed once.  Since it's not modified by the script it's fine to
load it directly from the original location.

Fixes: a103f3a2849f ("testing: Add options to only run pre- or posttest scripts of a scenario")
2025-04-04 12:06:59 +02:00
Tobias Brunner
5e4dedfc20 Merge branch 'android-always-on-managed'
Fixes an issue with initiating managed profiles as Always-on VPN.

Closes strongswan/strongswan#2756
2025-04-04 08:57:12 +02:00
Tobias Brunner
8036b3f932 android: New release after fixing Always-on VPN with managed profiles 2025-04-03 16:35:47 +02:00
Tobias Brunner
d87be9b981 android: Fix starting a managed profile as Always-on VPN
The callbacks provided via ProcessLifecycleOwner are only triggered when
Activities are started.  However, when Android triggers the Always-on
VPN it directly starts our VpnService subclass, no Activity.  So the
configs were not loaded and the VPN couldn't be initiated with a managed
profile.  This ensures the config is loaded right from the start of
the app.  And by registering for modifications in onCreate() we can also
use the correct config if the app is never started in-between changes to
the managed profiles and triggering the Always-on VPN.
2025-04-03 16:19:53 +02:00
Tobias Brunner
11978ddd39 Cast uses of return_*(), nop() and enumerator_create_empty()
As described in the previous commit, GCC 15 uses C23 by default and that
changes the meaning of such argument-less function declarations.  So
whenever we assign such a function to a pointer that expects a function
with arguments it causes an incompatible pointer type warning.  We
could define dedicated functions/callbacks whenever necessary, but this
seems like the simpler approach for now (especially since most uses of
these functions have already been cast).
2025-03-19 10:22:37 +01:00
Tobias Brunner
d5d2568ff0 callback-job: Replace return_false() in constructors with dedicated function
Besides being clearer, this fixes issues with GCC 15.  The latter uses
C23 by default, which changes the meaning of function declarations
without parameters such as

	bool return false();

Instead of "this function takes an unknown number of arguments", this
now equals (void), that is, "this function takes no arguments".  So we
run into incompatible pointer type warnings all over when using such
functions.  They could be cast to (void*) but this seems the cleaner
solution for this use case.
2025-03-19 10:22:37 +01:00
Tobias Brunner
38d89f57f0 charon-nm: Use CALLBACK macro for callback job's cancel implementation
Casting to this specific function type doesn't work anymore if C23 is
used as the types mismatch.
2025-03-19 10:22:37 +01:00
Tobias Brunner
a7b5de5690 pki: Fix signature of help() to match that of a callback in command_t 2025-03-19 10:22:37 +01:00
Tobias Brunner
2553357f85 github: Use AWS-LC 1.48.5 for tests 2025-03-18 08:32:52 +01:00
Tobias Brunner
1f222f5dfb testing: Install iperf3 instead of iperf 2025-03-14 11:49:48 +01:00
Tobias Brunner
a103f3a284 testing: Add options to only run pre- or posttest scripts of a scenario
This allows to manually do some testing without having to type commands
to set up a scenario.

Also changes how arguments are parsed (allowing to pass options mixed
with test dirs) and adds some usage output.
2025-03-14 11:49:42 +01:00
Tobias Brunner
25ec2bc43d Don't reference 5.9 in URLs to docs.strongswan.org 2025-03-11 10:26:31 +01:00
Tobias Brunner
378c75cb2e nm: Version bump to 1.6.2 2025-03-11 09:57:54 +01:00
Andreas Steffen
1e8cca4004 Version bump to 6.0.1 2025-03-10 19:19:37 +01:00
Andreas Steffen
5a74d796a8 testing: Adapted ha/active-passive tests 2025-03-10 19:18:40 +01:00
Tobias Brunner
fcaee9e123 vici: Document ICMP type/code traffic selector restrictions 2025-03-05 10:55:51 +01:00
Tobias Brunner
3c3a545bfe NEWS: Add news for 6.0.1 2025-03-05 08:50:44 +01:00
Tobias Brunner
4e2cf58961 receiver: Properly clean up if hasher or RNG can't be created 2025-03-04 15:30:25 +01:00
Tobias Brunner
380ec66c92 winhttp: Properly destroy linked list if connection can't be opened 2025-03-04 15:27:53 +01:00
Tobias Brunner
a70ba4d600 pkcs11: Free copied name of PKCS#11 module in error cases 2025-03-04 14:48:42 +01:00
Tobias Brunner
8fc09ae158 stream-service: Avoid FD leak during deinitialization 2025-03-04 14:41:03 +01:00
Tobias Brunner
3b0f260b40 gcm: Properly clean up IV generator if crypter can't be created 2025-03-04 14:37:44 +01:00
Tobias Brunner
2cf94745de daemon: Properly clean up logger entries in error cases
The copied target string was not freed.
2025-03-04 14:33:36 +01:00
Tobias Brunner
e6b9f82a87 swanctl: Fix memory leak in --load-creds if --clear fails 2025-03-04 14:30:35 +01:00
Tobias Brunner
938f6d3777 testing: Update build recipe after changing Python build
Fixes: 3babf1f7108d ("vici: Update Python build")
2025-03-04 13:52:30 +01:00
Tobias Brunner
251582d0b6 vici: Update docs after changing Python build
Fixes: 3babf1f7108d ("vici: Update Python build")
2025-03-04 13:52:24 +01:00
Tobias Brunner
511add2111 Fixed some typos, courtesy of codespell 2025-03-04 13:43:31 +01:00
Andreas Steffen
61c0006002 Version bump to 6.0.1rc1 2025-03-03 10:10:03 +01:00
Tobias Brunner
8c1714ba12 Revert "kernel-netlink: Don't fallback to peer address as gateway"
This reverts commit f717bb5249caea550bc6e2baeb09ca309ad83b39.

Causes issues in our testing environment. Default route via host is
preferred if no gateway is set in the installed routes.  Needs some
investigation.

References strongswan/strongswan#2548
2025-03-03 09:46:14 +01:00
Tobias Brunner
de30b6b385 charon-nm: Lower default retransmission settings to restore SAs more quickly
These are the same values we use for the Android app.

References strongswan/strongswan#2696
2025-02-28 16:47:05 +01:00
Tobias Brunner
8e97e20642 charon-nm: Use a DPD to check the current path
If the client's network goes down for a while but the same IP address
is assigned later, it won't be aware if the server killed the IKE_SA
while it wasn't reachable.  This way, a DPD is triggered and the client
can reestablish the SA if necessary.  When roaming to a different IP,
a MOBIKE update is triggered with the same effect.

References strongswan/strongswan#2696
2025-02-28 16:46:50 +01:00
Tobias Brunner
af0535894c conf: Document some global options for charon-nm
These have specific values for charon-nm's use case but might have to be
changed for special setups or because of conflicts.

References strongswan/strongswan#2683
2025-02-28 16:46:43 +01:00
Tobias Brunner
7205d02360 conf: Add missing modules to install config snippets
In particular the one for charon-nm was missing.

References strongswan/strongswan#2683
2025-02-28 16:45:33 +01:00
Tobias Brunner
069a81e69a ikev2: Trigger ike_reestablish_pre|post events for make-before-break reauth
Listeners can't track those IKE_SAs otherwise.  For break-before-make
reauthentications, these events are already triggered because that is
implemented by calling reestablish() on the old IKE_SA.
2025-02-28 16:27:10 +01:00
Tobias Brunner
660e06b048 ike-sa: Fix check for make-before-break when handling DELETE failure
Fixes: a5e80cf5e451 ("libcharon: Enable make_before_break option by default")
2025-02-28 16:27:10 +01:00
michael-dev
bff500dfd0 ike-natd: Float to the NAT-T port early when not connecting to port 500
When using port 4500 for IKE_SA_INIT, Windows Server 2016, 2025 and
possibly others send back all packets to the port initially used by the
client, not the one floated to before sending IKE_AUTH. So if UDP
encapsulation is used, no traffic can be received as the initial socket
can't have UDP decapsulation enabled.

tcpdump output:
```
IP <client-ip>.47547 > <server-ip>.4500: UDP-encap: ESP(spi=0xfd4e5fc2,seq=...)
IP <server-ip>.4500 > <client-ip>.57962: UDP-encap: ESP(spi=0xccc5e213,seq=...)
```

Avoid this by floating early if a non-default destination port is used.
This also ensures we don't send packets from port 500 (without non-ESP
marker) if ephemeral source ports are not used.

Closes strongswan/strongswan#2664

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2025-02-28 16:25:32 +01:00
Tobias Brunner
882b19c1df ike-sa: Only query last use time of CHILD_SAs if UDP-encap is used
Without UDP-encapsulation, the IKE and ESP traffic is not directly related
(other than via IPs), so firewalls might no keep the state for IKE traffic
alive if there is no IKE traffic for a while and constant ESP traffic
prevents DPDs from being exchanged because inbound ESP traffic is
considered.

Closes strongswan/strongswan#1759
2025-02-28 16:19:02 +01:00
Tobias Brunner
57703fa089 eap-radius: Add support to specify and bind a specific source address
Using a specific address can be useful in scenarios where dynamic routing
could change the path to the RADIUS server and a changing source address
is a problem for the server.

Closes strongswan/strongswan#2598
2025-02-28 16:16:48 +01:00
Tobias Brunner
c3ae859b9b Merge branch 'ha-multi-ke'
Adds support for multiple key exchanges to the ha plugin.  Also,
because of the delayed key derivation and the not synced IntAuth
values, incomplete IKE_SAs are now destroyed during a failover.

Closes strongswan/strongswan#2550
2025-02-28 16:11:59 +01:00
Tobias Brunner
97bd0e2297 ha: Destroy incomplete IKE_SAs after de-/activating a segment
The node that gets activated usually won't be able to complete the
IKE_SA mainly because the IKE keys are now derived delayed, so the key
material required to process a message often won't be available (only
later IKE_AUTH messages and retransmits of earlier messages that the
active node already received and synced the keys for may be decrypted).

A second issue affects IKE_SAs with multiple key exchanges.  Because the
IntAuth value(s) are currently not synced, which are necessary to
verify/create the AUTH payloads, the IKE_AUTH exchange couldn't be
completed.
2025-02-28 16:02:41 +01:00
Jean-François Hren
fd6ac87fc3 testing: Add ha/active-passive-multi-ke scenario 2025-02-28 16:02:41 +01:00
Tobias Brunner
e7848e36fa ha: Add support to sync IKE and Child SAs with multiple key exchanges
Synchronization for the additional transforms in the IKE and Child SA
proposals is added.  Details of the IKE_SA synchronization are changed
to support IKE_INTERMEDIATE exchanges that cause multiple HA_IKE_ADD
messages and key derivations.  The cache has been extended to handle
multiple such messages.

Co-authored-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-02-28 16:02:41 +01:00
Tobias Brunner
f717bb5249 kernel-netlink: Don't fallback to peer address as gateway
This doesn't really seem useful (perhaps it was before we started to
configure the outbound interface on our routes). And it can actually
cause the route installation to fail e.g. for routes over point-to-point
interfaces where we'd get "Error: Nexthop has invalid gateway" errors.

Closes strongswan/strongswan#2548
2025-02-28 16:01:49 +01:00
Tobias Brunner
9c97ecbb31 scripts: Add support for out-of-tree builds to test script
Can be useful when using the script locally.
2025-02-28 14:21:49 +01:00
Tobias Brunner
e385a83f5e vici: Fix out-of-tree builds with Perl module enabled
Not really building it out-of-tree for now, though.
2025-02-28 14:21:49 +01:00
Tobias Brunner
fad99c7a88 github: Explicitly install required packages for Linux builds
The runner images have some software pre-installed, which isn't the
case on regular Ubuntu images.
2025-02-28 14:21:41 +01:00
Tobias Brunner
8e4ea2cbbd github: Use all available CPU cores when building 2025-02-28 12:55:12 +01:00
Tobias Brunner
8c4e9f8c7b github: Call Botan configure script directly
This should find the required Python binary automatically (`python` might
not be available if not explicitly installed).
2025-02-28 12:55:12 +01:00
Tobias Brunner
f740faccac github: Don't use pip3 to install Python packages anymore
Currently, the runner images enable break-system-packages globally.
However, this workaround will be removed by the end of March.  So
we switch to installing these packages as intended via distro (the
alternative would be to use pipx, at least for tox).
2025-02-28 12:55:12 +01:00
Tobias Brunner
0bce9839c9 Merge branch 'android-reauth-fix'
Fixes issues with reauthentication, in particular, to reestablish the
SA if MOBIKE is disabled.  The app currently can't handle
make-before-break reauthentication.  In part because necessary events are
currently not triggered.  So for now, we switch back to the classic
reauthentication approach.
2025-02-27 11:23:52 +01:00
Tobias Brunner
a299a4d3ce android: New release after fixing reauthentication regression 2025-02-25 15:21:56 +01:00
Tobias Brunner
40a37b6ffc android: Disable make-before-break reauthentication
The service implementation with its handling of reauth callbacks and
no-DNS TUN device etc. can't handle make-before-break reauthentication
at the moment.
2025-02-25 14:57:00 +01:00
Tobias Brunner
9d4decbde8 github: Remove runs on Ubuntu 20.04
They will start to fail on certain days in March before the images are
removed on April 1st.
2025-02-21 14:46:08 +01:00
Tobias Brunner
5468759c71 github: Check test vectors with output in crypto plugin tests
This way we see what was actually tested. Increasing the verbosity for
the general test run produces too much output.
2025-02-21 14:13:26 +01:00
Tobias Brunner
31c44a758f test-vectors: Add a soft dependency on DRBG used for KEM tests
Depending on the loaded plugins, it's not necessary. So it's not a hard
dependency.
2025-02-21 11:06:17 +01:00
Tobias Brunner
e12540025d gmp: Declare dependency on DRBG to generate private keys 2025-02-21 11:06:02 +01:00
Tobias Brunner
ff50db8758 cirrus: Use FreeBSD 13.4 and 14.2 2025-02-20 16:30:11 +01:00
Tobias Brunner
1f0dd8d585 github: Use OpenSSL 3.4.1 for tests
There was an issue with OPENSSL_armcap_P in Android's static build for
OpenSSL 3.1.1+. This was finally fixed with this release (and was also
backported to older versions).
2025-02-20 16:30:11 +01:00
Tobias Brunner
827c572efd github: Use AWS-LC 1.46.1 for tests 2025-02-20 11:59:55 +01:00
Tobias Brunner
e4d6bcef48 android: Move annotation to method where startActivityAndCollapse() is called
Fixes: 5237bf3a5c6f ("android: Suppress deprecation warning because of startActivityAndCollapse()")
2025-02-20 11:59:55 +01:00
389 changed files with 19662 additions and 3612 deletions

View File

@ -1,11 +1,11 @@
freebsd_task:
matrix:
- name: FreeBSD 14.1
- name: FreeBSD 14.2
freebsd_instance:
image_family: freebsd-14-1
- name: FreeBSD 13.3
image_family: freebsd-14-2
- name: FreeBSD 13.4
freebsd_instance:
image_family: freebsd-13-3
image_family: freebsd-13-4
env:
TESTS_REDUCED_KEYLENGTHS: yes

View File

@ -2,6 +2,7 @@
name: "🐛 Bug report"
about: Report a reproducible bug or regression
labels: bug, new
type: Bug
---
<!--

View File

@ -2,6 +2,7 @@
name: Feature request
about: Suggest an idea for this project
labels: enhancement, new
type: Feature
---
<!--

View File

@ -5,9 +5,6 @@ runs:
- name: "Install Dependencies"
run: ./scripts/test.sh deps
shell: bash
- name: "Install Python Dependencies"
run: ./scripts/test.sh pydeps
shell: bash
- name: "Build Dependencies"
run: ./scripts/test.sh build-deps
shell: bash

View File

@ -18,7 +18,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
android:
needs: pre-check

View File

@ -19,7 +19,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
analyze:
needs: pre-check

View File

@ -21,7 +21,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
latest:
needs: pre-check
@ -48,6 +48,9 @@ jobs:
- test: no-dbg
- test: no-dbg
compiler: clang
- test: no-testable-ke
- test: no-testable-ke
compiler: clang
- test: fuzzing
compiler: clang
monolithic: yes
@ -90,33 +93,25 @@ jobs:
path: config.log
retention-days: 5
crypto-plugins:
crypto:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, ubuntu-22.04, ubuntu-20.04 ]
test: [ botan, wolfssl, openssl, openssl-3, openssl-awslc, gcrypt ]
os: [ ubuntu-latest, ubuntu-22.04 ]
leak-detective: [ no, yes ]
exclude:
# test custom-built libs only on the latest platform
- os: ubuntu-22.04
test: botan
- os: ubuntu-20.04
test: botan
- os: ubuntu-22.04
test: wolfssl
- os: ubuntu-20.04
test: wolfssl
- os: ubuntu-22.04
test: openssl-3
- os: ubuntu-20.04
test: openssl-3
- os: ubuntu-22.04
test: openssl-awslc
- os: ubuntu-20.04
test: openssl-awslc
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
@ -140,6 +135,12 @@ jobs:
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- name: Test Vectors (detailed)
env:
TESTS_SUITES: vectors
TESTS_VERBOSITY: 1
run:
./scripts/test.sh
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v4
@ -154,7 +155,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-20.04 ]
os: [ ubuntu-22.04 ]
test: [ all, nm ]
compiler: [ gcc, clang ]
exclude:
@ -164,8 +165,6 @@ jobs:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
# LSan causes spurious SIGSEGV after tests due to DTLS handling by glibc (on 20.04)
ASAN_OPTIONS: intercept_tls_get_addr=0
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

View File

@ -18,7 +18,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
macos:
strategy:

View File

@ -17,7 +17,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
sonarcloud:
needs: pre-check
@ -33,7 +33,6 @@ jobs:
with:
path: |
~/.cache/ccache
~/.sonar-cache
key: ccache-sonarcloud-${{ github.sha }}
restore-keys: |
ccache-sonarcloud-
@ -41,24 +40,17 @@ jobs:
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
# using SonarSource/sonarcloud-github-action is currently not recommended
# for C builds, so we follow the "any CI" instructions
- name: Install sonar-scanner
- uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4
- run: |
echo "BUILD_WRAPPER_OUT_DIR=$HOME/bw-output" >> $GITHUB_ENV
- uses: ./.github/actions/default
- uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "PATH=$HOME/.sonar/build-wrapper-linux-x86:$SONAR_SCANNER_HOME/bin:$PATH" >> $GITHUB_ENV
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_id }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT: ${{ secrets.SONAR_PROJECT }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
uses: ./.github/actions/default
with:
args: >
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT }}
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.cfamily.threads=2
-Dsonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json
- run: ccache -s

View File

@ -18,7 +18,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
tkm:
needs: pre-check

View File

@ -21,7 +21,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
cross-compile:
needs: pre-check

1
.gitignore vendored
View File

@ -55,3 +55,4 @@ coverage/
/*.includes
test-driver
nbproject/
*.[si]

View File

@ -1,3 +1,3 @@
Please refer to the [developer documentation](https://docs.strongswan.org/docs/5.9/devs/devs.html)
Please refer to the [developer documentation](https://docs.strongswan.org/docs/latest/devs/devs.html)
in our documentation for details regarding **code style** and
[**contribution requirements**](https://docs.strongswan.org/docs/5.9/devs/contributions.html).
[**contribution requirements**](https://docs.strongswan.org/docs/latest/devs/contributions.html).

View File

@ -991,7 +991,8 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = @SRC_DIR@/src/include
EXCLUDE = @SRC_DIR@/src/include \
@SRC_DIR@/src/frontends/android/app/src/main/jni/openssl
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@ -2375,6 +2376,7 @@ INCLUDE_FILE_PATTERNS =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = LEAK_DETECTIVE \
TESTABLE_KE \
__attribute__(x)=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this

View File

@ -14,7 +14,6 @@ the code, you need the following tools:
- autoconf
- libtool
- pkg-config
- gettext
- perl
- python
- lex/flex

View File

@ -144,4 +144,4 @@ Contents
For a more up-to-date list of recommended modules refer to:
* https://docs.strongswan.org/docs/5.9/install/kernelModules.html
* https://docs.strongswan.org/docs/latest/install/kernelModules.html

68
NEWS
View File

@ -1,3 +1,71 @@
strongswan-6.0.2
----------------
- Support for per-CPU SAs (RFC 9611) has been added (Linux 6.13+).
- Basic support for AGGFRAG mode (RFC 9347) has been added (Linux 6.14+).
- POSIX regular expressions can be used to match remote identities.
- Switching configs based on EAP-Identities is supported. Setting
`remote.eap_id` now always initiates an EAP-Identity exchange.
- On Linux, sequence numbers from acquires are used when installing SAs. This
allows handling narrowing properly.
- During rekeying, the narrowed traffic selectors are now proposed instead of
the configured ones.
- The default AH/ESP proposals contain all supported key exchange methods plus
`none` to make PFS optional and accept proposals of older peers.
- GRO for ESP in enabled for NAT-T UDP sockets, which can improve performance
if the esp4|6_offload modules are loaded.
- charon-nm sets the VPN connection as persistent, preventing NetworkManager
from tearing down the connection if the network connectivity changes.
- ML-KEM is supported via OpenSSL 3.5+.
- The wolfssl plugin is now compatible to wolfSSL's FIPS module.
- The libsoup plugin has been migrated to libsoup 3, libsoup 2 is not supported
anymore.
- The long defunct uci plugin has been removed.
- Log messages by watcher_t are now logged in a separate log group (`wch`).
strongswan-6.0.1
----------------
- The ha plugin supports IKE and Child SAs with multiple key exchanges.
Incomplete IKE_SAs are now destroyed during a failover.
- The new `interface_receive` option for the dhcp plugin allows binding the
receive socket to a different interface than the send socket. Also fixed a
regression if the DHCP server is running on the same host.
- The new `source` option for the eap-radius plugin allows sending RADIUS
messages from a specific IP address.
- Self-signed root CAs without policies are now excluded from policy validation.
- Inbound traffic on IPsec SAs is now ignored when sending DPDs unless
UDP-encapsulation is used.
- Send IKE_SA_INIT from NAT-T socket if not connecting to port 500.
- Local traffic selectors can be configured for charon-nm. Its default
retransmission settings have been set to those of the Android app.
- The vici Python wheel is now built via `build` frontend instead of calling
setup.py directly if --enable-python-wheels is used (the option to build eggs
has been removed). There is no option to automatically install the wheel (use
pip instead) and the --enable-python-eggs-install option has been removed.
strongswan-6.0.0
----------------

View File

@ -566,7 +566,7 @@ to generate a traditional 3072 bit RSA key and store it in binary DER format.
As an alternative a **TPM 2.0** *Trusted Platform Module* available on every
recent Intel platform could be used as a virtual smartcard to securely store an
RSA or ECDSA private key. For details, refer to the TPM 2.0
[HOWTO](https://docs.strongswan.org/docs/5.9/tpm/tpm2.html).
[HOWTO](https://docs.strongswan.org/docs/latest/tpm/tpm2.html).
In a next step the command

View File

@ -16,6 +16,7 @@ options = \
options/charon-systemd.opt \
options/imcv.opt \
options/imv_policy_manager.opt \
options/iptfs.opt \
options/manager.opt \
options/medsrv.opt \
options/pki.opt \

View File

@ -241,6 +241,7 @@ class GroffTagReplacer(TagReplacer):
if not punct:
punct = ''
text = re.sub(r'[\r\n\t]', ' ', m.group('text'))
text = re.sub(r'"', '""', text)
return '{0}.R{1} "{2}" "{3}" "{4}"\n'.format(nl, format, brack, text, punct)
return replacer
@ -305,7 +306,8 @@ class ManFormatter:
def __groffize(self, text):
"""Encode text as groff text"""
text = self.__tags.replace(text)
text = re.sub(r'(?<!\\)-', r'\\-', text)
text = re.sub(r'\\(?!-)', '\\[rs]', text)
text = re.sub(r'(?<!\\)-', '\\-', text)
# remove any leading whitespace
return re.sub(r'^\s+', '', text, flags = re.MULTILINE)

View File

@ -1,6 +1,55 @@
charon-nm {}
Section with settings specific to the NetworkManager backend `charon-nm`.
Settings from the `charon` section are not inherited, but many can be used
here as well. Defaults for some settings are chosen very deliberately and
should only be changed in case of conflicts.
charon-nm.ca_dir = <default>
Directory from which to load CA certificates if no certificate is
configured.
charon-nm.install_virtual_ip_on = lo
Interface on which virtual IP addresses are installed. Note that NM
also installs the virtual IPs on the XFRM interface.
charon-nm.mtu = 1400
MTU for XFRM interfaces created by the NM plugin.
charon-nm.port = 0
Source port when sending packets to port 500. Defaults to an ephemeral
port. May be set to 500 if firewall rules require a static port.
charon-nm.port_nat_t = 0
Source port when sending packets to port 4500 or a custom server port.
Defaults to an ephemeral port. May be set to e.g. 4500 if firewall rules
require a static port.
charon-nm.retransmit_base = 1.4
Base to use for calculating exponential back off, see IKEv2 RETRANSMISSION
in **strongswan.conf**(5). Default retransmission settings for charon-nm are
deliberately lower to fail and possibly reestablish SAs more quickly.
charon-nm.retransmit_timeout = 2.0
Timeout in seconds before sending first retransmit.
charon-nm.retransmit_tries = 3
Number of times to retransmit a packet before giving up.
charon-nm.routing_table = 210
Table where routes via XFRM interface are installed. Should be different
than the table used for the regular IKE daemon due to the mark.
charon-nm.routing_table_prio = 210
Priority of the routing table. Higher than the default priority used for the
regular IKE daemon.
charon-nm.plugins.kernel-netlink.fwmark = !210
Make packets with this mark ignore the routing table. Must be the same mark
set in charon-nm.plugins.socket-default.fwmark.
charon-nm.plugins.socket-default.fwmark = 210
Mark applied to IKE and ESP packets to ignore the routing table and avoid
routing loops when using XFRM interfaces.
charon-nm.syslog.daemon.default = 1
Default to logging via syslog's daemon facility on level 1.

38
conf/options/iptfs.opt Normal file
View File

@ -0,0 +1,38 @@
charon.iptfs {}
Global settings for IP-TFS (RFC 9347). The Linux kernel supports this mode
since 6.14. However, it currently only supports aggregation/fragmentation of
tunneled IP packets in ESP/AGGFRAG packets. It doesn't yet support other
IP-TFS features like sending packets at a constant rate or congestion control.
charon.iptfs.drop_time = 1000000
Time in microseconds to wait for out-of-order packets when processing
inbound traffic.
charon.iptfs.reorder_window = 3
Number of packets that may arrive out of order when processing inbound
traffic.
charon.iptfs.init_delay = 0
Time in microseconds to wait for subsequent packets to aggregate together
when sending outbound traffic. Only relevant if no packets are already
queued to be sent.
charon.iptfs.max_queue_size = 1048576
Maximum number of bytes allowed to be queued for sending on the tunnel
(default 1 MiB). If the queue is full, packets are dropped.
charon.iptfs.packet_size = 0
Maximum outer packet size (layer 3) when sending packets. The default of 0
will use the PMTU as packet size. Note that the kernel currently doesn't
pad smaller packets.
charon.iptfs.accept_fragments = yes
Whether fragments of inner packets across multiple AGGFRAG payloads are
accepted. This is an IKEv2 option, so if the peer doesn't adhere to this
request and still sends such fragments, they will be processed by the
kernel.
charon.iptfs.dont_frag = no
Force disabling fragmenting inner packets across multiple AGGFRAG payloads
when sending outbound traffic (fragmentation is automatically disabled if
the peer indicates that it doesn't support handling such packets).

View File

@ -84,6 +84,9 @@ charon.plugins.eap-radius.secret =
charon.plugins.eap-radius.server =
IP/Hostname of RADIUS server.
charon.plugins.eap-radius.source =
Optional specific source IP to use.
charon.plugins.eap-radius.retransmit_base = 1.4
Base to use for calculating exponential back off.
@ -96,12 +99,12 @@ charon.plugins.eap-radius.retransmit_tries = 4
charon.plugins.eap-radius.servers {}
Section to specify multiple RADIUS servers.
Section to specify multiple RADIUS servers. The **nas_identifier**,
**secret**, **sockets** and **port** (or **auth_port**) options can be
specified for each server. A server's IP/Hostname can be configured using
the **address** option. The **acct_port** [1813] option can be used to
specify the port used for RADIUS accounting. For each RADIUS server a
priority can be specified using the **preference** [0] option. The
Section to specify multiple RADIUS servers. The **source**,
**nas_identifier**, **secret**, **sockets** and **port** (or **auth_port**)
options can be specified for each server. A server's IP/Hostname can be
configured using the **address** option. The **acct_port** [1813] option can
be used to specify the port used for RADIUS accounting. For each RADIUS
server a priority can be specified using the **preference** [0] option. The
retransmission time for each server can set set using **retransmit_base**,
**retransmit_timeout** and **retransmit_tries**.

View File

@ -20,7 +20,7 @@
# initialize & set some vars
# ============================
AC_INIT([strongSwan],[6.0.0])
AC_INIT([strongSwan],[6.0.2])
AM_INIT_AUTOMAKE(m4_esyscmd([
echo tar-ustar
echo subdir-objects
@ -33,21 +33,18 @@ AM_INIT_AUTOMAKE(m4_esyscmd([
esac
]))
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_MACRO_DIR([m4/config])
AC_CONFIG_MACRO_DIRS([m4/config m4/macros])
AC_CONFIG_HEADERS([config.h])
AC_DEFINE([CONFIG_H_INCLUDED], [], [defined if config.h included])
AC_DISABLE_STATIC
PKG_PROG_PKG_CONFIG
m4_include(m4/macros/split-package-version.m4)
SPLIT_PACKAGE_VERSION
# =================================
# check --enable-xxx & --with-xxx
# =================================
m4_include(m4/macros/with.m4)
ARG_WITH_SUBST([random-device], [/dev/random], [set the device to read real random data from])
ARG_WITH_SUBST([urandom-device], [/dev/urandom], [set the device to read pseudo random data from])
ARG_WITH_SUBST([strongswan-conf], [${sysconfdir}/strongswan.conf], [set the strongswan.conf file location])
@ -70,6 +67,7 @@ ARG_WITH_SET([mpz_powm_sec], [yes], [use the more side-channel resistant
ARG_WITH_SET([dev-headers], [no], [install strongSwan development headers to directory.])
ARG_WITH_SET([printf-hooks], [auto], [force the use of a specific printf hook implementation (auto, builtin, glibc, vstr).])
ARG_WITH_SET([rubygemdir], ["gem environment gemdir"], [path to install ruby gems to])
ARG_WITH_SET([testable-ke], [yes], [make key exchange implementations testable by providing a set_seed() method])
if test -n "$PKG_CONFIG"; then
systemdsystemunitdir_default=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
@ -128,8 +126,6 @@ fi
# convert script name to uppercase
AC_SUBST(ipsec_script_upper, [`echo -n "$ipsec_script" | tr a-z A-Z`])
m4_include(m4/macros/enable-disable.m4)
# crypto plugins
ARG_ENABL_SET([aes], [enable AES software implementation plugin.])
ARG_ENABL_SET([af-alg], [enable AF_ALG crypto interface to Linux Crypto API.])
@ -237,7 +233,6 @@ ARG_ENABL_SET([socket-win], [enable Winsock2 based socket implementation for
ARG_ENABL_SET([stroke], [enable the stroke configuration backend.])
ARG_ENABL_SET([smp], [enable SMP configuration and control interface. Requires libxml.])
ARG_ENABL_SET([sql], [enable SQL database configuration backend.])
ARG_ENABL_SET([uci], [enable OpenWRT UCI configuration plugin.])
ARG_DISBL_SET([vici], [disable strongSwan IKE generic IPC interface plugin.])
# attribute provider/consumer plugins
ARG_ENABL_SET([android-dns], [enable Android specific DNS handler.])
@ -609,6 +604,10 @@ AC_LINK_IFELSE(
AC_SUBST(ATOMICLIB)
LIBS=$saved_LIBS
# Some platforms require explicit linking to use POSIX regular expressions
AC_SEARCH_LIBS([regcomp], [regex], [AC_DEFINE([HAVE_REGEX], [], [have regcomp() etc.])])
# ------------------------------------------------------
AC_MSG_CHECKING(for dladdr)
@ -1045,7 +1044,7 @@ if test x$unbound = xtrue; then
fi
if test x$soup = xtrue; then
PKG_CHECK_MODULES(soup, [libsoup-2.4])
PKG_CHECK_MODULES(soup, [libsoup-3.0])
AC_SUBST(soup_CFLAGS)
AC_SUBST(soup_LIBS)
fi
@ -1239,11 +1238,6 @@ if test x$botan = xtrue; then
LIBS=$saved_LIBS
fi
if test x$uci = xtrue; then
AC_CHECK_LIB([uci],[uci_alloc_context],[LIBS="$LIBS"],[AC_MSG_ERROR([UCI library libuci not found])],[])
AC_CHECK_HEADER([uci.h],,[AC_MSG_ERROR([UCI header uci.h not found!])])
fi
if test x$android_dns = xtrue; then
AC_CHECK_LIB([cutils],[property_get],[LIBS="$LIBS"],[AC_MSG_ERROR([Android library libcutils not found])],[])
AC_CHECK_HEADER([cutils/properties.h],,[AC_MSG_ERROR([Android header cutils/properties.h not found!])])
@ -1351,6 +1345,10 @@ if test x$unwind_backtraces = xtrue; then
AC_SUBST(UNWINDLIB)
fi
if test "x$testable_ke" = xyes; then
AC_DEFINE([TESTABLE_KE], [1], [Define to 1 if key exchange methods should be testable.])
fi
AM_CONDITIONAL(USE_DEV_HEADERS, [test "x$dev_headers" != xno])
if test x$dev_headers = xyes; then
dev_headers="$includedir/strongswan"
@ -1517,8 +1515,6 @@ CFLAGS="$WARN_CFLAGS $CFLAGS"
# collect plugin list for strongSwan components
# ===============================================
m4_include(m4/macros/add-plugin.m4)
# plugin lists for all components
charon_plugins=
pool_plugins=
@ -1674,7 +1670,6 @@ ADD_PLUGIN([led], [c charon])
ADD_PLUGIN([duplicheck], [c charon])
ADD_PLUGIN([coupling], [c charon])
ADD_PLUGIN([radattr], [c charon])
ADD_PLUGIN([uci], [c charon])
ADD_PLUGIN([addrblock], [c charon])
ADD_PLUGIN([unity], [c charon])
ADD_PLUGIN([counters], [c charon])
@ -1769,7 +1764,6 @@ AM_CONDITIONAL(USE_STROKE, test x$stroke = xtrue)
AM_CONDITIONAL(USE_VICI, test x$vici = xtrue)
AM_CONDITIONAL(USE_MEDSRV, test x$medsrv = xtrue)
AM_CONDITIONAL(USE_MEDCLI, test x$medcli = xtrue)
AM_CONDITIONAL(USE_UCI, test x$uci = xtrue)
AM_CONDITIONAL(USE_OSX_ATTR, test x$osx_attr = xtrue)
AM_CONDITIONAL(USE_P_CSCF, test x$p_cscf = xtrue)
AM_CONDITIONAL(USE_ANDROID_DNS, test x$android_dns = xtrue)
@ -1955,14 +1949,16 @@ strongswan_options=
AM_COND_IF([USE_AIKGEN], [strongswan_options=${strongswan_options}" aikgen"])
AM_COND_IF([USE_ATTR_SQL], [strongswan_options=${strongswan_options}" pool"])
AM_COND_IF([USE_CHARON], [strongswan_options=${strongswan_options}" charon charon-logging"])
AM_COND_IF([USE_CHARON], [strongswan_options=${strongswan_options}" charon charon-logging iptfs"])
AM_COND_IF([USE_FILE_CONFIG], [strongswan_options=${strongswan_options}" starter"])
AM_COND_IF([USE_IMV_ATTESTATION], [strongswan_options=${strongswan_options}" attest"])
AM_COND_IF([USE_IMCV], [strongswan_options=${strongswan_options}" imcv"])
AM_COND_IF([USE_IMCV], [strongswan_options=${strongswan_options}" imcv imv_policy_manager"])
AM_COND_IF([USE_IMC_SWIMA], [strongswan_options=${strongswan_options}" sw-collector"])
AM_COND_IF([USE_IMV_SWIMA], [strongswan_options=${strongswan_options}" sec-updater"])
AM_COND_IF([USE_LIBTNCCS], [strongswan_options=${strongswan_options}" tnc"])
AM_COND_IF([USE_MANAGER], [strongswan_options=${strongswan_options}" manager"])
AM_COND_IF([USE_MEDSRV], [strongswan_options=${strongswan_options}" medsrv"])
AM_COND_IF([USE_NM], [strongswan_options=${strongswan_options}" charon-nm"])
AM_COND_IF([USE_PKI], [strongswan_options=${strongswan_options}" pki"])
AM_COND_IF([USE_SWANCTL], [strongswan_options=${strongswan_options}" swanctl"])
AM_COND_IF([USE_SYSTEMD], [strongswan_options=${strongswan_options}" charon-systemd"])
@ -2122,7 +2118,6 @@ AC_CONFIG_FILES([
src/libcharon/plugins/medcli/Makefile
src/libcharon/plugins/addrblock/Makefile
src/libcharon/plugins/unity/Makefile
src/libcharon/plugins/uci/Makefile
src/libcharon/plugins/ha/Makefile
src/libcharon/plugins/kernel_netlink/Makefile
src/libcharon/plugins/kernel_pfkey/Makefile

View File

@ -2,10 +2,12 @@
SUBDIRS =
if USE_LEGACY_SYSTEMD
if USE_FILE_CONFIG
if USE_CHARON
SUBDIRS += systemd-starter
endif
endif
endif
if USE_SYSTEMD
if USE_SWANCTL

532
m4/macros/host-cpu-c-abi.m4 Normal file
View File

@ -0,0 +1,532 @@
# host-cpu-c-abi.m4
# serial 20
dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
dnl From Bruno Haible and Sam Steingold.
dnl Sets the HOST_CPU variable to the canonical name of the CPU.
dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
dnl C language ABI (application binary interface).
dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
dnl config.h.
dnl
dnl This canonical name can be used to select a particular assembly language
dnl source file that will interoperate with C code on the given host.
dnl
dnl For example:
dnl * 'i386' and 'sparc' are different canonical names, because code for i386
dnl will not run on SPARC CPUs and vice versa. They have different
dnl instruction sets.
dnl * 'sparc' and 'sparc64' are different canonical names, because code for
dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
dnl mode, but not both.
dnl * 'mips' and 'mipsn32' are different canonical names, because they use
dnl different argument passing and return conventions for C functions, and
dnl although the instruction set of 'mips' is a large subset of the
dnl instruction set of 'mipsn32'.
dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
dnl different sizes for the C types like 'int' and 'void *', and although
dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
dnl * The same canonical name is used for different endiannesses. You can
dnl determine the endianness through preprocessor symbols:
dnl - 'arm': test __ARMEL__.
dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
dnl - 'powerpc64': test __BIG_ENDIAN__ vs. __LITTLE_ENDIAN__.
dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
dnl assembly language source files use such instructions, you will
dnl need to make the distinction.
dnl - Speed of execution of the common instruction set is reasonable across
dnl the entire family of CPUs. If you have assembly language source files
dnl that are optimized for particular CPU types (like GNU gmp has), you
dnl will need to make the distinction.
dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
AC_DEFUN([gl_HOST_CPU_C_ABI],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_C_ASM])
AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
[case "$host_cpu" in
changequote(,)dnl
i[34567]86 )
changequote([,])dnl
gl_cv_host_cpu_c_abi=i386
;;
x86_64 )
# On x86_64 systems, the C compiler may be generating code in one of
# these ABIs:
# - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
# - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
# with native Windows (mingw, MSVC).
# - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if (defined __x86_64__ || defined __amd64__ \
|| defined _M_X64 || defined _M_AMD64)
int ok;
#else
error fail
#endif
]])],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __ILP32__ || defined _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=x86_64-x32],
[gl_cv_host_cpu_c_abi=x86_64])],
[gl_cv_host_cpu_c_abi=i386])
;;
changequote(,)dnl
alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
changequote([,])dnl
gl_cv_host_cpu_c_abi=alpha
;;
arm* | aarch64 )
# Assume arm with EABI.
# On arm64 systems, the C compiler may be generating code in one of
# these ABIs:
# - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
# - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef __aarch64__
int ok;
#else
error fail
#endif
]])],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __ILP32__ || defined _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=arm64-ilp32],
[gl_cv_host_cpu_c_abi=arm64])],
[# Don't distinguish little-endian and big-endian arm, since they
# don't require different machine code for simple operations and
# since the user can distinguish them through the preprocessor
# defines __ARMEL__ vs. __ARMEB__.
# But distinguish arm which passes floating-point arguments and
# return values in integer registers (r0, r1, ...) - this is
# gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
# passes them in float registers (s0, s1, ...) and double registers
# (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
# sets the preprocessor defines __ARM_PCS (for the first case) and
# __ARM_PCS_VFP (for the second case), but older GCC does not.
echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
# Look for a reference to the register d0 in the .s file.
AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
gl_cv_host_cpu_c_abi=armhf
else
gl_cv_host_cpu_c_abi=arm
fi
rm -fr conftest*
])
;;
hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
# On hppa, the C compiler may be generating 32-bit code or 64-bit
# code. In the latter case, it defines _LP64 and __LP64__.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef __LP64__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=hppa64],
[gl_cv_host_cpu_c_abi=hppa])
;;
ia64* )
# On ia64 on HP-UX, the C compiler may be generating 64-bit code or
# 32-bit code. In the latter case, it defines _ILP32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=ia64-ilp32],
[gl_cv_host_cpu_c_abi=ia64])
;;
mips* )
# We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
# at 32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=mips64],
[# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
# In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if (_MIPS_SIM == _ABIN32)
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=mipsn32],
[gl_cv_host_cpu_c_abi=mips])])
;;
powerpc* )
# Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
# No need to distinguish them here; the caller may distinguish
# them based on the OS.
# On powerpc64 systems, the C compiler may still be generating
# 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
# be generating 64-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __powerpc64__ || defined __LP64__
int ok;
#else
error fail
#endif
]])],
[# On powerpc64, there are two ABIs on Linux: The AIX compatible
# one and the ELFv2 one. The latter defines _CALL_ELF=2.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined _CALL_ELF && _CALL_ELF == 2
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=powerpc64-elfv2],
[gl_cv_host_cpu_c_abi=powerpc64])
],
[gl_cv_host_cpu_c_abi=powerpc])
;;
rs6000 )
gl_cv_host_cpu_c_abi=powerpc
;;
riscv32 | riscv64 )
# There are 2 architectures (with variants): rv32* and rv64*.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if __riscv_xlen == 64
int ok;
#else
error fail
#endif
]])],
[cpu=riscv64],
[cpu=riscv32])
# There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
# Size of 'long' and 'void *':
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __LP64__
int ok;
#else
error fail
#endif
]])],
[main_abi=lp64],
[main_abi=ilp32])
# Float ABIs:
# __riscv_float_abi_double:
# 'float' and 'double' are passed in floating-point registers.
# __riscv_float_abi_single:
# 'float' are passed in floating-point registers.
# __riscv_float_abi_soft:
# No values are passed in floating-point registers.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __riscv_float_abi_double
int ok;
#else
error fail
#endif
]])],
[float_abi=d],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __riscv_float_abi_single
int ok;
#else
error fail
#endif
]])],
[float_abi=f],
[float_abi=''])
])
gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
;;
s390* )
# On s390x, the C compiler may be generating 64-bit (= s390x) code
# or 31-bit (= s390) code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __LP64__ || defined __s390x__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=s390x],
[gl_cv_host_cpu_c_abi=s390])
;;
sparc | sparc64 )
# UltraSPARCs running Linux have `uname -m` = "sparc64", but the
# C compiler still generates 32-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __sparcv9 || defined __arch64__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=sparc64],
[gl_cv_host_cpu_c_abi=sparc])
;;
*)
gl_cv_host_cpu_c_abi="$host_cpu"
;;
esac
])
dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
AC_SUBST([HOST_CPU])
AC_SUBST([HOST_CPU_C_ABI])
# This was
# AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
# AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
# earlier, but KAI C++ 3.2d doesn't like this.
sed -e 's/-/_/g' >> confdefs.h <<EOF
#ifndef __${HOST_CPU}__
#define __${HOST_CPU}__ 1
#endif
#ifndef __${HOST_CPU_C_ABI}__
#define __${HOST_CPU_C_ABI}__ 1
#endif
EOF
AH_TOP([/* CPU and C ABI indicator */
#ifndef __i386__
#undef __i386__
#endif
#ifndef __x86_64_x32__
#undef __x86_64_x32__
#endif
#ifndef __x86_64__
#undef __x86_64__
#endif
#ifndef __alpha__
#undef __alpha__
#endif
#ifndef __arm__
#undef __arm__
#endif
#ifndef __armhf__
#undef __armhf__
#endif
#ifndef __arm64_ilp32__
#undef __arm64_ilp32__
#endif
#ifndef __arm64__
#undef __arm64__
#endif
#ifndef __hppa__
#undef __hppa__
#endif
#ifndef __hppa64__
#undef __hppa64__
#endif
#ifndef __ia64_ilp32__
#undef __ia64_ilp32__
#endif
#ifndef __ia64__
#undef __ia64__
#endif
#ifndef __loongarch32__
#undef __loongarch32__
#endif
#ifndef __loongarch64__
#undef __loongarch64__
#endif
#ifndef __m68k__
#undef __m68k__
#endif
#ifndef __mips__
#undef __mips__
#endif
#ifndef __mipsn32__
#undef __mipsn32__
#endif
#ifndef __mips64__
#undef __mips64__
#endif
#ifndef __powerpc__
#undef __powerpc__
#endif
#ifndef __powerpc64__
#undef __powerpc64__
#endif
#ifndef __powerpc64_elfv2__
#undef __powerpc64_elfv2__
#endif
#ifndef __riscv32__
#undef __riscv32__
#endif
#ifndef __riscv64__
#undef __riscv64__
#endif
#ifndef __riscv32_ilp32__
#undef __riscv32_ilp32__
#endif
#ifndef __riscv32_ilp32f__
#undef __riscv32_ilp32f__
#endif
#ifndef __riscv32_ilp32d__
#undef __riscv32_ilp32d__
#endif
#ifndef __riscv64_ilp32__
#undef __riscv64_ilp32__
#endif
#ifndef __riscv64_ilp32f__
#undef __riscv64_ilp32f__
#endif
#ifndef __riscv64_ilp32d__
#undef __riscv64_ilp32d__
#endif
#ifndef __riscv64_lp64__
#undef __riscv64_lp64__
#endif
#ifndef __riscv64_lp64f__
#undef __riscv64_lp64f__
#endif
#ifndef __riscv64_lp64d__
#undef __riscv64_lp64d__
#endif
#ifndef __s390__
#undef __s390__
#endif
#ifndef __s390x__
#undef __s390x__
#endif
#ifndef __sh__
#undef __sh__
#endif
#ifndef __sparc__
#undef __sparc__
#endif
#ifndef __sparc64__
#undef __sparc64__
#endif
])
])
dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
dnl one.
dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
[case "$host_cpu" in
# CPUs that only support a 32-bit ABI.
arc \
| bfin \
| cris* \
| csky \
| epiphany \
| ft32 \
| h8300 \
| m68k \
| microblaze | microblazeel \
| nds32 | nds32le | nds32be \
| nios2 | nios2eb | nios2el \
| or1k* \
| or32 \
| sh | sh[1234] | sh[1234]e[lb] \
| tic6x \
| xtensa* )
gl_cv_host_cpu_c_abi_32bit=yes
;;
# CPUs that only support a 64-bit ABI.
changequote(,)dnl
alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
changequote([,])dnl
gl_cv_host_cpu_c_abi_32bit=no
;;
*)
if test -n "$gl_cv_host_cpu_c_abi"; then
dnl gl_HOST_CPU_C_ABI has already been run. Use its result.
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | loongarch32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | loongarch64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
esac
else
gl_cv_host_cpu_c_abi_32bit=unknown
fi
if test $gl_cv_host_cpu_c_abi_32bit = unknown; then
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[int test_pointer_size[sizeof (void *) - 5];
]])],
[gl_cv_host_cpu_c_abi_32bit=no],
[gl_cv_host_cpu_c_abi_32bit=yes])
fi
;;
esac
])
HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
])

334
m4/macros/lib-prefix.m4 Normal file
View File

@ -0,0 +1,334 @@
# lib-prefix.m4
# serial 23
dnl Copyright (C) 2001-2005, 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
dnl From Bruno Haible.
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
dnl to access previously installed libraries. The basic assumption is that
dnl a user will want packages to use other packages he previously installed
dnl with the same --prefix option.
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
dnl libraries, but is otherwise very convenient.
AC_DEFUN([AC_LIB_PREFIX],
[
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_ARG_WITH([lib-prefix],
[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
--without-lib-prefix don't search for libraries in includedir and libdir]],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/$acl_libdirstem"
fi
fi
])
if test $use_additional = yes; then
dnl Potentially add $additional_includedir to $CPPFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's already present in $CPPFLAGS,
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
for x in $CPPFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $CPPFLAGS.
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
fi
fi
fi
fi
dnl Potentially add $additional_libdir to $LDFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LDFLAGS.
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
fi
fi
fi
fi
fi
])
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
dnl acl_final_exec_prefix, containing the values to which $prefix and
dnl $exec_prefix will expand at the end of the configure script.
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
[
dnl Unfortunately, prefix and exec_prefix get only finally determined
dnl at the end of configure.
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
else
acl_final_prefix="$prefix"
fi
if test "X$exec_prefix" = "XNONE"; then
acl_final_exec_prefix='${prefix}'
else
acl_final_exec_prefix="$exec_prefix"
fi
acl_saved_prefix="$prefix"
prefix="$acl_final_prefix"
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
prefix="$acl_saved_prefix"
])
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
dnl variables prefix and exec_prefix bound to the values they will have
dnl at the end of the configure script.
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
[
acl_saved_prefix="$prefix"
prefix="$acl_final_prefix"
acl_saved_exec_prefix="$exec_prefix"
exec_prefix="$acl_final_exec_prefix"
$1
exec_prefix="$acl_saved_exec_prefix"
prefix="$acl_saved_prefix"
])
dnl AC_LIB_PREPARE_MULTILIB creates
dnl - a function acl_is_expected_elfclass, that tests whether standard input
dnl; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
dnl the basename of the libdir to try in turn, either "lib" or "lib64" or
dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
[
dnl There is no formal standard regarding lib, lib32, and lib64.
dnl On most glibc systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
dnl We determine the compiler's default mode by looking at the compiler's
dnl library search path. If at least one of its elements ends in /lib64 or
dnl points to a directory whose absolute pathname ends in /lib64, we use that
dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
dnl namely "lib".
dnl On Solaris systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
[AC_EGREP_CPP([Extensible Linking Format],
[#if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C))
Extensible Linking Format
#endif
],
[gl_cv_elf=yes],
[gl_cv_elf=no])
])
if test $gl_cv_elf = yes; then
# Extract the ELF class of a file (5th byte) in decimal.
# Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
if od -A x < /dev/null >/dev/null 2>/dev/null; then
# Use POSIX od.
func_elfclass ()
{
od -A n -t d1 -j 4 -N 1
}
else
# Use BSD hexdump.
func_elfclass ()
{
dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
echo
}
fi
# Use 'expr', not 'test', to compare the values of func_elfclass, because on
# Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002,
# not 1 or 2.
changequote(,)dnl
case $HOST_CPU_C_ABI_32BIT in
yes)
# 32-bit ABI.
acl_is_expected_elfclass ()
{
expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null
}
;;
no)
# 64-bit ABI.
acl_is_expected_elfclass ()
{
expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null
}
;;
*)
# Unknown.
acl_is_expected_elfclass ()
{
:
}
;;
esac
changequote([,])dnl
else
acl_is_expected_elfclass ()
{
:
}
fi
dnl Allow the user to override the result by setting acl_cv_libdirstems.
AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
[acl_cv_libdirstems],
[dnl Try 'lib' first, because that's the default for libdir in GNU, see
dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
acl_libdirstem=lib
acl_libdirstem2=
acl_libdirstem3=
case "$host_os" in
solaris*)
dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
dnl symlink is missing, so we set acl_libdirstem2 too.
if test $HOST_CPU_C_ABI_32BIT = no; then
acl_libdirstem2=lib/64
case "$host_cpu" in
sparc*) acl_libdirstem3=lib/sparcv9 ;;
i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
esac
fi
;;
netbsd*)
dnl On NetBSD/sparc64, there is a 'sparc' subdirectory that contains
dnl 32-bit libraries.
if test $HOST_CPU_C_ABI_32BIT != no; then
case "$host_cpu" in
sparc*) acl_libdirstem2=lib/sparc ;;
esac
fi
;;
*)
dnl If $CC generates code for a 32-bit ABI, the libraries are
dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
dnl Find the compiler's search path. However, non-system compilers
dnl sometimes have odd library search paths. But we can't simply invoke
dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
| sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
if test $HOST_CPU_C_ABI_32BIT != no; then
# 32-bit or unknown ABI.
if test -d /usr/lib32; then
acl_libdirstem2=lib32
fi
fi
if test $HOST_CPU_C_ABI_32BIT != yes; then
# 64-bit or unknown ABI.
if test -d /usr/lib64; then
acl_libdirstem3=lib64
fi
fi
if test -n "$searchpath"; then
acl_saved_IFS="${IFS= }"; IFS=":"
for searchdir in $searchpath; do
if test -d "$searchdir"; then
case "$searchdir" in
*/lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
*/lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
*/../ | */.. )
# Better ignore directories of this form. They are misleading.
;;
*) searchdir=`cd "$searchdir" && pwd`
case "$searchdir" in
*/lib32 ) acl_libdirstem2=lib32 ;;
*/lib64 ) acl_libdirstem3=lib64 ;;
esac ;;
esac
fi
done
IFS="$acl_saved_IFS"
if test $HOST_CPU_C_ABI_32BIT = yes; then
# 32-bit ABI.
acl_libdirstem3=
fi
if test $HOST_CPU_C_ABI_32BIT = no; then
# 64-bit ABI.
acl_libdirstem2=
fi
fi
;;
esac
test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
])
dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
dnl acl_libdirstem3.
changequote(,)dnl
acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
changequote([,])dnl
])

View File

@ -28,8 +28,8 @@ build_botan()
git clone https://github.com/randombit/botan.git $BOTAN_DIR &&
cd $BOTAN_DIR &&
git checkout -qf $BOTAN_REV &&
python ./configure.py --amalgamation $BOTAN_CONFIG &&
make -j4 libs >/dev/null &&
./configure.py --amalgamation $BOTAN_CONFIG &&
make -j$(nproc) libs >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -37,7 +37,7 @@ build_botan()
build_wolfssl()
{
WOLFSSL_REV=v5.7.4-stable
WOLFSSL_REV=v5.8.2-stable
WOLFSSL_DIR=$DEPS_BUILD_DIR/wolfssl
if test -d "$WOLFSSL_DIR"; then
@ -54,7 +54,7 @@ build_wolfssl()
--enable-aesccm --enable-aesctr --enable-camellia
--enable-curve25519 --enable-curve448 --enable-des3
--enable-ecccustcurves --enable-ed25519 --enable-ed448
--enable-keygen --enable-kyber --with-max-rsa-bits=8192
--enable-keygen --enable-mlkem --with-max-rsa-bits=8192
--enable-md4 --enable-rsapss --enable-sha3 --enable-shake256"
git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR &&
@ -62,7 +62,7 @@ build_wolfssl()
git checkout -qf $WOLFSSL_REV &&
./autogen.sh &&
./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -84,7 +84,7 @@ build_tss2()
curl -L $TSS2_SRC | tar xz -C $DEPS_BUILD_DIR &&
cd $TSS2_DIR &&
./configure --prefix=$DEPS_PREFIX --disable-doxygen-doc &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -92,10 +92,8 @@ build_tss2()
build_openssl()
{
SSL_REV=3.1.1
SSL_PKG=openssl-$SSL_REV
SSL_DIR=$DEPS_BUILD_DIR/$SSL_PKG
SSL_SRC=https://www.openssl.org/source/$SSL_PKG.tar.gz
SSL_REV=openssl-3.5.1
SSL_DIR=$DEPS_BUILD_DIR/openssl
SSL_INS=$DEPS_PREFIX/ssl
SSL_OPT="-d shared no-dtls no-ssl3 no-zlib no-idea no-psk
no-tests enable-rfc3779 enable-ec_nistp_64_gcc_128"
@ -117,7 +115,7 @@ build_openssl()
echo "$ build_openssl()"
curl -L $SSL_SRC | tar xz -C $DEPS_BUILD_DIR || exit $?
git clone https://github.com/openssl/openssl.git --depth 1 -b $SSL_REV $SSL_DIR || exit $?
if [ "$TEST" = "android" ]; then
OPENSSL_SRC=${SSL_DIR} \
@ -125,7 +123,7 @@ build_openssl()
else
cd $SSL_DIR &&
./config --prefix=$SSL_INS --openssldir=$SSL_INS --libdir=lib $SSL_OPT &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install_sw >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -134,7 +132,7 @@ build_openssl()
build_awslc()
{
LC_REV=1.45.0
LC_REV=1.55.0
LC_PKG=aws-lc-$LC_REV
LC_DIR=$DEPS_BUILD_DIR/$LC_PKG
LC_SRC=https://github.com/aws/aws-lc/archive/refs/tags/v${LC_REV}.tar.gz
@ -204,6 +202,7 @@ prepare_system_openssl()
fi
}
: ${SRC_DIR=$PWD}
: ${BUILD_DIR=$PWD}
: ${DEPS_BUILD_DIR=$BUILD_DIR/..}
: ${DEPS_PREFIX=/usr/local}
@ -273,14 +272,7 @@ printf-builtin)
prepare_system_openssl $1
fi
;;
all|alpine|codeql|coverage|sonarcloud|no-dbg)
if [ "$TEST" = "sonarcloud" ]; then
if [ -z "$SONAR_PROJECT" -o -z "$SONAR_ORGANIZATION" -o -z "$SONAR_TOKEN" ]; then
echo "The SONAR_PROJECT, SONAR_ORGANIZATION and SONAR_TOKEN" \
"environment variables are required to run this test"
exit 1
fi
fi
all|alpine|codeql|coverage|sonarcloud|no-dbg|no-testable-ke)
if [ "$TEST" = "codeql" ]; then
# don't run tests, only analyze built code
TARGET=
@ -291,34 +283,39 @@ all|alpine|codeql|coverage|sonarcloud|no-dbg)
CONFIG="--enable-all --disable-android-dns --disable-android-log
--disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-padlock --disable-fuzzing
--disable-osx-attr --disable-tkm --disable-uci
--disable-osx-attr --disable-tkm
--disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
# not enabled on the build server
CONFIG="$CONFIG --disable-af-alg"
# unable to build Botan on Ubuntu 20.04
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
CONFIG="$CONFIG --disable-botan"
fi
if test "$TEST" != "coverage"; then
CONFIG="$CONFIG --disable-coverage"
else
DEPS="$DEPS lcov"
TARGET="coverage"
fi
DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
if [ "$TEST" = "no-testable-ke" ]; then
CONFIG="$CONFIG --without-testable-ke"
fi
DEPS="$DEPS libcurl4-gnutls-dev libsoup-3.0-dev libunbound-dev libldns-dev
libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
libldap2-dev libpcsclite-dev libpam0g-dev binutils-dev libnm-dev
libgcrypt20-dev libjson-c-dev python3-pip libtspi-dev libsystemd-dev
libselinux1-dev libiptc-dev"
libgcrypt20-dev libjson-c-dev libtspi-dev libsystemd-dev
libselinux1-dev libiptc-dev ruby-rubygems python3-build tox"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "22.04" -a "$1" = "build-deps" ]; then
# python3-build is broken on 22.04 with venv (https://bugs.launchpad.net/ubuntu/+source/python-build/+bug/1992108)
# while installing python3-virtualenv should help, it doesn't. as even
# after uninstalling python3-venv, build prefers the latter
sudo python3 -m pip install --upgrade build
fi
if [ "$TEST" = "alpine" ]; then
# override the whole list for alpine
DEPS="git gmp-dev openldap-dev curl-dev ldns-dev unbound-dev libsoup-dev
tpm2-tss-dev tpm2-tss-sys mariadb-dev wolfssl-dev libgcrypt-dev
botan3-dev pcsc-lite-dev networkmanager-dev linux-pam-dev
iptables-dev libselinux-dev binutils-dev libunwind-dev ruby
py3-setuptools py3-build py3-tox"
DEPS="git gmp-dev openldap-dev curl-dev ldns-dev unbound-dev libsoup3-dev
libxml2-dev tpm2-tss-dev tpm2-tss-sys mariadb-dev wolfssl-dev
libgcrypt-dev botan3-dev pcsc-lite-dev networkmanager-dev
linux-pam-dev iptables-dev libselinux-dev binutils-dev libunwind-dev
ruby py3-setuptools py3-build py3-tox"
# musl does not provide backtrace(), so use libunwind
CONFIG="$CONFIG --enable-unwind-backtraces"
# alpine doesn't have systemd
@ -328,11 +325,8 @@ all|alpine|codeql|coverage|sonarcloud|no-dbg)
# and no Clearsilver
CONFIG="$CONFIG --disable-fast --disable-manager --disable-medsrv"
fi
PYDEPS="build tox"
if test "$1" = "build-deps"; then
if [ "$ID" = "ubuntu" -a "$VERSION_ID" != "20.04" ]; then
build_botan
fi
build_botan
build_wolfssl
build_tss2
fi
@ -400,10 +394,9 @@ macos)
--enable-socket-default --enable-sshkey --enable-stroke
--enable-swanctl --enable-unity --enable-updown
--enable-x509 --enable-xauth-generic"
DEPS="automake autoconf libtool bison gettext gperf pkgconf openssl@1.1 curl"
DEPS="automake autoconf libtool bison gperf pkgconf openssl@1.1 curl"
BREW_PREFIX=$(brew --prefix)
export PATH=$BREW_PREFIX/opt/bison/bin:$PATH
export ACLOCAL_PATH=$BREW_PREFIX/opt/gettext/share/aclocal:$ACLOCAL_PATH
for pkg in openssl@1.1 curl
do
PKG_CONFIG_PATH=$BREW_PREFIX/opt/$pkg/lib/pkgconfig:$PKG_CONFIG_PATH
@ -457,11 +450,11 @@ fuzzing)
;;
nm)
DEPS="gnome-common libsecret-1-dev libgtk-3-dev libnm-dev libnma-dev"
# Ubuntu 20.04 requires this package explicitly for the ITS rules for the .metainfo.xml file
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
DEPS="$DEPS appstream"
ORIG_SRC_DIR="$SRC_DIR"
SRC_DIR="$ORIG_SRC_DIR/src/frontends/gnome"
if [ "$ORIG_SRC_DIR" = "$BUILD_DIR" ]; then
BUILD_DIR="$SRC_DIR"
fi
cd src/frontends/gnome
# don't run ./configure with ./autogen.sh
export NOCONFIGURE=1
;;
@ -484,11 +477,11 @@ deps)
case "$OS_NAME" in
linux)
sudo apt-get update -y && \
sudo apt-get install -y bison flex gperf gettext $DEPS
sudo apt-get install -y automake autoconf libtool pkgconf bison flex gperf $DEPS
;;
alpine)
apk add --no-cache build-base automake autoconf libtool pkgconfig && \
apk add --no-cache bison flex gperf gettext-dev tzdata $DEPS
apk add --no-cache bison flex gperf tzdata $DEPS
;;
macos)
brew update && \
@ -496,15 +489,11 @@ deps)
;;
freebsd)
pkg install -y automake autoconf libtool pkgconf && \
pkg install -y bison flex gperf gettext $DEPS
pkg install -y bison flex gperf $DEPS
;;
esac
exit $?
;;
pydeps)
test -z "$PYDEPS" || pip3 -q install --user $PYDEPS
exit $?
;;
build-deps)
exit
;;
@ -533,10 +522,15 @@ case "$TEST" in
;;
esac
echo "$ ./autogen.sh"
./autogen.sh || exit $?
cd $SRC_DIR
if [ ! -f ./configure ]; then
echo "$ ./autogen.sh"
./autogen.sh || exit $?
fi
cd $BUILD_DIR
echo "$ CC=$CC CFLAGS=\"$CFLAGS\" ./configure $CONFIG"
CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG || exit $?
CC="$CC" CFLAGS="$CFLAGS" $SRC_DIR/configure $CONFIG || exit $?
case "$TEST" in
apidoc)
@ -551,10 +545,10 @@ case "$TEST" in
sonarcloud)
# without target, coverage is currently not supported anyway because
# sonarqube only supports gcov, not lcov
build-wrapper-linux-x86-64 --out-dir bw-output make -j4 || exit $?
build-wrapper-linux-x86-64 --out-dir $BUILD_WRAPPER_OUT_DIR make -j$(nproc) || exit $?
;;
*)
make -j4 $TARGET || exit $?
make -j$(nproc) $TARGET || exit $?
;;
esac
@ -566,23 +560,9 @@ apidoc)
fi
rm make.warnings
;;
sonarcloud)
sonar-scanner \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=${SONAR_PROJECT} \
-Dsonar.organization=${SONAR_ORGANIZATION} \
-Dsonar.token=${SONAR_TOKEN} \
-Dsonar.projectVersion=$(git describe --exclude 'android-*')+${BUILD_NUMBER} \
-Dsonar.sources=. \
-Dsonar.cfamily.threads=2 \
-Dsonar.cfamily.analysisCache.mode=fs \
-Dsonar.cfamily.analysisCache.path=$HOME/.sonar-cache \
-Dsonar.cfamily.build-wrapper-output=bw-output || exit $?
rm -r bw-output .scannerwork
;;
android)
rm -r strongswan-*
cd src/frontends/android
cd $SRC_DIR/src/frontends/android
echo "$ ./gradlew build"
NDK_CCACHE=ccache ./gradlew build --info || exit $?
;;
@ -590,6 +570,7 @@ android)
;;
esac
cd $SRC_DIR
# ensure there are no unignored build artifacts (or other changes) in the Git repo
unclean="$(git status --porcelain)"
if test -n "$unclean"; then

View File

@ -1,3 +1,5 @@
sonar.sources=.
# exclude these files completely
sonar.exclusions=\
src/manager/templates/static/jquery.js, \

View File

@ -170,7 +170,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
case PROF_V1_XAUTH_AM:
case PROF_V1_XAUTH_PSK_AM:
case PROF_V1_HYBRID_AM:
peer.aggressive = TRUE;
peer.options |= OPT_IKEV1_AGGRESSIVE;
/* FALL */
case PROF_V1_PUB:
case PROF_V1_XAUTH:
@ -585,7 +585,7 @@ cmd_connection_t *cmd_connection_create()
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create_with_prio(
(callback_job_cb_t)initiate, this, NULL,
(callback_job_cancel_t)return_false, JOB_PRIO_CRITICAL));
callback_job_cancel_thread, JOB_PRIO_CRITICAL));
return &this->public;
}

View File

@ -217,6 +217,18 @@ int main(int argc, char *argv[])
lib->settings->set_default_str(lib->settings,
"charon-nm.plugins.kernel-netlink.fwmark", "!210");
/* trigger a DPD to verify the current path is working */
lib->settings->set_default_str(lib->settings,
"charon-nm.check_current_path", "yes");
/* fail more quickly so users don't have to wait too long for a new SA */
lib->settings->set_default_str(lib->settings,
"charon-nm.retransmit_tries", "3");
lib->settings->set_default_str(lib->settings,
"charon-nm.retransmit_timeout", "2.0");
lib->settings->set_default_str(lib->settings,
"charon-nm.retransmit_base", "1.4");
DBG1(DBG_DMN, "Starting charon NetworkManager backend (strongSwan "VERSION")");
if (lib->integrity)
{

View File

@ -78,7 +78,8 @@ static job_requeue_t run(nm_backend_t *this)
/**
* Cancel the GLib Main Event Loop
*/
static bool cancel(nm_backend_t *this)
CALLBACK(cancel, bool,
nm_backend_t *this)
{
if (this->loop)
{
@ -152,7 +153,7 @@ static bool nm_backend_init()
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create_with_prio((callback_job_cb_t)run, this,
NULL, (callback_job_cancel_t)cancel, JOB_PRIO_CRITICAL));
NULL, cancel, JOB_PRIO_CRITICAL));
return TRUE;
}

View File

@ -195,7 +195,7 @@ nm_handler_t *nm_handler_create()
.public = {
.handler = {
.handle = _handle,
.release = nop,
.release = (void*)nop,
.create_attribute_enumerator = _create_attribute_enumerator,
},
.create_enumerator = _create_enumerator,

View File

@ -214,6 +214,10 @@ static void signal_ip_config(NMVpnServicePlugin *plugin,
handler = priv->handler;
/* we can reconnect automatically if interfaces change */
g_variant_builder_add (&builder, "{sv}", NM_VPN_PLUGIN_CAN_PERSIST,
g_variant_new_boolean (TRUE));
/* NM apparently requires to know the gateway (it uses it to install a
* direct route via physical interface if conflicting routes are passed) */
other = ike_sa->get_other_host(ike_sa);

View File

@ -25,7 +25,9 @@
void charon_esa_acquire(result_type *res, const sp_id_type sp_id)
{
kernel_acquire_data_t data = {};
kernel_acquire_data_t data = {
.cpu = CPU_ID_MAX,
};
DBG1(DBG_KNL, "ees: acquire received for reqid %u", sp_id);
charon->kernel->acquire(charon->kernel, sp_id, &data);

View File

@ -265,7 +265,7 @@ static peer_cfg_t *load_peer_config(private_config_t *this,
.cert_policy = CERT_ALWAYS_SEND,
.unique = UNIQUE_NO,
.keyingtries = 1,
.no_mobike = TRUE,
.options = OPT_NO_MOBIKE,
};
ike_cfg = load_ike_config(this, settings, config);

View File

@ -9,8 +9,8 @@ android {
minSdkVersion 21
targetSdkVersion 34
versionCode 87
versionName "2.5.3"
versionCode 91
versionName "2.5.6"
externalNativeBuild {
ndkBuild {
@ -45,8 +45,8 @@ android {
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.lifecycle:lifecycle-process:2.8.3'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.lifecycle:lifecycle-process:2.9.1'
implementation 'androidx.preference:preference:1.2.1'
implementation 'com.google.android.material:material:1.12.0'
testImplementation 'junit:junit:4.13.2'

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2023 Relution GmbH
* Copyright (C) 2012-2024 Tobias Brunner
* Copyright (C) 2012-2025 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
*
@ -67,6 +67,9 @@ public class DatabaseHelper extends SQLiteOpenHelper
new DbColumn(VpnProfileDataSource.KEY_IKE_PROPOSAL, "TEXT", 15),
new DbColumn(VpnProfileDataSource.KEY_ESP_PROPOSAL, "TEXT", 15),
new DbColumn(VpnProfileDataSource.KEY_DNS_SERVERS, "TEXT", 17),
new DbColumn(VpnProfileDataSource.KEY_PROXY_HOST, "TEXT", 19),
new DbColumn(VpnProfileDataSource.KEY_PROXY_PORT, "INTEGER", 19),
new DbColumn(VpnProfileDataSource.KEY_PROXY_EXCLUSIONS, "TEXT", 19),
});
public static final DbTable TABLE_TRUSTED_CERTIFICATE = new DbTable(TABLE_NAME_TRUSTED_CERTIFICATE, 18, new DbColumn[]{
@ -84,7 +87,7 @@ public class DatabaseHelper extends SQLiteOpenHelper
new DbColumn(ManagedUserCertificate.KEY_PASSWORD, "TEXT", 18),
});
private static final int DATABASE_VERSION = 18;
private static final int DATABASE_VERSION = 19;
private static final Set<DbTable> TABLES;

View File

@ -83,6 +83,14 @@ public class ManagedVpnProfile extends VpnProfile
setIncludedSubnets(getString(splitTunneling, VpnProfileDataSource.KEY_INCLUDED_SUBNETS));
}
final Bundle proxyServer = bundle.getBundle(VpnProfileDataSource.KEY_PROXY_SERVER);
if (proxyServer != null)
{
setProxyHost(getString(proxyServer, VpnProfileDataSource.KEY_PROXY_HOST));
setProxyPort(getInt(proxyServer, VpnProfileDataSource.KEY_PROXY_PORT, 1, 65_535));
setProxyExclusions(getString(proxyServer, VpnProfileDataSource.KEY_PROXY_EXCLUSIONS));
}
setSplitTunneling(splitFlags);
setFlags(flags);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2019 Tobias Brunner
* Copyright (C) 2012-2025 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
*
@ -42,8 +42,8 @@ public class VpnProfile implements Cloneable
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
private String mRemoteId, mLocalId, mExcludedSubnets, mIncludedSubnets, mSelectedApps;
private String mIkeProposal, mEspProposal, mDnsServers;
private Integer mMTU, mPort, mSplitTunneling, mNATKeepAlive, mFlags;
private String mIkeProposal, mEspProposal, mDnsServers, mProxyHost, mProxyExclusions;
private Integer mMTU, mPort, mProxyPort, mSplitTunneling, mNATKeepAlive, mFlags;
private SelectedAppsHandling mSelectedAppsHandling = SelectedAppsHandling.SELECTED_APPS_DISABLE;
private VpnType mVpnType;
private UUID mUUID;
@ -313,6 +313,36 @@ public class VpnProfile implements Cloneable
return mSelectedAppsHandling;
}
public String getProxyHost()
{
return mProxyHost;
}
public void setProxyHost(String proxy)
{
this.mProxyHost = proxy;
}
public Integer getProxyPort()
{
return mProxyPort;
}
public void setProxyPort(Integer port)
{
this.mProxyPort = port;
}
public String getProxyExclusions()
{
return mProxyExclusions;
}
public void setProxyExclusions(String exclusions)
{
this.mProxyExclusions = exclusions;
}
public Integer getSplitTunneling()
{
return mSplitTunneling;

View File

@ -50,6 +50,10 @@ public interface VpnProfileDataSource
String KEY_IKE_PROPOSAL = "ike_proposal";
String KEY_ESP_PROPOSAL = "esp_proposal";
String KEY_DNS_SERVERS = "dns_servers";
String KEY_PROXY_SERVER = "proxy_server";
String KEY_PROXY_HOST = "proxy_host";
String KEY_PROXY_PORT = "proxy_port";
String KEY_PROXY_EXCLUSIONS = "proxy_exclusions";
String KEY_READ_ONLY = "read_only";
/**

View File

@ -151,6 +151,9 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
profile.setIkeProposal(cursor.getString(cursor.getColumnIndexOrThrow(KEY_IKE_PROPOSAL)));
profile.setEspProposal(cursor.getString(cursor.getColumnIndexOrThrow(KEY_ESP_PROPOSAL)));
profile.setDnsServers(cursor.getString(cursor.getColumnIndexOrThrow(KEY_DNS_SERVERS)));
profile.setProxyHost(cursor.getString(cursor.getColumnIndexOrThrow(KEY_PROXY_HOST)));
profile.setProxyPort(getInt(cursor, cursor.getColumnIndexOrThrow(KEY_PROXY_PORT)));
profile.setProxyExclusions(cursor.getString(cursor.getColumnIndexOrThrow(KEY_PROXY_EXCLUSIONS)));
return profile;
}
@ -179,6 +182,9 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
values.put(KEY_IKE_PROPOSAL, profile.getIkeProposal());
values.put(KEY_ESP_PROPOSAL, profile.getEspProposal());
values.put(KEY_DNS_SERVERS, profile.getDnsServers());
values.put(KEY_PROXY_HOST, profile.getProxyHost());
values.put(KEY_PROXY_PORT, profile.getProxyPort());
values.put(KEY_PROXY_EXCLUSIONS, profile.getProxyExclusions());
return values;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2018 Tobias Brunner
* Copyright (C) 2012-2025 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
*
@ -30,6 +30,7 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.ProxyInfo;
import android.net.VpnService;
import android.os.Build;
import android.os.Bundle;
@ -72,6 +73,8 @@ import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.SortedSet;
@ -1116,6 +1119,7 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
private final List<InetAddress> mDnsServers = new ArrayList<>();
private int mMtu;
private boolean mIPv4Seen, mIPv6Seen, mDnsServersConfigured;
private ProxyInfo mProxyServer;
public BuilderCache(VpnProfile profile)
{
@ -1169,6 +1173,17 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
}
}
if (profile.getProxyHost() != null)
{
int port = profile.getProxyPort() != null ? profile.getProxyPort() : Constants.PROXY_PORT_DEFAULT;
List<String> exclusions = new ArrayList<>();
if (profile.getProxyExclusions() != null)
{
Collections.addAll(exclusions, profile.getProxyExclusions().split("\\s+"));
}
mProxyServer = ProxyInfo.buildDirectProxy(profile.getProxyHost(), port, exclusions);
}
/* set a default MTU, will be set by the daemon for regular interfaces */
Integer mtu = profile.getMTU();
mMtu = mtu == null ? Constants.MTU_MAX : mtu;
@ -1249,7 +1264,7 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
}
}
public void applyData(VpnService.Builder builder)
public void applyData(Builder builder)
{
for (IPRange address : mAddresses)
{
@ -1375,6 +1390,10 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
break;
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && mProxyServer != null)
{
builder.setHttpProxy(mProxyServer);
}
builder.setMtu(mMtu);
}

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.ArrayList;
@ -55,7 +56,7 @@ public class SimpleFetcher
}
future = mExecutor.submit(() -> {
URL url = new URL(uri);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
HttpURLConnection conn = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY);
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
conn.setRequestProperty("Connection", "close");

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2023 Relution GmbH
* Copyright (C) 2014-2024 Tobias Brunner
* Copyright (C) 2014-2025 Tobias Brunner
*
* Copyright (C) secunet Security Networks AG
*
@ -38,14 +38,10 @@ import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import androidx.annotation.NonNull;
import androidx.core.os.HandlerCompat;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ProcessLifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
public class StrongSwanApplication extends Application implements DefaultLifecycleObserver
public class StrongSwanApplication extends Application
{
private static final String TAG = StrongSwanApplication.class.getSimpleName();
@ -80,6 +76,7 @@ public class StrongSwanApplication extends Application implements DefaultLifecyc
public void onCreate()
{
super.onCreate();
StrongSwanApplication.mContext = getApplicationContext();
StrongSwanApplication.mInstance = this;
@ -92,24 +89,12 @@ public class StrongSwanApplication extends Application implements DefaultLifecyc
mUserCertificateManager = new ManagedUserCertificateManager(mContext, mManagedConfigurationService, mDatabaseHelper);
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
}
@Override
public void onResume(@NonNull LifecycleOwner owner)
{
reloadManagedConfigurationAndNotifyListeners();
final IntentFilter restrictionsFilter = new IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
registerReceiver(mRestrictionsReceiver, restrictionsFilter);
}
@Override
public void onPause(@NonNull LifecycleOwner owner)
{
unregisterReceiver(mRestrictionsReceiver);
}
private void reloadManagedConfigurationAndNotifyListeners()
{
final Set<String> uuids = new HashSet<>(mManagedConfigurationService.getManagedProfiles().keySet());

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2023 Relution GmbH
* Copyright (C) 2012-2020 Tobias Brunner
* Copyright (C) 2012-2025 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
*
@ -147,6 +147,10 @@ public class VpnProfileDetailActivity extends AppCompatActivity
private TextView mProfileId;
private EditText mDnsServers;
private TextInputLayoutHelper mDnsServersWrap;
private EditText mProxyHost;
private EditText mProxyPort;
private TextInputLayoutHelper mProxyPortWrap;
private EditText mProxyExclusions;
private final ActivityResultLauncher<Intent> mInstallPKCS12 = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
@ -254,6 +258,11 @@ public class VpnProfileDetailActivity extends AppCompatActivity
/* make the link clickable */
((TextView)findViewById(R.id.proposal_intro)).setMovementMethod(LinkMovementMethod.getInstance());
mProxyHost = findViewById(R.id.proxy_host);
mProxyPort = findViewById(R.id.proxy_port);
mProxyPortWrap = findViewById(R.id.proxy_port_wrap);
mProxyExclusions = findViewById(R.id.proxy_exclusions);
mProfileIdLabel = findViewById(R.id.profile_id_label);
mProfileId = findViewById(R.id.profile_id);
@ -584,7 +593,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mProfile.getIncludedSubnets() != null || mProfile.getExcludedSubnets() != null ||
mProfile.getSelectedAppsHandling() != SelectedAppsHandling.SELECTED_APPS_DISABLE ||
mProfile.getIkeProposal() != null || mProfile.getEspProposal() != null ||
mProfile.getDnsServers() != null || mProfile.getLocalId() != null;
mProfile.getDnsServers() != null || mProfile.getLocalId() != null ||
mProfile.getProxyHost() != null || mProfile.getProxyPort() != null ||
mProfile.getProxyExclusions() != null;
}
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
@ -700,6 +711,11 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mDnsServersWrap.setError(getString(R.string.alert_text_no_ips));
valid = false;
}
if (!validateInteger(mProxyPort, 1, 65535))
{
mProxyPortWrap.setError(String.format(getString(R.string.alert_text_out_of_range), 1, 65535));
valid = false;
}
return valid;
}
@ -749,6 +765,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mProfile.setIkeProposal(getString(mIkeProposal));
mProfile.setEspProposal(getString(mEspProposal));
mProfile.setDnsServers(getString(mDnsServers));
mProfile.setProxyHost(getString(mProxyHost));
mProfile.setProxyPort(getInteger(mProxyPort));
mProfile.setProxyExclusions(getString(mProxyExclusions));
}
/**
@ -786,6 +805,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mIkeProposal.setText(mProfile.getIkeProposal());
mEspProposal.setText(mProfile.getEspProposal());
mDnsServers.setText(mProfile.getDnsServers());
mProxyHost.setText(mProfile.getProxyHost());
mProxyPort.setText(mProfile.getProxyPort() != null ? mProfile.getProxyPort().toString() : null);
mProxyExclusions.setText(mProfile.getProxyExclusions());
mProfileId.setText(mProfile.getUUID().toString());
flags = mProfile.getFlags();
useralias = mProfile.getUserCertificateAlias();
@ -877,6 +899,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mIkeProposal.setEnabled(!readOnly);
mEspProposal.setEnabled(!readOnly);
mDnsServers.setEnabled(!readOnly);
mProxyHost.setEnabled(!readOnly);
mProxyPort.setEnabled(!readOnly);
mProxyExclusions.setEnabled(!readOnly);
mSelectVpnType.setEnabled(!readOnly);
mCertReq.setEnabled(!readOnly);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2020 Tobias Brunner
* Copyright (C) 2016-2025 Tobias Brunner
*
* Copyright (C) secunet Security Networks AG
*
@ -556,6 +556,14 @@ public class VpnProfileImportActivity extends AppCompatActivity
flags |= VpnProfile.FLAGS_IPv6_TRANSPORT;
}
JSONObject proxy = obj.optJSONObject("proxy");
if (proxy != null)
{
profile.setProxyHost(proxy.optString("host"));
profile.setProxyPort(getInteger(proxy, "port", 1, 65535));
profile.setProxyExclusions(getFlatStringList(proxy, "exclusions"));
}
JSONObject split = obj.optJSONObject("split-tunneling");
if (split != null)
{
@ -569,8 +577,8 @@ public class VpnProfileImportActivity extends AppCompatActivity
profile.setSplitTunneling(st == 0 ? null : st);
}
/* only one of these can be set, prefer specific apps */
String selectedApps = getApps(obj.optJSONArray("apps"));
String excludedApps = getApps(obj.optJSONArray("excluded-apps"));
String selectedApps = getFlatStringList(obj, "apps");
String excludedApps = getFlatStringList(obj, "excluded-apps");
if (!TextUtils.isEmpty(selectedApps))
{
profile.setSelectedApps(selectedApps);
@ -606,24 +614,8 @@ public class VpnProfileImportActivity extends AppCompatActivity
private String getSubnets(JSONObject split, String key) throws JSONException
{
ArrayList<String> subnets = new ArrayList<>();
JSONArray arr = split.optJSONArray(key);
if (arr != null)
{
for (int i = 0; i < arr.length(); i++)
{ /* replace all spaces, e.g. in "192.168.1.1 - 192.168.1.10" */
subnets.add(arr.getString(i).replace(" ", ""));
}
}
else
{
String value = split.optString(key, null);
if (!TextUtils.isEmpty(value))
{
subnets.add(value);
}
}
if (subnets.size() > 0)
ArrayList<String> subnets = getStringList(split, key);
if (!subnets.isEmpty())
{
String joined = TextUtils.join(" ", subnets);
IPRangeSet ranges = IPRangeSet.fromString(joined);
@ -639,25 +631,8 @@ public class VpnProfileImportActivity extends AppCompatActivity
private String getAddressList(JSONObject obj, String key) throws JSONException
{
ArrayList<String> addrs = new ArrayList<>();
JSONArray arr = obj.optJSONArray(key);
if (arr != null)
{
for (int i = 0; i < arr.length(); i++)
{
String addr = arr.getString(i).replace(" ", "");
addrs.add(addr);
}
}
else
{
String value = obj.optString(key, null);
if (!TextUtils.isEmpty(value))
{
Collections.addAll(addrs, value.split("\\s+"));
}
}
if (addrs.size() > 0)
ArrayList<String> addrs = getStringList(obj, key);
if (!addrs.isEmpty())
{
for (String addr : addrs)
{
@ -675,17 +650,39 @@ public class VpnProfileImportActivity extends AppCompatActivity
return null;
}
private String getApps(JSONArray arr) throws JSONException
private String getFlatStringList(JSONObject obj, String key) throws JSONException
{
ArrayList<String> apps = new ArrayList<>();
ArrayList<String> list = getStringList(obj, key);
if (!list.isEmpty())
{
return TextUtils.join(" ", list);
}
return null;
}
/**
* Return a list of strings, either retrieved from an array or from a space-separated string.
*/
private ArrayList<String> getStringList(JSONObject obj, String key) throws JSONException
{
ArrayList<String> list = new ArrayList<>();
JSONArray arr = obj.optJSONArray(key);
if (arr != null)
{
for (int i = 0; i < arr.length(); i++)
{
apps.add(arr.getString(i));
{ /* replace all spaces, including e.g. in "192.168.1.1 - 192.168.1.10" */
list.add(arr.getString(i).replace(" ", ""));
}
}
return TextUtils.join(" ", apps);
else
{
String value = obj.optString(key, null);
if (!TextUtils.isEmpty(value))
{
Collections.addAll(list, value.split("\\s+"));
}
}
return list;
}
/**

View File

@ -130,7 +130,6 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
return mDataSource != null ? mDataSource.getVpnProfile(uuid) : null;
}
@SuppressLint("StartActivityAndCollapseDeprecated")
@Override
public void onClick()
{
@ -219,6 +218,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
}
@SuppressWarnings("deprecation")
@SuppressLint("StartActivityAndCollapseDeprecated")
private void startActivityAndCollapseCompat(Intent intent)
{
startActivityAndCollapse(intent);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2020 Tobias Brunner
* Copyright (C) 2016-2025 Tobias Brunner
*
* Copyright (C) secunet Security Networks AG
*
@ -45,6 +45,11 @@ public final class Constants
public static final int NAT_KEEPALIVE_MAX = 120;
public static final int NAT_KEEPALIVE_MIN = 10;
/**
* Default port for proxy servers
*/
public static final int PROXY_PORT_DEFAULT = 8080;
/**
* Preference key for default VPN profile
*/

View File

@ -48,17 +48,11 @@ extern jclass *android_charonvpnservice_builder_class;
extern jclass *android_simple_fetcher_class;
/**
* Currently known (supported) SDK versions
* SDK versions for which we need some special handling.
*
* see android.os.Build.VERSION_CODES for definitions
*/
typedef enum {
ANDROID_ICE_CREAM_SANDWICH = 14,
ANDROID_ICE_CREAM_SANDWICH_MR1 = 15,
ANDROID_JELLY_BEAN = 16,
ANDROID_JELLY_BEAN_MR1 = 17,
ANDROID_JELLY_BEAN_MR2 = 18,
ANDROID_LOLLIPOP = 21,
ANDROID_MARSHMALLOW = 23,
} android_sdk_version_t;

View File

@ -340,7 +340,7 @@ METHOD(android_dns_proxy_t, handle, bool,
skt);
lib->scheduler->schedule_job(lib->scheduler,
(job_t*)callback_job_create(handle_timeout, skt,
NULL, (callback_job_cancel_t)return_false), SOCKET_TIMEOUT);
NULL, callback_job_cancel_thread), SOCKET_TIMEOUT);
}
skt->last_use = time_monotonic(NULL);
if (sendto(skt->fd, data.ptr, data.len, 0, dst->get_sockaddr(dst),

View File

@ -435,16 +435,7 @@ METHOD(private_key_t, destroy, void,
JNIEnv *env;
androidjni_attach_thread(&env);
if (android_sdk_version == ANDROID_JELLY_BEAN)
{ /* there is a bug in JB that causes a SIGSEGV if the key object is
* garbage collected so we intentionally leak the reference to it */
DBG1(DBG_LIB, "intentionally leaking private key reference due to "
"a bug in the framework");
}
else
{
(*env)->DeleteGlobalRef(env, this->key);
}
(*env)->DeleteGlobalRef(env, this->key);
(*env)->DeleteGlobalRef(env, this->signature_class);
androidjni_detach_thread();
this->pubkey->destroy(this->pubkey);

View File

@ -359,7 +359,7 @@ static bool setup_tun_device(private_android_service_t *this,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create((callback_job_cb_t)handle_plain, this,
NULL, (callback_job_cancel_t)return_false));
NULL, callback_job_cancel_thread));
}
return TRUE;
}
@ -600,7 +600,7 @@ METHOD(listener_t, alert, bool,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create_with_prio(
(callback_job_cb_t)reestablish, id, free,
(callback_job_cancel_t)return_false, JOB_PRIO_HIGH));
callback_job_cancel_thread, JOB_PRIO_HIGH));
break;
}
case ALERT_PEER_INIT_UNREACHABLE:
@ -619,7 +619,7 @@ METHOD(listener_t, alert, bool,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create_with_prio(
(callback_job_cb_t)terminate, id, free,
(callback_job_cancel_t)return_false, JOB_PRIO_HIGH));
callback_job_cancel_thread, JOB_PRIO_HIGH));
stay_registered = FALSE;
}
else
@ -792,10 +792,9 @@ static job_requeue_t initiate(private_android_service_t *this)
};
char *type, *remote_id;
if (android_sdk_version >= ANDROID_LOLLIPOP)
{ /* only try once and notify the GUI on Android 5+ where we have a blocking TUN device */
peer.keyingtries = 1;
}
/* only try once and notify the GUI since Android 5+ where we have a
* blocking TUN device */
peer.keyingtries = 1;
ike.remote = this->settings->get_str(this->settings, "connection.server",
NULL);

View File

@ -256,11 +256,14 @@ CALLBACK(bypass_single_socket_cb, void,
}
METHOD(charonservice_t, bypass_socket, bool,
private_charonservice_t *this, int fd, int family)
private_charonservice_t *this, int fd, bool track_fd)
{
if (fd >= 0)
{
this->sockets->insert_last(this->sockets, (void*)(intptr_t)fd);
if (track_fd)
{
this->sockets->insert_last(this->sockets, (void*)(intptr_t)fd);
}
return bypass_single_socket(this, fd);
}
this->sockets->invoke_function(this->sockets, bypass_single_socket_cb, this);
@ -504,6 +507,11 @@ static void set_options(char *logfile, jboolean ipv6)
"charon.retransmit_base", ANDROID_RETRANSMIT_BASE);
lib->settings->set_bool(lib->settings,
"charon.initiator_only", TRUE);
/* the service currently can't handle make-before-break reauth and assumes
* the old SA is deleted before the replacement and installs a special
* replacement TUN device in-between */
lib->settings->set_bool(lib->settings,
"charon.make_before_break", FALSE);
lib->settings->set_bool(lib->settings,
"charon.close_ike_on_child_failure", TRUE);
lib->settings->set_bool(lib->settings,

View File

@ -109,13 +109,14 @@ struct charonservice_t {
* Install a bypass policy for the given socket using the protect() Method
* of the Android VpnService interface.
*
* Use -1 as fd to re-bypass previously bypassed sockets.
* If track_fd is TRUE, the fd is kept track of. Use -1 as fd to re-bypass
* all of those sockets.
*
* @param fd socket file descriptor
* @param family socket protocol family
* @param track_fd TRUE to keep track of fd
* @return TRUE if operation successful
*/
bool (*bypass_socket)(charonservice_t *this, int fd, int family);
bool (*bypass_socket)(charonservice_t *this, int fd, bool track_fd);
/**
* Get a list of trusted certificates via JNI

View File

@ -159,7 +159,7 @@ METHOD(kernel_ipsec_t, flush_policies, status_t,
METHOD(kernel_ipsec_t, bypass_socket, bool,
private_kernel_android_ipsec_t *this, int fd, int family)
{
return charonservice->bypass_socket(charonservice, fd, family);
return charonservice->bypass_socket(charonservice, fd, TRUE);
}
METHOD(kernel_ipsec_t, enable_udp_decap, bool,

View File

@ -70,7 +70,7 @@ struct private_android_net_t {
static job_requeue_t roam_event()
{
/* this will fail if no connection is up */
charonservice->bypass_socket(charonservice, -1, 0);
charonservice->bypass_socket(charonservice, -1, FALSE);
charon->kernel->roam(charon->kernel, TRUE);
return JOB_REQUEUE_NONE;
}
@ -122,13 +122,8 @@ METHOD(kernel_net_t, get_source_addr, host_t*,
strerror(errno));
return NULL;
}
charonservice->bypass_socket(charonservice, skt, dst->get_family(dst));
charonservice->bypass_socket(charonservice, skt, FALSE);
if (android_sdk_version <= ANDROID_JELLY_BEAN_MR2)
{ /* this seems to help avoiding the VIP, unless there is no connectivity
* at all */
charonservice->bypass_socket(charonservice, -1, 0);
}
if (connect(skt, dst->get_sockaddr(dst), addrlen) < 0)
{
/* don't report an error if we are not connected (ENETUNREACH) */
@ -179,28 +174,6 @@ CALLBACK(vip_equals, bool,
return host->ip_equals(host, vip);
}
METHOD(kernel_net_t, get_source_addr_old, host_t*,
private_android_net_t *this, host_t *dest, host_t *src)
{
host_t *host;
/* on older Android versions we might get the virtual IP back because
* the protect() implementation there and connect() don't properly work
* together, on newer releases (using fwmarks) that's not a problem */
host = get_source_addr(this, dest, src);
if (host)
{
this->mutex->lock(this->mutex);
if (this->vips->find_first(this->vips, vip_equals, NULL, host))
{
host->destroy(host);
host = NULL;
}
this->mutex->unlock(this->mutex);
}
return host;
}
METHOD(kernel_net_t, get_nexthop, host_t*,
private_android_net_t *this, host_t *dest, int prefix, host_t *src,
char **iface)
@ -303,11 +276,6 @@ kernel_net_t *kernel_android_net_create()
);
timerclear(&this->next_roam);
if (android_sdk_version <= ANDROID_JELLY_BEAN_MR2)
{
this->public.get_source_addr = _get_source_addr_old;
}
this->mutex->lock(this->mutex);
this->network_manager->add_connectivity_cb(
this->network_manager, (void*)connectivity_cb, this);

View File

@ -4,8 +4,8 @@ Dies ist die offizielle Android-Portierung der populären strongSwan VPN-Lösung
<ul>
<li>Verwendet die VpnService API von Android 4+. Geräte von einigen Herstellern scheinen diese nicht zu unterstützen - strongSwan wird auf diesen Geräten nicht funktionieren!</li>
<li>Verwendet das IKEv2 Schlüsselaustausch-Protokoll (IKEv1 wird nicht unterstützt)</li>
<li>Verwendet IPsec für den Datenkanal (L2TP wird nicht unterstützt)</li>
<li>Verwendet das IKEv2 Schlüsselaustausch-Protokoll</li>
<li>Verwendet IPsec für den Datenkanal</li>
<li>Volle Unterstützung für Konnektivitätsänderungen und Mobilität via MOBIKE (oder Re-Authentisierung)</li>
<li>Zur Authentisierung der Nutzer wird sowohl einfache auf Benutzername und Passwort basierende EAP-Authentisierung (namentlich EAP-MSCHAPv2, EAP-MD5 und EAP-GTC), sowie zertifikatsbasierte RSA/ECSA-Authentisierung unterstützt, EAP-TLS mit Benutzer-Zertifikaten wird ebenfalls unterstützt</li>
<li>Kombinierte Authentisierung mit RSA/ECDSA und EAP wird über zwei Authentisierungsrunden nach RFC 4739 unterstützt</li>
@ -19,7 +19,7 @@ Dies ist die offizielle Android-Portierung der populären strongSwan VPN-Lösung
<li>Unterstützt verwaltete Konfigurationen via Enterprise Mobility Management (EMM)</li>
</ul>
Details und ein Changelog sind in unserer Dokumentation zu finden: https://docs.strongswan.org/docs/5.9/os/androidVpnClient.html
Details und ein Changelog sind in unserer Dokumentation zu finden: https://docs.strongswan.org/docs/latest/os/androidVpnClient.html
# PERMISSIONS #
@ -30,7 +30,7 @@ Details und ein Changelog sind in unserer Dokumentation zu finden: https://docs.
# BEISPIEL-SERVERKONFIGURATION #
Sie finden in unserer Dokumentation Beispiel-Serverkonfigurationen: https://docs.strongswan.org/docs/5.9/os/androidVpnClient.html#_server_configuration
Sie finden in unserer Dokumentation Beispiel-Serverkonfigurationen: https://docs.strongswan.org/docs/latest/os/androidVpnClient.html#_server_configuration
Beachten Sie bitte, dass der im VPN Profil konfigurierte Hostname (bzw. die IP-Adresse) *zwingend* als subjectAltName-Extension im Server-Zertifikat vorhanden sein muss.

View File

@ -4,8 +4,8 @@ Official Android port of the popular strongSwan VPN solution.
<ul>
<li>Uses the VpnService API featured by Android 4+. Devices by some manufacturers seem to lack support for this - strongSwan VPN Client won't work on these devices!</li>
<li>Uses the IKEv2 key exchange protocol (IKEv1 is not supported)</li>
<li>Uses IPsec for data traffic (L2TP is not supported)</li>
<li>Uses the IKEv2 key exchange protocol</li>
<li>Uses IPsec for data traffic</li>
<li>Full support for changed connectivity and mobility through MOBIKE (or reauthentication)</li>
<li>Supports username/password EAP authentication (namely EAP-MSCHAPv2, EAP-MD5 and EAP-GTC) as well as RSA/ECDSA private key/certificate authentication to authenticate users, EAP-TLS with client certificates is also supported</li>
<li>Combined RSA/ECDSA and EAP authentication is supported by using two authentication rounds as defined in RFC 4739</li>
@ -19,7 +19,7 @@ Official Android port of the popular strongSwan VPN solution.
<li>Supports managed configurations via enterprise mobility management (EMM)</li>
</ul>
Details and a changelog can be found in our documentation: https://docs.strongswan.org/docs/5.9/os/androidVpnClient.html
Details and a changelog can be found in our documentation: https://docs.strongswan.org/docs/latest/os/androidVpnClient.html
# PERMISSIONS #
@ -30,7 +30,7 @@ Details and a changelog can be found in our documentation: https://docs.strongsw
# EXAMPLE SERVER CONFIGURATION #
Example server configurations may be found in our documentation: https://docs.strongswan.org/docs/5.9/os/androidVpnClient.html#_server_configuration
Example server configurations may be found in our documentation: https://docs.strongswan.org/docs/latest/os/androidVpnClient.html#_server_configuration
Please note that the host name (or IP address) configured with a VPN profile in the app *must be* contained in the server certificate as subjectAltName extension.

View File

@ -1,3 +1,15 @@
# 2.5.6 #
- Unterstützt benutzerdefinierte HTTP Proxy-Server (Android 10+)
# 2.5.5 #
- Fixt den Start von verwalteten Profilen als Always-on VPN
# 2.5.4 #
- Fixt Probleme beim Wiederherstellen der Verbindung
# 2.5.3 #
- Unterstützt die Verteilung von Passwörtern in verwalteten Profilen

View File

@ -1,3 +1,15 @@
# 2.5.6 #
- Add support for custom HTTP proxy server (Android 10+)
# 2.5.5 #
- Fix initiating managed profiles as Always-on VPN
# 2.5.4 #
- Fix issues when reestablishing the connection
# 2.5.3 #
- Add support for distributing passwords in managed profiles

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2019 Tobias Brunner
Copyright (C) 2012-2025 Tobias Brunner
Copyright (C) 2012 Giuliano Grassi
Copyright (C) 2012 Ralf Sager
@ -538,6 +538,72 @@
</org.strongswan.android.ui.widget.TextInputLayoutHelper>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="@string/profile_proxy_server_label"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="@string/profile_proxy_server_intro"
android:textSize="12sp" />
<org.strongswan.android.ui.widget.TextInputLayoutHelper
android:id="@+id/proxy_host_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/profile_proxy_host_label"
app:helper_text="@string/profile_proxy_host_hint">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/proxy_host"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:singleLine="true" />
</org.strongswan.android.ui.widget.TextInputLayoutHelper>
<org.strongswan.android.ui.widget.TextInputLayoutHelper
android:id="@+id/proxy_port_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/profile_proxy_port_label"
app:helper_text="@string/profile_proxy_port_hint">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/proxy_port"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number|textNoSuggestions"
android:singleLine="true" />
</org.strongswan.android.ui.widget.TextInputLayoutHelper>
<org.strongswan.android.ui.widget.TextInputLayoutHelper
android:id="@+id/proxy_exclusions_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/profile_proxy_exclusions_label"
app:helper_text="@string/profile_proxy_exclusions_hint">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/proxy_exclusions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:singleLine="true" />
</org.strongswan.android.ui.widget.TextInputLayoutHelper>
<TextView
android:id="@+id/profile_id_label"
android:layout_width="match_parent"

View File

@ -123,11 +123,19 @@
<string name="profile_select_one_app">Eine App ausgewählt</string>
<string name="profile_select_x_apps">%1$d Apps ausgewählt</string>
<string name="profile_proposals_label">Algorithmen</string>
<string name="profile_proposals_intro">Optionale spezifische Algorithmen für IKEv2 und/oder IPsec/ESP die statt der Standardwerte verwendet werden sollen. Eine <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">Liste gültiger Algorithmen</a> kann unserem Wiki entnommen werden (nicht alle werden von dieser App unterstützt). Beide Felder erwarten eine Liste von Algorithmen, jeweils mit einem Bindestrich getrennt.</string>
<string name="profile_proposals_intro">Optionale spezifische Algorithmen für IKEv2 und/oder IPsec/ESP die statt der Standardwerte verwendet werden sollen. Eine <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">Liste gültiger Algorithmen</a> kann unserem Wiki entnommen werden (nicht alle werden von dieser App unterstützt). Beide Felder erwarten eine Liste von Algorithmen, jeweils mit einem Bindestrich getrennt.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithmen</string>
<string name="profile_proposals_ike_hint">Für non-AEAD/klassische Verschlüsselungsalgorithmen wird ein Integritätsalgorithmus, eine pseudozufällige Funktion (PRF, optional, ansonsten wird eine auf dem Integritätsalgorithmus basierende verwendet) und eine Diffie-Hellman Gruppe benötigt (z.B. aes256-sha256-ecp256). Für kombinierte/AEAD Algorithmen wird der Integritätsalgorithmus weggelassen aber eine PRF wird benötigt (z.B. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithmen</string>
<string name="profile_proposals_esp_hint">Für non-AEAD/klassische Verschlüsselungsalgorithmen wird ein Integritätsalgorithmus benötigt, eine Diffie-Hellman Gruppe ist optional (z.B. aes256-sha256 oder aes256-sha256-ecp256). Für kombinierte/AEAD Algorithmen wird der Integritätsalgorithmus weggelassen (z.B. aes256gcm16 oder aes256gcm16-ecp256). Falls eine DH Gruppe angegeben wird, kommt während dem IPsec SA Rekeying ein DH Schlüsselaustausch zur Anwendung. Beim initialen Verbindungsaufbau hat eine DH Gruppe hier keinen Einfluss, weil die Schlüssel dort von der IKE SA abgeleitet werden. Deshalb wird eine Fehlkonfiguration mit dem Server erst später während dem Rekeying zu einem Fehler führen.</string>
<string name="profile_proxy_server_label">HTTP Proxy-Server</string>
<string name="profile_proxy_server_intro">Optionaler HTTP Proxy-Server bei Verbindung zum VPN. Dies ist nur eine Empfehlung und kann von Apps ignoriert werden. Bitte beachten, dass Apps, die den Proxy verwenden, unabhängig vom Ziel alle HTTP-Ressourcen darüber abrufen, so dass Split-Tunneling-Einstellungen möglicherweise keine Auswirkungen haben. Um die Verwendung des Proxys für bestimmte Hosts zu vermeiden, kann die Ausschlussliste unten verwendet werden.</string>
<string name="profile_proxy_host_label">Proxy-Host</string>
<string name="profile_proxy_host_hint">IP-Adresse oder Hostname des HTTP Proxy-Servers, der bei Verbindung zum VPN verwendet werden soll</string>
<string name="profile_proxy_port_label">Proxy-Port</string>
<string name="profile_proxy_port_hint">Port um auf den HTTP Proxy-Server zuzugreifen, Standardwert ist 8080</string>
<string name="profile_proxy_exclusions_label">Proxy-Ausschlussliste</string>
<string name="profile_proxy_exclusions_hint">Optionale Liste von Hosts für die der HTTP Proxy-Server nicht verwendet werden soll (mit Leerzeichen getrennt und Platzhalter können verwendet werden, z.B. \"direct.example.net *.example.com\")</string>
<string name="profile_import">VPN Profil importieren</string>
<string name="profile_import_failed">VPN Profil-Import fehlgeschlagen</string>
<string name="profile_import_failed_detail">VPN Profil-Import fehlgeschlagen: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -125,11 +125,19 @@
<string name="profile_select_one_app">One application selected</string>
<string name="profile_select_x_apps">%1$d applications selected</string>
<string name="profile_proposals_label">Algorithms</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithms</string>
<string name="profile_proposals_ike_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm, a pseudo random function (optional, defaults to one based on the integrity algorithm) and a Diffie-Hellman group are required (e.g. aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted but a PRF is required (e.g. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithms</string>
<string name="profile_proposals_esp_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm is required, a Diffie-Hellman group is optional (e.g. aes256-sha256 or aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted (e.g. aes256gcm16 or aes256gcm16-ecp256). If a DH group is specified IPsec SA rekeying will use a DH key exchange. However, DH groups specified here are not used when the connection is established initially because the keys there are derived from the IKE SA key material. Therefore, any configuration mismatch with the server will only cause errors later during rekeying.</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">Import VPN profile</string>
<string name="profile_import_failed">Failed to import VPN profile</string>
<string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -119,11 +119,19 @@
<string name="profile_select_one_app">One application selected</string>
<string name="profile_select_x_apps">%1$d applications selected</string>
<string name="profile_proposals_label">Algorithms</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithms</string>
<string name="profile_proposals_ike_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm, a pseudo random function (optional, defaults to one based on the integrity algorithm) and a Diffie-Hellman group are required (e.g. aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted but a PRF is required (e.g. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithms</string>
<string name="profile_proposals_esp_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm is required, a Diffie-Hellman group is optional (e.g. aes256-sha256 or aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted (e.g. aes256gcm16 or aes256gcm16-ecp256). If a DH group is specified IPsec SA rekeying will use a DH key exchange. However, DH groups specified here are not used when the connection is established initially because the keys there are derived from the IKE SA key material. Therefore, any configuration mismatch with the server will only cause errors later during rekeying.</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">Import VPN profile</string>
<string name="profile_import_failed">Failed to import VPN profile</string>
<string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -120,11 +120,19 @@
<string name="profile_select_one_app">One application selected</string>
<string name="profile_select_x_apps">%1$d applications selected</string>
<string name="profile_proposals_label">Algorithms</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithms</string>
<string name="profile_proposals_ike_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm, a pseudo random function (optional, defaults to one based on the integrity algorithm) and a Diffie-Hellman group are required (e.g. aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted but a PRF is required (e.g. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithms</string>
<string name="profile_proposals_esp_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm is required, a Diffie-Hellman group is optional (e.g. aes256-sha256 or aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted (e.g. aes256gcm16 or aes256gcm16-ecp256). If a DH group is specified IPsec SA rekeying will use a DH key exchange. However, DH groups specified here are not used when the connection is established initially because the keys there are derived from the IKE SA key material. Therefore, any configuration mismatch with the server will only cause errors later during rekeying.</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">Import VPN profile</string>
<string name="profile_import_failed">Failed to import VPN profile</string>
<string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -119,11 +119,19 @@
<string name="profile_select_one_app">已选择一个应用程序</string>
<string name="profile_select_x_apps">%1$d 应用程序被选择</string>
<string name="profile_proposals_label">算法</string>
<string name="profile_proposals_intro">可选配置用于IKEv2和/或IPsec/ESP的特定算法而不是默认算法。请参阅我们的wiki以了解<a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">算法标识符列表</a>(请注意,此应用程序并不支持所有标识符)。这两个字段都包含一个算法列表,每个算法用连字符分隔。</string>
<string name="profile_proposals_intro">可选配置用于IKEv2和/或IPsec/ESP的特定算法而不是默认算法。请参阅我们的wiki以了解<a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">算法标识符列表</a>(请注意,此应用程序并不支持所有标识符)。这两个字段都包含一个算法列表,每个算法用连字符分隔。</string>
<string name="profile_proposals_ike_label">IKEv2算法</string>
<string name="profile_proposals_ike_hint">对于非AEAD/经典加密算法需要完整性算法、伪随机函数可选默认为基于完整性算法的函数和Diffie-Hellman组例如aes256-sha256-ecp256。对于组合模式/AEAD算法省略完整性算法但需要PRF例如aes256gcm16-prfsha256-ecp256</string>
<string name="profile_proposals_esp_label">IPsec/ESP 算法</string>
<string name="profile_proposals_esp_hint">对于非AEAD/经典加密算法需要完整性算法Diffie-Hellman组是可选的例如aes256-sha256或aes256-sha256-ecp256。对于组合模式/AEAD算法省略完整性算法例如aes256gcm16或aes256gcm16-ecp256。如果指定了DH组IPsec SA密钥更新将使用DH密钥交换。但是在最初建立连接时不使用此处指定的DH组因为其中的密钥来自IKE SA密钥材料。因此与服务器的任何配置不匹配只会在稍后重新设置密钥时导致错误。</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">导入VPN配置</string>
<string name="profile_import_failed">导入VPN配置失败</string>
<string name="profile_import_failed_detail">导入VPN配置失败: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -119,11 +119,19 @@
<string name="profile_select_one_app">One application selected</string>
<string name="profile_select_x_apps">%1$d applications selected</string>
<string name="profile_proposals_label">Algorithms</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithms</string>
<string name="profile_proposals_ike_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm, a pseudo random function (optional, defaults to one based on the integrity algorithm) and a Diffie-Hellman group are required (e.g. aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted but a PRF is required (e.g. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithms</string>
<string name="profile_proposals_esp_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm is required, a Diffie-Hellman group is optional (e.g. aes256-sha256 or aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted (e.g. aes256gcm16 or aes256gcm16-ecp256). If a DH group is specified IPsec SA rekeying will use a DH key exchange. However, DH groups specified here are not used when the connection is established initially because the keys there are derived from the IKE SA key material. Therefore, any configuration mismatch with the server will only cause errors later during rekeying.</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">匯入VPN設定檔</string>
<string name="profile_import_failed">匯入VPN設定檔失敗</string>
<string name="profile_import_failed_detail">匯入VPN設定檔失敗: %1$s</string>

View File

@ -108,4 +108,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -123,11 +123,19 @@
<string name="profile_select_one_app">One application selected</string>
<string name="profile_select_x_apps">%1$d applications selected</string>
<string name="profile_proposals_label">Algorithms</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/5.9/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_intro">Optionally configure specific algorithms to use for IKEv2 and/or IPsec/ESP instead of the defaults. Refer to our wiki for a <a href="https://docs.strongswan.org/docs/latest/config/IKEv2CipherSuites.html">list of algorithm identifiers</a> (note that not all are supported by this app). Both fields take a list of algorithms, each separated by a hyphen.</string>
<string name="profile_proposals_ike_label">IKEv2 Algorithms</string>
<string name="profile_proposals_ike_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm, a pseudo random function (optional, defaults to one based on the integrity algorithm) and a Diffie-Hellman group are required (e.g. aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted but a PRF is required (e.g. aes256gcm16-prfsha256-ecp256).</string>
<string name="profile_proposals_esp_label">IPsec/ESP Algorithms</string>
<string name="profile_proposals_esp_hint">For non-AEAD/classic encryption algorithms, an integrity algorithm is required, a Diffie-Hellman group is optional (e.g. aes256-sha256 or aes256-sha256-ecp256). For combined-mode/AEAD algorithms, the integrity algorithm is omitted (e.g. aes256gcm16 or aes256gcm16-ecp256). If a DH group is specified IPsec SA rekeying will use a DH key exchange. However, DH groups specified here are not used when the connection is established initially because the keys there are derived from the IKE SA key material. Therefore, any configuration mismatch with the server will only cause errors later during rekeying.</string>
<string name="profile_proxy_server_label">HTTP proxy server</string>
<string name="profile_proxy_server_intro">Optional HTTP proxy server to use when connected to the VPN. This is only a recommendation and may be ignored by apps. Note that apps using the proxy will access all HTTP resources through it regardless of the destination, so split-tunneling settings might not have any effect. To avoid using the proxy server for specific hosts, use the exclusion list below.</string>
<string name="profile_proxy_host_label">Proxy host</string>
<string name="profile_proxy_host_hint">IP address or hostname of the HTTP proxy server to use when connected to the VPN</string>
<string name="profile_proxy_port_label">Proxy port</string>
<string name="profile_proxy_port_hint">Port to access the HTTP proxy server, defaults to 8080</string>
<string name="profile_proxy_exclusions_label">Proxy exclusion list</string>
<string name="profile_proxy_exclusions_hint">Optional list of hosts for which the HTTP proxy server is not used (separated by spaces, and wildcards are possible, e.g. \"direct.example.net *.example.com\")</string>
<string name="profile_import">Import VPN profile</string>
<string name="profile_import_failed">Failed to import VPN profile</string>
<string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2025 Tobias Brunner
Copyright (C) 2023 Relution GmbH
Copyright (C) secunet Security Networks AG
@ -108,4 +109,13 @@
<string name="managed_config_split_tunneling_block_ipv6_title">@string/profile_split_tunnelingv6_title</string>
<string name="managed_config_split_tunneling_block_ipv6_description">Specifies whether to block IPv6 traffic that\'s not destined for the VPN. Forces all IPv6 traffic via VPN (traffic that does not match the negotiated traffic selector is then just dropped). Thus this is basically equivalent to including ::/0 in subnets</string>
<!-- Managed configuration, VPN profile, proxy server -->
<string name="managed_config_proxy_server_bundle_title">@string/profile_proxy_server_label</string>
<string name="managed_config_proxy_server_bundle_description">@string/profile_proxy_server_intro</string>
<string name="managed_config_proxy_host_title">@string/profile_proxy_host_label</string>
<string name="managed_config_proxy_host_description">@string/profile_proxy_host_hint</string>
<string name="managed_config_proxy_port_title">@string/profile_proxy_port_label</string>
<string name="managed_config_proxy_port_description">@string/profile_proxy_port_hint</string>
<string name="managed_config_proxy_exclusions_title">@string/profile_proxy_exclusions_label</string>
<string name="managed_config_proxy_exclusions_description">@string/profile_proxy_exclusions_hint</string>
</resources>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2025 Tobias Brunner
Copyright (C) 2023 Relution GmbH
Copyright (C) secunet Security Networks AG
@ -305,6 +306,35 @@
</restriction>
<restriction
android:description="@string/managed_config_proxy_server_bundle_description"
android:key="proxy_server"
android:restrictionType="bundle"
android:title="@string/managed_config_proxy_server_bundle_title">
<restriction
android:defaultValue=""
android:description="@string/managed_config_proxy_host_description"
android:key="proxy_host"
android:restrictionType="string"
android:title="@string/managed_config_proxy_host_title" />
<restriction
android:defaultValue="-1"
android:description="@string/managed_config_proxy_port_description"
android:key="proxy_port"
android:restrictionType="integer"
android:title="@string/managed_config_proxy_port_description" />
<restriction
android:defaultValue=""
android:description="@string/managed_config_proxy_exclusions_description"
android:key="proxy_exclusions"
android:restrictionType="string"
android:title="@string/managed_config_proxy_exclusions_title" />
</restriction>
</restriction>
</restriction>
</restrictions>

View File

@ -12,7 +12,7 @@ export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
export ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}
# automatically determine the ABIs supported by the NDK
: ${ABIS=$(jq -r 'keys | join(" ")' ${ANDROID_NDK_ROOT}/meta/abis.json)}
: ${ABIS=$(jq -r 'map_values(select(.default == true)) | keys | join(" ")' ${ANDROID_NDK_ROOT}/meta/abis.json)}
# this should match APP_PLATFORM
: ${MIN_SDK=21}
@ -35,6 +35,10 @@ x86)
x86_64)
OPTIONS="android-x86_64"
;;
*)
echo "!! Skipping unknown ABI '${ABI}'"
continue
;;
esac
OPTIONS="${OPTIONS} \

View File

@ -1,3 +1,14 @@
NetworkManager-strongswan-1.6.3
-------------------------------
- Fix configure/linker issue when not using GNU libtool
- Update URL in metainfo
NetworkManager-strongswan-1.6.2
-------------------------------
- Add support to configure local and remote traffic selectors
NetworkManager-strongswan-1.6.1
-------------------------------

View File

@ -31,7 +31,7 @@
</screenshot>
</screenshots>
<url type="homepage">https://docs.strongswan.org/docs/5.9/features/networkManager.html</url>
<url type="homepage">https://docs.strongswan.org/docs/latest/features/networkManager.html</url>
<url type="bugtracker">https://github.com/strongswan/strongswan/issues</url>
<url type="help">https://www.strongswan.org/support.html</url>
<update_contact>info_AT_strongswan.org</update_contact>

View File

@ -1,6 +1,6 @@
AC_PREREQ([2.69])
AC_INIT([NetworkManager-strongswan],[1.6.1],[info@strongswan.org],[NetworkManager-strongswan])
AC_INIT([NetworkManager-strongswan],[1.6.3],[info@strongswan.org],[NetworkManager-strongswan])
AM_INIT_AUTOMAKE([subdir-objects])
AM_MAINTAINER_MODE
@ -35,8 +35,9 @@ AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(select socket uname)
AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
LIBS=""
AC_SEARCH_LIBS([dlopen], [dl dld], [DL_LIBS=$LIBS])
AC_SUBST([DL_LIBS])
AM_GNU_GETTEXT_VERSION([0.19])
AM_GNU_GETTEXT([external])

View File

@ -29,6 +29,7 @@ struct udphdr {
/* UDP socket options */
#define UDP_CORK 1 /* Never send partially complete segments */
#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
#define UDP_GRO 104 /* This socket can receive UDP GRO packets */
/* UDP encapsulation types */
#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */

View File

@ -154,7 +154,8 @@ enum {
#define XFRM_MODE_ROUTEOPTIMIZATION 2
#define XFRM_MODE_IN_TRIGGER 3
#define XFRM_MODE_BEET 4
#define XFRM_MODE_MAX 5
#define XFRM_MODE_IPTFS 5
#define XFRM_MODE_MAX 6
/* Netlink configuration messages. */
enum {
@ -317,6 +318,14 @@ enum xfrm_attr_type_t {
XFRMA_IF_ID, /* __u32 */
XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */
XFRMA_SA_DIR, /* __u8 */
XFRMA_NAT_KEEPALIVE_INTERVAL, /* __u32 in seconds for NAT keepalive */
XFRMA_SA_PCPU, /* __u32 */
XFRMA_IPTFS_DROP_TIME, /* __u32 in: usec to wait for next seq */
XFRMA_IPTFS_REORDER_WINDOW, /* __u16 in: reorder window size (pkts) */
XFRMA_IPTFS_DONT_FRAG, /* out: don't use fragmentation */
XFRMA_IPTFS_INIT_DELAY, /* __u32 out: initial packet wait delay (usec) */
XFRMA_IPTFS_MAX_QSIZE, /* __u32 out: max ingress queue size (octets) */
XFRMA_IPTFS_PKT_SIZE, /* __u32 out: size of outer packet, 0 for PMTU */
__XFRMA_MAX
#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */
@ -432,6 +441,7 @@ struct xfrm_userpolicy_info {
#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
/* Automatically expand selector to include matching ICMP payloads. */
#define XFRM_POLICY_ICMP 2
#define XFRM_POLICY_CPU_ACQUIRE 4
__u8 share;
};

View File

@ -50,7 +50,8 @@ encoding/payloads/fragment_payload.c encoding/payloads/fragment_payload.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.c kernel/kernel_net.h \
kernel/kernel_listener.h kernel/kernel_handler.c kernel/kernel_handler.h \
kernel/kernel_listener.c kernel/kernel_listener.h \
kernel/kernel_handler.c kernel/kernel_handler.h \
network/receiver.c network/receiver.h network/sender.c network/sender.h \
network/socket.c network/socket.h \
network/socket_manager.c network/socket_manager.h \

View File

@ -48,7 +48,8 @@ encoding/payloads/fragment_payload.c encoding/payloads/fragment_payload.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.c kernel/kernel_net.h \
kernel/kernel_listener.h kernel/kernel_handler.c kernel/kernel_handler.h \
kernel/kernel_listener.c kernel/kernel_listener.h \
kernel/kernel_handler.c kernel/kernel_handler.h \
network/receiver.c network/receiver.h network/sender.c network/sender.h \
network/socket.c network/socket.h \
network/socket_manager.c network/socket_manager.h \
@ -669,13 +670,6 @@ if MONOLITHIC
endif
endif
if USE_UCI
SUBDIRS += plugins/uci
if MONOLITHIC
libcharon_la_LIBADD += plugins/uci/libstrongswan-uci.la
endif
endif
if USE_ADDRBLOCK
SUBDIRS += plugins/addrblock
if MONOLITHIC

View File

@ -182,6 +182,9 @@ struct listener_t {
* peer_cfg (and the old hosts), but before resolving the hosts anew.
* It is not invoked on the responder.
*
* If this is called during a reauthentication, COND_REAUTHENTICATING is
* set on the old IKE_SA and the hosts are not resolved anew.
*
* @param old IKE_SA getting reestablished (is destroyed)
* @param new new IKE_SA replacing old (gets established)
* @return TRUE to stay registered, FALSE to unregister

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2019 Tobias Brunner
* Copyright (C) 2008-2025 Tobias Brunner
* Copyright (C) 2016 Andreas Steffen
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@ -67,12 +67,12 @@ struct private_child_cfg_t {
/**
* list for traffic selectors for my site
*/
linked_list_t *my_ts;
traffic_selector_list_t *my_ts;
/**
* list for traffic selectors for others site
*/
linked_list_t *other_ts;
traffic_selector_list_t *other_ts;
/**
* updown script
@ -258,165 +258,66 @@ METHOD(child_cfg_t, add_traffic_selector, void,
{
if (local)
{
this->my_ts->insert_last(this->my_ts, ts);
this->my_ts->add(this->my_ts, ts);
}
else
{
this->other_ts->insert_last(this->other_ts, ts);
this->other_ts->add(this->other_ts, ts);
}
}
METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
private_child_cfg_t *this, bool local, linked_list_t *supplied,
linked_list_t *hosts, bool log)
/**
* Check whether the config is for regular transport mode.
*/
static bool is_transport_mode(private_child_cfg_t *this)
{
enumerator_t *e1, *e2;
traffic_selector_t *ts1, *ts2, *selected;
linked_list_t *result, *derived;
host_t *host;
return this->mode == MODE_TRANSPORT && !has_option(this, OPT_PROXY_MODE);
}
result = linked_list_create();
derived = linked_list_create();
if (local)
{
e1 = this->my_ts->create_enumerator(this->my_ts);
}
else
{
e1 = this->other_ts->create_enumerator(this->other_ts);
}
/* in a first step, replace "dynamic" TS with the host list */
while (e1->enumerate(e1, &ts1))
{
if (hosts && hosts->get_count(hosts))
{ /* set hosts if TS is dynamic or as initiator in transport mode */
bool dynamic = ts1->is_dynamic(ts1),
proxy_mode = has_option(this, OPT_PROXY_MODE);
if (dynamic || (this->mode == MODE_TRANSPORT && !proxy_mode &&
!supplied))
{
e2 = hosts->create_enumerator(hosts);
while (e2->enumerate(e2, &host))
{
if (!dynamic && !host->is_anyaddr(host) &&
!ts1->includes(ts1, host))
{ /* for transport mode, we skip TS that don't match
* specific IPs */
continue;
}
ts2 = ts1->clone(ts1);
if (dynamic || !host->is_anyaddr(host))
{ /* don't make regular TS larger than they were */
ts2->set_address(ts2, host);
}
derived->insert_last(derived, ts2);
}
e2->destroy(e2);
continue;
}
}
derived->insert_last(derived, ts1->clone(ts1));
}
e1->destroy(e1);
METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
private_child_cfg_t *this, bool local, linked_list_t *hosts)
{
traffic_selector_list_t *ts = local ? this->my_ts : this->other_ts;
if (log)
{
DBG2(DBG_CFG, "%s traffic selectors for %s:",
supplied ? "selecting" : "proposing", local ? "us" : "other");
}
if (!supplied)
{
while (derived->remove_first(derived, (void**)&ts1) == SUCCESS)
{
if (log)
{
DBG2(DBG_CFG, " %R", ts1);
}
result->insert_last(result, ts1);
}
derived->destroy(derived);
}
else
{
e1 = derived->create_enumerator(derived);
e2 = supplied->create_enumerator(supplied);
/* enumerate all configured/derived selectors */
while (e1->enumerate(e1, &ts1))
{
/* enumerate all supplied traffic selectors */
while (e2->enumerate(e2, &ts2))
{
selected = ts1->get_subset(ts1, ts2);
if (selected)
{
if (log)
{
DBG2(DBG_CFG, " config: %R, received: %R => match: %R",
ts1, ts2, selected);
}
result->insert_last(result, selected);
}
else if (log)
{
DBG2(DBG_CFG, " config: %R, received: %R => no match",
ts1, ts2);
}
}
supplied->reset_enumerator(supplied, e2);
}
e1->destroy(e1);
e2->destroy(e2);
/* force replacing non-dynamic TS to the IPs in transport mode */
return ts->get(ts, hosts, is_transport_mode(this));
}
/* check if we/peer did any narrowing, raise alert */
e1 = derived->create_enumerator(derived);
e2 = result->create_enumerator(result);
while (e1->enumerate(e1, &ts1))
{
if (!e2->enumerate(e2, &ts2) || !ts1->equals(ts1, ts2))
{
charon->bus->alert(charon->bus, ALERT_TS_NARROWED,
local, result, this);
break;
}
}
e1->destroy(e1);
e2->destroy(e2);
/*
* Described in header
*/
linked_list_t *child_cfg_select_ts(child_cfg_t *cfg, bool local,
traffic_selector_list_t *list,
linked_list_t *supplied, linked_list_t *hosts)
{
private_child_cfg_t *this = (private_child_cfg_t*)cfg;
traffic_selector_list_t *ts = list ?: (local ? this->my_ts : this->other_ts);
linked_list_t *result;
bool force, narrowed = FALSE;
derived->destroy_offset(derived, offsetof(traffic_selector_t, destroy));
}
DBG2(DBG_CFG, "%s traffic selectors for %s:",
supplied ? "selecting" : "proposing", local ? "us" : "other");
/* remove any redundant traffic selectors in the list */
e1 = result->create_enumerator(result);
e2 = result->create_enumerator(result);
while (e1->enumerate(e1, &ts1))
/* force replacing non-dynamic TS to the IPs in transport mode, but only
* when proposing as initiator */
force = !supplied && is_transport_mode(this);
result = ts->select(ts, supplied, hosts, force, &narrowed);
if (narrowed)
{
while (e2->enumerate(e2, &ts2))
{
if (ts1 != ts2)
{
if (ts2->is_contained_in(ts2, ts1))
{
result->remove_at(result, e2);
ts2->destroy(ts2);
result->reset_enumerator(result, e1);
break;
}
if (ts1->is_contained_in(ts1, ts2))
{
result->remove_at(result, e1);
ts1->destroy(ts1);
break;
}
}
}
result->reset_enumerator(result, e2);
charon->bus->alert(charon->bus, ALERT_TS_NARROWED,
local, result, this);
}
e1->destroy(e1);
e2->destroy(e2);
return result;
}
METHOD(child_cfg_t, select_traffic_selectors, linked_list_t*,
private_child_cfg_t *this, bool local, linked_list_t *supplied,
linked_list_t *hosts)
{
return child_cfg_select_ts(&this->public, local, NULL, supplied, hosts);
}
METHOD(child_cfg_t, get_updown, char*,
private_child_cfg_t *this)
{
@ -681,13 +582,8 @@ METHOD(child_cfg_t, equals, bool,
{
return FALSE;
}
if (!this->my_ts->equals_offset(this->my_ts, other->my_ts,
offsetof(traffic_selector_t, equals)))
{
return FALSE;
}
if (!this->other_ts->equals_offset(this->other_ts, other->other_ts,
offsetof(traffic_selector_t, equals)))
if (!this->my_ts->equals(this->my_ts, other->my_ts) ||
!this->other_ts->equals(this->other_ts, other->other_ts))
{
return FALSE;
}
@ -733,8 +629,8 @@ METHOD(child_cfg_t, destroy, void,
if (ref_put(&this->refcount))
{
this->proposals->destroy_offset(this->proposals, offsetof(proposal_t, destroy));
this->my_ts->destroy_offset(this->my_ts, offsetof(traffic_selector_t, destroy));
this->other_ts->destroy_offset(this->other_ts, offsetof(traffic_selector_t, destroy));
this->my_ts->destroy(this->my_ts);
this->other_ts->destroy(this->other_ts);
DESTROY_IF(this->label);
free(this->updown);
free(this->interface);
@ -755,6 +651,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
.get_name = _get_name,
.add_traffic_selector = _add_traffic_selector,
.get_traffic_selectors = _get_traffic_selectors,
.select_traffic_selectors = _select_traffic_selectors,
.add_proposal = _add_proposal,
.get_proposals = _get_proposals,
.select_proposal = _select_proposal,
@ -809,8 +706,8 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
.interface = strdupnull(data->interface),
.refcount = 1,
.proposals = linked_list_create(),
.my_ts = linked_list_create(),
.other_ts = linked_list_create(),
.my_ts = traffic_selector_list_create(),
.other_ts = traffic_selector_list_create(),
.replay_window = lib->settings->get_int(lib->settings,
"%s.replay_window", DEFAULT_REPLAY_WINDOW, lib->ns),
.hw_offload = data->hw_offload,

View File

@ -32,6 +32,7 @@ typedef struct child_cfg_create_t child_cfg_create_t;
#include <library.h>
#include <selectors/traffic_selector.h>
#include <selectors/traffic_selector_list.h>
#include <crypto/proposal/proposal.h>
#include <kernel/kernel_ipsec.h>
@ -119,26 +120,53 @@ struct child_cfg_t {
traffic_selector_t *ts);
/**
* Get a list of traffic selectors to use for the CHILD_SA.
* Get a list of configured traffic selectors to use for the CHILD_SA.
*
* The config contains two set of traffic selectors, one for the local
* The config contains two sets of traffic selectors, one for the local
* side, one for the remote side.
*
* Some traffic selectors may be "dynamic", meaning they are narrowed down
* to a specific address (host-to-host or virtual-IP setups). Use the
* \p hosts parameter to narrow such traffic selectors to an address.
*
* Returned list and its traffic selectors must be destroyed after use.
*
* Note that this method does not log anything. If logging is required, use
* select_traffic_selectors() without passing supplied traffic selectors.
*
* @param local TRUE for TS on local side, FALSE for remote
* @param hosts addresses to use for narrowing "dynamic" TS', host_t
* @return list containing the traffic selectors
*/
linked_list_t *(*get_traffic_selectors)(child_cfg_t *this, bool local,
linked_list_t *hosts);
/**
* Select a list of traffic selectors to use for the CHILD_SA.
*
* The config contains two sets of traffic selectors, one for the local
* side, one for the remote side.
*
* If a list with traffic selectors is supplied, these are used to narrow
* down the traffic selector list to the greatest common divisor.
* Some traffic selector may be "dynamic", meaning they are narrowed down
* to a specific address (host-to-host or virtual-IP setups). Use
* the "host" parameter to narrow such traffic selectors to that address.
* Resulted list and its traffic selectors must be destroyed after use.
* down the traffic selector list to the greatest common subset.
*
* Some traffic selectors may be "dynamic", meaning they are narrowed down
* to a specific address (host-to-host or virtual-IP setups). Use the
* \p hosts parameter to narrow such traffic selectors to an address.
*
* Returned list and its traffic selectors must be destroyed after use.
*
* Details about the selection process are logged and an alert is triggered
* if narrowing occurred.
*
* @param local TRUE for TS on local side, FALSE for remote
* @param supplied list with TS to select from, or NULL
* @param hosts addresses to use for narrowing "dynamic" TS', host_t
* @param log FALSE to avoid logging details about the selection
* @return list containing the traffic selectors
*/
linked_list_t *(*get_traffic_selectors)(child_cfg_t *this, bool local,
linked_list_t *supplied,
linked_list_t *hosts, bool log);
linked_list_t *(*select_traffic_selectors)(child_cfg_t *this, bool local,
linked_list_t *supplied,
linked_list_t *hosts);
/**
* Get the updown script to run for the CHILD_SA.
@ -386,6 +414,12 @@ enum child_cfg_option_t {
/** Disable copying the ECN header field in tunnel mode */
OPT_NO_COPY_ECN = (1<<8),
/** Enable per-CPU CHILD_SAs */
OPT_PER_CPU_SAS = (1<<9),
/** Enable UDP encapsulation for per-CPU CHILD_SAs */
OPT_PER_CPU_SAS_ENCAP = (1<<10),
};
/**
@ -449,4 +483,21 @@ struct child_cfg_create_t {
*/
child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data);
/**
* Select and narrow traffic selectors in the given traffic selector list.
* Refer to child_cfg_t::select_traffic_selectors() for details, the difference
* is that this can work with external traffic selector lists.
*
* @param this config to use
* @param local TRUE for TS on local side, FALSE for remote (also
* used for logging)
* @param list traffic selectors to use instead of those in config
* @param supplied list with TS to select from, or NULL
* @param hosts addresses to use for narrowing "dynamic" TS', host_t
* @return list containing the traffic selectors
*/
linked_list_t *child_cfg_select_ts(child_cfg_t *this, bool local,
traffic_selector_list_t *list,
linked_list_t *supplied, linked_list_t *hosts);
#endif /** CHILD_CFG_H_ @}*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2019 Tobias Brunner
* Copyright (C) 2007-2025 Tobias Brunner
* Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
*
@ -68,6 +68,11 @@ struct private_peer_cfg_t {
*/
char *name;
/**
* Options
*/
peer_cfg_option_t options;
/**
* IKE config associated to this peer config
*/
@ -103,21 +108,6 @@ struct private_peer_cfg_t {
*/
uint32_t keyingtries;
/**
* enable support for MOBIKE
*/
bool use_mobike;
/**
* Use aggressive mode?
*/
bool aggressive;
/**
* Use pull or push in mode config?
*/
bool pull_mode;
/**
* Time before starting rekeying
*/
@ -183,11 +173,6 @@ struct private_peer_cfg_t {
*/
identification_t *ppk_id;
/**
* Whether a PPK is required
*/
bool ppk_required;
#ifdef ME
/**
* Is this a mediation connection?
@ -213,6 +198,12 @@ METHOD(peer_cfg_t, get_name, char*,
return this->name;
}
METHOD(peer_cfg_t, has_option, bool,
private_peer_cfg_t *this, peer_cfg_option_t option)
{
return this->options & option;
}
METHOD(peer_cfg_t, get_ike_version, ike_version_t,
private_peer_cfg_t *this)
{
@ -423,7 +414,7 @@ static u_int get_ts_match(child_cfg_t *cfg, bool local,
}
/* fetch configured TS list, narrowing dynamic TS */
cfg_list = cfg->get_traffic_selectors(cfg, local, NULL, hosts, TRUE);
cfg_list = cfg->select_traffic_selectors(cfg, local, NULL, hosts);
/* use a round counter to rate leading TS with higher priority */
round = sup_list->get_count(sup_list);
@ -559,24 +550,6 @@ METHOD(peer_cfg_t, get_over_time, uint32_t,
return this->over_time;
}
METHOD(peer_cfg_t, use_mobike, bool,
private_peer_cfg_t *this)
{
return this->use_mobike;
}
METHOD(peer_cfg_t, use_aggressive, bool,
private_peer_cfg_t *this)
{
return this->aggressive;
}
METHOD(peer_cfg_t, use_pull_mode, bool,
private_peer_cfg_t *this)
{
return this->pull_mode;
}
METHOD(peer_cfg_t, get_dpd, uint32_t,
private_peer_cfg_t *this)
{
@ -648,12 +621,6 @@ METHOD(peer_cfg_t, get_ppk_id, identification_t*,
return this->ppk_id;
}
METHOD(peer_cfg_t, ppk_required, bool,
private_peer_cfg_t *this)
{
return this->ppk_required;
}
#ifdef ME
METHOD(peer_cfg_t, is_mediation, bool,
private_peer_cfg_t *this)
@ -757,23 +724,20 @@ METHOD(peer_cfg_t, equals, bool,
return FALSE;
}
return (
this->options == other->options &&
get_ike_version(this) == get_ike_version(other) &&
this->cert_policy == other->cert_policy &&
this->ocsp_policy == other->ocsp_policy &&
this->unique == other->unique &&
this->keyingtries == other->keyingtries &&
this->use_mobike == other->use_mobike &&
this->rekey_time == other->rekey_time &&
this->reauth_time == other->reauth_time &&
this->jitter_time == other->jitter_time &&
this->over_time == other->over_time &&
this->dpd == other->dpd &&
this->aggressive == other->aggressive &&
this->pull_mode == other->pull_mode &&
auth_cfg_equal(this, other) &&
this->if_id_in == other->if_id_in &&
this->if_id_out == other->if_id_out &&
this->ppk_required == other->ppk_required &&
id_equal(this->ppk_id, other->ppk_id)
#ifdef ME
&& this->mediation == other->mediation &&
@ -839,6 +803,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
INIT(this,
.public = {
.get_name = _get_name,
.has_option = _has_option,
.get_ike_version = _get_ike_version,
.get_ike_cfg = _get_ike_cfg,
.add_child_cfg = _add_child_cfg,
@ -853,9 +818,6 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
.get_rekey_time = _get_rekey_time,
.get_reauth_time = _get_reauth_time,
.get_over_time = _get_over_time,
.use_mobike = _use_mobike,
.use_aggressive = _use_aggressive,
.use_pull_mode = _use_pull_mode,
.get_dpd = _get_dpd,
.get_dpd_timeout = _get_dpd_timeout,
.add_virtual_ip = _add_virtual_ip,
@ -866,7 +828,6 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
.create_auth_cfg_enumerator = _create_auth_cfg_enumerator,
.get_if_id = _get_if_id,
.get_ppk_id = _get_ppk_id,
.ppk_required = _ppk_required,
.equals = (void*)_equals,
.get_ref = _get_ref,
.destroy = _destroy,
@ -877,6 +838,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
#endif /* ME */
},
.name = strdup(name),
.options = data->options,
.ike_cfg = ike_cfg,
.child_cfgs = linked_list_create(),
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
@ -888,15 +850,11 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
.reauth_time = data->reauth_time,
.jitter_time = data->jitter_time,
.over_time = data->over_time,
.use_mobike = !data->no_mobike,
.aggressive = data->aggressive,
.pull_mode = !data->push_mode,
.dpd = data->dpd,
.dpd_timeout = data->dpd_timeout,
.if_id_in = data->if_id_in,
.if_id_out = data->if_id_out,
.ppk_id = data->ppk_id,
.ppk_required = data->ppk_required,
.vips = linked_list_create(),
.pools = linked_list_create(),
.local_auth = linked_list_create(),

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2019 Tobias Brunner
* Copyright (C) 2007-2025 Tobias Brunner
* Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
*
@ -27,6 +27,7 @@
typedef enum cert_policy_t cert_policy_t;
typedef enum ocsp_policy_t ocsp_policy_t;
typedef enum unique_policy_t unique_policy_t;
typedef enum peer_cfg_option_t peer_cfg_option_t;
typedef struct peer_cfg_t peer_cfg_t;
typedef struct peer_cfg_create_t peer_cfg_create_t;
@ -147,6 +148,14 @@ struct peer_cfg_t {
*/
char* (*get_name) (peer_cfg_t *this);
/**
* Check if an option flag is set.
*
* @param option option flag to check
* @return TRUE if option flag set, FALSE otherwise
*/
bool (*has_option)(peer_cfg_t *this, peer_cfg_option_t option);
/**
* Get the IKE version to use for initiating.
*
@ -277,27 +286,6 @@ struct peer_cfg_t {
*/
uint32_t (*get_over_time)(peer_cfg_t *this);
/**
* Use MOBIKE (RFC4555) if peer supports it?
*
* @return TRUE to enable MOBIKE support
*/
bool (*use_mobike) (peer_cfg_t *this);
/**
* Use/Accept aggressive mode with IKEv1?.
*
* @return TRUE to use aggressive mode
*/
bool (*use_aggressive)(peer_cfg_t *this);
/**
* Use pull or push mode for mode config?
*
* @return TRUE to use pull, FALSE to use push mode
*/
bool (*use_pull_mode)(peer_cfg_t *this);
/**
* Get the DPD check interval.
*
@ -357,13 +345,6 @@ struct peer_cfg_t {
*/
identification_t *(*get_ppk_id)(peer_cfg_t *this);
/**
* Whether a PPK is required with this peer.
*
* @return TRUE, if a PPK is required
*/
bool (*ppk_required)(peer_cfg_t *this);
#ifdef ME
/**
* Is this a mediation connection?
@ -418,10 +399,30 @@ struct peer_cfg_t {
void (*destroy) (peer_cfg_t *this);
};
/**
* Option flags that may be set on a peer_cfg_t object.
*/
enum peer_cfg_option_t {
/** Disable MOBIKE (RFC 4555) */
OPT_NO_MOBIKE = (1<<0),
/** Use/accept aggressive mode with IKEv1 */
OPT_IKEV1_AGGRESSIVE = (1<<1),
/** Use IKEv1 modeconfig in push mode (otherwise, pull mode is used) */
OPT_IKEV1_PUSH_MODE = (1<<2),
/** Require a PPK (otherwise, it's optional) */
OPT_PPK_REQUIRED = (1<<3),
};
/**
* Data passed to the constructor of a peer_cfg_t object.
*/
struct peer_cfg_create_t {
/** Options set for peer_cfg_t */
peer_cfg_option_t options;
/** Whether to send a certificate payload */
cert_policy_t cert_policy;
/** Whether to send OCSP status request/response */
@ -438,12 +439,6 @@ struct peer_cfg_create_t {
uint32_t jitter_time;
/** Maximum overtime in seconds before closing a rekeying/reauth SA */
uint32_t over_time;
/** Disable MOBIKE (RFC4555) */
bool no_mobike;
/** Use/accept aggressive mode with IKEv1 */
bool aggressive;
/** TRUE to use modeconfig push, FALSE for pull */
bool push_mode;
/** DPD check interval, 0 to disable */
uint32_t dpd;
/** DPD timeout interval (IKEv1 only), if 0 default applies */
@ -454,8 +449,6 @@ struct peer_cfg_create_t {
uint32_t if_id_out;
/** Postquantum Preshared Key ID (adopted) */
identification_t *ppk_id;
/** TRUE if a PPK is required, FALSE if it's optional */
bool ppk_required;
#ifdef ME
/** TRUE if this is a mediation connection */
bool mediation;

View File

@ -400,6 +400,8 @@ METHOD(job_t, destroy_job, void,
{
this->listener.lock->destroy(this->listener.lock);
DESTROY_IF(this->listener.done);
DESTROY_IF(this->listener.child_cfg);
DESTROY_IF(this->listener.peer_cfg);
free(this);
}
}
@ -416,14 +418,11 @@ METHOD(job_t, initiate_execute, job_requeue_t,
{
ike_sa_t *ike_sa;
interface_listener_t *listener = &job->listener;
peer_cfg_t *peer_cfg = listener->peer_cfg;
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
peer_cfg);
peer_cfg->destroy(peer_cfg);
listener->peer_cfg);
if (!ike_sa)
{
DESTROY_IF(listener->child_cfg);
listener->status = FAILED;
listener_done(listener);
return JOB_REQUEUE_NONE;
@ -449,7 +448,6 @@ METHOD(job_t, initiate_execute, job_requeue_t,
"%d exceeds limit of %d", half_open, limit_half_open);
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager,
ike_sa);
DESTROY_IF(listener->child_cfg);
listener->status = INVALID_STATE;
listener_done(listener);
return JOB_REQUEUE_NONE;
@ -468,7 +466,6 @@ METHOD(job_t, initiate_execute, job_requeue_t,
"limit of %d", jobs, limit_job_load);
charon->ike_sa_manager->checkin_and_destroy(
charon->ike_sa_manager, ike_sa);
DESTROY_IF(listener->child_cfg);
listener->status = INVALID_STATE;
listener_done(listener);
return JOB_REQUEUE_NONE;
@ -476,6 +473,10 @@ METHOD(job_t, initiate_execute, job_requeue_t,
}
}
if (listener->child_cfg)
{
listener->child_cfg->get_ref(listener->child_cfg);
}
if (ike_sa->initiate(ike_sa, listener->child_cfg, NULL) == SUCCESS)
{
if (!listener->logger.callback ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2017 Tobias Brunner
* Copyright (C) 2006-2025 Tobias Brunner
* Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2006 Daniel Roethlisberger
* Copyright (C) 2005 Jan Hutter
@ -106,9 +106,9 @@ struct private_daemon_t {
mutex_t *mutex;
/**
* Integrity check failed?
* Initialization (e.g. integrity check) failed?
*/
bool integrity_failed;
bool init_failed;
/**
* Number of times we have been initialized
@ -193,6 +193,30 @@ void register_custom_logger(char *name,
}
}
#define MAX_LIBCHARON_INIT_FUNCTIONS 10
/**
* Static array for init function registration using __attribute__((constructor))
*/
static library_init_t init_functions[MAX_LIBCHARON_INIT_FUNCTIONS];
static int init_function_count;
/**
* Described in header
*/
void libcharon_init_register(library_init_t init)
{
if (init_function_count < MAX_LIBCHARON_INIT_FUNCTIONS - 1)
{
init_functions[init_function_count++] = init;
}
else
{
fprintf(stderr, "failed to register init function, please increase "
"MAX_LIBCHARON_INIT_FUNCTIONS");
}
}
/**
* Types of supported loggers
*/
@ -368,7 +392,7 @@ static logger_entry_t *get_logger_entry(char *target, logger_type_t type,
get_syslog_facility(target));
break;
#else
free(entry);
logger_entry_destroy(entry);
return NULL;
#endif /* HAVE_SYSLOG */
case CUSTOM_LOGGER:
@ -378,7 +402,7 @@ static logger_entry_t *get_logger_entry(char *target, logger_type_t type,
}
if (!entry->logger.custom)
{
free(entry);
logger_entry_destroy(entry);
return NULL;
}
break;
@ -980,6 +1004,7 @@ private_daemon_t *daemon_create()
void libcharon_deinit()
{
private_daemon_t *this = (private_daemon_t*)charon;
int i;
if (!this || !ref_put(&this->ref))
{ /* have more users */
@ -988,6 +1013,11 @@ void libcharon_deinit()
run_scripts(this, "stop");
for (i = 0; i < init_function_count; ++i)
{
init_functions[i](FALSE);
}
destroy(this);
charon = NULL;
}
@ -998,12 +1028,13 @@ void libcharon_deinit()
bool libcharon_init()
{
private_daemon_t *this;
int i;
if (charon)
{ /* already initialized, increase refcount */
this = (private_daemon_t*)charon;
ref_get(&this->ref);
return !this->integrity_failed;
return !this->init_failed;
}
this = daemon_create();
@ -1019,7 +1050,15 @@ bool libcharon_init()
!lib->integrity->check(lib->integrity, "libcharon", libcharon_init))
{
dbg(DBG_DMN, 1, "integrity check of libcharon failed");
this->integrity_failed = TRUE;
this->init_failed = TRUE;
}
return !this->integrity_failed;
for (i = 0; i < init_function_count; ++i)
{
if (!init_functions[i](TRUE))
{
this->init_failed = TRUE;
}
}
return !this->init_failed;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2017 Tobias Brunner
* Copyright (C) 2006-2025 Tobias Brunner
* Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2006 Daniel Roethlisberger
* Copyright (C) 2005 Jan Hutter
@ -391,6 +391,16 @@ bool libcharon_init();
*/
void libcharon_deinit();
/**
* Register a custom init function that's called at the end of libcharon_init()
* and the start of libcharon_deinit().
*
* To be called from __attribute__((constructor)) functions.
*
* @param init init function
*/
void libcharon_init_register(library_init_t init);
/**
* Register a custom logger constructor.
*

View File

@ -2100,7 +2100,7 @@ static message_t *create_fragment(private_message_t *this, payload_type_t next,
* or transaction messages. */
ike_sa = charon->bus->get_sa(charon->bus);
if (ike_sa && (peer_cfg = ike_sa->get_peer_cfg(ike_sa)) &&
peer_cfg->use_aggressive(peer_cfg))
peer_cfg->has_option(peer_cfg, OPT_IKEV1_AGGRESSIVE))
{
message->set_exchange_type(message, AGGRESSIVE);
}

View File

@ -1023,7 +1023,7 @@ encrypted_fragment_payload_t *encrypted_fragment_payload_create()
.get_length = _frag_get_length,
.add_payload = _frag_add_payload,
.remove_payload = (void*)return_null,
.generate_payloads = nop,
.generate_payloads = (void*)nop,
.set_transform = _frag_set_transform,
.get_transform = _frag_get_transform,
.encrypt = _frag_encrypt,

View File

@ -61,9 +61,10 @@ ENUM_NEXT(notify_type_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUTHENTIC
"USE_ASSIGNED_HoA",
"TEMPORARY_FAILURE",
"CHILD_SA_NOT_FOUND");
ENUM_NEXT(notify_type_names, STATE_NOT_FOUND, STATE_NOT_FOUND, CHILD_SA_NOT_FOUND,
"STATE_NOT_FOUND");
ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, STATE_NOT_FOUND,
ENUM_NEXT(notify_type_names, STATE_NOT_FOUND, TS_MAX_QUEUE, CHILD_SA_NOT_FOUND,
"STATE_NOT_FOUND",
"TS_MAX_QUEUE");
ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, TS_MAX_QUEUE,
"ME_CONNECT_FAILED");
ENUM_NEXT(notify_type_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
"MS_NOTIFY_STATUS");
@ -121,9 +122,12 @@ ENUM_NEXT(notify_type_names, USE_PPK, INTERMEDIATE_EXCHANGE_SUPPORTED, SIGNATURE
"PPK_IDENTITY",
"NO_PPK_AUTH",
"INTERMEDIATE_EXCHANGE_SUPPORTED");
ENUM_NEXT(notify_type_names, ADDITIONAL_KEY_EXCHANGE, ADDITIONAL_KEY_EXCHANGE, INTERMEDIATE_EXCHANGE_SUPPORTED,
"ADDITIONAL_KEY_EXCHANGE");
ENUM_NEXT(notify_type_names, INITIAL_CONTACT_IKEV1, INITIAL_CONTACT_IKEV1, ADDITIONAL_KEY_EXCHANGE,
ENUM_NEXT(notify_type_names, ADDITIONAL_KEY_EXCHANGE, USE_AGGFRAG, INTERMEDIATE_EXCHANGE_SUPPORTED,
"ADDITIONAL_KEY_EXCHANGE",
"USE_AGGFRAG");
ENUM_NEXT(notify_type_names, SA_RESOURCE_INFO, SA_RESOURCE_INFO, USE_AGGFRAG,
"SA_RESOURCE_INFO");
ENUM_NEXT(notify_type_names, INITIAL_CONTACT_IKEV1, INITIAL_CONTACT_IKEV1, SA_RESOURCE_INFO,
"INITIAL_CONTACT");
ENUM_NEXT(notify_type_names, DPD_R_U_THERE, DPD_R_U_THERE_ACK, INITIAL_CONTACT_IKEV1,
"DPD_R_U_THERE",
@ -180,9 +184,10 @@ ENUM_NEXT(notify_type_short_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUT
"ASSIGNED_HoA",
"TEMP_FAIL",
"NO_CHILD_SA");
ENUM_NEXT(notify_type_short_names, STATE_NOT_FOUND, STATE_NOT_FOUND, CHILD_SA_NOT_FOUND,
"NO_STATE");
ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, STATE_NOT_FOUND,
ENUM_NEXT(notify_type_short_names, STATE_NOT_FOUND, TS_MAX_QUEUE, CHILD_SA_NOT_FOUND,
"NO_STATE",
"MAX_QUEUE");
ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, TS_MAX_QUEUE,
"ME_CONN_FAIL");
ENUM_NEXT(notify_type_short_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
"MS_STATUS");
@ -240,9 +245,12 @@ ENUM_NEXT(notify_type_short_names, USE_PPK, INTERMEDIATE_EXCHANGE_SUPPORTED, SIG
"PPK_ID",
"NO_PPK",
"IKE_INT_SUP");
ENUM_NEXT(notify_type_short_names, ADDITIONAL_KEY_EXCHANGE, ADDITIONAL_KEY_EXCHANGE, INTERMEDIATE_EXCHANGE_SUPPORTED,
"ADD_KE");
ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT_IKEV1, INITIAL_CONTACT_IKEV1, ADDITIONAL_KEY_EXCHANGE,
ENUM_NEXT(notify_type_short_names, ADDITIONAL_KEY_EXCHANGE, USE_AGGFRAG, INTERMEDIATE_EXCHANGE_SUPPORTED,
"ADD_KE",
"AGGFRAG");
ENUM_NEXT(notify_type_short_names, SA_RESOURCE_INFO, SA_RESOURCE_INFO, USE_AGGFRAG,
"RES_INFO");
ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT_IKEV1, INITIAL_CONTACT_IKEV1, SA_RESOURCE_INFO,
"INITIAL_CONTACT");
ENUM_NEXT(notify_type_short_names, DPD_R_U_THERE, DPD_R_U_THERE_ACK, INITIAL_CONTACT_IKEV1,
"DPD",
@ -554,6 +562,12 @@ METHOD(payload_t, verify, status_t,
bad_length = TRUE;
}
break;
case USE_AGGFRAG:
if (this->notify_data.len != 1)
{
bad_length = TRUE;
}
break;
default:
/* TODO: verify */
break;

View File

@ -82,6 +82,8 @@ enum notify_type_t {
/* multiple key exchanges, RFC 9370 */
STATE_NOT_FOUND = 47,
/* No more per-resource CHILD_SAs, RFC 9611 */
TS_MAX_QUEUE = 48,
/* IKE-ME, private use */
ME_CONNECT_FAILED = 8192,
@ -169,6 +171,11 @@ enum notify_type_t {
/* multiple key exchanges, RFC 9370 */
ADDITIONAL_KEY_EXCHANGE = 16441,
/* IP-TFS/AGGFRAG, RFC 9347 */
USE_AGGFRAG = 16442,
/* Resource info for CHILD_SAs, RFC 9611 */
SA_RESOURCE_INFO = 16444,
/* IKEv1 initial contact */
INITIAL_CONTACT_IKEV1 = 24578,

View File

@ -56,22 +56,30 @@ static inline protocol_id_t proto_ip2ike(uint8_t protocol)
METHOD(kernel_listener_t, acquire, bool,
private_kernel_handler_t *this, uint32_t reqid, kernel_acquire_data_t *data)
{
char buf[BUF_LEN] = "";
char lbuf[BUF_LEN] = "", cbuf[32] = "", sbuf[32] = "";
if (data->label)
{
snprintf(buf, sizeof(buf), ", label {%s}",
snprintf(lbuf, sizeof(lbuf), ", label {%s}",
data->label->get_string(data->label));
}
if (data->cpu != CPU_ID_MAX)
{
snprintf(cbuf, sizeof(cbuf), ", cpu {%u}", data->cpu);
}
if (data->seq)
{
snprintf(sbuf, sizeof(sbuf), ", seq {%u}", data->seq);
}
if (data->src && data->dst)
{
DBG1(DBG_KNL, "creating acquire job for policy %R === %R with "
"reqid {%u}%s", data->src, data->dst, reqid, buf);
"reqid {%u}%s%s%s", data->src, data->dst, reqid, lbuf, cbuf, sbuf);
}
else
{
DBG1(DBG_KNL, "creating acquire job for policy with reqid {%u}%s",
reqid, buf);
DBG1(DBG_KNL, "creating acquire job for policy with reqid {%u}%s%s%s",
reqid, lbuf, cbuf, sbuf);
}
lib->processor->queue_job(lib->processor,
(job_t*)acquire_job_create(reqid, data));

View File

@ -392,12 +392,19 @@ METHOD(kernel_interface_t, alloc_reqid, status_t,
/* search by reqid if given */
entry = this->reqids->get(this->reqids, tmpl);
}
if (entry && entry_equals_selectors(entry, tmpl))
/* if the IPsec stack supports sequence numbers for acquires, we can
* allocate a new reqid if narrowing occurred (otherwise, we get the same
* reqid back anyway). if not, we want to reuse the existing reqid of
* the trap polices and explicitly don't want to match the traffic
* selectors. another case where we want to reuse an existing reqid is
* when labels are used. because we currently only install policies once
* with the generic label, the reqid has to stay the same even if narrowing
* occurs. however, in either case we don't want to reuse the reqid if the
* additional selectors (e.g. marks) are different */
if (entry && (label || !(get_features(this) & KERNEL_ACQUIRE_SEQ)) &&
entry_equals_selectors(entry, tmpl))
{
/* we don't require a traffic selector match for existing reqids,
* as we want to reuse a reqid for trap-triggered policies that
* got narrowed during negotiation, but we don't want to reuse the
* reqid if the additional selectors (e.g. marks) are different */
reqid_entry_destroy(tmpl);
}
else

View File

@ -81,6 +81,8 @@ enum kernel_feature_t {
KERNEL_POLICY_SPI = (1<<4),
/** IPsec backend reports use time per SA via query_sa() */
KERNEL_SA_USE_TIME = (1<<5),
/** IPsec backend associates acquires and SAs with a sequence number */
KERNEL_ACQUIRE_SEQ = (1<<6),
};
/**

Some files were not shown because too many files have changed in this diff Show More