Add support for creating static DNS 'A' records in consommé - #4085
Add support for creating static DNS 'A' records in consommé#4085OneBlue wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Not ready to approve
The static-record name normalization currently accepts inputs that can never match real DNS questions, and the new UDP fast-path lacks a direct test despite existing test harness support in the same file.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR adds a “static DNS” fast-path to the net_consomme virtual networking stack so host code can register DNS records that are answered immediately (currently only A records), bypassing the normal resolver pipeline.
Changes:
- Introduces a static DNS record store and wire-format response builder for
Aqueries. - Adds a control-plane API (
ConsommeControl::add_dns_record) and internal message handling to register records at runtime. - Hooks UDP gateway DNS handling to check static records first and emit a response immediately on match.
File summaries
| File | Description |
|---|---|
| vm/devices/net/net_consomme/src/lib.rs | Exposes static DNS record types/errors and adds a control API + message wiring for registering records. |
| vm/devices/net/net_consomme/consomme/src/udp.rs | Adds the UDP DNS fast-path to answer matching queries from the static record store. |
| vm/devices/net/net_consomme/consomme/src/lib.rs | Adds the static_dns store to Consomme and an API to register records. |
| vm/devices/net/net_consomme/consomme/src/dns_records.rs | New module implementing record storage, query parsing, and A response construction with unit tests. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 4
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| ///Adds a static DNS record that will be returned directly | ||
| /// if the guest sends a matching query. | ||
| pub async fn add_dns_record( |
| // If the query matches a static DNS record, return that record directly. | ||
| if let Some(response_data) = self.inner.static_dns.build_response(udp.payload()) { | ||
| let response = DnsResponse { | ||
| flow, | ||
| response_data, |
| /// Error adding a static DNS record. | ||
| #[error("dns record error")] | ||
| DnsRecord(StaticDnsRecordError), |
|
DNSSEC delenda est. |
This change adds API support for registering "static" DNS records via the virtionet API. When a DNS question from the guest matches a static record, that record is returned immediately, bypassing the resolver.
This change only implements support for "A" records, but the API is designed to easily allow support for more DNS records types in the future.
This change also does not support DNSSEC, and always returns replies with the AD flag unset. This can be addressed in a followup if needed