Genymobile/gnirehtet

Auto-Stop and WiFi-Simulation

simonferndriger opened this issue ยท 26 comments

All-in-all a great app. What would make it perfect for me are the following two feature requests:

Auto-Stop
Once, gnirehtet is running on my phone, it runs. So, when I plug the USB cable out of my phone, with gnirehtet running, my mobile phone is unable to use the mobile internet connection. It only works again after I (manually) stop gnirehtet. So it would be awesome if gnirehtet would stop itself automatically, after the USB cable is pulled out of the phone.

WiFi-Simulation
Unfortunately, still some major apps rely specifically on a WiFi connection (or are unable to run with reverse tethering) like the Play Store, Google Contact Sync or MIUI updater. So it would be immensly cool if gnirehtet could pretend to be a WiFi connection so these stupid apps (telling me I have no internet connection while using gnirehtet) would finally work as they are supposed to.

In my case, Google Play Store works since beginning, tested with Android 6 and 10.

Well, the store "works" for me in that way, that I can search for apps etc. But updating and installing doesn't work (Android 8.1.0) - it always says "Waiting for download..." (I can't update to Android 10 unfortunately, since MIUI 11 is the latest version I can install today), but great that it will work with 10!

rom1v commented

See #51 and #102

Close on disconnect is not implemented yet. I have no solution for the PlayStore issue.

Well, that's at least some good news - maybe Google Play Store will work soon on my phone too. So with #51 coming up that will be awesome! ๐Ÿ‘

In my case, Google Play Store works since beginning, tested with Android 6 and 10.

PlayStore works sometimes, sometimes it doesn't. It's almost like the developers enjoy playing with people's emotions. Currently, I run 22.4.25-21 [0] [PR] 337959405 and it doesn't work at all with gnirehtet :(

shame play store issue is not yet circumventable...

also having issues with whatsapp where web.whatsapp.com on browser does not update (or shows 'phone not connected' message), but works again once i turn wifi back on on the phone. anyone with similar issues, and know how to get round it?

@imonlygitting I also get the web.whatsapp problem sometimes, however, unpluging and re-pluging the phone to the USB cable and/or closing web.whatsapp and reopening it again does the trick for me usually.

hDmtP commented

After running gnirehtet run command in my cmd it works as it is expected. Reverse tethering works properly. But in case of some Google PlayStore App, it notifies that a data network or wifi is required. Even my Android System update demands the same thing claiming there is no network connection although gnirehtet.cmd is running properly. But in other cases, this package works like a charm.

Also want to ask dev whether having

  1. multiple phones connected to same gnirehtet window causes problems in any way (i do get whatsapp/playstore issues); and
  2. having gnirehtet windows on multiple pcs (eg home pc and work pc) causes problems in any way (or put another way, code takes care of these complexities)?

this program is a life saver and i use it all the time... thanks to the community for continued support

rom1v commented

multiple phones connected to same gnirehtet window causes problems in any way

It should not.

having gnirehtet windows on multiple pcs (eg home pc and work pc)

What do you mean? If it's installed on one computer, it could not conflict with the one on another computer. ๐Ÿค”

You can use Aurora Store (get it from F-Droid), it's a proxy for the google play store. Works with all free apps.

Robin Christianne Juson has solved the Play Store issue in his/ her Tetrd app, verified by me in LineageOS 18.1/ Android 11 on my Nokia 6.1 with different versions of the Play Store app. Both, updating existing apps and installing new ones, work. No extra fakeWifi app necessary. Tetrd uses a IP v.4 VPN in the 10.x subnet. IP v.6 can remain inactive (default).

@rom1v maybe you have a chance to look at its code for inspiration :)

rom1v commented

maybe you have a chance to look at its code for inspiration :)

It looks like a proprietary app, it's not open source (the code is not published).

rom1v commented

After a quick look at the API, maybe calling ConnectivityManager.bindProcessToNetwork() here may help:

Network vpnNetwork = findVpnNetwork();

yes, proprietary, but still sometimes it's possible to gain some insights nevertheless, even without reversing/ decoding the binary data into readable programming language code. Above all I wanted to let y'all know it's possible.

Great find, that line of code ๐Ÿ‘ . Maybe it's easier to solve this issue than thought until now :)

Just upgraded to Android 11 and gnirehtet which was working fine on 10 basically stopped working on 11 (only Chrome browsing works). Tetrd or fake wifi is not an option in my case :(

So only option is to downgrade back to 10, or is there some way to do what Tetrd does?

@casper why is Tetrd not an option for you? I also have fiddled endlessly in Android 11; Tetrd proved to be the ONLY working option! The โ‚ฌ6,49 in-App purchase for the Pro upgrade was an absolutely worthwhile investment. That small price tag really shouldn't be an obstacle, and I hope that's not why you're hesitant..

Other than that, Google has been deciding with each upgrade that we users have less and less wiggle-room for doing stuff OUR way, faking "security concerns". If you're fine with A10 and don't need any A11/12/13 bells & whistles, then do downgrade to A10. (Many things stopped working in A11, esp. related to scoped storage).

Hey @LeeBinder , thanks a lot for your reply. My main problem with Tetrd is that it requires Windows 7+ 64-bit, and I am on an old computer which I cannot upgrade (very long story).

However I will say that after a few hours of fiddling I managed to get Gnirehtet to work on Android 11, but it required a SIM with a data plan, a Xiaomi account, and enabling mobile data while Gnirehtet is running, like posted here on another issue.

With that combo it works, and mobile data is not used while the Gnirehtet VPN is active even through mobile data is on.

Lots of silly tricks. I may still consider to go back to A10. Or maybe better to get a small single board MiniPC, just to run Win10 so I can run Tetrd. Probably what I will have to do. Anyway..for now it kind of works as long as you jump through all the hoops. Thanks.

You're welcome. Ok I understand. Just: why is a "Xiaomi account" required for you - what purpose does it serve in this context?

It has something to do with the permission requirements for USB debugging. I guess it's only a Xiaomi issue. See the post here: #5 (comment) .

Those options cannot be enabled without activating a Xiaomi account first (which requires a network connection :) ...there is a chicken and egg issue for you, so a SIM with data is needed also to get past that step).

Try turning on wifi and mobile data while gnirehtet is running. This makes playstore and apps work without gnirehtet without actually having to use mobile data or wifi.

"Play Store works since beginning (Android 6 & 10)"
"Play Store "works" (can search for apps etc.) but updating and installing doesn't work (Android 8.1.0) - it always says "Waiting for download..." "
"PlayStore works sometimes, sometimes it doesn't."

I had the exact same issues with some applications at first.
Most of them resolved by themselves. For the Play Store issue, you can swap with Aurora Store

Telegram (Nekogram X) wouldn't connect at first - but magically did after some time. The same goes for (almost) all other applications. And the performace & throughput is amazing on fast connections!

@GameDevIvan said:

You can use Aurora Store (get it from F-Droid), it's a proxy for the google play store. Works with all free apps.

Aurora Store acutally supports logging in with your very own Google account and thus accessing your purchased applications. I don't know about new purchases though.

Robin Christianne Juson has solved the Play Store issue in his/ her Tetrd app, verified by me in LineageOS 18.1/ Android 11 on my Nokia 6.1 with different versions of the Play Store app. Both, updating existing apps and installing new ones, work. No extra fakeWifi app necessary. Tetrd uses a IP v.4 VPN in the 10.x subnet. IP v.6 can remain inactive (default).

@rom1v maybe you have a chance to look at its code for inspiration :)

KDE-Connect doesn't connect at all when using gnirehtet.
Maybe it's due to it's peer discovery only scanning IPv6? It's because the devices connected with Gnirehtet are in a subnet to the LAN network the Host Computer is in. See #554

Suggestion: Would it be technically possible to have both a IPv4 & v6 - connection? Or to switch between connection types on desktop?

For all who know what KDE-Connect is: You know how much of a Dealbreaker this is ^^

@NA0341 I'm not using KDE-Connect, but have you tried if re-Link allows KDE-Connect to connect between your computer and the mobile device?

@LeeBinder I haven't tried yet ~ but don't see it as a solution either.
re-Link is closed source, time-limited, phones home ~ and the desktop relay needs to be run as root ~ not ideal.
On top of that, it also uses a VPN to establish the connection ~ so it probably uses a similar method as gnirehtet (I contacted them regarding that just in case).

โœ” Since KDE-Connect scans both IPv4 & v6, missing IPv6 support shouldn't be the issue.
๐Ÿ’ก I read gnirehtet's Dev-Doc and it appears to me that the Mobile Device simply doesn't receive a local IP in the Host Device's LAN at all (using gnirehtets method). ~ Which @rom1v confirms in #446.

That means (as of now) any kind of LAN Peer Discovery does not work between gnirehtet's Client & Host - Device. Because the Client has no individual IP address.

Lastly. Thank You for Your answer ๐ŸฏโœŒ

PS: I created a Feature Request regarding this issue here: #554

Gotcha. Thumbs up that Romain can make this work.