From 3e5252d93c87c4cddf596d4030d736e2cea81557 Mon Sep 17 00:00:00 2001 From: Tushar Pankaj Date: Mon, 12 Nov 2018 18:33:33 -0600 Subject: Implement server check iface Signed-off-by: Tushar Pankaj --- Makefile | 10 +++++----- server.c | 9 +++++++-- 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 #include #include +#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() -- cgit v1.2.3-59-g8ed1b