WiFi-Widget icon indicating copy to clipboard operation
WiFi-Widget copied to clipboard

[Feature Request] List IPv6 Gateway and DNS information

Open GoetzGoerisch opened this issue 10 months ago • 11 comments

Overview

Currently the WiFi-Widget only lists the DNS, DHCP and Gateway information for IPv4. Please also display and make it configurable for IPv6.

GoetzGoerisch avatar Apr 23 '24 17:04 GoetzGoerisch

Well there's no API for retrieving those addresses as IPv6s AFAIK, and I suppose just converting them from their IPv4 versions wouldn't be of much use, or am I wrong?

w2sv avatar May 08 '24 18:05 w2sv

Not deep into Kotlin and Android, but shouldn't https://developer.android.com/reference/android/net/LinkProperties#getDnsServers() and https://developer.android.com/reference/android/net/LinkProperties#getRoutes() return the necessary information? BTW this would also be nice: https://developer.android.com/reference/android/net/LinkProperties#getNat64Prefix()

GoetzGoerisch avatar May 08 '24 18:05 GoetzGoerisch

The InetAddresses returned by https://developer.android.com/reference/android/net/LinkProperties#getDnsServers() only contain the IPv4 host addresses. https://developer.android.com/reference/android/net/LinkProperties#getRoutes() on the other hand returns various routes and addresses, which I, however, don't really know how to interpret. The class documentation at https://developer.android.com/reference/android/net/RouteInfo doesn't help me much either.

The RouteInfo instances it returns on my network contains the following information:

interface: wlan0 | gateway: /fe80::f1db:c284:67f6:e8d2 | destination: ::/0 | isDefaultRoute: true
interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:5207::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::f669:42ff:fea7:a73 | destination: ::/0 | isDefaultRoute: true
interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:78f3::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::7df4:c55f:14b4:7dc3 | destination: ::/0 | isDefaultRoute: true
interface: wlan0 | gateway: /0.0.0.0 | destination: 192.168.1.0/24 | isDefaultRoute: false
interface: wlan0 | gateway: /192.168.1.1 | destination: 0.0.0.0/0 | isDefaultRoute: true

192.168.1.1 is also my gateway, DNS and DHCP address shown on the widget, other than that none of those addresses is a duplicate of one featured by the widget.

Can you infer how to interpret them?

w2sv avatar May 10 '24 13:05 w2sv

The nat64Prefix I can definitely add, I created a separate issue for that @ https://github.com/w2sv/WiFi-Widget/issues/144.

w2sv avatar May 10 '24 13:05 w2sv

Default route IPv6

interface: wlan0 | gateway: /fe80::f1db:c284:67f6:e8d2 | destination: ::/0 | isDefaultRoute: true

Default route IPv6 for prefix 2a02:3032:2e0:5207::/64

interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:5207::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::f669:42ff:fea7:a73 | destination: ::/0 | isDefaultRoute: true

Default route IPv6 for prefix 2a02:3032:2e0:78f3::/64

interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:78f3::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::7df4:c55f:14b4:7dc3 | destination: ::/0 | isDefaultRoute: true

Default route IPv4:

interface: wlan0 | gateway: /0.0.0.0 | destination: 192.168.1.0/24 | isDefaultRoute: false
interface: wlan0 | gateway: /192.168.1.1 | destination: 0.0.0.0/0 | isDefaultRoute: true

GoetzGoerisch avatar May 10 '24 14:05 GoetzGoerisch

So these aren't DHCP or DNS addresses but an entirely separate property?

w2sv avatar May 10 '24 14:05 w2sv

Also, how can you tell that

interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:5207::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::f669:42ff:fea7:a73 | destination: ::/0 | isDefaultRoute: true

And

interface: wlan0 | gateway: /:: | destination: 2a02:3032:2e0:78f3::/64 | isDefaultRoute: false
interface: wlan0 | gateway: /fe80::7df4:c55f:14b4:7dc3 | destination: ::/0 | isDefaultRoute: true

respectively belong together, just by their order of appearance? I'm not too much of a networking expert, as I guess isn't hard to spot.

w2sv avatar May 10 '24 14:05 w2sv

their belonging together was only based on the order of apperance. On a normal linux host more information is given. You have 2 prefixes assigned, probably due to the dynamic assignment by o2 every 24h. One link-local address is derived from the interface MAC address, the others are random generated. I would need to know more about the network and the setup to properly figure this out.

GoetzGoerisch avatar May 10 '24 15:05 GoetzGoerisch

Okay, so they actually don't have anything to do with the original issue subject. Do you think adding them to the displayable widget properties under the name "Route" would be of value anyways?

w2sv avatar May 10 '24 16:05 w2sv

Basically your device has more than one IPv6 Gateway configured. So this part matched the issue title. Nevertheless, there seam to be no obvious API to get the IPv6 DNS information, if I understood you and the documentation correctly?

GoetzGoerisch avatar May 12 '24 08:05 GoetzGoerisch

Just for information:

Gateway 0.0.0.0
DNS     0.0.0.0
DHCP    0.0.0.0

is definitely not correct, if there isn't ipv4 at wifi interface at all. The properties Gateway, DNS, DHCP should be hidden then. Or 0.0.0.0 should be replaced by something representing nothing/empty .

At the moment the app shows the correct public ipv4 ip(*). The local ipv4 address (clat, usually 192.0.0.2) is only visible in system "about phone". DNS (IPv6!) is correctly shown in wifi connection settings, but not in that app.

Strictly speaking - clat is an extra interface. It appears, when uplink (wifi or cellular) provides nat64.

* under some circumstances you can have two different public ipv4 addresses. (one via clat interface and one directly via NAT64, but that configuration is a rarity on plat side)

thomasschaeferm avatar May 12 '24 15:05 thomasschaeferm