[Replicant] [PATCH v2] Fix "RepWifi connection not correctly reported to userspace apps" Issue #1792.

Wolfgang Wiedmeyer wreg at wiedmeyer.de
Mon Aug 28 12:01:39 UTC 2017


Fil writes:

> Fil wrote:
>> Wolfgang Wiedmeyer wrote:
>> > 
>> >  Wouldn't it be possible to e.g. read the property
>> > dhcp.wlan0.gateway and check if it's empty or not?
>> For sure, but I currently lack a way of doing it, without using shell
>> commands. See above; same reasoning.
>> I'm investigating android.net.DhcpInfo class, to see if it's usable in
>> this context. I'll get back to you if I get to get something out of it.
>> 
> Unfortunately, no luck on that side; android.net.DhcpInfo heavily relies
> on the native WiFi state, and as such it gives no accurate info on the
> connection established "manually" via wpa_supplicant.
> Indeed, reading system properties *IS* doable without shell commands,
> taking advantage of the android.os.SystemProperties class.
> *But* the only seemingly-reliable property to check for effective
> connection seems to be "dhcp.wlan0.reason" which I found to be pretty
> reactive to connection changes, and is set to "BOUND" only when there is
> an actual WiFi connection working.
> Conversely, the value of "dhcp.wlan0.gateway" is totally unreliable, as
> it persists even when no connection is in place, reporting the last used
> gateway.
> I grepped for other system properties that could come in handy; found
> none.

Ok, good to know. Thanks for looking into this!

> I believe we have three possible choices here:
>
> 1) leave my first solution as it is, only relying on the IP address.
> False positives are still possible, but unlikely to happen.

Yes, this solution is now included in the development branch and will be
part of the next release (unless an improved one comes around before the
release).

> 2) introduce an additional check based on "dhcp.wlan0.reason".
> This one would work for wifi only, not for reverse tethering.

Is there no dhcp.rndis0.reason?

> 3) introduce a two-step check on "dhcp.wlan0.gateway":
> 3A) retrieve the last known gateway from the sysprop.
> 3B) make sure it is effectively in use by pinging it.
> I would not recommend this, as the java method InetAddress.isReachable()
> is known to perform badly, and ping would need a shell command (possibly
> root).

Agreed, using ping here sounds like trouble.

> That said, I wait for suggestions on which path to undertake.

Let's stick with your first solution for now. If you want to look into
the other improvements, feel free to do so. No doubt that it would be
of help.

Best regards,
Wolfgang


-- 
Website: https://fossencdi.org
OpenPGP: 0F30 D1A0 2F73 F70A 6FEE  048E 5816 A24C 1075 7FC4
Key download: https://wiedmeyer.de/keys/ww.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20170828/cb4a4f83/attachment.asc>


More information about the Replicant mailing list