Browse Source

Implement selectable tap adapter in Windows

pull/155/head
emanuele-f 5 years ago
parent
commit
69e1d50ca3
  1. 2
      edge.c
  2. 1
      n2n.h
  3. 5
      win32/wintap.c

2
edge.c

@ -139,7 +139,7 @@ static void help() {
"[-p <local port>] [-M <mtu>] " "[-p <local port>] [-M <mtu>] "
"[-r] [-E] [-v] [-i <reg_interval>] [-t <mgmt port>] [-b] [-A] [-h]\n\n"); "[-r] [-E] [-v] [-i <reg_interval>] [-t <mgmt port>] [-b] [-A] [-h]\n\n");
#ifdef __linux__ #if defined(N2N_CAN_NAME_IFACE)
printf("-d <tun device> | tun device name\n"); printf("-d <tun device> | tun device name\n");
#endif #endif

1
n2n.h

@ -38,6 +38,7 @@
#ifdef WIN32 #ifdef WIN32
#include "win32/n2n_win32.h" #include "win32/n2n_win32.h"
#include "win32/winconfig.h" #include "win32/winconfig.h"
#define N2N_CAN_NAME_IFACE 1
#undef N2N_HAVE_DAEMON #undef N2N_HAVE_DAEMON
#undef N2N_HAVE_SETUID #undef N2N_HAVE_SETUID
#else #else

5
win32/wintap.c

@ -22,6 +22,7 @@ void initWin32() {
} }
int open_wintap(struct tuntap_dev *device, int open_wintap(struct tuntap_dev *device,
const char * devname,
const char * address_mode, /* "static" or "dhcp" */ const char * address_mode, /* "static" or "dhcp" */
char *device_ip, char *device_ip,
char *device_mask, char *device_mask,
@ -40,7 +41,7 @@ int open_wintap(struct tuntap_dev *device,
memset(device, 0, sizeof(struct tuntap_dev)); memset(device, 0, sizeof(struct tuntap_dev));
device->device_handle = INVALID_HANDLE_VALUE; device->device_handle = INVALID_HANDLE_VALUE;
device->device_name = NULL; device->device_name = devname[0] ? devname : NULL;
device->ifName = NULL; device->ifName = NULL;
device->ip_addr = inet_addr(device_ip); device->ip_addr = inet_addr(device_ip);
@ -262,7 +263,7 @@ int tuntap_open(struct tuntap_dev *device,
char *device_mask, char *device_mask,
const char * device_mac, const char * device_mac,
int mtu) { int mtu) {
return(open_wintap(device, address_mode, device_ip, device_mask, device_mac, mtu)); return(open_wintap(device, dev, address_mode, device_ip, device_mask, device_mac, mtu));
} }
/* ************************************************ */ /* ************************************************ */

Loading…
Cancel
Save