mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-16 12:53:17 +00:00
#43: Basic windows support operational
This commit is contained in:
parent
59c68b773a
commit
4db8137c1a
|
@ -7,6 +7,20 @@ iodine - http://code.kryo.se/iodine
|
|||
Extra README file for Win32 related stuff
|
||||
|
||||
|
||||
== Running iodine on Windows:
|
||||
1. Install the TAP32 driver
|
||||
http://openvpn.net/index.php/downloads.html
|
||||
choose OpenVPN 2.0.9 Windows Installer, when installing you can
|
||||
select to install only the TAP driver.
|
||||
|
||||
2. Have one TAP32 interface installed
|
||||
|
||||
3. Name the interface "dns"
|
||||
|
||||
4. Run iodine/iodined as normal.
|
||||
|
||||
5. Enjoy!
|
||||
|
||||
|
||||
== Building on Windows:
|
||||
You need:
|
||||
|
@ -22,16 +36,15 @@ You need:
|
|||
Then run "make cross-mingw"
|
||||
Note that the binaries will not get a .exe suffix
|
||||
|
||||
|
||||
== Zlib download
|
||||
You can get zlib for MinGW here (both for native and crosscompile):
|
||||
http://code.kryo.se/iodine/deps/zlib.zip
|
||||
Unzip it in your MinGW directory on Windows or in $ROOT/usr for
|
||||
cross-compile.
|
||||
|
||||
== Running iodine on Windows:
|
||||
Get the TAP32 driver here (choose OpenVPN 2.0.9 Windows Installer,
|
||||
you can choose to get only the driver):
|
||||
http://openvpn.net/index.php/downloads.html
|
||||
|
||||
== Results of crappy Win32 API:
|
||||
The following fixable limitations apply:
|
||||
- The password is shown when entered
|
||||
- DNS server IP can not be fetched automatically
|
||||
|
@ -44,3 +57,4 @@ The following (probably) un-fixable limitations apply:
|
|||
- Priviligies cannot be dropped
|
||||
- chroot() cannot be used
|
||||
- Detaching from terminal not possible
|
||||
|
||||
|
|
|
@ -230,7 +230,11 @@ warn(const char *fmt, ...)
|
|||
|
||||
va_start(list, fmt);
|
||||
if (fmt) fprintf(stderr, fmt, list);
|
||||
fprintf(stderr, "%s\n", strerror(errno));
|
||||
if (errno == 0) {
|
||||
fprintf(stderr, ": WSA error %d\n", WSAGetLastError());
|
||||
} else {
|
||||
fprintf(stderr, ": %s\n", strerror(errno));
|
||||
}
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
|
20
src/tun.c
20
src/tun.c
|
@ -424,27 +424,31 @@ tun_setip(const char *ip, int netbits)
|
|||
r = DeviceIoControl(dev_handle, TAP_IOCTL_SET_MEDIA_STATUS, &status,
|
||||
sizeof(status), &status, sizeof(status), &len, NULL);
|
||||
if (!r) {
|
||||
printf("Failed to enable interface\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ipdata[2] = (DWORD) net.s_addr;
|
||||
|
||||
if (inet_aton(ip, &addr)) {
|
||||
ipdata[0] = (DWORD) addr.s_addr;
|
||||
ipdata[1] = ipdata[2] & ipdata[0]; /* Get network bits */
|
||||
ipdata[0] = (DWORD) addr.s_addr; /* local ip addr */
|
||||
ipdata[1] = net.s_addr & ipdata[0]; /* network addr */
|
||||
ipdata[2] = (DWORD) net.s_addr; /* netmask */
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
/* Tell ip/network addr/netmask to device for arp use */
|
||||
|
||||
/* Tell ip/networkaddr/netmask to device for arp use */
|
||||
r = DeviceIoControl(dev_handle, TAP_IOCTL_CONFIG_TUN, &ipdata,
|
||||
sizeof(ipdata), &ipdata, sizeof(ipdata), &len, NULL);
|
||||
if (!r) {
|
||||
printf("Failed to set interface in TUN mode\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO use netsh to set ip address */
|
||||
cmdline[0] = 0;
|
||||
return 0;
|
||||
/* use netsh to set ip address */
|
||||
printf("Setting IP of interface '%s' to %s (can take a few seconds)...\n", if_name, ip);
|
||||
snprintf(cmdline, sizeof(cmdline), "netsh interface ip set address \"%s\" static %s %s",
|
||||
if_name, ip, inet_ntoa(net));
|
||||
return system(cmdline);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue