Commit Graph

11570 Commits

Author SHA1 Message Date
Tobias Brunner 56b0fac8c9 unity: Allow UNITY_LOCAL_LAN to be longer than 8 bytes 2013-07-17 18:23:57 +02:00
Tobias Brunner c7d0b80abb unity: Fix memory leak in provider 2013-07-17 18:23:57 +02:00
Tobias Brunner b2dfa0624d ipsec.conf.5: closeaction is now supported for IKEv1 2013-07-17 18:18:57 +02:00
Tobias Brunner a9ffb48f21 ikev1: Reestablish IKE_SA/CHILD_SAs if it gets deleted by the peer
We call ike_sa_t.reestablish() so the IKE_SA is only recreated if any
CHILD_SA requires it.
2013-07-17 18:16:59 +02:00
Tobias Brunner 68db844f99 ike: Migrate queued CHILD_SA-creating tasks when reestablishing an IKE_SA 2013-07-17 18:16:58 +02:00
Oliver Smith b79fdab878 ikev1: Support closeaction of CHILD_SA.
When a CHILD_SA is closed in IKEv1, if it is not being rekeyed and
closeaction has been set, we can now perform a restart or hold as is
currently done for IKEv2.
2013-07-17 18:16:58 +02:00
Tobias Brunner 6b99e4b7e0 Merge branch 'kernel-pfroute-mobility'
This improves the behavior of the kernel-pfroute plugin (and sometimes
the kernel-pfkey plugin) in case of mobility, mostly when used as as
client but also as gateway, if clients are mobile.
2013-07-17 17:49:26 +02:00
Tobias Brunner fae4d67adc kernel-pfroute: Ignore IP address changes if address is %any 2013-07-17 17:45:18 +02:00
Tobias Brunner b308a97944 kernel-pfroute: Properly enumerate sockaddrs in interface messages
The ifa_msghdr and rt_msghdr structs are not compatible (at least not on
FreeBSD).
2013-07-17 17:45:18 +02:00
Tobias Brunner 5310f485d9 kernel-pfroute: Provide name of interfaces on which virtual IPs are installed 2013-07-17 17:45:18 +02:00
Tobias Brunner e9c1ca0278 kernel-pfroute: Ignore virtual IPs in address map
As the virtual flag is set after the address has been added to the map,
we make sure we ignore virtual IPs when doing lookups.
2013-07-17 17:45:18 +02:00
Tobias Brunner cb082d15ef kernel-pfroute: Make sure source addresses are not virtual and usable
It seems we sometimes get the virtual IP as source (with
rightsubnet=0.0.0.0/0) even if the exclude route is already
installed.  Might be a timing issue because shortly afterwards the
lookup seems to succeed.
2013-07-17 17:45:18 +02:00
Tobias Brunner 527663d6b6 kernel-pfroute: Don't report an error when trying to reinstall a route 2013-07-17 17:45:18 +02:00
Tobias Brunner 8afd0f05e3 kernel-pfkey: Provide interface name when installing exclude route 2013-07-17 17:45:18 +02:00
Tobias Brunner 0745f846d0 kernel-pfroute: Reinstall routes on interface/address changes 2013-07-17 17:45:17 +02:00
Tobias Brunner 7b9c3fb41f kernel-pfroute: Trigger a roam event if a new interface appears 2013-07-17 17:45:17 +02:00
Tobias Brunner e50b20539b kernel-pfroute: Use ref_get() to allocate sequence numbers 2013-07-17 17:45:17 +02:00
Tobias Brunner baa6419ec1 kernel-pfroute: Make time that is waited for VIPs to appear configurable
One second might be too short for IPs to appear/disappear, especially on
virtualized hosts.
2013-07-17 17:45:17 +02:00
Tobias Brunner dc8b083d9f kernel-pfroute: Retry route lookup without source address on failure
The known source address might be gone resulting in an error, making
learning a new source address impossible.
2013-07-17 17:45:17 +02:00
Tobias Brunner bbd9df25a9 kernel-pfkey: Remove latest IPsec SA mapping when deleting a policy
If IPsec SAs are rekeyed due to an address change (e.g. because
update_sa is not supported) the exact same policy with the same reqid
will be installed, but with different addresses.  After the rekeying the
old SA and its policies are removed, using the first matching mapping
breaks the mapping between the policies and the new SA (at least on
FreeBSD, the Linux kernel might only use the reqid for this).  Using the
oldest matching SA is still an approximation but it solves the above
issue.
2013-07-17 17:45:17 +02:00
Tobias Brunner a9f14ada34 kernel-pfkey: Correctly handle IPSEC_PROTO_ANY in an acquire 2013-07-17 17:45:17 +02:00
Tobias Brunner 84693a3d79 linked-list: Remove barely used has_more() method
This required some refactoring when handling encrypted payloads.

Also changed log messages so that "encrypted payload" is logged instead
of "encryption payload" (even if we internally still call it that) as
that's the name used in RFC 5996.
2013-07-17 17:42:53 +02:00
Tobias Brunner 1a9528f916 linked-list: Don't require an argument for the item when enumerating 2013-07-17 17:42:53 +02:00
Tobias Brunner cf4172637a linked-list: Remove unused clone_function() method 2013-07-17 17:42:53 +02:00
Tobias Brunner 0f3ddbd189 linked-list: Remove barely used find_last() method 2013-07-17 17:42:53 +02:00
Tobias Brunner be3c09d020 linked-list: Remove unused replace() method
Its functionality can be replicated by calling insert_before() followed
by remove_at().  Not the other way around, though, because remove_at()
changes the enumerator position.
2013-07-17 17:42:53 +02:00
Martin Willi 20ea35679e Merge branch 'array'
Introduces a new lightweight array collection having minimal memory overhead.
The new class replaces various linked lists that are used during the full
lifetime of an SA, reducing memory requirements by about 5KB or more per tunnel.
2013-07-17 17:28:18 +02:00
Martin Willi c6f1d0de94 child-sa: refactor proxy transport mode address lookup 2013-07-17 17:20:18 +02:00
Martin Willi 2745ae264a child-sa: replace traffic selector lists by arrays
Saves up to another 0.5KB of memory per CHILD_SA.
2013-07-17 17:20:18 +02:00
Martin Willi 553bb78730 child-sa: replace get_traffic_selectors() with create_ts_enumerator()
Not directly returning a linked list allows us to change the internals of
the CHILD_SA transparently.
2013-07-17 17:20:18 +02:00
Martin Willi 6207fadb6c ikev2: replace linked lists by arrays in task manager
Eliminates another three lists, 0.5KB per IKE_SA.
2013-07-17 17:20:18 +02:00
Martin Willi 926776ec80 auth-cfg: use array instead of linked list
Saves another 4 linked lists (1KB) per IKE_SA
2013-07-17 17:20:18 +02:00
Martin Willi c907b57f56 proposal: use array to store proposal list
Removes another two linked lists (0.5KB) of memory per IKE/CHILD_SA pair.
2013-07-17 17:20:18 +02:00
Martin Willi 5cd64f979c proposal: use a single list to store all transforms
Beside that it makes the code actually simpler, it reduces the number of lists
stored by each IKE_SA and each CHILD_SA by 4, which can be up to 1KB per SA.
2013-07-17 17:20:17 +02:00
Martin Willi 893da0411f ike-sa: use arrays instead of linked lists in long lived collections
This saves about 1.5KB of memory per IKE_SA.
2013-07-17 17:20:17 +02:00
Martin Willi 4730c4b32b unit-tests: implement tests for array collection 2013-07-17 17:20:17 +02:00
Martin Willi 2621ff4d40 array: introduce an array collection storing elements very efficiently
Currently we use the very versatile linked-list collection to store elements
with variable count. This is fine, but very inefficient: Due to the many
methods in the linked list, on 64-bit platforms an empty list alone is more
than 200 bytes. As we currently have about 50 lists per IKE_SA/CHILD_SA pair,
this takes up to 10KB just for managing the empty lists. This is about the
half of memory used by an IKE_SA/CHILD_SA pair, and obviously way too much.

The new array type is not an object, but a collection of functions on an
abstract type.

The following lists are per IKE_SA and should be considered for a replacement
with more efficient arrays (this uses load-testers on-demand created dynamic
configurations, other scenarios have different lists):

14 -> ike_sa_create() @ src/libcharon/sa/ike_sa.c:2198
10 -> auth_cfg_create() @ src/libstrongswan/credentials/auth_cfg.c:1088
 6 -> task_manager_v2_create() @ src/libcharon/sa/ikev2/task_manager_v2.c:1505
 6 -> proposal_create() @ src/libcharon/config/proposal.c:592
 5 -> peer_cfg_create() @ src/libcharon/config/peer_cfg.c:657
 4 -> child_sa_create() @ src/libcharon/sa/child_sa.c:1090
 2 -> child_cfg_create() @ src/libcharon/config/child_cfg.c:536
 1 -> ike_cfg_create() @ src/libcharon/config/ike_cfg.c:330
 1 -> put_connected_peers() @ src/libcharon/sa/ike_sa_manager.c:854
2013-07-17 17:20:17 +02:00
Tobias Brunner f067348134 kernel-libipsec: Log error if no local address is found when installing routes 2013-07-15 14:37:31 +02:00
Tobias Brunner 1ee1163214 dumm: Sort templates by name 2013-07-15 14:37:05 +02:00
Tobias Brunner 9e7a45bec2 testing: Don't load certificates explicitly and delete CA certificates in PKCS#12 scenarios
Certificates are now properly extracted from PKCS#12 files.
2013-07-15 11:27:07 +02:00
Tobias Brunner 591f923134 stroke: Add certificates extracted from PKCS#12 files to correct credential set
Only keys and shared secrets are moved from the temporary credential set after
loading all secrets.
2013-07-15 10:59:13 +02:00
Tobias Brunner e0b868f79e pkcs12: Add plugin dependencies with soft dependencies on the most common algorithms 2013-07-15 10:48:19 +02:00
Martin Willi 1e54e40f5d leak-detective: remove hdr entry when reallocating zero bytes 2013-07-12 20:00:16 +02:00
Martin Willi c93cf85356 leak-detective: print total of allocated/leaked bytes in usage/report 2013-07-12 20:00:14 +02:00
Martin Willi 783b55cc5c dumm: add include for in.h, if_bridge.h now uses struct in6_addr 2013-07-12 18:21:24 +02:00
Andreas Steffen 126778679f Recognize critical IssuingDistributionPoint CRL extension 2013-07-12 09:00:47 +02:00
Andreas Steffen 0a013e1af5 Override policy recommendation in enforcement 2013-07-11 10:34:00 +02:00
Andreas Steffen 9e0182b922 openssl plugin can replace random, hmac, and gcm plugins 2013-07-10 20:38:07 +02:00
Andreas Steffen 3910fb3715 Added openssl-ikev2/net2net-pkcs12 scenario 2013-07-10 20:25:49 +02:00
Andreas Steffen 49a26e5b57 Added ikev2/net2net-pkcs12 scenario 2013-07-10 20:17:44 +02:00