Browse Source

1

nodeinfo-routing-update
Evgeny 4 weeks ago
parent
commit
0e61029231
  1. 14
      configure.ac
  2. 8
      src/Makefile.am
  3. 4
      src/tun_freebsd.c
  4. 4
      src/tun_linux.c
  5. 5
      src/tun_windows.c

14
configure.ac

@ -81,20 +81,6 @@ AC_MSG_RESULT([$os_freebsd])
AM_CONDITIONAL([OS_FREEBSD], [test "x$os_freebsd" = "xyes"]) AM_CONDITIONAL([OS_FREEBSD], [test "x$os_freebsd" = "xyes"])
# Set TUN source file based on platform
if test "x$os_freebsd" = "xyes"; then
TUN_SOURCE="tun_freebsd.c"
TUN_LIBS=""
elif test "x$os_windows" = "xyes"; then
TUN_SOURCE="tun_windows.c"
TUN_LIBS="-liphlpapi -lws2_32 -ladvapi32 -lbcrypt -ldbghelp"
else
TUN_SOURCE="tun_linux.c"
TUN_LIBS=""
fi
AC_SUBST([TUN_SOURCE])
AC_SUBST([TUN_LIBS])
# Checks for header files, typedefs, functions... # Checks for header files, typedefs, functions...
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
AC_TYPE_SIZE_T AC_TYPE_SIZE_T

8
src/Makefile.am

@ -11,6 +11,9 @@ utun_CORE_SOURCES = \
routing.c \ routing.c \
tun_if.c \ tun_if.c \
tun_route.c \ tun_route.c \
tun_linux.c \
tun_freebsd.c \
tun_windows.c \
etcp.c \ etcp.c \
etcp_connections.c \ etcp_connections.c \
etcp_loadbalancer.c \ etcp_loadbalancer.c \
@ -22,9 +25,8 @@ utun_CORE_SOURCES = \
etcp_api.c \ etcp_api.c \
control_server.c control_server.c
# Platform-specific TUN sources # Platform-specific TUN libs (Windows only)
utun_TUN_SOURCES = $(TUN_SOURCE) utun_TUN_LIBS = -liphlpapi -lws2_32 -ladvapi32 -lbcrypt -ldbghelp
utun_TUN_LIBS = $(TUN_LIBS)
# TinyCrypt sources (only used without OpenSSL) # TinyCrypt sources (only used without OpenSSL)
utun_TINYCRYPT_SOURCES = \ utun_TINYCRYPT_SOURCES = \

4
src/tun_freebsd.c

@ -1,6 +1,8 @@
// tun_freebsd.c - FreeBSD TUN/TAP implementation // tun_freebsd.c - FreeBSD TUN/TAP implementation
// Uses /dev/tun device with ioctl // Uses /dev/tun device with ioctl
#if defined(__FreeBSD__)
#include "tun_if.h" #include "tun_if.h"
#include "../lib/debug_config.h" #include "../lib/debug_config.h"
#include <stdio.h> #include <stdio.h>
@ -235,3 +237,5 @@ ssize_t tun_platform_write(struct tun_if* tun, const uint8_t* buf, size_t len) {
int tun_platform_get_poll_fd(struct tun_if* tun) { int tun_platform_get_poll_fd(struct tun_if* tun) {
return tun->fd; return tun->fd;
} }
#endif // __FreeBSD__

4
src/tun_linux.c

@ -1,6 +1,8 @@
// tun_linux.c - Linux TUN/TAP implementation // tun_linux.c - Linux TUN/TAP implementation
// Uses /dev/net/tun device with ioctl // Uses /dev/net/tun device with ioctl
#if defined(__linux__)
#include "tun_if.h" #include "tun_if.h"
#include "../lib/debug_config.h" #include "../lib/debug_config.h"
#include <stdio.h> #include <stdio.h>
@ -237,3 +239,5 @@ ssize_t tun_platform_write(struct tun_if* tun, const uint8_t* buf, size_t len) {
int tun_platform_get_poll_fd(struct tun_if* tun) { int tun_platform_get_poll_fd(struct tun_if* tun) {
return tun->fd; return tun->fd;
} }
#endif // __linux__

5
src/tun_windows.c

@ -1,4 +1,7 @@
// tun_windows.c - Wintun implementation // tun_windows.c - Wintun implementation
#if defined(_WIN32)
#include "../lib/debug_config.h" #include "../lib/debug_config.h"
#include "../lib/u_async.h" #include "../lib/u_async.h"
#include "tun_if.h" #include "tun_if.h"
@ -307,3 +310,5 @@ DWORD WINAPI tun_read_thread_proc(LPVOID arg)
DEBUG_DEBUG(DEBUG_CATEGORY_TUN, "TUN exit"); DEBUG_DEBUG(DEBUG_CATEGORY_TUN, "TUN exit");
return 0; return 0;
} }
#endif // _WIN32

Loading…
Cancel
Save