robinpaulson / SimpleRT

Simple Reverse Tethering utility for Android
GNU General Public License v3.0
899 stars 101 forks source link

Added vpn networks visibility for Google play and other apps, fixed problems with android 7+ #40

Closed eugene-sevostianov-sc closed 2 years ago

eugene-sevostianov-sc commented 6 years ago

Added vpn networks visibility for Google play and other apps that use connectivity manager. This feature will work from 5.1 Android, saved compatibility for Android 4.

eugene-sevostianov-sc commented 6 years ago

@Sur3 @vvviperrr this is solves https://github.com/vvviperrr/SimpleRT/issues/3 and https://github.com/vvviperrr/SimpleRT/issues/35 starting from android 5.0

gp54321 commented 6 years ago

I tried to compile your changes and .... absolutely nothing changes from the distributed version. When trying to access a given application in the Google store, phone says that there is no network. I must miss something. I only applied the first set, believing that the last 3 are just cosmetic. I have also to admit that it is the first time I compiled an Android app :-) However I tried first with the original unpatched code and it worked exactly like the distributed app so I must have done things not completely wrong (I hope) This is with android 5.1. I even did a logcat TetherService:W *:S that should - I believe catch - the only way that your code should not be called (my nitpick: why did you call the subroutine setAsUndernlyingNetwork and not setAsUnderlyingNetwork?) I looked at the routing table and it seems that no default route for the 'VPN' exist in the linux table 'main'. Is it normal ?

eugene-sevostianov-sc commented 6 years ago

@gp54321 I've faced strange issue before with enabling/disabling wifi during test session, and it gives me false positive. I missed there network prefix. Can you try again please, now it should work properly. However google app updates still now working, but they are not working on all others implementations of reverse tethering. But you are able to view apps in google play and download them. I've used simple-rt for automation purposes, this fix for me download of some content.

Now my routing table look like this $ netstat -nr Routing tables

Internet: Destination Gateway Flags Refs Use Netif Expire default 10.65.28.1 UGSc 70 60750 en0 10.1.1/24 10.1.1.1 UGSc 2 84764 utun223 10.1.1.2 10.1.1.1 UH 0 5347 utun223 10.65.28/22 link#4 UCS 2 0 en0 10.65.28.1/32 link#4 UCS 1 0 en0 10.65.28.1 60:9c:9f:c5:7c:d0 UHLWIir 69 28 en0 1151 10.65.29.99 78:4f:43:76:f:d8 UHLWI 0 0 en0 1177 10.65.30.40 e8:b2:ac:6d:ca:f5 UHLWI 0 0 en0 786 10.65.31.112/32 link#4 UCS 0 0 en0 127 127.0.0.1 UCS 0 0 lo0 127.0.0.1 127.0.0.1 UH 44 1572378 lo0 169.254 link#4 UCS 0 0 en0 224.0.0/4 link#4 UmCS 2 0 en0 224.0.0.251 1:0:5e:0:0:fb UHmLWI 0 44 en0 239.255.255.250 1:0:5e:7f:ff:fa UHmLWI 0 794 en0 255.255.255.255/32 link#4 UCS 0 0 en0

utun here is vpn.

gp54321 commented 6 years ago

Thanks Eugene, with this change I am able to download from Google store with simplert only. Update returns no error but I am not sure this is because there are no updates or because it does not work correctly. The app that was interesting me (Linphone) is still not able to connect when using only simplert even with your last changes but as Csipsimple is working fine with the same setup it's not a real problem.

Your Android phone seems to get the full netstat, on my phone netstat -nr do not output routes, so I use 'ip route' instead. When connected to simplert without wifi I have only one line - the default route is hidden in another table and seems to be used by many apps but not all (?) -

As of enabling/disabling wifi, yes it is problematic. Possibly Dns resolution is not updated correctly, I have seen strange things indeed with DNS.

eugene-sevostianov-sc commented 6 years ago

@vvviperrr Hi! Can you please review and merge my pr to your project? What was done here

  1. Added vpn as underlying network - that fix part of problems with different apps that doesn't recognize connection (as google play store).
  2. Fixes for 7+ android. 2.1 Fixes for Direct boot (after phone restart it trying to connect before whole android loaded). 2.2 Run as foreground service, to prevent killing app by 7+ android. 2.3 Add method allowBypass() to builder. Otherwise on 7+ android OS version without wi-fi tool doesn't work.
Sur3 commented 6 years ago

I had some problems with the outdated gradle, but I updated that now and just tested simple-rt with this pr code and everything seems to work, this is awesome, thanks. 👍

fsobanski commented 6 years ago

Hey @Sur3, you might also want to have a look at our fork. It is based on Eugenes fork. I have summarized the reason in this PR.

We are successfully using our fork in production for several months now. I suggest to use version 1.2.2. The commit made for version 1.2.3 is in my opinion only necessary if your mobile phone uses Android 6.0.1.

Zero3K commented 4 years ago

This PR can no longer be applied to the latest source code.

nanaceba commented 2 years ago

this pr is not needed anymore merged as a part of other patch https://github.com/robinpaulson/SimpleRT/commit/9b6352603ffd5e1586d8621e026ae550c6e9a26f

robinpaulson commented 2 years ago

Closing, apparently this was fixed elsewhere. #3