Martin Willi [Wed, 24 Jul 2013 14:20:46 +0000 (16:20 +0200)]
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.
Martin Willi [Wed, 24 Jul 2013 13:45:39 +0000 (15:45 +0200)]
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.
Otherwise, array->esize is promoted to int and if array->esize * num
results in a value > 0x7fffffff the return value would be incorrect due
the implicit sign extension when getting cast to size_t.
Martin Willi [Fri, 19 Jul 2013 13:27:07 +0000 (15:27 +0200)]
processor: force synchronous execute_job() if set_threads(0) has been called
During daemon shutdown, some idle threads might be lingering around even if
set_threads(0) already has been called. To avoid any races, we enforce
synchronous execution of the job.
Martin Willi [Thu, 18 Jul 2013 14:03:14 +0000 (16:03 +0200)]
Merge branch 'ipc-service'
Adds network transparency and TCP support to the IPC interfaces of different
plugins using the new stream and stream service classes. A central watcher
thread can watch multiple file descriptors to handle connection requests
for these and other services using only a single thread.
Martin Willi [Thu, 18 Jul 2013 09:37:42 +0000 (11:37 +0200)]
processor: add an execute_job() method to directly execute an important job
If all worker threads are busy and waiting for an event, we must ensure that
a job delivering that event gets executed. This new method has this property
for CRITICAL jobs, using a worker if we have one, but executing the job directly
if not.
Martin Willi [Mon, 1 Jul 2013 09:42:18 +0000 (11:42 +0200)]
error-notify: use a stream service to accept client connections
As TCP does not have SOCK_SEQPACKET, we now use SOCK_STREAM for the error-notify
socket. To have network transparency, the message now uses network byte order.
Martin Willi [Mon, 1 Jul 2013 09:19:01 +0000 (11:19 +0200)]
duplicheck: use a stream service to accept client connections
As we can't use SOCK_SEQPACKET over TCP, we now have to provide message
boundaries ourselves. We do this by appending a 16-bit length header to each
sent duplicate identity.
Martin Willi [Mon, 1 Jul 2013 16:34:08 +0000 (18:34 +0200)]
watcher: release threads waiting in remove() when watcher thread gets cancelled
During daemon shutdown, users might call remove() after processor.set_threads(0)
has been called. This gets problematic, as a watch event might be unable
to signal completion when no threads are available anymore. Work around this
issue by cancelling waiters once processor.cancel() has been called.
Martin Willi [Fri, 28 Jun 2013 12:55:27 +0000 (14:55 +0200)]
stream: use a service constructor to create services
It does not make much sense to reference running services in the manager,
especially as unregistration would need the URI (which a user would have to
store instead of the service reference).
Martin Willi [Fri, 28 Jun 2013 12:33:41 +0000 (14:33 +0200)]
stream: replace print/vprint() convenience functions by a FILE* getter
While this will complicate the implementation of streams not based on a fd,
it allows us to unleash the full power of FILE based convenience functions.
Martin Willi [Wed, 17 Jul 2013 12:45:39 +0000 (14:45 +0200)]
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.