6 years agovici: Use silent builder destroy function in vici_free_req()
Martin Willi [Fri, 12 Dec 2014 09:07:31 +0000 (10:07 +0100)]
vici: Use silent builder destroy function in vici_free_req()

6 years agovici: Add a destroy method to builder, allowing cancellation without error
Martin Willi [Fri, 12 Dec 2014 09:06:39 +0000 (10:06 +0100)]
vici: Add a destroy method to builder, allowing cancellation without error

When cancelling a builder, finalize throws an error which we might prefer
to avoid.

6 years agoeap-radius: Use the single-server legacy server options as fallback
Martin Willi [Thu, 11 Dec 2014 11:29:53 +0000 (12:29 +0100)]
eap-radius: Use the single-server legacy server options as fallback

6 years agoPack private key arrays
Andreas Steffen [Wed, 10 Dec 2014 21:45:13 +0000 (22:45 +0100)]
Pack private key arrays

6 years agodumm: Fix -Wformat warning in ruby extension
Martin Willi [Wed, 10 Dec 2014 13:26:14 +0000 (14:26 +0100)]
dumm: Fix -Wformat warning in ruby extension

In recent ruby versions, extensions get built with -Wformat. As we use custom
printf specifiers, that does not work for us. As there does not seem to be a
reliable way to override -Wformat, we use a variable for the format string,
which prevents gcc from doing the -Wformat check in that particular situation.

6 years agoAutomatic generation of optimized Huffman codes
Andreas Steffen [Tue, 9 Dec 2014 06:48:51 +0000 (07:48 +0100)]
Automatic generation of optimized Huffman codes

6 years agounit-tests: added bliss_sampler test
Andreas Steffen [Tue, 9 Dec 2014 06:44:36 +0000 (07:44 +0100)]
unit-tests: added bliss_sampler test

6 years agoExpanded bliss_bitpacker to 32 bits
Andreas Steffen [Tue, 9 Dec 2014 06:31:59 +0000 (07:31 +0100)]
Expanded bliss_bitpacker to 32 bits

6 years agoNEWS: Add note about AH algorithm mapping
Tobias Brunner [Fri, 5 Dec 2014 14:06:31 +0000 (15:06 +0100)]
NEWS: Add note about AH algorithm mapping

6 years agoikev1: Use same map for AH and ESP authentication algorithms
Tobias Brunner [Mon, 24 Nov 2014 16:28:27 +0000 (17:28 +0100)]
ikev1: Use same map for AH and ESP authentication algorithms

The transform identifier used in AH transforms is not the same as the
authentication algorithm identifier used in the transform attributes in
AH (and ESP) transforms.

6 years agoikev1: Accept IPComp proposals with 4 octet long CPI values
Tobias Brunner [Tue, 4 Nov 2014 17:24:16 +0000 (18:24 +0100)]
ikev1: Accept IPComp proposals with 4 octet long CPI values

While they SHOULD be sent as 16-bit values according to RFC 3173
a responder MUST be able to accept CPI values encoded in four bytes.

6 years agoike: Only parse payloads valid for the current IKE version
Tobias Brunner [Tue, 21 Oct 2014 12:03:25 +0000 (14:03 +0200)]
ike: Only parse payloads valid for the current IKE version

6 years agoike: Make check for known payloads depend on IKE version
Tobias Brunner [Tue, 21 Oct 2014 09:22:51 +0000 (11:22 +0200)]
ike: Make check for known payloads depend on IKE version

6 years agopkcs5: Add support for PBES2 encryption schemes other than 3DES
Tobias Brunner [Fri, 17 Oct 2014 08:16:19 +0000 (10:16 +0200)]
pkcs5: Add support for PBES2 encryption schemes other than 3DES

This allows using e.g. AES for PKCS#8 and PKCS#12 files.

Some legacy schemes defined in RFC 2898 are not supported (like RC2).

Fixes #740.

6 years agoasn1: Add OID for Blowfish CBC
Tobias Brunner [Fri, 17 Oct 2014 10:33:14 +0000 (12:33 +0200)]
asn1: Add OID for Blowfish CBC

The OID ( is technically not correct, the correct
one is (  Every other library or tool (like OpenSSL)
uses the incorrect one so we do the same.

References #740.

6 years agodiffie-hellman: Handle dh_exponent_ansi_x9_42 as a boolean setting
Martin Willi [Fri, 5 Dec 2014 12:48:51 +0000 (13:48 +0100)]
diffie-hellman: Handle dh_exponent_ansi_x9_42 as a boolean setting

While it was always documented as boolean setting, the option is currently
handled as integer value, for which yes/no values do not work. Instead the
default of TRUE is used for a no value.

The option has been moved a lot during the last years, and in some locations
was handled as bool, in some as integer. In the latest codebase it
congruently used integer, which is actually not what is documented and used
in testing.

Fixes #781.

6 years agounity: Only do narrowing of responder's TS if we received
Tobias Brunner [Thu, 16 Oct 2014 14:16:48 +0000 (16:16 +0200)]
unity: Only do narrowing of responder's TS if we received

iOS and Mac OS X clients establish individual IPsec SAs for the traffic
selectors received in Split-Include attributes (might have been different
in earlier releases).  If we return as TSr that either results
in a bunch of Quick Mode exchanges (for each TS), or with the latest
client releases an error notify (ATTRIBUTES_NOT_SUPPORTED).
We also can't install the IPsec SA with all configured subnets as that
would cause conflicts if the client later negotiates SAs for other subnets,
which iOS 8 does based on traffic to such subnets.

For Shrew and the Cisco client, which propose, we still need to
override the narrowed TS with, as they otherwise won't accept
the Quick Mode response.  Likewise, we also have to narrow the TS before
installing the IPsec SAs and policies.

So we basically have to follow the client's proposal and only modify TSr
if we received  Since we don't get the original TS in the
narrow hook we handle the inbound QM messages and make note of IKE_SAs on
which we received a TSr of

Fixes #737.

6 years agoid-payload: Enable multiple calls to get_ts() for subnet traffic selectors
Tobias Brunner [Thu, 16 Oct 2014 14:10:41 +0000 (16:10 +0200)]
id-payload: Enable multiple calls to get_ts() for subnet traffic selectors

The second call resulted in a /32 subnet previously.

6 years agoikev2: Fix handling of more than one hash-and-URL certificate payloads
Tobias Brunner [Thu, 4 Dec 2014 10:32:22 +0000 (11:32 +0100)]
ikev2: Fix handling of more than one hash-and-URL certificate payloads

6 years agoMerge branch 'wfp-drop-firewall'
Martin Willi [Thu, 4 Dec 2014 10:11:47 +0000 (11:11 +0100)]
Merge branch 'wfp-drop-firewall'

Introduces ALE layer WFP rules to accept tunnel mode packets in Windows
stateful packet filtering if default-drop policies are used.

6 years agokernel-wfp: Install outbound ALE connect rules for IPsec
Martin Willi [Fri, 28 Nov 2014 08:39:40 +0000 (09:39 +0100)]
kernel-wfp: Install outbound ALE connect rules for IPsec

Similar to the inbound rules, the ALE filter processes IP-in-IP packets for
outbound tunnel mode traffic. When using an outbound default-drop policy,
Windows does not allow connection initiation without these explicit rules.

6 years agokernel-wfp: Install inbound ALE IP-in-IP filters
Martin Willi [Thu, 27 Nov 2014 18:19:09 +0000 (19:19 +0100)]
kernel-wfp: Install inbound ALE IP-in-IP filters

When processing inbound tunnel mode packets, Windows decrypts packets and
filters them as IP-in-IP packets. We therefore require an ALE filter that
calls the FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_ALE_ACCEPT callout to allow them
when using a default-drop policy.

Without these rules, any outbound packet created an ALE state that allows
inbound packets as well. Processing inbound packets without any outbound
traffic fails without these rules.

6 years agokernel-wfp: Add missing IPsec sublayer GUIDs
Martin Willi [Fri, 28 Nov 2014 14:41:21 +0000 (15:41 +0100)]
kernel-wfp: Add missing IPsec sublayer GUIDs

6 years agokernel-wfp: Define IPsec related ALE layers and callout GUIDs
Martin Willi [Thu, 27 Nov 2014 18:00:34 +0000 (19:00 +0100)]
kernel-wfp: Define IPsec related ALE layers and callout GUIDs

6 years agokernel-wfp: Fix logging of MM/QM/EM NetEvent failures
Martin Willi [Thu, 27 Nov 2014 18:10:11 +0000 (19:10 +0100)]
kernel-wfp: Fix logging of MM/QM/EM NetEvent failures

6 years agovici: Make sure to send/recv all requested bytes over socket
Martin Willi [Wed, 19 Nov 2014 13:20:47 +0000 (14:20 +0100)]
vici: Make sure to send/recv all requested bytes over socket

As the underlying C functions, send/recv on ruby sockets are not guaranteed
to send/recv all requested bytes. Use wrapper functions to make sure we get
all bytes needed.

6 years agoupdown: Inverse comment of VPN_LOGGING variable, as it is enabled by default
Martin Willi [Tue, 2 Dec 2014 14:02:41 +0000 (15:02 +0100)]
updown: Inverse comment of VPN_LOGGING variable, as it is enabled by default

Fixes #780.

6 years agoVersion bump to 5.2.2dr1 5.2.2dr1
Andreas Steffen [Sat, 29 Nov 2014 14:00:10 +0000 (15:00 +0100)]
Version bump to 5.2.2dr1

6 years agoIncreased check size du to INITIAL_CONTACT notify
Andreas Steffen [Sat, 29 Nov 2014 13:57:41 +0000 (14:57 +0100)]
Increased check size du to INITIAL_CONTACT notify

6 years agoRenewed expired certificates
Andreas Steffen [Sat, 29 Nov 2014 10:52:49 +0000 (11:52 +0100)]
Renewed expired certificates

6 years agoImplemented full BLISS support for IKEv2 public key authentication and the pki tool
Andreas Steffen [Fri, 28 Nov 2014 12:13:47 +0000 (13:13 +0100)]
Implemented full BLISS support for IKEv2 public key authentication and the pki tool

6 years agoCreated ikev2/rw-ntru-bliss scenario
Andreas Steffen [Fri, 28 Nov 2014 12:11:58 +0000 (13:11 +0100)]
Created ikev2/rw-ntru-bliss scenario

6 years agoApplied bit packing to BLISS public key
Andreas Steffen [Thu, 27 Nov 2014 10:55:54 +0000 (11:55 +0100)]
Applied bit packing to BLISS public key

6 years agoWipe BLISS private key memory
Andreas Steffen [Thu, 27 Nov 2014 08:42:36 +0000 (09:42 +0100)]
Wipe BLISS private key memory

6 years agoCreated bliss_bitpacker class to encode BLISS signatures
Andreas Steffen [Thu, 27 Nov 2014 07:52:24 +0000 (08:52 +0100)]
Created bliss_bitpacker class to encode BLISS signatures

6 years agoSkip the unused bits field of the ASN.1 BIT STRING encoding
Andreas Steffen [Thu, 27 Nov 2014 07:48:45 +0000 (08:48 +0100)]
Skip the unused bits field of the ASN.1 BIT STRING encoding

6 years agoStore NTT A of BLISS public key a
Andreas Steffen [Mon, 24 Nov 2014 22:02:23 +0000 (23:02 +0100)]
Store NTT A of BLISS public key a

6 years agounit-tests: created bliss_sign test suite
Andreas Steffen [Mon, 24 Nov 2014 21:02:49 +0000 (22:02 +0100)]
unit-tests: created bliss_sign test suite

6 years agoFinished BLISS signature generation
Andreas Steffen [Tue, 18 Nov 2014 06:51:53 +0000 (07:51 +0100)]
Finished BLISS signature generation

6 years agoImplemented Gaussian rejection sampler
Andreas Steffen [Tue, 11 Nov 2014 13:21:00 +0000 (14:21 +0100)]
Implemented Gaussian rejection sampler

The bliss_sampler class uses the mgf1_bitspender as a
pseudo-random source.

6 years agoImplemented get_byte() method for mgf1_bitspender class
Andreas Steffen [Mon, 10 Nov 2014 06:56:28 +0000 (07:56 +0100)]
Implemented get_byte() method for mgf1_bitspender class

The new get_byte() method returns a pseudo-random byte at a time.
Changed the get_bits() interface to the same interface as get_byte().
Updated the mgf1 unit-tests accordingly.

6 years agoAdded support for BLISS-III
Andreas Steffen [Mon, 10 Nov 2014 06:55:32 +0000 (07:55 +0100)]
Added support for BLISS-III

6 years agoStarted implementing BLISS signature generation
Andreas Steffen [Sun, 9 Nov 2014 13:38:55 +0000 (14:38 +0100)]
Started implementing BLISS signature generation

6 years agoStore and parse BLISS private and public keys in DER and PEM format
Andreas Steffen [Tue, 4 Nov 2014 19:51:33 +0000 (20:51 +0100)]
Store and parse BLISS private and public keys in DER and PEM format

Additionally generate SHA-1 fingerprints of raw BLISS subjectPublicKey
and subjectPublicKeyInfo objects.

Some basic functions used by the bliss_public_key class are shared
with the bliss_private_key class.

6 years agounit-tests: Created separate mgf1 test suite
Andreas Steffen [Sun, 2 Nov 2014 16:35:16 +0000 (17:35 +0100)]
unit-tests: Created separate mgf1 test suite

6 years agoUse mgf1_bitspender in ntru_poly_create_from_seed
Andreas Steffen [Sat, 1 Nov 2014 12:11:43 +0000 (13:11 +0100)]
Use mgf1_bitspender in ntru_poly_create_from_seed

6 years agoUse mgf1_bitspender to generate random secret key
Andreas Steffen [Sat, 1 Nov 2014 10:29:03 +0000 (11:29 +0100)]
Use mgf1_bitspender to generate random secret key

6 years agoImplemented bitspender based on the MGF1 mask generator function
Andreas Steffen [Sat, 1 Nov 2014 09:16:54 +0000 (10:16 +0100)]
Implemented bitspender based on the MGF1 mask generator function

6 years agounit-tests: Added bliss_fft test suite
Andreas Steffen [Thu, 30 Oct 2014 13:31:26 +0000 (14:31 +0100)]
unit-tests: Added bliss_fft test suite

6 years agoMoved mgf1 class to libstrongswan/crypto/mgf1
Andreas Steffen [Thu, 30 Oct 2014 07:00:41 +0000 (08:00 +0100)]
Moved mgf1 class to libstrongswan/crypto/mgf1

6 years agoDefined BLISS I and IV parameter sets
Andreas Steffen [Wed, 29 Oct 2014 21:35:13 +0000 (22:35 +0100)]
Defined BLISS I and IV parameter sets

6 years agoAdded BLISS OIDs in ITA-HSR OID tree
Andreas Steffen [Wed, 29 Oct 2014 21:34:36 +0000 (22:34 +0100)]
Added BLISS OIDs in ITA-HSR OID tree

6 years agoImplemented Number Theoretic Transform using the FFT algorithm
Andreas Steffen [Sat, 25 Oct 2014 17:09:41 +0000 (19:09 +0200)]
Implemented Number Theoretic Transform using the FFT algorithm

By pre-multiplying the input arrays with a linear phase the
fast multiplication via FFT and inverse FFT computes a negative
wrapped convolution corresponding to a modulus of x^n+1.

6 years agoCreated framework for BLISS post-quantum signature algorithm
Andreas Steffen [Tue, 21 Oct 2014 22:19:49 +0000 (00:19 +0200)]
Created framework for BLISS post-quantum signature algorithm

6 years agolibtls: Catch POLLHUP/NVAL in TLS socket splicing
Martin Willi [Fri, 28 Nov 2014 14:50:58 +0000 (15:50 +0100)]
libtls: Catch POLLHUP/NVAL in TLS socket splicing

If one of the sockets gets disconnected, some systems return POLLHUP. Signal
the socket as ready to let the read/write call fail properly.

6 years agowatcher: Proper handle poll() POLLHUP/NVAL signaling
Martin Willi [Fri, 28 Nov 2014 11:36:10 +0000 (12:36 +0100)]
watcher: Proper handle poll() POLLHUP/NVAL signaling

poll() may return POLLHUP or POLLNVAL for given file descriptors. To handle
these properly, we signal them to the EXCEPT watcher state, if registered. If
not, we call the read/write callbacks, so they can properly fail when trying
to read from or write to the file descriptor.

6 years agowindows: Properly set errno for read/write functions using Winsock
Martin Willi [Thu, 27 Nov 2014 17:15:45 +0000 (18:15 +0100)]
windows: Properly set errno for read/write functions using Winsock

6 years agoikev2: Fix ike_rekey switch statement broken with last commit
Martin Willi [Mon, 24 Nov 2014 09:03:26 +0000 (10:03 +0100)]
ikev2: Fix ike_rekey switch statement broken with last commit

6 years agoikev2: Prevent IKE_SA rekeying if we are currently retrying a CHILD_SA rekey
Martin Willi [Fri, 21 Nov 2014 11:10:16 +0000 (12:10 +0100)]
ikev2: Prevent IKE_SA rekeying if we are currently retrying a CHILD_SA rekey

6 years agocontroller: Keep following initiate() if the first DH guess was wrong
Martin Willi [Mon, 3 Nov 2014 08:39:16 +0000 (09:39 +0100)]
controller: Keep following initiate() if the first DH guess was wrong

6 years agochild-sa: Introduce a CHILD_RETRYING state to detect DH group retries
Martin Willi [Mon, 3 Nov 2014 08:38:27 +0000 (09:38 +0100)]
child-sa: Introduce a CHILD_RETRYING state to detect DH group retries

6 years agoMerge branch 'poll'
Martin Willi [Fri, 21 Nov 2014 11:49:07 +0000 (12:49 +0100)]
Merge branch 'poll'

Replace relevant uses of select() by poll(). poll(2) avoids the difficulties
we have with more than 1024 open file descriptors, and seems to be fairly

Fixes #757.

6 years agowindows: Move the compatibility header to the compat subfolder
Martin Willi [Thu, 6 Nov 2014 13:31:28 +0000 (14:31 +0100)]
windows: Move the compatibility header to the compat subfolder

6 years agoapple: Wrap accept() and recvfrom() with poll(2) instead of select
Martin Willi [Thu, 6 Nov 2014 13:40:52 +0000 (14:40 +0100)]
apple: Wrap accept() and recvfrom() with poll(2) instead of select

6 years agoapple: Introduce a central compatibility header with all __APPLE__ quirks
Martin Willi [Thu, 6 Nov 2014 13:27:07 +0000 (14:27 +0100)]
apple: Introduce a central compatibility header with all __APPLE__ quirks

6 years agowatcher: Use Windows read/write(2) wrappers instead of compile-conditions
Martin Willi [Thu, 6 Nov 2014 13:20:28 +0000 (14:20 +0100)]
watcher: Use Windows read/write(2) wrappers instead of compile-conditions

6 years agowindows: Provide a write(2) wrapper that uses send(2) on sockets
Martin Willi [Thu, 6 Nov 2014 13:18:22 +0000 (14:18 +0100)]
windows: Provide a write(2) wrapper that uses send(2) on sockets

6 years agowindows: Provide a read(2) wrapper that uses recv(2) on sockets
Martin Willi [Thu, 6 Nov 2014 13:15:09 +0000 (14:15 +0100)]
windows: Provide a read(2) wrapper that uses recv(2) on sockets

6 years agounit-tests: Test cancellability of some cancellation points we rely on
Martin Willi [Thu, 6 Nov 2014 10:19:51 +0000 (11:19 +0100)]
unit-tests: Test cancellability of some cancellation points we rely on

6 years agothread: Test for pending cancellation requests before poll()ing on OS X
Martin Willi [Wed, 5 Nov 2014 18:30:45 +0000 (19:30 +0100)]
thread: Test for pending cancellation requests before poll()ing on OS X

As we are now using poll(2) instead of select(2), we need the work-around from
76dc329e for poll() as well.

6 years agokernel-libipsec: Use poll(2) instead of select
Martin Willi [Wed, 5 Nov 2014 16:44:30 +0000 (17:44 +0100)]
kernel-libipsec: Use poll(2) instead of select

6 years agowatcher: Use poll(2) instead of select
Martin Willi [Wed, 5 Nov 2014 16:31:17 +0000 (17:31 +0100)]
watcher: Use poll(2) instead of select

6 years agolibtls: Use poll(2) instead of select() in tls_socket
Martin Willi [Wed, 5 Nov 2014 16:09:56 +0000 (17:09 +0100)]
libtls: Use poll(2) instead of select() in tls_socket

6 years agosocket-default: Use round-robin selection of sockets to read from
Martin Willi [Fri, 21 Nov 2014 10:43:20 +0000 (11:43 +0100)]
socket-default: Use round-robin selection of sockets to read from

If multiple sockets are ready, we previously preferred the IPv4 non-NAT socket
over others. To handle all with equal priority, use a round-robin selection.

6 years agosocket-default: Use poll(2) instead of select
Martin Willi [Wed, 5 Nov 2014 15:59:39 +0000 (16:59 +0100)]
socket-default: Use poll(2) instead of select

It is not only simpler, but also allows the use of arbitrary high fd numbers,
which silently fails with select().

6 years agotun-device: Read from tun to buffer on stack to avoid over-allocation of packets
Martin Willi [Fri, 21 Nov 2014 10:23:08 +0000 (11:23 +0100)]
tun-device: Read from tun to buffer on stack to avoid over-allocation of packets

Instead of allocating MTU-sized buffers for each packet, read to a stack buffer
and copy to an allocation of the actual packet size. While it requires an
additional copy on non-Apple platforms, this should make allocation more
efficient for small packets.

6 years agotun-device: Remove the superfluous use of select() before read()
Martin Willi [Wed, 5 Nov 2014 15:43:01 +0000 (16:43 +0100)]
tun-device: Remove the superfluous use of select() before read()

6 years agolibradius: Use poll(2) to wait for RADIUS responses
Martin Willi [Wed, 5 Nov 2014 15:28:42 +0000 (16:28 +0100)]
libradius: Use poll(2) to wait for RADIUS responses

6 years agowindows: Provide a poll(2) wrapper calling WSAPoll()
Martin Willi [Thu, 6 Nov 2014 11:11:25 +0000 (12:11 +0100)]
windows: Provide a poll(2) wrapper calling WSAPoll()

6 years agoMerge branch 'netlink-extensions'
Martin Willi [Fri, 21 Nov 2014 10:01:39 +0000 (11:01 +0100)]
Merge branch 'netlink-extensions'

Introduces options to enable concurrent Netlink queries. While this does not
make much sense on vanilla Linux, this can help on third party stacks to
increase throughput if longer latencies are to expect. Netlink message
retransmission can be optionally enabled if transmission is unreliable.
Non-socket based IKE bypass policies and other tweaks bring better compatibility
to third party stacks using Netlink.

6 years agokernel-netlink: Optionally ignore errors resulting from response message loss
Martin Willi [Thu, 14 Aug 2014 09:33:12 +0000 (11:33 +0200)]
kernel-netlink: Optionally ignore errors resulting from response message loss

As some backends over unreliable transport do not cache response messages,
retransmissions due the loss of responses perform the operation again. Add an
option to ignore some errors arising from such duplicate operations.

Note: This approach can't distinguish between real EXIST/NOTFOUND errors
and packet failures, and therefore is a source of race conditions and can't
detect any of these errors actually happening. Therefore that behavior is
disabled by default, and can be enabled with the ignore_retransmit_errors
strongswan.conf option.

To properly distinguish between real and retransmission errors, a Netlink
backend should implement retransmission detection using sequence numbers.

6 years agokernel-netlink: Add an option to enforce using XFRM_MSG_UPDPOLICY
Martin Willi [Tue, 29 Jul 2014 14:38:45 +0000 (16:38 +0200)]
kernel-netlink: Add an option to enforce using XFRM_MSG_UPDPOLICY

6 years agokernel-netlink: Fallback to UDP if detecting socket protocol fails
Martin Willi [Mon, 29 Sep 2014 15:11:53 +0000 (17:11 +0200)]
kernel-netlink: Fallback to UDP if detecting socket protocol fails

getsockopt(SO_PROTOCOL) is not supported before 2.6.32. Default to UDP if
either the SO_PROTOCOL define is missing or the syscall fails.

6 years agokernel-netlink: Alternatively support global port based IKE bypass policies
Martin Willi [Wed, 16 Jul 2014 14:31:52 +0000 (16:31 +0200)]
kernel-netlink: Alternatively support global port based IKE bypass policies

The socket based IKE bypass policies are usually superior, but not supported
on all networking stacks. The port based variant uses global policies for the
UDP ports we have IKE sockets for.

6 years agoconf: Document kernel-netlink retransmission and parallelization options
Martin Willi [Wed, 16 Jul 2014 11:22:21 +0000 (13:22 +0200)]
conf: Document kernel-netlink retransmission and parallelization options

6 years agokernel-netlink: Add options to enable parallel Netlink queries explicitly
Martin Willi [Wed, 16 Jul 2014 10:38:30 +0000 (12:38 +0200)]
kernel-netlink: Add options to enable parallel Netlink queries explicitly

As under vanilla Linux the kernel can't handle parallel dump queries and returns
EBUSY, it makes not much sense to use them. Disable parallel queries by default
to basically restore original behavior, improving performance.

6 years agokernel-netlink: Release lock while doing Netlink NEW/DELADDR operations
Martin Willi [Wed, 16 Jul 2014 09:59:59 +0000 (11:59 +0200)]
kernel-netlink: Release lock while doing Netlink NEW/DELADDR operations

Besides that it can improve throughput, it avoids a deadlock situation. If
all threads are busy, watcher will invoke the FD notification for NEWADDR
events itself. If the lock is held, it gets locked up. As watcher is not
dispatching anymore, it can't signal Netlink socket send() completion, and
the send() operation does not return and keeps the lock.

6 years agokernel-netlink: Add non-dumping variants of echo and stress tests
Martin Willi [Tue, 15 Jul 2014 13:58:11 +0000 (15:58 +0200)]
kernel-netlink: Add non-dumping variants of echo and stress tests

6 years agokernel-netlink: Add test cases for successful and timing out retransmissions
Martin Willi [Tue, 15 Jul 2014 13:47:03 +0000 (15:47 +0200)]
kernel-netlink: Add test cases for successful and timing out retransmissions

6 years agokernel-netlink: Add a compile-time hook to simulate request message loss
Martin Willi [Tue, 15 Jul 2014 13:11:14 +0000 (15:11 +0200)]
kernel-netlink: Add a compile-time hook to simulate request message loss

6 years agokernel-netlink: Implement configurable Netlink request retransmission
Martin Willi [Mon, 14 Jul 2014 15:17:38 +0000 (17:17 +0200)]
kernel-netlink: Implement configurable Netlink request retransmission

6 years agokernel-netlink: Add a stress test with several threads doing Netlink exchanges
Martin Willi [Mon, 14 Jul 2014 14:56:30 +0000 (16:56 +0200)]
kernel-netlink: Add a stress test with several threads doing Netlink exchanges

6 years agokernel-netlink: Retry netlink query while kernel returns EBUSY
Martin Willi [Mon, 14 Jul 2014 14:50:07 +0000 (16:50 +0200)]
kernel-netlink: Retry netlink query while kernel returns EBUSY

If the kernel can't execute a Netlink query because a different query is already
active, it returns EBUSY. As this can happen now as we support parallel queries,
retry on this error condition.

6 years agokernel-netlink: Support parallel Netlink queries
Martin Willi [Thu, 10 Jul 2014 14:28:44 +0000 (16:28 +0200)]
kernel-netlink: Support parallel Netlink queries

Instead of locking the socket exclusively to wait for replies, use watcher
to wait for and read in responses asynchronously. This allows multiple parallel
Netlink queries, which can significantly improve performance if the kernel
Netlink layer has longer latencies and supports parallel queries.

For vanilla Linux, parallel queries don't make much sense, as it usually returns
EBUSY for the relevant dump requests. This requires a retry, and in the end
makes queries more expensive under high load.

Instead of checking the Netlink message sequence number to detect multi-part
messages, this code now relies on the NLM_F_MULTI flag to detect them. This
has previously been avoided (by 1d51abb7). It is unclear if the flag did not
work correctly on very old Linux kernels, or if the flag was not used
appropriately by strongSwan. The flag seems to work just fine back to 2.6.18,
which is a kernel still in use by RedHat/CentOS 5.

6 years agokernel-netlink: Add a simple send message test querying available links
Martin Willi [Wed, 9 Jul 2014 13:26:30 +0000 (15:26 +0200)]
kernel-netlink: Add a simple send message test querying available links

6 years agokernel-netlink: Add a stub for a test-runner
Martin Willi [Wed, 9 Jul 2014 13:08:28 +0000 (15:08 +0200)]
kernel-netlink: Add a stub for a test-runner

6 years agomem-pool: Fix potential memory leak and lost leases when reassigning leases
Tobias Brunner [Tue, 11 Nov 2014 17:50:26 +0000 (18:50 +0100)]
mem-pool: Fix potential memory leak and lost leases when reassigning leases

If no offline leases are available for the current client and assigning online
leases is disabled, and if all IPs of the pool have already been assigned to
clients we look for offline leases that previously were assigned to other

In case the current client has online leases the previous code would
replace the existing mapping entry and besides resulting in a memory leak
the online leases would be lost forever (even if the client later releases
the addresses).  If this happens repeatedly the number of available addresses
would decrease even though the total number of online and offline leases seen
in `ipsec leases` would indicate that there are free addresses available.

Fixes #764.

6 years agoandroid: New release based on 5.2.1 and after adding EAP-TLS
Tobias Brunner [Thu, 6 Nov 2014 16:16:27 +0000 (17:16 +0100)]
android: New release based on 5.2.1 and after adding EAP-TLS

Also enables support for IKEv2 fragmentation, provides improved MOBIKE
handling and optionally enables PFS for CHILD_SAs.

6 years agoandroid: Build binaries for MIPS
Tobias Brunner [Thu, 6 Nov 2014 16:11:55 +0000 (17:11 +0100)]
android: Build binaries for MIPS

6 years agoandroid: Increase fragment size
Tobias Brunner [Thu, 6 Nov 2014 16:05:47 +0000 (17:05 +0100)]
android: Increase fragment size

We use the same value we use as MTU on TUN devices.