Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DL6ER
Copy link
Member

@DL6ER DL6ER commented Sep 2, 2025

What does this implement/fix?

See title.


Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): https://discourse.pi-hole.net/t/host-name-of-client-203-0-113-41-dns-vm-1-none-contains-at-least-one-invalid-character-hex-28-at-position-10/82042


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories development branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

@DL6ER DL6ER requested a review from a team as a code owner September 2, 2025 17:39
@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/host-name-of-client-203-0-113-41-dns-vm-1-none-contains-at-least-one-invalid-character-hex-28-at-position-10/82042/18

@rdwebdesign
Copy link
Member

I know that any domain name starting with or containing ( is invalid, but normally FTL doesn't remove/ignore/sanitize any other invalid domains and simply generates a warning.

Maybe I'm being too "nitpicky", but I think we should check if the domain name is exactly equal to (none) and ignore the value only in that case. I consider (none) a special case, as it is an invalid value returned by the kernel.

In other cases like (my_custom_domain) or any other name starting with (, I think we should just warn that the domain name is invalid.

What do you think?

@DL6ER
Copy link
Member Author

DL6ER commented Sep 3, 2025

But can you even set a domain with () in Linux?

@rdwebdesign
Copy link
Member

My point is exactly this.

If the user sets an invalid domain on purpose, we should simply warn about the invalid name.

If the user didn't set anything and the function returns (none) (received from the kernel, not from user setting), we remove the value and consider an empty domain.

@DL6ER
Copy link
Member Author

DL6ER commented Sep 4, 2025

We cannot really issue a warning here as this would be printed each time the domain name is queried and/or also when this will never be an issue (because the domain name will never be used). We substitute .no_fqdn_available in this case and have this documented. I think that'll suffice.

edit For reference:

FTL/src/dnsmasq_interface.c

Lines 3384 to 3393 in bc18568

// If local suffix is not available, we try to obtain the domain from
// the kernel similar to how we do it for the hostname
if(!suffix)
suffix = (char*)domainname();
// If local suffix is not available, we substitute "no_fqdn_available"
// see the comment about PIHOLE_PTR=HOSTNAMEFQDN in the Pi-hole docs
// for further details on why this was chosen
if(!suffix || suffix[0] == '\0')
suffix = (char*)"no_fqdn_available";

@rdwebdesign
Copy link
Member

OK.
I agree this is enough.

@DL6ER DL6ER merged commit 0d26011 into development Sep 4, 2025
18 checks passed
@DL6ER DL6ER deleted the fix/domain_none branch September 4, 2025 16:30
@PromoFaux PromoFaux mentioned this pull request Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants