Skip to content

Add support for creating static DNS 'A' records in consommé - #4085

Open
OneBlue wants to merge 1 commit into
microsoft:mainfrom
OneBlue:user/oneblue/dns-records
Open

Add support for creating static DNS 'A' records in consommé#4085
OneBlue wants to merge 1 commit into
microsoft:mainfrom
OneBlue:user/oneblue/dns-records

Conversation

@OneBlue

@OneBlue OneBlue commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

@OneBlue
OneBlue requested a review from a team as a code owner July 29, 2026 21:35
Copilot AI review requested due to automatic review settings July 29, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 A queries.
  • 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.

Comment on lines +318 to +320
///Adds a static DNS record that will be returned directly
/// if the guest sends a matching query.
pub async fn add_dns_record(
Comment thread vm/devices/net/net_consomme/consomme/src/dns_records.rs
Comment on lines +605 to +609
// 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,
Comment on lines +199 to +201
/// Error adding a static DNS record.
#[error("dns record error")]
DnsRecord(StaticDnsRecordError),
@github-actions

Copy link
Copy Markdown

@jstarks

jstarks commented Jul 30, 2026

Copy link
Copy Markdown
Member

DNSSEC delenda est.

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.

3 participants