Commit Graph

11409 Commits

Author SHA1 Message Date
Martin Willi f4e822c1b4 trap-manager: don't check-in nonexisting IKE_SA if acquire fails 2013-06-19 16:30:40 +02:00
Martin Willi ae131e6bac trap-manager: fix a memleak when installing a trap to %any 2013-06-19 16:30:40 +02:00
Martin Willi 1551d8b13d kernel-netlink: reject policy refcount if the reqid differs
Previously we silently replaced an existing policy with a new one if the
reqid changed for the same selectors. This will break an old policy in the
favour of the new one (for example if two clients behind the same NAT use
transport mode).

With this change any new policy gets rejected if the reqid differs. This will
make sure we break no existing policy. For rekeying and acquires we still can
have overlapping policies (as we use the same reqid), but for unrelated
connections this is not true anymore (it wasn't actually before, we just
silently broke the existing policy).
2013-06-19 16:30:40 +02:00
Martin Willi de2debf8e0 stroke: add exportconn{cert,chain} commands in addition to exportx509
The new commands either export a single end entity certificate or the
full trust chain for a specific connection name.
2013-06-19 16:27:19 +02:00
Martin Willi a485320393 Raise an alert if the responding peer narrowed traffic selectors 2013-06-19 16:11:46 +02:00
Martin Willi ad58246f53 backtrace: use backtrace_symbols() only if we have backtrace() and dladdr() fails 2013-06-19 16:09:31 +02:00
Tobias Brunner 4d04e2c63b utils: Remove volatile qualifier from refcount_t typedef
It's not really required anymore (if it ever was) and may cause compiler
warnings when using the non atomic versions of ref_get/ref_put.
2013-06-19 09:28:30 +02:00
Martin Willi 24303f99f7 dhcp: search for transactions only for connections having a poolname "dhcp"
When a connection has a single pool that queries recursively the DHCP backend,
we shouldn't return any attributes directly from DHCP when queried for that
pool.
2013-06-18 09:50:29 +02:00
Martin Willi 9a00d9aa2f starter: ignore return value of sete[gu]id(), now having warn_unused_result 2013-06-18 08:54:10 +02:00
Tobias Brunner c6f1929a45 socket-default: Make sure sockets are open when checking with FD_ISSET 2013-06-14 17:25:16 +02:00
Tobias Brunner 1889837767 socket-default: Properly initialize NAT-T port if opening regular socket failed 2013-06-14 16:42:56 +02:00
Tobias Brunner 92f102c21b android: Forward initiator flag to libipsec when adding IPsec SA 2013-06-13 13:55:58 +02:00
Tobias Brunner 52d7c530e9 libipsec: Add initiator flag to definition of ipsec_sa_mgr_t.add_sa() 2013-06-13 13:54:05 +02:00
Martin Willi 246e2bed1d Use subset matching instead of is_contained_in() to select a child_cfg
If one selector has a wider IP range than the other, but the other has a
wider port/protocol selector than the first one, none is completely contained
in the other. The check for a match using is_contained_in() therefore would
fail. Using get_subset() can handle such cases, fixing configuration selection.
2013-06-13 13:37:50 +02:00
Tobias Brunner 44fb978169 ha: Fix CHILD_SA installation in ha_dispatcher after adding initiator flag 2013-06-13 13:17:55 +02:00
Martin Willi a8c9454423 kernel-interface: add an exchange initiator parameter to add_sa()
This new flag gives the kernel-interface a hint how it should priorize the
use of newly installed SAs during rekeying.

Consider the following rekey procedure in IKEv2:

Initiator  ---    Responder

I1 -------CREATE-------> R1
I2 <------CREATE--------
   -------DELETE-------> R2
I3 <------DELETE--------

SAs are always handled as pairs, the following happens at the SA level:

  * Initiator starts the exchange at I1
  * Responder installs new SA pair at R1
  * Initiator installs new SA pair at I2
  * Responder removes old SA pair at R2
  * Initiator removes old SA pair at I3

This makes sure SAs get installed/removed overlapping during rekeying. However,
to avoid any packet loss, it is crucial that the new outbound SA gets
activated at the correct position:

  * as exchange initiator, in I2
  * as exchange responder, in R2

This should guarantee that we don't use the new outbound SA before the peer
could install its corresponding inbound SA.

The new parameter allows the kernel backend to install the new SA with
appropriate priorities, i.e. it should:

  * as exchange inititator, have the new outbound SA installed with higher
    priority than the old SA
  * as exchange responder, have the new outbound SA installed with lower
    priority than the old SA

While we could split up the SA installation at the responder, this approach
has another advantage: it allows the kernel backend to switch SAs based on
other criteria, for example when receiving traffic on the new inbound SA.
2013-06-11 15:58:48 +02:00
Martin Willi d024a4652c Merge branch 'unique-sas'
Makes IKE_SA unique ID and CHILD_SA reqid counters atomic.
2013-06-11 15:54:27 +02:00
Martin Willi 37a60cad3c ikev1: keep vendor ID task alive during full Main/Aggressive Mode
Fixes DPD with Cisco IOS sending the DPD vendor ID not in the first message.
2013-06-11 15:54:27 +02:00
Martin Willi 3568abe7be Use ref_get() to make sure IKE_SA unique IDs are unique 2013-06-11 15:54:27 +02:00
Martin Willi 61345afb22 Merge branch 'init-auth-fail'
Properly notifies the responder if authentication of an IKE_SA or installation
of a CHILD_SA fails as initiator, keeping SA state on peers consistent.
2013-06-11 15:54:27 +02:00
Martin Willi d64f6ef6ae Use ref_get() to make sure CHILD_SA reqids are unique 2013-06-11 15:54:27 +02:00
Martin Willi e196c41bd2 ikev2: if installing a CHILD_SA as initiator fails, notify the responder 2013-06-11 15:54:27 +02:00
Martin Willi 3160b92adb utils: ref_get() returns the new value of the reference counter
This allows us to use ref_get() for getting unique values.
2013-06-11 15:54:27 +02:00
Martin Willi 2788634c8c Merge branch 'scep-bind'
Extend fetcher interface by an option to specify a source IP, implement
it in the curl plugin and provide a --bind option in scepclient.
2013-06-11 15:54:26 +02:00
Martin Willi ff3fff4dc9 ikev2: raise LOCAL_AUTH_FAILED when receiving INFORMATIONAL with AUTH_FAILED 2013-06-11 15:54:26 +02:00
Martin Willi 78af570fd5 scepclient: support a --bind option to fetch from a specific source IP 2013-06-11 15:54:26 +02:00
Martin Willi ca74bf7a06 ikev2: close an established IKE_SA when receiving AUTHENTICATION_FAILED
RFC 5996 compatible implementations MAY send an INFORMATIONAL message
with an AUTHENTICATION_FAILED if the initiator failed to authenticate us.
Handle such a message like a DELETE for an IKE_SA.
2013-06-11 15:54:26 +02:00
Martin Willi fe20f752f1 curl: add an option to fetch bound to a local source address 2013-06-11 15:54:26 +02:00
Martin Willi eaafcec190 ikev2: if responder authentication fails, send AUTHENTICATION_FAILED
According to RFC 5996, we MAY send an INFORMATIONAL message having an
AUTHENTICATION_FAILED. We don't do any retransmits, though, but just close
the IKE_SA after one message has been sent, avoiding the danger that an
unauthenticated IKE_SA stays alive.
2013-06-11 15:54:26 +02:00
Martin Willi 44d9970f4c Allow IPComp on NATed connections, both for IKEv1 and IKEv2
While this was problematic in earlier releases, it seems that it works just
fine the way we handle compression now. So there is no need to disable it over
NATed connections or when using forceencaps.
2013-06-11 15:54:25 +02:00
Martin Willi 0adfffb6dd fetcher: add missing "continue" when handling FETCH_CALLBACK 2013-06-11 15:54:25 +02:00
Tobias Brunner f5f7053bcd leak-detective: Resolve hooked functions during initialization
If uses of dlopen(), e.g. when loading plugins, produce errors an error
string could get allocated dynamically.  At this point realloc() might not
yet be resolved and when dlsym() is later called by leak detective to do
so the error string might get freed while leak detective is disabled and
real_free() will be called with a pointer into one of leak detective's
memory blocks instead of a pointer to the block itself, causing a SIGSEGV.
2013-06-11 15:48:26 +02:00
Tobias Brunner 3873526f3e Properly compare CHILD_SAs during rekey collision
The previous code did not properly check for the situation when the
DELETE for a redundant CHILD_SA created by a responder during a
CHILD_SA rekey collision arrives before the responder's answer to the
initiator's winning CREATE_CHILD_SA request.
2013-06-11 14:00:02 +02:00
Tobias Brunner 5744226e92 Merge branch 'plugin-loader'
Improves how plugin loader resolves dependencies between plugins.  The
old loader had problems if plugins had dependencies on features provided
by plugins listed later in the plugin list.  For instance, it was not
possible to use the X.509 implementation provided by the x509 plugin
while using all the crypto primitives provided by the openssl plugin.
Because the x509 plugin has a dependency on SHA1, the old loader skipped
that plugin until it loaded a SHA1 implementation.  Because the loader
also loaded all features with resolved dependencies provided by a specific
plugin it would, while loading the openssl plugin's SHA1 implementation,
also load its X.509 implementation.  So to use the x509 plugin it was
necessary to load the sha1 plugin before it so that its dependencies
could be properly resolved.

With the new implementation the plugins don't have to be in a specific
order to resolve dependencies.  But the order still matters if two
plugins provide the same feature.

Also, support for the get_features() interface was added to all plugins.
2013-06-11 11:36:40 +02:00
Tobias Brunner 31a416a5b2 Removed stray *_plugin_create() declarations from header files 2013-06-11 11:18:19 +02:00
Tobias Brunner 460488b180 eap-radius: Do initialization in a plugin feature callback 2013-06-11 11:18:19 +02:00
Tobias Brunner 49d7a98f47 Refactored plugin-loader with improved dependency resolution
With the new implementation the plugins don't have to be listed in any
special order, dependencies are properly resolved.  The order only
matters if two plugins provide the same feature.
2013-06-11 11:18:19 +02:00
Tobias Brunner facc781500 android-log: Use plugin features 2013-06-11 11:18:19 +02:00
Tobias Brunner df60999b5f android-dns: Use plugin features to register attribute handler 2013-06-11 11:18:19 +02:00
Tobias Brunner e183a6c36d maemo: Use plugin features 2013-06-11 11:18:19 +02:00
Tobias Brunner 6d766925b2 medsrv: Use plugin features with dependency on database implementation 2013-06-11 11:18:19 +02:00
Tobias Brunner da7c3f8900 medcli: Use plugin features with dependency on database implementation 2013-06-11 11:18:19 +02:00
Tobias Brunner d0ccae4dd2 whitelist: Use plugin features to register listener 2013-06-11 11:18:19 +02:00
Tobias Brunner 49d333ac67 updown: Use plugin features to register listener and attribute handler 2013-06-11 11:18:19 +02:00
Tobias Brunner 819cb66298 unity: Use plugin features to register listener and attribute handler/provider 2013-06-11 11:18:19 +02:00
Tobias Brunner b033d59d1e unit-tester: Use plugin features 2013-06-11 11:18:19 +02:00
Tobias Brunner e1360331e9 uci: Use plugin features to register backend and credential set 2013-06-11 11:18:19 +02:00
Tobias Brunner 36f27c1506 systime-fix: Use plugin features to register validator 2013-06-11 11:18:19 +02:00
Tobias Brunner c1f5841bb2 smp: Use plugin features 2013-06-11 11:18:19 +02:00
Tobias Brunner 64b0c2575f radattr: Use plugin features to register listener 2013-06-11 11:18:18 +02:00