Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid domain names are parsed incorrectly #1581

Open
m33x opened this issue Sep 10, 2020 · 18 comments
Open

Invalid domain names are parsed incorrectly #1581

m33x opened this issue Sep 10, 2020 · 18 comments

Comments

@m33x
Copy link

m33x commented Sep 10, 2020

Versions

  • Pi-hole: v5.1.2 (Latest: v5.1.2)
  • AdminLTE: v5.1.1 (Latest: v5.1.1)
  • FTL: v5.2 (Latest: v5.2)

Platform

  • OS and version: Raspbian GNU/Linux 10 (buster)
  • Platform: Raspberry Pi

Expected behavior

Invalid hostnames that include a <space> should be displayed correctly.

Actual behavior / bug

Hostnames are automatically split by <space> thus the invalid hostname "hello world" results in the Domain "hello" and the Client "world".

I explored the issue and found the bug here.

pihole.log contains:

Sep 10 16:48:04 dnsmasq[2904]: query[A] hello world from 10.0.0.100
Sep 10 16:48:04 dnsmasq[2904]: config hello world is NODATA-IPv4

FTL returns valid data:

>getallqueries
1599752884 A hello world imac_lan 3 0 1 27 N/A -1
1599752785 A docs.google.com imac_lan 2 2 4 186 N/A -1

api.php?getAllQueries returns:
["1599752884","A","hello","world","imac_lan","3","0","1","27","N\/A","-1"]

Steps to reproduce

Steps to reproduce the behavior:

dig @pihole-ip 'hello world'

Screenshots

Screenshot 2020-09-10 at 17 48 32

@dschaper
Copy link
Member

Glad Pi-hole could help you identify the misbehaving client. I assume everything works when the client is sending the proper name?

@m33x
Copy link
Author

m33x commented Sep 10, 2020

Absolutely, all valid requests are displayed correctly.

@dschaper
Copy link
Member

I'm not sure if this is something we'll be able to address. @DL6ER That looks like it's just how dnsmasq operates?

@m33x
Copy link
Author

m33x commented Sep 10, 2020

I guess the easy fix is to improve the parsing by not relying on the <space> but on some other structure within the message. An alternative is to change the data format from Array to Dict this way a confusion cannot happen.
Instead of data[2] = Domain you should do data['domain'] = Domain.

@DL6ER
Copy link
Member

DL6ER commented Sep 10, 2020

This will not solve the issue because it happens in FTL as you said:

>getallqueries
1599752884 A hello world imac_lan 3 0 1 27 N/A -1
1599752785 A docs.google.com imac_lan 2 2 4 186 N/A -1

Here the space separation is the issue. Behind the scenes* we're working on Pi-hole v6.0 which will change the format out of FTL from our legacy telnet-like format to valid JSON, replacing the entire PHP API. This will solve the issue you've found at the same time.


*) actually, this is not hidden at all but a public branch new/http on the FTL repo

@fhriley

This comment has been minimized.

@dschaper

This comment has been minimized.

@dschaper

This comment has been minimized.

@fhriley

This comment has been minimized.

@fhriley

This comment has been minimized.

@dschaper

This comment has been minimized.

@fhriley

This comment has been minimized.

@dschaper

This comment has been minimized.

@fhriley

This comment has been minimized.

@dschaper

This comment has been minimized.

@fhriley

This comment has been minimized.

@dschaper

This comment has been minimized.

@fhriley

This comment has been minimized.

@pi-hole pi-hole locked as off-topic and limited conversation to collaborators Dec 13, 2020
@yubiuser yubiuser added this to the v6.0 milestone Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants