Commit Graph

393 Commits

Author SHA1 Message Date
Tobias Brunner 505a69eba4 attr: Silently skip over load option 2014-02-12 14:34:34 +01:00
Tobias Brunner 10c4f4e1fd libhydra: Remove unused hydra->daemon 2014-02-12 14:34:32 +01:00
Tobias Brunner d347a130f5 libhydra: Use lib->ns instead of hydra->daemon 2014-02-12 14:34:32 +01:00
Tobias Brunner eb9b375aa1 attr-sql: Use namespace for attr-sql config, with fallback 2014-02-12 14:34:32 +01:00
Tobias Brunner 822b22c96f kernel-pfroute: Don't cache route entries if installation fails 2014-02-12 13:52:25 +01:00
Tobias Brunner f0f78b74d4 kernel-netlink: Don't cache route entries if installation fails
Fixes #500.
2014-02-12 13:52:01 +01:00
Tobias Brunner fe2a2d1885 kernel-netlink: Set selector on transport mode IPComp SAs 2014-01-23 10:27:13 +01:00
Tobias Brunner cc04a6db3e kernel-netlink: Selectively add selector on SAs that use IPComp
Don't add a selector to tunnel mode SAs, these might serve multiple
traffic selectors but with only one selector on the SA only the traffic
matching the first one would actually get tunneled.
2014-01-23 10:27:12 +01:00
Tobias Brunner 38a4f1964e kernel-netlink: Enable TFC padding only for tunnel mode ESP SAs
The kernel does not allow them for transport mode SAs or IPComp SAs (and
of course not for AH SAs).

Fixes #446.
2013-11-19 12:44:16 +01:00
Tobias Brunner 20c99edab9 android: Remove dependency on libvstr 2013-11-13 11:40:47 +01:00
Tobias Brunner 8e8e97d10d kernel-netlink: Check existence of linux/fib_rules.h, don't include it in distribution
This reverts commit b0761f1f0a.
2013-10-18 09:52:54 +02:00
Tobias Brunner 59213396fa kernel-pfkey: Install ICMP[v6] type/code as expected by the Linux kernel 2013-10-17 16:57:39 +02:00
Tobias Brunner 406a504ca7 kernel-netlink: Convert ports in acquires to ICMP[v6] type and code 2013-10-17 16:57:39 +02:00
Tobias Brunner ddc2d3c8e4 kernel-netlink: Properly install policies with ICMP[v6] types and codes 2013-10-17 16:57:39 +02:00
Tobias Brunner 51fefe4606 kernel-netlink: Allow setting firewall marks on routing rule 2013-10-11 15:32:44 +02:00
Tobias Brunner bd085dd978 attr-sql: Use a serializable transaction when inserting identities 2013-10-11 15:29:10 +02:00
Tobias Brunner ec6ad6b086 pool: Move the pool utility to its own directory in src 2013-10-11 15:16:05 +02:00
Tobias Brunner 5abe3c52d3 attr-sql: Handle concurrent insertion of identities
If the same identity is added concurrently by two threads (or by the
pool utility) INSERT might fail even though the SELECT was unsuccessful
before.

We are currently not able to lock the identities table in a portable way
(something like SELECT ... FOR UPDATE on MySQL).
2013-10-11 15:16:05 +02:00
Tobias Brunner 4b8b1354ce attr-sql: Don't use database transactions in create_attribute_enumerator
There could, of course, be race conditions when enumerating the attributes,
but those probably don't matter (e.g. missing an attribute that was
concurrently added).

Transactions are more intended to revert multiple changes if anything
fails in the process.
2013-10-11 15:16:05 +02:00
Martin Willi d7083b6541 kernel: Use a time_t to report use time in query_policy() 2013-10-11 10:23:17 +02:00
Martin Willi c99458e94e kernel: Use a time_t to report use time in query_sa() 2013-10-11 10:23:17 +02:00
Ansis Atteka 255b9dac5d kernel-netlink: Allow to override xfrm_acq_expires value
When using auto=route, current xfrm_acq_expires default value
implies that tunnel can be down for up to 165 seconds, if
other peer rejected first IKE request with an AUTH_FAILED or
NO_PROPOSAL_CHOSEN error message. These error messages are
completely normal in setups where another application
pushes configuration to both strongSwans without waiting
for acknowledgment that they have updated their configurations.

This patch allows strongswan to override xfrm_acq_expires default
value by setting charon.plugins.kernel-netlink.xfrm_acq_expires in
strongswan.conf.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2013-09-23 10:45:14 +02:00
Tobias Brunner f5dcb38ead resolve: Remove comment when using resolvconf(8)
Since comments in resolv.conf are only valid at the beginning of a line
resolvconf(8) seems to have started treating any text after
'nameserver <ip>' as additional IP addresses for name servers.

Since it ignores comments, and we can easily remove the added servers
again, there is no point to add any.

Fixes #410.
2013-09-13 14:13:21 +02:00
Tobias Brunner 9af44ef5d9 Build all shared libraries with -no-undefined and link them properly
The flag is required to convince libtool on Cygwin to build DLLs. But on
Windows these shared libraries can not have undefined symbols, so we have to
link them explicitly to the libraries they reference.

For plugins this is currently not done, so only the monolithic build is
supported.  The plugin loader wouldn't be able to load DLLs anyway, as
it tries to load files that don't exist on Cygwin.
2013-09-12 01:44:49 +02:00
Ansis Atteka ec331a7dd6 kernel-netlink: increase buffer size for RT netlink messages
Commit 940e1b0f66 "Filter ignored
interfaces in kernel interfaces (for events, address enumeration,
etc.)" made charon to ignore routes with unusable interfaces.
Unusable interface is one where charon has not seen RTM_NEWLINK
message from the kernel.

Sometime RTM_NEWLINK message can be 1048 bytes large. This is
24 bytes more than currently allocated buffer of 1024 bytes.
If kernel sends such a large message, then it would be silently
ignored by charon and corresponding interface would never become
usable. Hence strongSwan might resolve invalid source IP address
in get_route() function. This would prevent IPsec tunnel to be
established.

To reproduce create a VLAN interface with following command:

vconfig add eth1 12
2013-09-10 09:34:09 +02:00
Martin Willi 3482cc9cf6 attributes: shorten some Unity and XAuth attribute short names 2013-09-03 16:26:19 +02:00
Mathias Krause 45b80880f8 kernel-pfroute: Fix mixed up memset() call in get_route()
The retry code introduced in dc8b083 got the memset() arguments wrong.
Fix this to ensure the buffer gets zeroed, for real.

It probably doesn't matter as we do reset the message length on retry, so
the stale data shouldn't be seen by anyone.

Found-by: git grep 'memset\s*\([^,]*,\s*[^,]*,\s*0\s*\)'
2013-08-29 18:56:39 +02:00
Tobias Brunner d7ae0b254d kernel: Restore enumeration of all addresses when searching for address in TS
Since f52cf07532 addresses on ignored, down or loopback interfaces were
not considered as valid addresses anymore when searching for an address
contained in the local traffic selector.  This meant that route
installation failed, for instance, if charon.install_virtual_ip_on was
set to 'lo', or, on gateways, if internal interfaces were ignored with
the charon.interfaces_* options.
2013-08-21 17:01:03 +02:00
Tobias Brunner e001cc2b07 kernel-netlink: Fix calculation of ESN bitmap length
While bmp_len stores the number of u_int32_t the allocated bitmap
actually consists of those integers.
2013-08-21 08:28:12 +02:00
Tobias Brunner 11f468533f kernel-netlink,pfroute: Properly update address flag within ROAM_DELAY
77d4a02 and 55da01f only updated the address flag when a job was created,
which obviously had the same limitation as the old code.

Fixes #374.
2013-08-12 12:08:23 +02:00
Tobias Brunner 55da01f348 kernel-pfroute: Implement roam event handling like in the kernel-netlink plugin
There was no proper locking and the issue regarding the address
flag also existed.
2013-08-12 12:03:48 +02:00
Tobias Brunner 77d4a0281a kernel-netlink: Ensure address changes are not missed in roam events
If multiple roam events are triggered within ROAM_DELAY, only one job is
created.  The old code set the address flag to the value of the last
triggering call.  So if a route change followed an address change within
ROAM_DELAY the address change was missed by the upper layers, e.g. causing
it not to update the list of addresses via MOBIKE.

The new code now keeps the state of the address flag until the job is
actually executed, which still has some issues.  For instance, if an
address disappears and reappears within ROAM_RELAY, the flag would not
have to be set to TRUE.  So address updates might occasionally get
triggered where none would actually be required.

Fixes #374.
2013-08-12 12:02:55 +02:00
Martin Willi 7612a6e42f mem-pool: add option for reusing online leases, and disable it by default
Mainly for reauthentication with third party implementations, we allowed to
reuse an online lease, but only for the same peer identity and when it
explicitly requested the same address.

This has always been problematic, because it changes the reqid of the CHILD_SA
with the same traffic selectors, breaking the old tunnel. As we now reject
such policy overwrites, this usually lets the installation of the new policies
fail. We therefore disable reassignment of online leases by default.
2013-07-29 08:56:09 +02:00
Martin Willi c5d2d867f1 mem-pool: replace per-identity online/offline lists by more efficient arrays
This saves two lists per connected peer identity, up to 0.4KB.
2013-07-29 08:55:21 +02:00
Martin Willi d882880e87 mem-pool: refcount online lease when reassigning it to another tunnel
When we reassign an online lease for the same peer, we have to refcount it.
Otherwise we would set it offline if one of the tunnels goes down, but it is
actually still in use by a the second tunnel. This can finally lead in
assigning the same virtual IP to different peers.
2013-07-26 13:12:22 +02:00
Tobias Brunner e7d717cf01 kernel-pfkey: Add sanity check when deleting policies 2013-07-24 16:17:22 +02:00
Tobias Brunner 0ceb288815 Fix various API doc issues and typos
Partially based on an old patch by Adrian-Ken Rueegsegger.
2013-07-18 18:30:36 +02:00
Martin Willi 46666dd3c1 kernel-pfroute: use watcher to receive kernel events 2013-07-18 16:00:30 +02:00
Martin Willi 7f698daef9 kernel-pfkey: use watcher to receive networking events 2013-07-18 16:00:30 +02:00
Martin Willi f4f77d7467 kernel-netlink: use watcher to receive kernel events for net/ipsec 2013-07-18 16:00:30 +02:00
Tobias Brunner e5b5a66712 kernel-pfkey: Fail route installation if remote TS matches peer 2013-07-18 15:41:36 +02:00
Tobias Brunner dfc9902013 capabilities: Some plugins don't actually require capabilities at runtime 2013-07-18 15:25:35 +02:00
Martin Willi 19cb07b890 automake: replace INCLUDES by AM_CPPFLAGS
INCLUDES are now deprecated and throw warnings when using automake 1.13.
We now also differentiate AM_CPPFLAGS and AM_CFLAGS, where includes and
defines are passed to AM_CPPFLAGS only.
2013-07-18 14:59:19 +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