summaryrefslogtreecommitdiff
path: root/src/libstrongswan/networking
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2014-03-11 20:48:48 +0100
committerYves-Alexis Perez <corsac@debian.org>2014-03-11 20:48:48 +0100
commit15fb7904f4431a6e7c305fd08732458f7f885e7e (patch)
treec93b60ee813af70509f00f34e29ebec311762427 /src/libstrongswan/networking
parent5313d2d78ca150515f7f5eb39801c100690b6b29 (diff)
downloadvyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.tar.gz
vyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.zip
Imported Upstream version 5.1.2
Diffstat (limited to 'src/libstrongswan/networking')
-rw-r--r--src/libstrongswan/networking/host_resolver.c8
-rw-r--r--src/libstrongswan/networking/streams/stream.c17
-rw-r--r--src/libstrongswan/networking/streams/stream.h5
-rw-r--r--src/libstrongswan/networking/tun_device.c8
-rw-r--r--src/libstrongswan/networking/tun_device.h1
5 files changed, 15 insertions, 24 deletions
diff --git a/src/libstrongswan/networking/host_resolver.c b/src/libstrongswan/networking/host_resolver.c
index 99a17d17c..10af11a7f 100644
--- a/src/libstrongswan/networking/host_resolver.c
+++ b/src/libstrongswan/networking/host_resolver.c
@@ -355,11 +355,11 @@ host_resolver_t *host_resolver_create()
);
this->min_threads = max(0, lib->settings->get_int(lib->settings,
- "libstrongswan.host_resolver.min_threads",
- MIN_THREADS_DEFAULT));
+ "%s.host_resolver.min_threads",
+ MIN_THREADS_DEFAULT, lib->ns));
this->max_threads = max(this->min_threads ?: 1,
lib->settings->get_int(lib->settings,
- "libstrongswan.host_resolver.max_threads",
- MAX_THREADS_DEFAULT));
+ "%s.host_resolver.max_threads",
+ MAX_THREADS_DEFAULT, lib->ns));
return &this->public;
}
diff --git a/src/libstrongswan/networking/streams/stream.c b/src/libstrongswan/networking/streams/stream.c
index 8ecb89fc9..f6fec0b4a 100644
--- a/src/libstrongswan/networking/streams/stream.c
+++ b/src/libstrongswan/networking/streams/stream.c
@@ -159,17 +159,6 @@ METHOD(stream_t, write_all, bool,
}
/**
- * Remove a registered watcher
- */
-static void remove_watcher(private_stream_t *this)
-{
- if (this->read_cb || this->write_cb)
- {
- lib->watcher->remove(lib->watcher, this->fd);
- }
-}
-
-/**
* Watcher callback
*/
static bool watch(private_stream_t *this, int fd, watcher_event_t event)
@@ -228,7 +217,7 @@ static void add_watcher(private_stream_t *this)
METHOD(stream_t, on_read, void,
private_stream_t *this, stream_cb_t cb, void *data)
{
- remove_watcher(this);
+ lib->watcher->remove(lib->watcher, this->fd);
this->read_cb = cb;
this->read_data = data;
@@ -239,7 +228,7 @@ METHOD(stream_t, on_read, void,
METHOD(stream_t, on_write, void,
private_stream_t *this, stream_cb_t cb, void *data)
{
- remove_watcher(this);
+ lib->watcher->remove(lib->watcher, this->fd);
this->write_cb = cb;
this->write_data = data;
@@ -270,7 +259,7 @@ METHOD(stream_t, get_file, FILE*,
METHOD(stream_t, destroy, void,
private_stream_t *this)
{
- remove_watcher(this);
+ lib->watcher->remove(lib->watcher, this->fd);
close(this->fd);
free(this);
}
diff --git a/src/libstrongswan/networking/streams/stream.h b/src/libstrongswan/networking/streams/stream.h
index 810514da9..3516d9186 100644
--- a/src/libstrongswan/networking/streams/stream.h
+++ b/src/libstrongswan/networking/streams/stream.h
@@ -39,9 +39,8 @@ typedef stream_t*(*stream_constructor_t)(char *uri);
/**
* Callback function prototype, called when stream is ready.
*
- * It is allowed to destroy the stream during the callback, but only if it has
- * no other active on_read()/on_write() callback and returns FALSE. It is not
- * allowed to to call on_read()/on_write/() during the callback.
+ * It is not allowed to destroy the stream nor to call on_read()/on_write/()
+ * during the callback.
*
* As select() may return even if a read()/write() would actually block, it is
* recommended to use the non-blocking calls and handle return values
diff --git a/src/libstrongswan/networking/tun_device.c b/src/libstrongswan/networking/tun_device.c
index 65268d242..ecefdc233 100644
--- a/src/libstrongswan/networking/tun_device.c
+++ b/src/libstrongswan/networking/tun_device.c
@@ -27,9 +27,11 @@
#include <unistd.h>
#include <net/if.h>
+#if !defined(__APPLE__) && !defined(__linux__) && !defined(HAVE_NET_IF_TUN_H)
+
#include "tun_device.h"
-#if !defined(__APPLE__) && !defined(__linux__) && !defined(HAVE_NET_IF_TUN_H)
+#include <utils/debug.h>
#warning TUN devices are not supported!
@@ -46,12 +48,14 @@ tun_device_t *tun_device_create(const char *name_tmpl)
#include <netinet/in_var.h>
#include <sys/kern_control.h>
#elif defined(__linux__)
+#include <linux/types.h>
#include <linux/if_tun.h>
#else
#include <net/if_tun.h>
#endif
-#include <library.h>
+#include "tun_device.h"
+
#include <utils/debug.h>
#include <threading/thread.h>
diff --git a/src/libstrongswan/networking/tun_device.h b/src/libstrongswan/networking/tun_device.h
index 1d330f133..543125beb 100644
--- a/src/libstrongswan/networking/tun_device.h
+++ b/src/libstrongswan/networking/tun_device.h
@@ -23,7 +23,6 @@
#ifndef TUN_DEVICE_H_
#define TUN_DEVICE_H_
-#include <library.h>
#include <networking/host.h>
typedef struct tun_device_t tun_device_t;