-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you add support for VPN service for android? #5
Comments
Interesting idea indeed. However it would require an important amount of work which I can't deal with right now. |
So, as far as I understand your comments from #6 and here — it is impossible to just give a vpn-group permission for application in android? |
Indeed, I tried yesterday and the process didn't get access to /dev/tun either. |
My untested, unreliable understanding is this:
|
very well thanks |
@sandymac: thanks for your comments. However as per my testing, the BIND_VPN_SERVICE permission doesn't give the app access to /dev/tun device, which is needed for the standalone daemon to use it. |
Hi, TincGui would need to register an Android VPN service via android.net.VpnService and create a Unix socket via android.net.LocalSocket. Androids VPN service interface provides a file descriptor for sending/receiving IP packets. This file descriptor must then be forwarded to the local Unix socket. Unfortunately my Java skills are somehow limited to implement this. But I' willing to put some effort in creating the socket support for tinc. Cheers, |
I have created a patchset for non-root/VpnService use. The repo is at https://github.com/culugyx/tinc_gui It's not intensively tested/documented and might be unstable, but at least works here, on android M. |
@stv0g I think ics-openvpn has a similar architecture to your idea (sending/receiving file descriptors). Here I avoided fd transferring by linking tinc directly to tinc_gui and use JNI. Passing fds is much easier in a single process. |
Thanks for sharing. I'm surprised how few java code is actually required for this change. |
VpnService appears only to support TUN mode (IFF_TUN | IFF_NO_PI): If both modes are to be kept, maybe we can use pref_key_super_user to determine which mode to use. A few more Java code will be necessary (of which I'm not quite familiar). On the JNI side, tinc can be compiled twice as both shared lib and executable with different flags. Currently, I tried to add reconnect_on_net_change function, but it still crashes occasionally on network changes. |
It will definitely be nice to have possibility to use Mode=switch (tap) without root. |
I've made changes so that both root and non-root mode can co-exist and switch depend on use_super_user. |
@culugyx do you have an apk or anything? Would really love this feature! |
@codemac https://github.com/culugyx/tinc_gui/wiki |
Is this still "wontfix" ? It would be real handy if it was fixed, even if only supporting mode = route |
People ported openvpn to android as ics-openvpn.
Perhaps, tinc could be ported to android with support for VPN service, too.
With built-in VPN service, I wouldn't have to root my device.
The text was updated successfully, but these errors were encountered: