pi-hole / FTL

The Pi-hole FTL engine
https://pi-hole.net
Other
1.36k stars 194 forks source link

Regex Extension "reply=" truncates ipv6 addresses to 16 characters #2013

Closed mtezzo closed 2 months ago

mtezzo commented 2 months ago

Versions

Platform

Expected behavior

A request for a AAAA record for a blacklisted domain with a reply= should be answered with the IPv6 Address specified in the reply=

Example:

^example.com$;reply=192.168.1.9;reply=fd17:1234:1234:1234:1234:1234:1234:1234

dig AAAA example.com should return fd17:1234:1234:1234:1234:1234:1234:1234

Actual behavior / bug

Using the example above:

dig AAAA example.com returns ::

In the Pi-Hole Diagnosis, the following error is then reported:

Error message:
Unknown reply type "fd17:1234:1234:1"

The IPv6 address appears to be truncated to 16 characters and results in a failure. This appears to be due to line 244 in FTL/src/regex.c:

// options ";reply=NXDOMAIN", etc.
else if(sscanf(part, "reply=%16s", extra))
{

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to 'Domains'
  2. Add a Regex Filter as a Blacklist Item such as (be sure the IPv6 is >16 characters): ^example.com$;reply=192.168.1.9;reply=fd17:1234:1234:1234:1234:1234:1234:1234
  3. From another machine, run: dig AAAA example.com
  4. Go to Tools->Pi-Hole Diagnosis and see error.

Debug Token

Screenshots

Screenshot 2024-07-16 at 12 26 44 PM

Additional context

Add any other context about the problem here.

DL6ER commented 2 months ago

Thanks for your report. This particular bug has been fixed more than one year ago in the public Pi-hole v6.0 beta via https://github.com/pi-hole/FTL/commit/9483ed677826fac82405911c7ee9dbf86c165ea8. Neither the beta nor the released version of Pi-hole v6.0 will be affected by this any longer.

I will close this issue ticket as there are not plans to release a further v5.x version but enter the release cycle for v6.0 soon(ish).