fmetzger/android-sensorium

Network connection information

bonanza123 opened this issue · 3 comments

Would it be possible to add network related information (internal and external ipv4, ipv6, dns etc)? I've seen that wifi information shows only internal ipv4 and no ipv6 info.

@bonanza123, these all sound doable, but see below.

DNS should be easy, see ref. (There's a chance that the reading will not be too interesting, e.g. if your WiFi router acts and DHCP-advertises itself as the DNS server to contact.)

Local IPv4/IPv6 I'm not sure -- we rely on Android's WifiInfo to return the current device IP address, I'd guess this would include/be v6 if the WiFi device had one. Maybe someone has an IPv6 deployment to test on? (Also, dual stack for comparison?)

Getting the external IP for NATted devices is difficult in terms of privacy: The external IP isn't know on the device itself (nor is it necessarily constant). You have to poll a service on the public Internet, e.g. https://checkip.amazonaws.com/ (via HTTPS) or myresolver.zenodotus.poly.edu (a DNS resolver that you can contact directly, replies with the apparent IP source address as the A record). Whichever you choose, the external service will know that you contacted it. This would require some form of user consent / config.

@aaaaalbert thanks for your fast feedback!

To be honest, I'm not an Android expert at, but wouldn't it be possible obtain this ipv6 from cat /proc/net/if_inet6? Using this way, also the ipv6-routes (to get the gateway information?) could be obtained by cat /proc/net/ipv6_route.

Regarding the external IPs there is indeed a privacy issue. Maybe we could make there some button which retrieves the external IP only on demand? There are also some other websites which offer e.g. easy access via curl: http://ifconfig.me/ and https://ifconfig.co/

procfs and command-line tools generally work, although we'd preferrably use the Android API to find these things. We use the on-board Android command-line tools in another project a lot, and it's no fun (1) supporting changes in them across Android versions, and (2) dealing with the fact that they are not the usual, featureful tools, but lighter-weight, less powerful, GPL-evading surrogates (with due apologies for the political undertone).

Re the ifconfig web pages: Nice tools, thanks for the pointer! Adding a button (and maybe a checkbox to allow auto-updating?) sounds good.