stream: Add basic stream service for systemd sockets

This allows systemd socket activation by passing URIs such as systemd://foo
to plugins such as VICI.

For example setting charon.plugins.vici.socket = systemd://vici, a
systemd socket file descriptor with the name "vici" will be picked up.

So these would be the corresponding unit options:

  [Socket]
  FileDescriptorName=vici
  Service=strongswan.service

  ListenStream=/run/charon.vici

The implementation currently is very basic and right now only the first
file descriptor for a particular identifier is picked up if there are
multiple socket units with the same FileDescriptorName.

Signed-off-by: aszlig <[email protected]>

Closes strongswan/strongswan#79.
This commit is contained in:
aszlig
2017-10-10 11:11:11 +02:00
committed by Tobias Brunner
parent ea613d5d27
commit 59db98fb94
4 changed files with 118 additions and 0 deletions
@@ -21,6 +21,9 @@
# include "stream_unix.h"
# include "stream_service_unix.h"
#endif
#ifdef USE_SYSTEMD
# include "stream_service_systemd.h"
#endif
#include <threading/rwlock.h>
@@ -241,6 +244,9 @@ stream_manager_t *stream_manager_create()
add_stream(this, "unix://", stream_create_unix);
add_service(this, "unix://", stream_service_create_unix);
#endif
#ifdef USE_SYSTEMD
add_service(this, "systemd://", stream_service_create_systemd);
#endif
return &this->public;
}