commit a2a19aeddc98c6d78d0db4be6fe47b8411d310b1 Author: Maximilian Wilhelm Date: Tue Jul 31 19:38:31 2007 +0200 Bugfix from Neil Brown which should solve the 'I-get-no-traffic-through-the-tunnel'-Problem. Signed-off-by: Maximilian Wilhelm diff --git a/tun.c b/tun.c index df3d227..aa66433 100644 --- a/tun.c +++ b/tun.c @@ -3092,7 +3092,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6 /* set point-to-point mode if TUN device */ - if (tt->type == DEV_TYPE_TUN) + if (tt->type == DEV_TYPE_TUN && NET_TYPE(tt) == NET_TYPE_PTP) { in_addr_t ep[2]; ep[0] = htonl (tt->local); @@ -3107,6 +3107,22 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6 msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun"); } + if (tt->type == DEV_TYPE_TUN && NET_TYPE(tt) == NET_TYPE_SUBNET) + { + in_addr_t ep[3]; + ep[0] = htonl (tt->local); + ep[1] = htonl (tt->local & tt->remote_netmask); + ep[2] = htonl (tt->remote_netmask); + if (!tt->did_ifconfig_setup) + { + msg (M_FATAL, "ERROR: --dev tun also requires --ifconfig"); + } + if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_TUN, + ep, sizeof (ep), + ep, sizeof (ep), &len, NULL)) + msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set TUN mode, which is required for --nettype subnet"); + } + /* should we tell the TAP-Win32 driver to masquerade as a DHCP server as a means of setting the adapter address? */ if (tt->did_ifconfig_setup && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ)