Skip to content

hosts: resolve PTR queries from the local hosts database - #413

Merged
ibauersachs merged 2 commits into
dnsjava:masterfrom
ChrisJr404:hosts-ptr-lookup
Aug 30, 2026
Merged

ibauersachs merged 2 commits into
dnsjava:masterfrom
ChrisJr404:hosts-ptr-lookup

Conversation

@ChrisJr404

Copy link
Copy Markdown
Contributor

Closes #350. HostsFileParser can now resolve a reverse (PTR) lookup back to the first host name for an address, and both Lookup and LookupSession consult it for PTR queries the same way they already do for A and AAAA. Added unit tests for the parser and integration tests for both lookup paths.

Reverse lookups now consult the hosts file the same way forward A/AAAA
lookups already do, in both Lookup and LookupSession.

Closes dnsjava#350
@codecov

codecov Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.05085% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.88%. Comparing base (06a0599) to head (eb15ef6).

Files with missing lines Patch % Lines
src/main/java/org/xbill/DNS/Lookup.java 58.33% 3 Missing and 2 partials ⚠️
.../main/java/org/xbill/DNS/lookup/LookupSession.java 75.00% 1 Missing and 2 partials ⚠️
...main/java/org/xbill/DNS/hosts/HostsFileParser.java 94.28% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #413      +/-   ##
============================================
+ Coverage     66.69%   66.88%   +0.18%     
- Complexity     3074     3085      +11     
============================================
  Files           198      198              
  Lines         13645    13692      +47     
  Branches       2126     2140      +14     
============================================
+ Hits           9101     9158      +57     
+ Misses         3966     3953      -13     
- Partials        578      581       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ibauersachs
ibauersachs merged commit 64efa23 into dnsjava:master Aug 30, 2026
18 checks passed
@ibauersachs

Copy link
Copy Markdown
Member

Thanks!

@ibauersachs ibauersachs added this to the v3.6.6 milestone Aug 30, 2026
@ibauersachs ibauersachs self-assigned this Aug 30, 2026
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.

Support parsing PTR from /etc/hosts

2 participants