Using TUN driver in windows

This forum is for general conversation and user-user networking.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
vijayaplv
OpenVpn Newbie
Posts: 2
Joined: Thu Sep 20, 2012 8:18 pm

Using TUN driver in windows

Post by vijayaplv » Thu Sep 20, 2012 8:19 pm

Hi,
I have installed the TAP-WIN32 Adapter V9 on my windows 7 machine. I want to use
TUN to read the IP packets out of the interface. I followed the C# sample from
http://www.varsanofiev.com/inside/using ... indows.htm

i modified the code like below

IntPtr ptun = Marshal.AllocHGlobal(8);
Marshal.WriteInt32(ptun, 0, 0x0a030001);
Marshal.WriteInt32(ptun, 4, unchecked((int)0x00ffffFF));
bool val = DeviceIoControl (ptr, TAP_CONTROL_CODE (5, METHOD_BUFFERED) /*POINT
TO POINT */, ptun, 8,ptun, 8, out len, IntPtr.Zero);

However i still don't seem to get IP Packets. I ran tcpdump on the other end and
it complains "Wrong link layer encapsulation".

Is this the correct way of trying to get IP Packets out of TUN interface?.

-Vijay

Post Reply