aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--server.c9
2 files changed, 12 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 30249db..0c47913 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ CFLAGS ?= ${CFLAGS_DEBUG} ${LIBRARY_INCLUDES}
LDFLAGS ?= ${LDFLAGS_DEBUG} ${LIBRARY_LDFLAGS}
.PHONY: clean style
PROGS = wg-dynamic-client wg-dynamic-server
-CLIENT_OBJS = wg_dynamic_client.o client.o protocol.capnp.o
-SERVER_OBJS = wg_dynamic_server.o server.o protocol.capnp.o
+CLIENT_OBJS = wg_dynamic_client.o client.o protocol.capnp.o wireguard.o
+SERVER_OBJS = wg_dynamic_server.o server.o protocol.capnp.o wireguard.o
all: ${PROGS}
wg-dynamic-client: ${CLIENT_OBJS}
@@ -36,6 +36,6 @@ protocol.capnp.c: protocol.capnp
clean:
rm -f ${PROGS} *.o *~
style:
- find . -type f \( -name "*.c" -or -name "*.h" \) -and \
- -not \( -name "*.capnp.c" -or -name "*.capnp.h" \) | \
- xargs clang-format -i --style=file
+ find . -path ./WireGuard -prune -o -type f \( -name "*.c" -or \
+ -name "*.h" \) -and -not \( -name "*.capnp.c" -or \
+ -name "*.capnp.h" \) -print | xargs clang-format -i --style=file
diff --git a/server.c b/server.c
index 89a78c0..318dc60 100644
--- a/server.c
+++ b/server.c
@@ -11,13 +11,18 @@
#include <sys/wait.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#include "wireguard.h"
#include "protocol.h"
#include "server.h"
bool is_wg_up_on_iface(const char iface[])
{
- /* TODO */
- return true;
+ wg_device *device;
+ if (wg_get_device(&device, iface) < 0) {
+ return false;
+ } else {
+ return true;
+ }
}
int setup_server()