Skip to content

Commit

Permalink
Merge pull request meyerd#6 from syxoasis/master
Browse files Browse the repository at this point in the history
fix "tun_close"  compile error on OS X
  • Loading branch information
meyerd committed Nov 30, 2015
2 parents 3eb9869 + 7e16a04 commit f1014fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions n2n_v1/tuntap_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

#ifdef _DARWIN_

void tun_close(tuntap_dev *device);
void tuntap_close(tuntap_dev *device);

/* ********************************** */

#define N2N_OSX_TAPDEVICE_SIZE 32
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
char *device_ip,
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
char *device_ip,
char *device_mask,
const char * device_mac,
int mtu) {
Expand All @@ -42,7 +42,7 @@ int tuntap_open(tuntap_dev *device /* ignored */,
break;
}
}

if(device->fd < 0) {
traceEvent(TRACE_ERROR, "Unable to open tap device");
return(-1);
Expand Down Expand Up @@ -76,15 +76,15 @@ int tuntap_open(tuntap_dev *device /* ignored */,

fd = popen(buf, "r");
if(fd < 0) {
tun_close(device);
tuntap_close(device);
return(-1);
} else {
int a, b, c, d, e, f;

buf[0] = 0;
fgets(buf, sizeof(buf), fd);
pclose(fd);

if(buf[0] == '\0') {
traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address");
exit(0);
Expand Down
14 changes: 7 additions & 7 deletions n2n_v2/tuntap_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

#ifdef _DARWIN_

void tun_close(tuntap_dev *device);
void tuntap_close(tuntap_dev *device);

/* ********************************** */

#define N2N_OSX_TAPDEVICE_SIZE 32
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
const char *address_mode, /* static or dhcp */
char *device_ip,
char *device_ip,
char *device_mask,
const char * device_mac,
int mtu) {
Expand All @@ -43,7 +43,7 @@ int tuntap_open(tuntap_dev *device /* ignored */,
break;
}
}

if(device->fd < 0) {
traceEvent(TRACE_ERROR, "Unable to open tap device");
return(-1);
Expand Down Expand Up @@ -77,15 +77,15 @@ int tuntap_open(tuntap_dev *device /* ignored */,

fd = popen(buf, "r");
if(fd < 0) {
tun_close(device);
tuntap_close(device);
return(-1);
} else {
int a, b, c, d, e, f;

buf[0] = 0;
fgets(buf, sizeof(buf), fd);
pclose(fd);

if(buf[0] == '\0') {
traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address");
exit(0);
Expand Down

0 comments on commit f1014fd

Please sign in to comment.