Skip to content
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

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

Closed

Conversation

eugene-sevostianov-sc
Copy link
Contributor

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
Copy link
Contributor Author

@Sur3 @vvviperrr this is solves #3 and #35 starting from android 5.0

@gp54321
Copy link

gp54321 commented Sep 4, 2017

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
Copy link
Contributor Author

@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
Copy link

gp54321 commented Sep 5, 2017

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.

jokubasdargissc and others added 7 commits September 12, 2017 14:20
I changed the libusb_hotplug_flag of libusb_hotplug_register_callback
from LIBUSB_HOTPLUG_NO_FLAGS to LIBUSB_HOTPLUG_ENUMERATE. This way,
the callback is fired for all currently attached devices. Otherwise,
you would have to disconnect and reconnect again a device that is
already attached when SimpleRT is started.
@eugene-sevostianov-sc eugene-sevostianov-sc changed the title Added vpn networks visibilty for Google play and other apps Added vpn networks visibility for Google play and other apps, fixed problems with android 7+ Sep 26, 2017
@eugene-sevostianov-sc
Copy link
Contributor Author

@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.

Start reverse tethering on startup on all connected devices
@Sur3
Copy link
Contributor

Sur3 commented Jan 26, 2018

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
Copy link
Contributor

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
Copy link

Zero3K commented Mar 6, 2020

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

@nanaceba
Copy link

this pr is not needed anymore merged as a part of other patch 9b63526

@robinpaulson
Copy link
Owner

Closing, apparently this was fixed elsewhere. #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants