feat(dns): derive PTR records from machine interface addresses#2691
feat(dns): derive PTR records from machine interface addresses#2691chet wants to merge 1 commit into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughA new SQL migration adds the PL/pgSQL function ChangesReverse DNS PTR Record Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/api-db/src/dns/mod.rs`:
- Around line 90-126: The test cases in the check_cases_async function call
currently cover standard IPv4 and IPv6 addresses but are missing a test case for
IPv6-mapped IPv4 addresses (in the format ::ffff:x.x.x.x), which exercise a
dedicated embedded-IPv4 conversion branch in the SQL function. Add a new Case
object to the test array with a scenario that uses an IPv6-mapped IPv4 address
as input (for example ::ffff:192.0.2.1), set an appropriate expect value with
the expected PTR record output for that mapped address, and place it alongside
the other test cases passed to check_cases_async to ensure this branch is
covered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3e40a21a-8107-4574-b58b-fd3918484804
📒 Files selected for processing (2)
crates/api-db/migrations/20260618070345_reverse_dns_ptr_records.sqlcrates/api-db/src/dns/mod.rs
Adds the database foundation for reverse DNS. A new `nico_ip_to_arpa_qname(inet)` function turns an address into its PTR query name -- reversed octets under `in-addr.arpa` for IPv4, reversed nibbles under `ip6.arpa` for IPv6 -- reusing the IPv6 expansion from `nico_inet_to_dns_hostname` so the two address-derived helpers agree. A new `dns_records_ptr` view answers each interface address's arpa name with the FQDN the forward shortname view already publishes for that interface. The view's `WHERE` matches `dns_records_shortname_combined` exactly (primary or BMC interfaces), so a forward A/AAAA record and its PTR round-trip -- the PTR resolves to the same name the forward record came from. Nothing serves these records yet; the api-db query, the api-core handler arm, and the carbide-dns unlock are the follow-on tasks. Tests cover the function's IPv4 and IPv6 arpa forms (dotted-quad, documentation prefix, loopback, unspecified) with a DB-backed test against Postgres. This supports NVIDIA#2637. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
Summary
The database foundation for reverse DNS (PTR records).
nico_ip_to_arpa_qname(inet)PL/pgSQL function: reversed octets underin-addr.arpa(IPv4) and reversed nibbles underip6.arpa(IPv6), reusing the IPv6::-expansion fromnico_inet_to_dns_hostnameso the two address-derived helpers agree.dns_records_ptrview: each interface address's arpa name → the FQDN the forward shortname view publishes for that interface. ItsWHEREmatchesdns_records_shortname_combinedexactly (primary or BMC interfaces), so a forward A/AAAA record and its PTR round-trip.test_ip_to_arpa_qname) covering the IPv4 and IPv6 arpa forms (dotted-quad, documentation prefix, loopback, unspecified) against Postgres.Plumbing only — nothing serves PTR yet; the api-db query (#2639), the api-core handler arm (#2641), and the carbide-dns unlock (#2643) are the follow-ons.
Implements #2637. Part of the #2630 epic (reverse DNS / PTR records).
Draft pending review.