Skip to contentSkip to conversation

Problem setting point-to-point mode in 2.0 versions

Openvpn-devel Harsha V. Madhyastha 2 participants 2 messages Jan 16, 2005 – Jan 18, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using OpenVPN on Windows XP and I need to set Point-to-Point mode on the device in order to emulate a "tun" interface (as specified in
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/tap-win32/tapdrvr.c?rev=1.2.2.5)

As specified in
http://www.tinc-vpn.org/svn/tinc/branches/1.0-gnutls/src/mingw/device.c
and
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/tun.c?rev=1.46
I used the following code to do this:

#define TAP_CONTROL_CODE(request, method) \
CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD | 8000, request, method, \
FILE_ANY_ACCESS)
#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE(6, METHOD_BUFFERED)

unsigned long ep[2];
HANDLE hTAP32;
long len;

hTAP32 = CreateFile(device_path, GENERIC_READ | GENERIC_WRITE, 0, 0, \
	OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
ep[0] = inet_addr("10.0.0.1");
ep[1] = ep[0] ^ inet_addr("0.0.0.3");
if (!DeviceIoControl (hTAP32, TAP_IOCTL_CONFIG_POINT_TO_POINT, \
	ep, sizeof (ep), ep, sizeof (ep), &len, NULL))

{
fprintf (stderr, "ERROR: The TAP-Win32 driver rejected a
DeviceIoControl call to set Point-to-Point mode\n");
}

The above call to DeviceIoControl works in the 1.6 version of OpenVPN but fails in all the 2.0 beta versions. It would be great if any of could let me know what the cause for the problem could be.

BTW, thank you very much Charles for replying to my previous post. I guess the point you raised there was pertinent. I will look into the JVM source to figure out the root of the problem.

Thanks!
Harsha

#1 lore raw

There shouldn't be any difference in the TAP-Win32 API between 1.6 and 2.0.

Why don't you try running a debugger or add printfs to a working version of OpenVPN 2.0 so you can see what is being passed in the TAP_IOCTL_CONFIG_POINT_TO_POINT ioctl -- then duplicate that in your custom application.

James

Quoted 53 lines · Harsha V. Madhyastha

Hi,

I'm using OpenVPN on Windows XP and I need to set Point-to-Point mode on the device in order to emulate a "tun" interface (as specified in
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/tap-win32/tapdrvr.c?rev=1.2.2.5)

As specified in
http://www.tinc-vpn.org/svn/tinc/branches/1.0-gnutls/src/mingw/device.c
and
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/tun.c?rev=1.46
I used the following code to do this:

#define TAP_CONTROL_CODE(request, method) \
CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD | 8000, request, method, \
FILE_ANY_ACCESS)
#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE(6, METHOD_BUFFERED)

unsigned long ep[2];
HANDLE hTAP32;
long len;

hTAP32 = CreateFile(device_path, GENERIC_READ | GENERIC_WRITE, 0, 0, \
	OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
ep[0] = inet_addr("10.0.0.1");
ep[1] = ep[0] ^ inet_addr("0.0.0.3");
if (!DeviceIoControl (hTAP32, TAP_IOCTL_CONFIG_POINT_TO_POINT, \
	ep, sizeof (ep), ep, sizeof (ep), &len, NULL))A

{
fprintf (stderr, "ERROR: The TAP-Win32 driver rejected a
DeviceIoControl call to set Point-to-Point mode\n");
}

The above call to DeviceIoControl works in the 1.6 version of OpenVPN but fails in all the 2.0 beta versions. It would be great if any of could let me know what the cause for the problem could be.

BTW, thank you very much Charles for replying to my previous post. I guess the point you raised there was pertinent. I will look into the JVM source to figure out the root of the problem.

Thanks!
Harsha

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel