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

Do not try to resolve hostname of clients in long-term data #1931

Merged
merged 1 commit into from
Oct 23, 2021
Merged

Conversation

yubiuser
Copy link
Member

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)
  • I have Signed Off all commits. (git commit --signoff)

What does this PR aim to accomplish?:

Do not try to resolve client's IP to hostname for long-term data.
Two reasons:

  1. This function was introduced by Long-term data: Resolve IPs to host names #690. It uses gethostbyaddr to resolve the IPs to hostnames. Therefore it uses the first name server configured in /etc/resolv.conf. When the feature was introduced, Pi-hole had set itself (127.0.0.1) as name server. Hence, the queries could be answered by Pi-hole.
    Now we do not set Pi-hole as name server for the host device anymore. Therefore queries will be forwarded to any upstream server configured in resolv.conf which might be unaware e.g. of "Local DNS Records".

  2. The long-term database can reach back as long as users want them to be. By default, it is one year. We can not be sure that a IP belonging to a specific client one year ago does still belong to the same client. Esp. if users do not use deterministic DHCP server.

How does this PR accomplish the above?:

Just remove obsolete code.

@yubiuser yubiuser added the PR: Approval Required Open Pull Request, needs approval label Oct 22, 2021
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/top-clients-honor-dns-records-in-homepage-only/50512/15

@DL6ER DL6ER self-requested a review October 22, 2021 16:52
@DL6ER DL6ER requested a review from PromoFaux October 23, 2021 09:27
@DL6ER
Copy link
Member

DL6ER commented Oct 23, 2021

This is a change in behavior and - even when I consider it to be a good one - I'll ask for a second review.

@DL6ER DL6ER requested a review from dschaper October 23, 2021 09:28
Copy link
Member

@PromoFaux PromoFaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. I had thought about this from time to time - there is no guarantee that old clients still have the same IP

@DL6ER DL6ER merged commit e5c86db into devel Oct 23, 2021
@DL6ER DL6ER deleted the no_hostname branch October 23, 2021 12:14
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-11-web-v5-8-and-core-v5-6-released/50566/1

@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/ips-instead-of-hostnames/50592/2

@Mausy5043
Copy link

The long-term database can reach back as long as users want them to be. By default, it is one year. We can not be sure that a IP belonging to a specific client one year ago does still belong to the same client. Esp. if users do not use deterministic DHCP server.

IMHO logging of IP-addresses is useless and human-unfriendly anyway. The preferred action should be to resolve IP-addresses prior to commiting to the log. I.e. at time of the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Approval Required Open Pull Request, needs approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pi.hole/admin/db_queries.php doesn't show client's name but shows client IP
5 participants