How OpenVPN3 and/or /dev/net/tun routes packets?
Posted: Thu Dec 12, 2019 11:10 pm
I'm writing an OpenVPN client that does not use tun device. I send the packets directly through the library. For testing, I'm using libtins to craft the IP packets by hand.
I did like this:
If I send this through the OpenVPN every second, and I tcpdump the tun0 on the OpenVPN server, I see nothing. However, if I tcpdump eth0 on the OpenVPN server, I see the encoded packet arriving every second. So OpenVPN server receives but I think tcpdump refuses to route the packet.
I then inspected the packet sent by a conventional OpenVPN client through tun (I inserted a little code in OpenVPN to get exactly what it was reading from tun) and I noted that the source address being used was 192.168.255.18. When I put this as the source address in the libtins packet above, it works!
So, what does the source packet has to do with all of this? Is it OpenVPN server or tun server that is refusing the packet with source 0.0.0.0?
I did like this:
Code: Select all
Tins::IP pkt = Tins::IP("10.139.1.1") /
Tins::TCP(80) /
Tins::RawPDU("I'm a payload!");
pkt.src_addr("0.0.0.0");
I then inspected the packet sent by a conventional OpenVPN client through tun (I inserted a little code in OpenVPN to get exactly what it was reading from tun) and I noted that the source address being used was 192.168.255.18. When I put this as the source address in the libtins packet above, it works!
So, what does the source packet has to do with all of this? Is it OpenVPN server or tun server that is refusing the packet with source 0.0.0.0?