Implement selectable tap adapter in Windows

This commit is contained in:
emanuele-f 2019-06-30 18:32:39 +02:00
parent bc260c2312
commit 69e1d50ca3
3 changed files with 5 additions and 3 deletions

2
edge.c
View File

@ -139,7 +139,7 @@ static void help() {
"[-p <local port>] [-M <mtu>] "
"[-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");
#endif

1
n2n.h
View File

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

View File

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