mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
fix windows compile (#636)
This commit is contained in:
parent
c73e59341d
commit
b42c111527
|
@ -180,8 +180,12 @@ void closeTraceFile ();
|
||||||
void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...);
|
void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...);
|
||||||
|
|
||||||
/* Tuntap API */
|
/* Tuntap API */
|
||||||
int tuntap_open (tuntap_dev *device, char *dev, const char *address_mode, char *device_ip,
|
int tuntap_open (struct tuntap_dev *device, char *dev, const char *address_mode, char *device_ip,
|
||||||
char *device_mask, const char * device_mac, int mtu);
|
char *device_mask, const char * device_mac, int mtu
|
||||||
|
#ifdef WIN32
|
||||||
|
, int metric
|
||||||
|
#endif
|
||||||
|
);
|
||||||
int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len);
|
int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len);
|
||||||
int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len);
|
int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len);
|
||||||
void tuntap_close (struct tuntap_dev *tuntap);
|
void tuntap_close (struct tuntap_dev *tuntap);
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (WIN32)
|
#if defined (WIN32)
|
||||||
#include <Wincrypt.h> // HCTYPTPROV, Crypt*-functions
|
#include <wincrypt.h> // HCTYPTPROV, Crypt*-functions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1889,7 +1889,11 @@ void edge_read_from_tap (n2n_edge_t * eee) {
|
||||||
sleep(3);
|
sleep(3);
|
||||||
tuntap_close(&(eee->device));
|
tuntap_close(&(eee->device));
|
||||||
tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr,
|
tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr,
|
||||||
eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu);
|
eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu
|
||||||
|
#ifdef WIN32
|
||||||
|
,eee->tuntap_priv_conf.metric
|
||||||
|
#endif
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
const uint8_t * mac = eth_pkt;
|
const uint8_t * mac = eth_pkt;
|
||||||
traceEvent(TRACE_DEBUG, "### Rx TAP packet (%4d) for %s",
|
traceEvent(TRACE_DEBUG, "### Rx TAP packet (%4d) for %s",
|
||||||
|
@ -3124,7 +3128,11 @@ int quick_edge_init (char *device_name, char *community_name,
|
||||||
/* Open the tuntap device */
|
/* Open the tuntap device */
|
||||||
if(tuntap_open(&tuntap, device_name, "static",
|
if(tuntap_open(&tuntap, device_name, "static",
|
||||||
local_ip_address, "255.255.255.0",
|
local_ip_address, "255.255.255.0",
|
||||||
device_mac, DEFAULT_MTU) < 0)
|
device_mac, DEFAULT_MTU
|
||||||
|
#ifdef WIN32
|
||||||
|
, 0
|
||||||
|
#endif
|
||||||
|
) < 0)
|
||||||
return(-2);
|
return(-2);
|
||||||
|
|
||||||
/* Init edge */
|
/* Init edge */
|
||||||
|
|
|
@ -53,7 +53,11 @@ int main() {
|
||||||
"10.0.0.1", // Set ip address
|
"10.0.0.1", // Set ip address
|
||||||
"255.255.255.0", // Netmask to use
|
"255.255.255.0", // Netmask to use
|
||||||
"DE:AD:BE:EF:01:10", // Set mac address
|
"DE:AD:BE:EF:01:10", // Set mac address
|
||||||
DEFAULT_MTU) < 0) // MTU to use
|
DEFAULT_MTU // MTU to use
|
||||||
|
#ifdef WIN32
|
||||||
|
, 0
|
||||||
|
#endif
|
||||||
|
) < 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user