summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <wagi@monom.org>2019-07-19 10:18:20 +0200
committerDaniel Wagner <wagi@monom.org>2019-11-07 08:53:06 +0100
commitdc9d71aacbc1317755097b454d3219522e726005 (patch)
tree291f5b4c7252fdbc9eb9a3ce79df497728a43407
parent4e1546be9537294af18be022de90f479b0799b02 (diff)
downloadconnman-dc9d71aacbc1317755097b454d3219522e726005.tar.gz
vpn: Add WireGuard plugin placeholder
Add an empty new plugin for WireGuard support.
-rw-r--r--Makefile.plugins18
-rw-r--r--configure.ac9
-rw-r--r--vpn/plugins/wireguard.c44
3 files changed, 70 insertions, 1 deletions
diff --git a/Makefile.plugins b/Makefile.plugins
index 14f2a782..3d4e32f0 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -62,6 +62,24 @@ if VPN
builtin_modules += vpn
builtin_sources += plugins/vpn.c
+if WIREGUARD
+builtin_vpn_source = vpn/plugins/vpn.c vpn/plugins/vpn.h
+if WIREGUARD_BUILTIN
+builtin_vpn_modules += wireguard
+builtin_vpn_sources += vpn/plugins/wireguard.c
+builtin_vpn_cflags += -DWIREGUARD=\"@WIREGUARD@\"
+else
+vpn_plugin_LTLIBRARIES += vpn/plugins/wireguard.la
+vpn_plugin_objects += $(plugins_wireguard_la_OBJECTS)
+vpn_plugins_wireguard_la_SOURCES = vpn/plugins/wireguard.c
+vpn_plugins_wireguard_la_CFLAGS = $(plugin_cflags) \
+ -DWIREGUARD=\"@WIREGUARD@\" \
+ -DVPN_STATEDIR=\""$(vpn_statedir)"\" \
+ -DSCRIPTDIR=\""$(build_scriptdir)"\"
+vpn_plugins_wireguard_la_LDFLAGS = $(plugin_ldflags)
+endif
+endif
+
if OPENCONNECT
builtin_vpn_source = vpn/plugins/vpn.c vpn/plugins/vpn.h
if OPENCONNECT_BUILTIN
diff --git a/configure.ac b/configure.ac
index 69e9f538..537ba5f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,6 +342,12 @@ AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
[enable_ethernet=${enableval}])
AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
+AC_ARG_ENABLE(wireguard, AC_HELP_STRING([--disable-wireguard],
+ [disable Wireguard support]),
+ [enable_wireguard=${enableval}])
+AM_CONDITIONAL(WIREGUARD, test "${enable_wireguard}" != "no")
+AM_CONDITIONAL(WIREGUARD_BUILTIN, test "${enable_wireguard}" = "builtin")
+
AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
[disable USB Gadget support]),
[enable_gadget=${enableval}])
@@ -453,7 +459,8 @@ AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
"${enable_openvpn}" != "no" -o \
"${enable_vpnc}" != "no" -o \
"${enable_l2tp}" != "no" -o \
- "${enable_pptp}" != "no")
+ "${enable_pptp}" != "no" -o \
+ "${enable_wireguard}" != "no")
AC_MSG_CHECKING(which DNS backend to use)
AC_ARG_WITH(dns-backend, AC_HELP_STRING([--with-dns-backend=TYPE],
diff --git a/vpn/plugins/wireguard.c b/vpn/plugins/wireguard.c
new file mode 100644
index 00000000..5056bd97
--- /dev/null
+++ b/vpn/plugins/wireguard.c
@@ -0,0 +1,44 @@
+/*
+ * ConnMan VPN daemon
+ *
+ * Copyright (C) 2019 Daniel Wagner. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+#include <connman/task.h>
+#include <connman/dbus.h>
+#include <connman/vpn-dbus.h>
+
+#include "vpn.h"
+
+static int wg_init(void)
+{
+ return 0;
+}
+
+static void wg_exit(void)
+{
+}
+
+CONNMAN_PLUGIN_DEFINE(wireguard, "WireGuard VPN plugin", VERSION,
+ CONNMAN_PLUGIN_PRIORITY_DEFAULT, wg_init, wg_exit)