Hi,
I am coding an app with a native (C/C++) lib to create a tunnel interface and inspect read/write pkts prior to forwarding via the actual physical interface. I am interfacing via JNI to create and manage tunnel as described in the documentation at: https://developer.android.com/reference/android/net/VpnService.
The current situation:
The tun0 interface gets created with IP and route's are setup. The native lib does receive the pkt on read(tun_fd). The issue is: write(tun_fd) succeeds, however the end application (e.g ping) does not receive the response. The interface counters on tunnel interface does show "RX" incrementing and no drops!!
Am I running into any policy based routing issues ? Appreciate any pointers! Please redirect if this is not the correct forum for this issue. Thank you!
--
Android Version: 11
gta7litewifi:/ $ ifconfig tun0
tun0 Link encap:UNSPEC
inet addr:10.10.20.3 P-t-P:10.10.20.3 Mask:255.255.255.255
inet6 addr: fe80::24cd:7b38:a0b1:90e7/64 Scope: Link
UP POINTOPOINT RUNNING MTU:1500 Metric:1
RX packets:218 errors:0 dropped:0 overruns:0 frame:0 >>>> no drops RX increments when data is written into tun_fd
TX packets:135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:29184 TX bytes:18936
gta7litewifi:/ $ ip route show table 1056 >>>> 1056 is the table created for the tun interface.
default dev tun0 proto static scope link
10.10.20.3 dev tun0 proto static scope link