Created
May 7, 2010 03:05
-
-
Save oraccha/392986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru usock-0.6.orig/linux/device_tap.c usock-0.6/linux/device_tap.c | |
--- usock-0.6.orig/linux/device_tap.c 2010-05-07 11:49:06.000000000 +0900 | |
+++ usock-0.6/linux/device_tap.c 2010-05-07 11:59:39.000000000 +0900 | |
@@ -16,13 +16,18 @@ | |
#include <sys/ioctl.h> | |
#include <sys/select.h> | |
#include <sys/socket.h> | |
+#ifdef linux | |
#include <linux/if.h> | |
#include <linux/if_tun.h> | |
+#endif | |
#include "device.h" | |
+#ifdef linux | |
#define TUNDEV "/dev/net/tun" | |
- | |
+#else | |
+#define TUNDEV "/dev/tap0" | |
+#endif | |
static int fd = -1; | |
@@ -31,7 +36,6 @@ | |
Initialize device | |
*/ | |
void dev_init(void) { | |
- struct ifreq ifr; | |
char buf[256]; | |
if ((fd = open(TUNDEV, O_RDWR)) < 0) { | |
@@ -39,6 +43,8 @@ | |
exit(1); | |
} | |
+#if linux | |
+ struct ifreq ifr; | |
memset(&ifr, 0, sizeof(ifr)); | |
ifr.ifr_flags = (IFF_TAP | IFF_NO_PI); | |
@@ -46,8 +52,9 @@ | |
perror("ERROR: dev_init() failed"); | |
exit(1); | |
} | |
+#endif | |
- sprintf(buf, "ifconfig tap0 inet 192.168.1.1"); | |
+ sprintf(buf, "ifconfig tap0 inet 192.168.0.1"); | |
system(buf); | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment