Commit Graph
10546 Commits
Author SHA1 Message Date
Tobias Brunner bc9acd7b9e swanctl: Document --stats command 2014-09-19 11:30:08 +02:00
Tobias Brunner 22949c590f ikev2: Don't treat initial messages as MOBIKE exchanges
The MOBIKE task is active during the initial exchanges but we don't want
to treat them as actual MOBIKE exchanges (i.e. there is no path probing).
2014-09-16 15:05:12 +02:00
Tobias Brunner 8a6b01dd2a ikev1: Don't cache last block of INFORMATIONAL messages as IV
We don't expect a response with the same MID, but apparently some
devices (e.g. FRITZ!Box) do that for DPDs, while still treating the
response as a new exchange.  By storing the last message block as IV
we can't decrypt the first block of such a response.

Fixes #661.
2014-09-12 13:56:18 +02:00
Tobias Brunner 2e62f51bcc ikev1: Log IV when encrypting messages 2014-09-12 13:56:17 +02:00
Tobias Brunner 2f7fef569b ikev1: Skip unusable IPComp proposals
Fixes #661.
2014-09-12 13:56:06 +02:00
Tobias Brunner 84337ac8d0 ikev1: Properly handle different proposal numbering schemes
While the examples in RFC 2408 show proposal numbers starting at 1 and
increasing by one for each subsequent proposal this is not mandatory.
Actually, IKEv1 proposals may start at any number, the only requirement
is that the proposal numbers increase monotonically they don't have to
do so consecutively.

Most implementations follow the examples and start numbering at 1 (charon,
racoon, Shrew, Cisco, Windows XP, FRITZ!Box) but pluto was one of the
implementations that started with 0 and there might be others out there.

The previous assumption that implementations always start numbering proposals
at 0 caused problems with clients that start numbering with 1 and whose first
proposal consists of multiple protocols (e.g. ESP+IPComp).

Fixes #661.
2014-09-12 13:55:00 +02:00
Tobias Brunner 90e6675a65 kernel-netlink: Optionally install protocol and ports on transport mode SAs 2014-09-12 10:45:50 +02:00
Tobias Brunner acd69fc291 ikev2: Reduce timeout if path probing was enabled 2014-09-12 10:29:37 +02:00
Tobias Brunner de6ab8e85a ikev2: Defer MOBIKE updates if no path is available 2014-09-12 10:29:37 +02:00
Tobias Brunner 8956dcecd4 ike-mobike: Allow calling transmit() even when not currently path probing
Path probing is enabled if the current path is not available anymore.
2014-09-12 10:29:37 +02:00
Tobias Brunner 10bad0fc23 ikev2: Defer path probing if no path is currently available
We do the same before initiating the task, so we should probably do it
too when we already initiated it, not just time out and destroy the SA.
2014-09-12 10:29:37 +02:00
Tobias Brunner 7840952edc ike-mobike: Return FALSE in transmit() if no path was available 2014-09-12 10:29:36 +02:00
Tobias Brunner 1b17f647a5 ikev2: Enable path probing for currently active MOBIKE task
This might not be the case if e.g. an address appeared but the old one
is still available but not actually usable.  Without this the MOBIKE
task would eventually time out even though we might be able to switch
to a working address.
2014-09-12 10:29:36 +02:00
Tobias Brunner 2180ace937 ike-mobike: Add method to enable path probing 2014-09-12 10:29:36 +02:00
Tobias Brunner c5a5bc85d9 ike-mobike: Skip peer addresses we can't send packets to when checking paths 2014-09-12 10:29:36 +02:00
Tobias Brunner ff60134157 ikev2: Skip peer addresses we can't send packets to when looking for valid paths 2014-09-12 10:29:36 +02:00
Tobias Brunner 3293d14628 ikev2: Insert MOBIKE tasks at the front of the queue
In case we have no usable path to the other peer there is no point in
initiating any other tasks (like rekeying).
2014-09-12 10:29:36 +02:00
Tobias Brunner 40164bbe27 ikev2: Migrate number of pending MOBIKE updates
This will probably never be more than 1 since we only have one task queued
at a time and we don't migrate running tasks.
2014-09-12 10:29:36 +02:00
Tobias Brunner 03f61ba3d5 ikev2: Properly keep track of pending MOBIKE updates
Because we only queue one MOBIKE task at a time, but destroy superfluous
ones only after we already increased the counter for pending MOBIKE updates,
we have to reduce the counter when such tasks are destroyed.  Otherwise, the
queued task would assume another task is queued when it is running and
ignore any successful response.
2014-09-12 10:29:36 +02:00
Tobias Brunner f9ceb5b543 android: Reduce CHILD_SA lifetime 2014-09-12 10:21:50 +02:00
Tobias Brunner 1fe3b02838 android: Add DH groups to ESP proposals 2014-09-12 10:21:49 +02:00
Tobias Brunner f92399ef18 child-cfg: Ignore duplicate proposals
If ESP proposals are added once with and once without DH groups
duplicates result during IKE_AUTH when DH groups are stripped.
2014-09-12 10:18:14 +02:00
Tobias Brunner 8e52dc2733 proposal: Fix equals() 2014-09-12 10:18:13 +02:00
Tobias Brunner ac1b3a6ddd android: Reestablish IKE_SA if CHILD_SA rekeying failed 2014-09-12 10:18:13 +02:00
Tobias Brunner a39c28bb35 android: Report error if CHILD_SA rekeying fails 2014-09-12 10:18:13 +02:00
Tobias Brunner 47a0e289d9 kernel-netlink: Add global option to configure MSS-clamping on installed routes 2014-09-12 10:13:30 +02:00
Tobias Brunner c1adf7e0c4 kernel-netlink: Add global option to set MTU on installed routes 2014-09-12 10:13:30 +02:00
Tobias Brunner c6e8b5dc2c chunk: Fix Doxygen comments for chunk_internet_checksum[_inc] 2014-09-11 17:56:12 +02:00
Tobias Brunner 8ca9a67fac auth-cfg: Fix crash after several reauthentications with multiple authentication rounds
Due to the issue described in c641974, purge() inadvertently destroyed
CA certificates that should have been kept (while the pointer to these
objects remained in the array).  This lead to incorrect reference counts
and after a few reauthentications with multiple authentication rounds,
which cause calls to purge(TRUE), to crashes.
2014-09-11 17:52:37 +02:00
Tobias Brunner ea50394bf1 array: Adjust negative index before calling remove_head|tail()
For ARRAY_TAIL we most often want to call remove_tail() not remove_head().
2014-09-11 17:52:37 +02:00
Tobias Brunner c641974de0 array: Warn about caveat with array_remove_at() and value based arrays
Because enumerate() for value based arrays returns a pointer directly to
the internal array elements and because array_remove_at() or rather the
called array_remove() may move elements over the element at the currently
enumerated position, the pointer passed to enumerate() will point to a
different array element after the array_remove_at() call.  The caller
will thus operate on the wrong element if that pointer is accessed again
before calling enumerate().

For performance reasons we currently don't change the implementation to copy
each array element during enumeration to a private member of the enumerator and
return a pointer to that.  Similarly, due to the danger of subtle bugs we don't
remember the pointer passed to enumerate() to later redirect it to a copy
created during the array_remove_at() call.
2014-09-11 17:52:00 +02:00
Tobias Brunner 92b76384a0 asn1: Try to fill the available binary OID buffer if possible 2014-09-09 12:31:00 +02:00
Tobias Brunner c6f886ce10 unit-tests: Give worker threads time to clean up when testing thread_t.detach() 2014-09-09 10:58:59 +02:00
Tobias Brunner cee338eccd stream-service: Prevent race conditions due to blocking call to destroy()
In the previous implementation queued jobs could prevent a service from
getting destroyed.  This could have lead to a deadlock when the
processor is cancelled.  Now destroy() still blocks, but waits only for
actually running tasks.  The service instance is reference counted so that
queued jobs can safely be destroyed.
2014-09-09 10:58:59 +02:00
Tobias Brunner 10859adfd4 stream-service: Do not accept or re-register when service is terminated 2014-09-09 10:58:59 +02:00
Tobias Brunner 22e90cad00 stream-service: Restart accepting without blocking
Calling on_accept() sometimes lead to deadlocks when service->destroy()
was called concurrently.  That is, two threads waiting in on_accept() but
the last worker would only wake one due to the call to signal().  Calling
broadcast() wouldn't help either as that could lead to crashes if the thread
that called destroy() is woken first.

This is also more efficient as a constant pool of concurrent workers can
be maintained, otherwise peaks at the limit were followed by only a single
worker being active.
2014-09-09 10:58:58 +02:00
Tobias Brunner e58764ca0f android: Add support for querying use stats of a CHILD_SA 2014-09-09 10:57:51 +02:00
Tobias Brunner de622eb1f9 eap-radius: Forward Cisco and Microsoft specific DNS/NBNS attributes
Fixes #677.
2014-09-09 10:56:16 +02:00
Tobias Brunner 2d38a03d77 ikev1: Make sure proposed IPsec mode matches our own
References #557.
2014-09-09 10:56:16 +02:00
Tobias Brunner 34e402ef8d ike: Reset IKE_SA in state CONNECTING instead of reauthenticating
Due to how reauthentication works for IKEv1 we could get a second
IKE_SA, which might cause problems, when connectivity problems arise
when the connection is initially established.

Fixes #670.
2014-09-09 10:56:15 +02:00
Tobias Brunner 4df9250f26 asn1: Make sure not to exceed buffer for binary OID 2014-09-09 10:56:15 +02:00
Tobias Brunner f80093e2ee kernel-pfroute: Delete interfaces on RTM_IFANNOUNCE/IFAN_DEPARTURE events
We actually never deleted cached interfaces.  So if the kernel reuses
interface indices events for newly created interfaces could have been
associated with interface objects of deactivated and deleted interfaces.

Since we also didn't update the interface name when such an interface
got reactivated we ended up using the old name e.g. to install routes.

A trigger for this was the deletion and recreation of TUN devices during
reauthentication of SAs that use virtual IPs.
2014-09-09 10:56:15 +02:00
Tobias Brunner f8613abc8a ip-packet: Define our own structs to handle TCP/UDP headers 2014-09-09 10:56:15 +02:00
Tobias Brunner 25fcbab678 kernel-pfkey: Report packet counts of IPsec SAs
Seems that packet counts can be retrieved after all. At least the Linux
and FreeBSD kernels treat the number of allocations as number of packets.
We actually installed packet limits in that field already.
2014-09-09 10:56:15 +02:00
Tobias Brunner 8a59fa6467 swanctl: Document how connections.*.unique affects initiators 2014-09-09 10:56:15 +02:00
Tobias Brunner dbd7f4be31 mutex: Use atomics to set current thread in recursive mutex
Because this->thread is also read by threads that don't hold the
mutex the previous implementation was problematic (especially since
pthread_t is an opaque type of unknown length).

Fixes #654.
2014-09-09 10:56:15 +02:00
Tobias Brunner 7e433456fc curl: Log error code too
It seems libcurl does not always return an error message.
2014-09-09 10:56:14 +02:00
Tobias Brunner 4f71ee2cf6 unit-tests: Add option to exclude specific test suites
Listing test suites in TESTS_SUITES_EXCLUDE allows excluding specific
test suites from running.
2014-09-09 10:56:14 +02:00
Tobias Brunner 5818467639 openssl: Report correct key length for EC keys when not using NIST curves
Fixes #688.
2014-09-02 08:15:17 +02:00
Thomas Egerer 8d80528a60 credmgr: Fix copy and paste error in add_validator
This won't hurt as long as sets and validators are of the same class.
But as soon as one of the object's class is changed this will cause
either a compile error (best option), or result (most likely) in a
crash.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2014-08-29 13:22:23 +02:00