Page 1 of 1

Need help understanding the Windows tun reading code...

Posted: Thu Mar 05, 2015 2:28 pm
by RobertF
Hey folks,

I'm trying to use your Windows tun driver and create a greatly functionally reduced client modeled after your client code in order to read/write from/to the tun driver. Basically I'm trying to create a very lightweight VPN client that runs on Windows.

So far I've been able to bring up the interface and successfully read from it. When I do I get IPv6 datagrams originating from the adapter IPv6 address. So far so good.

I then set a routing rule so as to route IPv4 traffic from my Windows box to another machine on my LAN directed through the adapter interface IP.
The route add command succeeds, and route print looks to be correct...

Network Destination Netmask Gateway Interface Metric
192.168.10.101 255.255.255.255 On-link 10.0.0.2 31

Now I'm sending an IPv4 UDP packet from the Windows host to the destination IP.
I was expecting (hoping) that once I sent the packet that it would be readable out of the tun.
In other words I thought I would read an IPv4 datagram with the UDP packet as the payload...
But no, I am not reading any IPv4 datagrams... (Again, I do get some IPv6 datagrams originating from the adapter IPv6 address)

At this point I figure that the reason I am not seeing the IPv4 packet is:
A - My code is incorrect or incomplete
B - My thinking that I should be able to read the IPv4 packet from the adapter is incorrect

It "seems" that my code is OK, in that I'm able to read and parse out the openvpn_ipv6hdr prefaced datagrams... (but no IPv4 datagram as expected)
Am I wrong to be thinking that my IPv4 packet being routed through the adapter IPv4 address should be readable out of the tun...?
Or maybe there's additional perfunctory interface configuration that I'm missing...? (There's the "code incomplete" clause...)

Any insight on this matter would be greatly appreciated !

Thanks,

- RobertF