aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2016-05-19 11:13:24 +0200
committerMartin Willi <martin@strongswan.org>2016-05-19 11:13:24 +0200
commit294ac097d65f34251754ead4ed720b7b3a9ad4c3 (patch)
treed7ca40628e56d792ff2333ac1b7ee756a22f88f8 /src
parent989db1bf2f8d3a81e1bcaee6ba7a455cc6fce74b (diff)
downloadstrongswan-294ac097d65f34251754ead4ed720b7b3a9ad4c3.tar.bz2
strongswan-294ac097d65f34251754ead4ed720b7b3a9ad4c3.tar.xz
af-alg: Silently skip probing algorithms if AF_ALG is not supported
If the af-alg plugin is enabled, but kernel support is missing, we get an error line during startup for each probed algorithm. This is way too verbose, so just skip probing if AF_ALG is unsupported.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/af_alg/af_alg_plugin.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/af_alg/af_alg_plugin.c b/src/libstrongswan/plugins/af_alg/af_alg_plugin.c
index 445667507..571882cec 100644
--- a/src/libstrongswan/plugins/af_alg/af_alg_plugin.c
+++ b/src/libstrongswan/plugins/af_alg/af_alg_plugin.c
@@ -22,6 +22,8 @@
#include "af_alg_prf.h"
#include "af_alg_crypter.h"
+#include <unistd.h>
+
typedef struct private_af_alg_plugin_t private_af_alg_plugin_t;
/**
@@ -41,6 +43,19 @@ METHOD(plugin_t, get_name, char*,
return "af-alg";
}
+static bool af_alg_supported()
+{
+ int fd;
+
+ fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
+ if (fd != -1)
+ {
+ close(fd);
+ return true;
+ }
+ return false;
+}
+
METHOD(plugin_t, get_features, int,
private_af_alg_plugin_t *this, plugin_feature_t *features[])
{
@@ -50,6 +65,10 @@ METHOD(plugin_t, get_features, int,
if (!count)
{ /* initialize only once */
+ if (!af_alg_supported())
+ {
+ return 0;
+ }
f[count++] = PLUGIN_REGISTER(HASHER, af_alg_hasher_create);
af_alg_hasher_probe(f, &count);
f[count++] = PLUGIN_REGISTER(SIGNER, af_alg_signer_create);