pi-hole / web

Pi-hole Dashboard for stats and more
https://pi-hole.net
Other
2.05k stars 558 forks source link

IPv6 DHCP Parsed Incorrectly #1213

Closed Queuecumber closed 2 years ago

Queuecumber commented 4 years ago

In raising this issue, I confirm the following: {please fill the checkboxes, e.g: [X]}

How familiar are you with the the source code relevant to this issue?: 1

{Replace this with a number from 1 to 10. 1 being not familiar, and 10 being very familiar}


Expected behaviour:

Correct information on the DHCP page for IPv6

Actual behaviour:

Entries are parsed as though they are IPv4 and it seems that dnsmasq uses a different format for them

Steps to reproduce:

It should be sufficient to simply activate "Enable IPv6 support (SLAAC + RA)" on the DHCP page to see the issue.

Debug token provided by uploading pihole -d log:

This is irrelevant, if it is really required I'll update with it.

Troubleshooting undertaken, and/or other relevant information:

The entries are parsed incorrectly in a couple of ways.

First and foremost, you cannot add static DHCP entries for IPv6, pihole complains that the IP address format is incorrect, likely because it is validating it as IPv4. I remember seeing a PR adding IPv6 validation to something, probably that code could be used wholesale to fix this part.

Second, if you manually edit 04-pihole-static-dhcp.conf and add an entry like dhcp-host=B0:4E:26:98:44:62,[::3:7] the IPv6 address shows up in the hostname column in the UI:

Screenshot from 2020-04-12 20-09-54

Finally, IPv6 entries in the DHCP table do not show their MAC address, they show some kind of identifier instead:

Screenshot from 2020-04-12 20-12-41

This is because dhcp.leases is being parsed incorrectly, it seems to use a slightly different format for IPv4 and IPv6. I took a glance at it and I couldnt exaclty figure out what the numbers mean, nor am I entirely sure where the MAC address is for an IPv6 entry.

Given that pihole has been working on IPv6 support for beta 5 I thought it might be a good time to take a look at display this stuff properly. Also I'm not entirely sure if this is the fault of the web UI or of pihole core.

I can try to take a look at fixing this pending feedback from the developers.

Queuecumber commented 4 years ago

I just noticed #3114 in pihole core

Probably thats the best we can get, although maybe that column should be renamed. Although it seems that often the MAC is at the end of the DUID (last column) I wouldnt rely on this.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.