From 3dbf0a16d15b7d3242b267ffc94c51adff876b00 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Tue, 18 Jun 2024 12:02:57 -0700 Subject: [PATCH 01/14] follow trust-dns to its new name: hickory --- Cargo.lock | 204 ++++++++++++++----------- Cargo.toml | 8 +- clients/oxide-client/Cargo.toml | 2 +- clients/oxide-client/src/lib.rs | 18 +-- dns-server/Cargo.toml | 13 +- dns-server/src/dns_server.rs | 24 ++- dns-server/src/lib.rs | 15 +- dns-server/src/storage.rs | 10 +- dns-server/tests/basic_test.rs | 17 +-- end-to-end-tests/Cargo.toml | 2 +- end-to-end-tests/src/helpers/ctx.rs | 2 +- internal-dns-cli/Cargo.toml | 2 +- internal-dns-cli/src/bin/dnswait.rs | 2 +- internal-dns/Cargo.toml | 2 +- internal-dns/src/resolver.rs | 31 ++-- nexus/Cargo.toml | 4 +- nexus/src/app/external_dns.rs | 21 ++- nexus/test-utils/Cargo.toml | 2 +- nexus/test-utils/src/lib.rs | 15 +- nexus/tests/integration_tests/silos.rs | 4 +- wicketd/Cargo.toml | 2 +- wicketd/src/preflight_check/uplink.rs | 35 ++--- workspace-hack/Cargo.toml | 4 +- 23 files changed, 227 insertions(+), 212 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5949144ab5..7010730c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1922,6 +1922,10 @@ dependencies = [ "dns-service-client", "dropshot", "expectorate", + "hickory-client", + "hickory-proto", + "hickory-resolver", + "hickory-server", "http 0.2.12", "omicron-test-utils", "omicron-workspace-hack", @@ -1941,10 +1945,6 @@ dependencies = [ "thiserror", "tokio", "toml 0.8.13", - "trust-dns-client", - "trust-dns-proto", - "trust-dns-resolver", - "trust-dns-server", "uuid", ] @@ -2208,6 +2208,7 @@ dependencies = [ "clap", "colored", "dhcproto", + "hickory-resolver", "http 0.2.12", "humantime", "hyper 0.14.28", @@ -2227,7 +2228,6 @@ dependencies = [ "socket2 0.5.7", "tokio", "toml 0.8.13", - "trust-dns-resolver", "uuid", ] @@ -2249,6 +2249,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.64", +] + [[package]] name = "env_logger" version = "0.9.3" @@ -3059,6 +3071,90 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hickory-client" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab9683b08d8f8957a857b0236455d80e1886eaa8c6178af556aa7871fb61b55" +dependencies = [ + "cfg-if", + "data-encoding", + "futures-channel", + "futures-util", + "hickory-proto", + "once_cell", + "radix_trie", + "rand 0.8.5", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "hickory-proto" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.0", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.2", + "rand 0.8.5", + "resolv-conf", + "smallvec 1.13.2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "hickory-server" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be0e43c556b9b3fdb6c7c71a9a32153a2275d02419e3de809e520bfcfe40c37" +dependencies = [ + "async-trait", + "bytes", + "cfg-if", + "enum-as-inner 0.6.0", + "futures-util", + "hickory-proto", + "serde", + "thiserror", + "time", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "highway" version = "1.1.0" @@ -3440,6 +3536,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.5.0" @@ -3702,6 +3808,7 @@ dependencies = [ "dropshot", "expectorate", "futures", + "hickory-resolver", "hyper 0.14.28", "omicron-common", "omicron-test-utils", @@ -3716,7 +3823,6 @@ dependencies = [ "tempfile", "thiserror", "tokio", - "trust-dns-resolver", "uuid", ] @@ -3727,12 +3833,12 @@ dependencies = [ "anyhow", "clap", "dropshot", + "hickory-resolver", "internal-dns", "omicron-common", "omicron-workspace-hack", "slog", "tokio", - "trust-dns-resolver", ] [[package]] @@ -4894,6 +5000,7 @@ dependencies = [ "gateway-messages", "gateway-test-utils", "headers", + "hickory-resolver", "http 0.2.12", "hyper 0.14.28", "illumos-utils", @@ -4918,7 +5025,6 @@ dependencies = [ "slog", "tokio", "tokio-util", - "trust-dns-resolver", "uuid", ] @@ -5472,6 +5578,7 @@ dependencies = [ "gateway-test-utils", "headers", "hex", + "hickory-resolver", "http 0.2.12", "httptest", "hubtools", @@ -5560,7 +5667,6 @@ dependencies = [ "tokio-postgres", "tokio-util", "tough", - "trust-dns-resolver", "tufaceous", "tufaceous-lib", "update-common", @@ -5908,6 +6014,7 @@ dependencies = [ "group", "hashbrown 0.14.5", "hex", + "hickory-proto", "hmac", "hyper 0.14.28", "indexmap 2.2.6", @@ -5967,7 +6074,6 @@ dependencies = [ "toml_edit 0.19.15", "toml_edit 0.22.13", "tracing", - "trust-dns-proto", "unicode-bidi", "unicode-normalization", "unicode-xid", @@ -6184,6 +6290,7 @@ dependencies = [ "base64 0.22.1", "chrono", "futures", + "hickory-resolver", "http 0.2.12", "hyper 0.14.28", "omicron-workspace-hack", @@ -6195,7 +6302,6 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "trust-dns-resolver", "uuid", ] @@ -9937,15 +10043,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.7.8" @@ -10118,26 +10215,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "trust-dns-client" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c408c32e6a9dbb38037cece35740f2cf23c875d8ca134d33631cec83f74d3fe" -dependencies = [ - "cfg-if", - "data-encoding", - "futures-channel", - "futures-util", - "lazy_static", - "radix_trie", - "rand 0.8.5", - "thiserror", - "time", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "trust-dns-proto" version = "0.22.0" @@ -10147,7 +10224,7 @@ dependencies = [ "async-trait", "cfg-if", "data-encoding", - "enum-as-inner", + "enum-as-inner 0.5.1", "futures-channel", "futures-io", "futures-util", @@ -10158,53 +10235,10 @@ dependencies = [ "smallvec 1.13.2", "thiserror", "tinyvec", - "tokio", "tracing", "url", ] -[[package]] -name = "trust-dns-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lazy_static", - "lru-cache", - "parking_lot 0.12.2", - "resolv-conf", - "smallvec 1.13.2", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - -[[package]] -name = "trust-dns-server" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99022f9befa6daec2a860be68ac28b1f0d9d7ccf441d8c5a695e35a58d88840d" -dependencies = [ - "async-trait", - "bytes", - "cfg-if", - "enum-as-inner", - "futures-executor", - "futures-util", - "serde", - "thiserror", - "time", - "tokio", - "toml 0.5.11", - "tracing", - "trust-dns-client", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -11036,6 +11070,7 @@ dependencies = [ "gateway-messages", "gateway-test-utils", "hex", + "hickory-resolver", "http 0.2.12", "hubtools", "hyper 0.14.28", @@ -11074,7 +11109,6 @@ dependencies = [ "tokio-util", "toml 0.8.13", "tough", - "trust-dns-resolver", "tufaceous", "tufaceous-lib", "update-common", diff --git a/Cargo.toml b/Cargo.toml index d461e0585a..b754037b02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -288,6 +288,10 @@ headers = "0.3.9" heck = "0.5" hex = "0.4.3" hex-literal = "0.4.1" +hickory-client = "0.24.1" +hickory-proto = "0.24.1" +hickory-resolver = "0.24.1" +hickory-server = "0.24.1" highway = "1.1.0" hkdf = "0.12.4" http = "0.2.12" @@ -483,10 +487,6 @@ tokio-util = { version = "0.7.10", features = ["io", "io-util"] } toml = "0.8.12" toml_edit = "0.22.12" tough = { version = "0.17.1", features = [ "http" ] } -trust-dns-client = "0.22" -trust-dns-proto = "0.22" -trust-dns-resolver = "0.22" -trust-dns-server = "0.22" trybuild = "1.0.91" tufaceous = { path = "tufaceous" } tufaceous-lib = { path = "tufaceous-lib" } diff --git a/clients/oxide-client/Cargo.toml b/clients/oxide-client/Cargo.toml index f2adcacb1b..183640946f 100644 --- a/clients/oxide-client/Cargo.toml +++ b/clients/oxide-client/Cargo.toml @@ -12,6 +12,7 @@ anyhow.workspace = true base64.workspace = true chrono.workspace = true futures.workspace = true +hickory-resolver.workspace = true http.workspace = true hyper.workspace = true progenitor.workspace = true @@ -22,6 +23,5 @@ serde.workspace = true serde_json.workspace = true thiserror.workspace = true tokio = { workspace = true, features = [ "net" ] } -trust-dns-resolver.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/clients/oxide-client/src/lib.rs b/clients/oxide-client/src/lib.rs index 07a190c38e..94d09ccdea 100644 --- a/clients/oxide-client/src/lib.rs +++ b/clients/oxide-client/src/lib.rs @@ -7,13 +7,13 @@ use anyhow::anyhow; use anyhow::Context; use futures::FutureExt; +use hickory_resolver::config::{ + NameServerConfig, Protocol, ResolverConfig, ResolverOpts, +}; +use hickory_resolver::TokioAsyncResolver; use std::net::SocketAddr; use std::sync::Arc; use thiserror::Error; -use trust_dns_resolver::config::{ - NameServerConfig, Protocol, ResolverConfig, ResolverOpts, -}; -use trust_dns_resolver::TokioAsyncResolver; progenitor::generate_api!( spec = "../../openapi/nexus.json", @@ -46,14 +46,14 @@ impl CustomDnsResolver { socket_addr: dns_addr, protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); - let resolver = Arc::new( - TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()) - .context("failed to create resolver")?, - ); + let resolver = Arc::new(TokioAsyncResolver::tokio( + resolver_config, + ResolverOpts::default(), + )); Ok(CustomDnsResolver { dns_addr, resolver }) } diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index 237d2a2fbb..0816b93703 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -14,24 +14,24 @@ chrono.workspace = true clap.workspace = true dns-service-client.workspace = true dropshot.workspace = true +hickory-client.workspace = true +hickory-proto.workspace = true +hickory-resolver.workspace = true +hickory-server.workspace = true http.workspace = true pretty-hex.workspace = true schemars.workspace = true serde.workspace = true serde_json.workspace = true sled.workspace = true -slog.workspace = true -slog-term.workspace = true slog-async.workspace = true slog-envlogger.workspace = true +slog-term.workspace = true +slog.workspace = true tempfile.workspace = true thiserror.workspace = true tokio = { workspace = true, features = [ "full" ] } toml.workspace = true -trust-dns-client.workspace = true -trust-dns-proto.workspace = true -trust-dns-resolver.workspace = true -trust-dns-server.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true @@ -43,4 +43,3 @@ openapiv3.workspace = true openapi-lint.workspace = true serde_json.workspace = true subprocess.workspace = true -trust-dns-resolver.workspace = true diff --git a/dns-server/src/dns_server.rs b/dns-server/src/dns_server.rs index 01a8430b62..cfa0e491f6 100644 --- a/dns-server/src/dns_server.rs +++ b/dns-server/src/dns_server.rs @@ -13,6 +13,15 @@ use crate::storage::QueryError; use crate::storage::Store; use anyhow::anyhow; use anyhow::Context; +use hickory_proto::op::header::Header; +use hickory_proto::op::response_code::ResponseCode; +use hickory_proto::rr::rdata::SRV; +use hickory_proto::rr::record_data::RData; +use hickory_proto::rr::record_type::RecordType; +use hickory_proto::rr::{Name, Record}; +use hickory_proto::serialize::binary::{BinDecodable, BinDecoder, BinEncoder}; +use hickory_server::authority::MessageResponse; +use hickory_server::authority::{MessageRequest, MessageResponseBuilder}; use pretty_hex::*; use serde::Deserialize; use slog::{debug, error, info, o, trace, Logger}; @@ -21,17 +30,6 @@ use std::str::FromStr; use std::sync::Arc; use thiserror::Error; use tokio::net::UdpSocket; -use trust_dns_proto::op::header::Header; -use trust_dns_proto::op::response_code::ResponseCode; -use trust_dns_proto::rr::rdata::SRV; -use trust_dns_proto::rr::record_data::RData; -use trust_dns_proto::rr::record_type::RecordType; -use trust_dns_proto::rr::{Name, Record}; -use trust_dns_proto::serialize::binary::{ - BinDecodable, BinDecoder, BinEncoder, -}; -use trust_dns_server::authority::MessageResponse; -use trust_dns_server::authority::{MessageRequest, MessageResponseBuilder}; use uuid::Uuid; /// Configuration related to the DNS server @@ -222,7 +220,7 @@ fn dns_record_to_record( let mut a = Record::new(); a.set_name(name.clone()) .set_rr_type(RecordType::A) - .set_data(Some(RData::A(addr))); + .set_data(Some(RData::A(addr.into()))); Ok(a) } @@ -230,7 +228,7 @@ fn dns_record_to_record( let mut aaaa = Record::new(); aaaa.set_name(name.clone()) .set_rr_type(RecordType::AAAA) - .set_data(Some(RData::AAAA(addr))); + .set_data(Some(RData::AAAA(addr.into()))); Ok(aaaa) } diff --git a/dns-server/src/lib.rs b/dns-server/src/lib.rs index ea8625a667..7e8269bf3f 100644 --- a/dns-server/src/lib.rs +++ b/dns-server/src/lib.rs @@ -48,13 +48,13 @@ pub mod http_server; pub mod storage; use anyhow::{anyhow, Context}; +use hickory_resolver::config::NameServerConfig; +use hickory_resolver::config::Protocol; +use hickory_resolver::config::ResolverConfig; +use hickory_resolver::config::ResolverOpts; +use hickory_resolver::TokioAsyncResolver; use slog::o; use std::net::SocketAddr; -use trust_dns_resolver::config::NameServerConfig; -use trust_dns_resolver::config::Protocol; -use trust_dns_resolver::config::ResolverConfig; -use trust_dns_resolver::config::ResolverOpts; -use trust_dns_resolver::TokioAsyncResolver; /// Starts both the HTTP and DNS servers over a given store. pub async fn start_servers( @@ -167,12 +167,11 @@ impl TransientServer { socket_addr: self.dns_server.local_address(), protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); let resolver = - TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()) - .context("creating DNS resolver")?; + TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()); Ok(resolver) } } diff --git a/dns-server/src/storage.rs b/dns-server/src/storage.rs index 21fb9ebdc6..9816f5c23d 100644 --- a/dns-server/src/storage.rs +++ b/dns-server/src/storage.rs @@ -95,6 +95,8 @@ use crate::dns_types::{DnsConfig, DnsConfigParams, DnsConfigZone, DnsRecord}; use anyhow::{anyhow, Context}; use camino::Utf8PathBuf; +use hickory_client::rr::Name; +use hickory_proto::rr::LowerName; use serde::{Deserialize, Serialize}; use sled::transaction::ConflictableTransactionError; use slog::{debug, error, info, o, warn}; @@ -104,8 +106,6 @@ use std::sync::atomic::Ordering; use std::sync::Arc; use thiserror::Error; use tokio::sync::Mutex; -use trust_dns_client::rr::LowerName; -use trust_dns_client::rr::Name; const KEY_CONFIG: &'static str = "config"; @@ -586,7 +586,7 @@ impl Store { /// If the returned set would have been empty, returns `QueryError::NoName`. pub(crate) fn query( &self, - mr: &trust_dns_server::authority::MessageRequest, + mr: &hickory_server::authority::MessageRequest, ) -> Result, QueryError> { let name = mr.query().name(); let orig_name = mr.query().original().name(); @@ -784,14 +784,14 @@ mod test { use anyhow::Context; use camino::Utf8PathBuf; use camino_tempfile::Utf8TempDir; + use hickory_client::rr::Name; + use hickory_proto::rr::LowerName; use omicron_test_utils::dev::test_setup_log; use std::collections::BTreeSet; use std::collections::HashMap; use std::net::Ipv6Addr; use std::str::FromStr; use std::sync::Arc; - use trust_dns_client::rr::LowerName; - use trust_dns_client::rr::Name; /// As usual, `TestContext` groups the various pieces we need in a bunch of /// our tests and helps make sure they get cleaned up properly. diff --git a/dns-server/tests/basic_test.rs b/dns-server/tests/basic_test.rs index 19666e82c1..0744ee0ea3 100644 --- a/dns-server/tests/basic_test.rs +++ b/dns-server/tests/basic_test.rs @@ -9,6 +9,12 @@ use dns_service_client::{ Client, }; use dropshot::{test_util::LogContext, HandlerTaskMode}; +use hickory_resolver::error::ResolveErrorKind; +use hickory_resolver::TokioAsyncResolver; +use hickory_resolver::{ + config::{NameServerConfig, Protocol, ResolverConfig, ResolverOpts}, + proto::op::ResponseCode, +}; use omicron_test_utils::dev::test_setup_log; use slog::o; use std::{ @@ -16,12 +22,6 @@ use std::{ net::Ipv6Addr, net::{IpAddr, Ipv4Addr}, }; -use trust_dns_resolver::error::ResolveErrorKind; -use trust_dns_resolver::TokioAsyncResolver; -use trust_dns_resolver::{ - config::{NameServerConfig, Protocol, ResolverConfig, ResolverOpts}, - proto::op::ResponseCode, -}; const TEST_ZONE: &'static str = "oxide.internal"; @@ -379,12 +379,11 @@ async fn init_client_server( socket_addr: dns_server.local_address(), protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); - let resolver = - TokioAsyncResolver::tokio(rc, ResolverOpts::default()).unwrap(); + let resolver = TokioAsyncResolver::tokio(rc, ResolverOpts::default()); let client = Client::new(&format!("http://{}", dropshot_server.local_addr()), log); diff --git a/end-to-end-tests/Cargo.toml b/end-to-end-tests/Cargo.toml index 1102094b61..35bdb76d4e 100644 --- a/end-to-end-tests/Cargo.toml +++ b/end-to-end-tests/Cargo.toml @@ -25,7 +25,7 @@ serde.workspace = true serde_json.workspace = true tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } toml.workspace = true -trust-dns-resolver.workspace = true +hickory-resolver.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true ispf.workspace = true diff --git a/end-to-end-tests/src/helpers/ctx.rs b/end-to-end-tests/src/helpers/ctx.rs index e4bf61356c..ec0a8a176e 100644 --- a/end-to-end-tests/src/helpers/ctx.rs +++ b/end-to-end-tests/src/helpers/ctx.rs @@ -1,6 +1,7 @@ use crate::helpers::generate_name; use anyhow::{anyhow, Context as _, Result}; use chrono::Utc; +use hickory_resolver::error::ResolveErrorKind; use omicron_sled_agent::rack_setup::config::SetupServiceConfig; use omicron_test_utils::dev::poll::{wait_for_condition, CondCheckError}; use oxide_client::types::{Name, ProjectCreate}; @@ -13,7 +14,6 @@ use std::net::IpAddr; use std::net::SocketAddr; use std::sync::Arc; use std::time::Duration; -use trust_dns_resolver::error::ResolveErrorKind; use uuid::Uuid; const RSS_CONFIG_STR: &str = include_str!(concat!( diff --git a/internal-dns-cli/Cargo.toml b/internal-dns-cli/Cargo.toml index dae0af0280..3e34c21622 100644 --- a/internal-dns-cli/Cargo.toml +++ b/internal-dns-cli/Cargo.toml @@ -11,9 +11,9 @@ workspace = true anyhow.workspace = true clap.workspace = true dropshot.workspace = true +hickory-resolver.workspace = true internal-dns.workspace = true omicron-common.workspace = true slog.workspace = true tokio.workspace = true -trust-dns-resolver.workspace = true omicron-workspace-hack.workspace = true diff --git a/internal-dns-cli/src/bin/dnswait.rs b/internal-dns-cli/src/bin/dnswait.rs index 9e003ed14f..b650f2f307 100644 --- a/internal-dns-cli/src/bin/dnswait.rs +++ b/internal-dns-cli/src/bin/dnswait.rs @@ -66,7 +66,7 @@ async fn main() -> Result<()> { let resolver = if opt.nameserver_addresses.is_empty() { info!(&log, "using system configuration"); let async_resolver = - trust_dns_resolver::AsyncResolver::tokio_from_system_conf() + hickory_resolver::AsyncResolver::tokio_from_system_conf() .context("initializing resolver from system configuration")?; Resolver::new_with_resolver(log.clone(), async_resolver) } else { diff --git a/internal-dns/Cargo.toml b/internal-dns/Cargo.toml index c08cc012c1..c12035e2cb 100644 --- a/internal-dns/Cargo.toml +++ b/internal-dns/Cargo.toml @@ -18,7 +18,7 @@ omicron-uuid-kinds.workspace = true reqwest = { workspace = true, features = ["rustls-tls", "stream"] } slog.workspace = true thiserror.workspace = true -trust-dns-resolver.workspace = true +hickory-resolver.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/internal-dns/src/resolver.rs b/internal-dns/src/resolver.rs index cf5def01c5..c3734c3651 100644 --- a/internal-dns/src/resolver.rs +++ b/internal-dns/src/resolver.rs @@ -2,24 +2,24 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. +use hickory_resolver::config::{ + LookupIpStrategy, NameServerConfig, Protocol, ResolverConfig, ResolverOpts, +}; +use hickory_resolver::lookup::SrvLookup; +use hickory_resolver::TokioAsyncResolver; use hyper::client::connect::dns::Name; use omicron_common::address::{ Ipv6Subnet, ReservedRackSubnet, AZ_PREFIX, DNS_PORT, }; use slog::{debug, error, info, trace}; use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; -use trust_dns_resolver::config::{ - LookupIpStrategy, NameServerConfig, Protocol, ResolverConfig, ResolverOpts, -}; -use trust_dns_resolver::lookup::SrvLookup; -use trust_dns_resolver::TokioAsyncResolver; pub type DnsError = dns_service_client::Error; #[derive(Debug, Clone, thiserror::Error)] pub enum ResolveError { #[error(transparent)] - Resolve(#[from] trust_dns_resolver::error::ResolveError), + Resolve(#[from] hickory_resolver::error::ResolveError), #[error("Record not found for SRV key: {}", .0.dns_name())] NotFound(crate::ServiceName), @@ -66,7 +66,7 @@ impl Resolver { socket_addr, protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); } @@ -77,7 +77,7 @@ impl Resolver { // the IPv4 variant. opts.ip_strategy = LookupIpStrategy::Ipv6Only; opts.negative_max_ttl = Some(std::time::Duration::from_secs(15)); - let resolver = TokioAsyncResolver::tokio(rc, opts)?; + let resolver = TokioAsyncResolver::tokio(rc, opts); Ok(Self { log, resolver }) } @@ -163,7 +163,7 @@ impl Resolver { .iter() .next() .ok_or_else(|| ResolveError::NotFound(srv))?; - Ok(*address) + Ok(address.0) } /// Returns the targets of the SRV records for a DNS name @@ -313,7 +313,7 @@ impl Resolver { // (1) it returns `IpAddr`'s rather than `SocketAddr`'s // (2) it doesn't actually return all the addresses from the Additional // section of the DNS server's response. - // See bluejekyll/trust-dns#1980 + // See bluejekyll/hickory-dns#1980 // // (1) is not a huge deal as we can try to match up the targets ourselves // to grab the port for creating a `SocketAddr` but (2) means we need to do @@ -350,10 +350,9 @@ impl Resolver { .await .into_iter() .flat_map(move |target| match target { - Ok((ips, port)) => Some( - ips.into_iter() - .map(move |ip| SocketAddrV6::new(ip, port, 0, 0)), - ), + Ok((ips, port)) => Some(ips.into_iter().map(move |aaaa| { + SocketAddrV6::new(aaaa.into(), port, 0, 0) + })), Err((target, err)) => { error!( log, @@ -510,7 +509,7 @@ mod test { assert!( matches!( dns_error.kind(), - trust_dns_resolver::error::ResolveErrorKind::NoRecordsFound { .. }, + hickory_resolver::error::ResolveErrorKind::NoRecordsFound { .. }, ), "Saw error: {dns_error}", ); @@ -663,7 +662,7 @@ mod test { error, ResolveError::Resolve(error) if matches!(error.kind(), - trust_dns_resolver::error::ResolveErrorKind::NoRecordsFound { .. } + hickory_resolver::error::ResolveErrorKind::NoRecordsFound { .. } ) ); diff --git a/nexus/Cargo.toml b/nexus/Cargo.toml index 81cf6499b2..4450ad3ad1 100644 --- a/nexus/Cargo.toml +++ b/nexus/Cargo.toml @@ -34,6 +34,7 @@ futures.workspace = true gateway-client.workspace = true headers.workspace = true hex.workspace = true +hickory-resolver.workspace = true http.workspace = true hyper.workspace = true illumos-utils.workspace = true @@ -84,7 +85,6 @@ tokio = { workspace = true, features = ["full"] } tokio-postgres = { workspace = true, features = ["with-serde_json-1"] } tokio-util = { workspace = true, features = ["codec"] } tough.workspace = true -trust-dns-resolver.workspace = true uuid.workspace = true nexus-auth.workspace = true @@ -138,7 +138,7 @@ sp-sim.workspace = true rustls = { workspace = true } subprocess.workspace = true term.workspace = true -trust-dns-resolver.workspace = true +hickory-resolver.workspace = true tufaceous.workspace = true tufaceous-lib.workspace = true httptest.workspace = true diff --git a/nexus/src/app/external_dns.rs b/nexus/src/app/external_dns.rs index c6a8d833c2..4a0cbb34fd 100644 --- a/nexus/src/app/external_dns.rs +++ b/nexus/src/app/external_dns.rs @@ -5,15 +5,15 @@ use std::net::IpAddr; use std::net::SocketAddr; +use hickory_resolver::config::NameServerConfig; +use hickory_resolver::config::Protocol; +use hickory_resolver::config::ResolverConfig; +use hickory_resolver::config::ResolverOpts; +use hickory_resolver::TokioAsyncResolver; use hyper::client::connect::dns::Name; use omicron_common::address::DNS_PORT; -use trust_dns_resolver::config::NameServerConfig; -use trust_dns_resolver::config::Protocol; -use trust_dns_resolver::config::ResolverConfig; -use trust_dns_resolver::config::ResolverOpts; -use trust_dns_resolver::TokioAsyncResolver; -/// Wrapper around trust-dns-resolver to provide name resolution +/// Wrapper around hickory-resolver to provide name resolution /// using a given set of DNS servers for use with reqwest. pub struct Resolver(TokioAsyncResolver); @@ -26,7 +26,7 @@ impl Resolver { socket_addr: SocketAddr::new(*addr, DNS_PORT), protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); } @@ -34,10 +34,7 @@ impl Resolver { opts.use_hosts_file = false; // Do as many requests in parallel as we have configured servers opts.num_concurrent_reqs = dns_servers.len(); - Resolver( - TokioAsyncResolver::tokio(rc, opts) - .expect("creating resovler shouldn't fail"), - ) + Resolver(TokioAsyncResolver::tokio(rc, opts)) } } @@ -48,7 +45,7 @@ impl reqwest::dns::Resolve for Resolver { let ips = resolver.lookup_ip(name.as_str()).await?; let addrs = ips .into_iter() - // trust-dns-resolver returns `IpAddr`s but reqwest wants + // hickory-resolver returns `IpAddr`s but reqwest wants // `SocketAddr`s (useful if you have a custom resolver that // returns a scoped IPv6 address). The port provided here // is ignored in favour of the scheme default (http/80, diff --git a/nexus/test-utils/Cargo.toml b/nexus/test-utils/Cargo.toml index 0eab038f91..3c2921818b 100644 --- a/nexus/test-utils/Cargo.toml +++ b/nexus/test-utils/Cargo.toml @@ -44,7 +44,7 @@ sled-agent-client.workspace = true slog.workspace = true tokio.workspace = true tokio-util.workspace = true -trust-dns-resolver.workspace = true +hickory-resolver.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/nexus/test-utils/src/lib.rs b/nexus/test-utils/src/lib.rs index 97fd66f949..25dd9e7ebe 100644 --- a/nexus/test-utils/src/lib.rs +++ b/nexus/test-utils/src/lib.rs @@ -17,6 +17,11 @@ use dropshot::HandlerTaskMode; use futures::future::BoxFuture; use futures::FutureExt; use gateway_test_utils::setup::GatewayTestContext; +use hickory_resolver::config::NameServerConfig; +use hickory_resolver::config::Protocol; +use hickory_resolver::config::ResolverConfig; +use hickory_resolver::config::ResolverOpts; +use hickory_resolver::TokioAsyncResolver; use nexus_config::Database; use nexus_config::DpdConfig; use nexus_config::InternalDns; @@ -72,11 +77,6 @@ use std::collections::HashMap; use std::fmt::Debug; use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::time::Duration; -use trust_dns_resolver::config::NameServerConfig; -use trust_dns_resolver::config::Protocol; -use trust_dns_resolver::config::ResolverConfig; -use trust_dns_resolver::config::ResolverOpts; -use trust_dns_resolver::TokioAsyncResolver; use uuid::Uuid; pub use sim::TEST_HARDWARE_THREADS; @@ -1568,12 +1568,11 @@ pub async fn start_dns_server( socket_addr: dns_server.local_address(), protocol: Protocol::Udp, tls_dns_name: None, - trust_nx_responses: false, + trust_negative_responses: false, bind_addr: None, }); let resolver = - TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()) - .context("creating DNS resolver")?; + TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()); Ok((dns_server, http_server, resolver)) } diff --git a/nexus/tests/integration_tests/silos.rs b/nexus/tests/integration_tests/silos.rs index 2e6c21bb79..efeb6cd37d 100644 --- a/nexus/tests/integration_tests/silos.rs +++ b/nexus/tests/integration_tests/silos.rs @@ -37,6 +37,7 @@ use std::fmt::Write; use std::str::FromStr; use base64::Engine; +use hickory_resolver::error::ResolveErrorKind; use http::method::Method; use http::StatusCode; use httptest::{matchers::*, responders::*, Expectation, Server}; @@ -44,7 +45,6 @@ use nexus_types::external_api::shared::{FleetRole, SiloRole}; use std::convert::Infallible; use std::net::Ipv4Addr; use std::time::Duration; -use trust_dns_resolver::error::ResolveErrorKind; use uuid::Uuid; type ControlPlaneTestContext = @@ -2164,7 +2164,7 @@ pub async fn verify_silo_dns_name( .await { Ok(result) => { - let addrs: Vec<_> = result.iter().collect(); + let addrs: Vec<_> = result.iter().map(|a| &a.0).collect(); if addrs.is_empty() { false } else { diff --git a/wicketd/Cargo.toml b/wicketd/Cargo.toml index bfd8a4cf45..79ead23a8f 100644 --- a/wicketd/Cargo.toml +++ b/wicketd/Cargo.toml @@ -25,6 +25,7 @@ flume.workspace = true futures.workspace = true gateway-messages.workspace = true hex.workspace = true +hickory-resolver.workspace = true http.workspace = true hubtools.workspace = true hyper.workspace = true @@ -46,7 +47,6 @@ tokio-stream.workspace = true tokio-util.workspace = true toml.workspace = true tough.workspace = true -trust-dns-resolver.workspace = true uuid.workspace = true bootstrap-agent-client.workspace = true diff --git a/wicketd/src/preflight_check/uplink.rs b/wicketd/src/preflight_check/uplink.rs index 395fb8c795..b860df35e3 100644 --- a/wicketd/src/preflight_check/uplink.rs +++ b/wicketd/src/preflight_check/uplink.rs @@ -14,6 +14,11 @@ use dpd_client::types::PortSpeed as DpdPortSpeed; use dpd_client::Client as DpdClient; use dpd_client::ClientState as DpdClientState; use either::Either; +use hickory_resolver::config::NameServerConfigGroup; +use hickory_resolver::config::ResolverConfig; +use hickory_resolver::config::ResolverOpts; +use hickory_resolver::error::ResolveErrorKind; +use hickory_resolver::TokioAsyncResolver; use illumos_utils::zone::SVCCFG; use illumos_utils::PFEXEC; use omicron_common::address::DENDRITE_PORT; @@ -39,12 +44,6 @@ use std::time::Instant; use thiserror::Error; use tokio::process::Command; use tokio::sync::mpsc; -use trust_dns_resolver::config::NameServerConfigGroup; -use trust_dns_resolver::config::ResolverConfig; -use trust_dns_resolver::config::ResolverOpts; -use trust_dns_resolver::error::ResolveError; -use trust_dns_resolver::error::ResolveErrorKind; -use trust_dns_resolver::TokioAsyncResolver; use update_engine::StepSpec; use wicket_common::rack_setup::UserSpecifiedPortConfig; use wicket_common::rack_setup::UserSpecifiedRackNetworkConfig; @@ -992,16 +991,7 @@ impl DnsLookupStep { }; 'dns_servers: for &dns_ip in dns_servers { - let resolver = match self.build_resolver(dns_ip) { - Ok(resolver) => resolver, - Err(err) => { - self.warnings.push(format!( - "failed to create resolver for {dns_ip}: {}", - DisplayErrorChain::new(&err) - )); - continue; - } - }; + let resolver = self.build_resolver(dns_ip); // Attempt to resolve any NTP servers that aren't IP addresses. for &ntp_name in &ntp_names_to_resolve { @@ -1114,14 +1104,18 @@ impl DnsLookupStep { ( "A", resolver.ipv4_lookup(name).await.map(|records| { - Either::Left(records.into_iter().map(IpAddr::V4)) + Either::Left( + records.into_iter().map(|x| IpAddr::V4(x.into())), + ) }), ) } else { ( "AAAA", resolver.ipv6_lookup(name).await.map(|records| { - Either::Right(records.into_iter().map(IpAddr::V6)) + Either::Right( + records.into_iter().map(|x| IpAddr::V6(x.into())), + ) }), ) }; @@ -1237,10 +1231,7 @@ impl DnsLookupStep { /// /// If building it fails, we'll append to our internal `warnings` and return /// `None`. - fn build_resolver( - &mut self, - dns_ip: IpAddr, - ) -> Result { + fn build_resolver(&mut self, dns_ip: IpAddr) -> TokioAsyncResolver { let mut options = ResolverOpts::default(); // We will retry ourselves; we don't want the resolver diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 1b21b72495..9b11ff38c0 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -59,6 +59,7 @@ getrandom = { version = "0.2.14", default-features = false, features = ["js", "r group = { version = "0.13.0", default-features = false, features = ["alloc"] } hashbrown = { version = "0.14.5", features = ["raw"] } hex = { version = "0.4.3", features = ["serde"] } +hickory-proto = { version = "0.24.1", features = ["text-parsing"] } hmac = { version = "0.12.1", default-features = false, features = ["reset"] } hyper = { version = "0.14.28", features = ["full"] } indexmap = { version = "2.2.6", features = ["serde"] } @@ -110,7 +111,6 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.13", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } -trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } usdt = { version = "0.5.0" } @@ -163,6 +163,7 @@ getrandom = { version = "0.2.14", default-features = false, features = ["js", "r group = { version = "0.13.0", default-features = false, features = ["alloc"] } hashbrown = { version = "0.14.5", features = ["raw"] } hex = { version = "0.4.3", features = ["serde"] } +hickory-proto = { version = "0.24.1", features = ["text-parsing"] } hmac = { version = "0.12.1", default-features = false, features = ["reset"] } hyper = { version = "0.14.28", features = ["full"] } indexmap = { version = "2.2.6", features = ["serde"] } @@ -216,7 +217,6 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.13", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } -trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } unicode-xid = { version = "0.2.4" } From 3964433b1ed24e9f405d0bb64511742ce9a85f6a Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Thu, 20 Jun 2024 17:45:28 -0700 Subject: [PATCH 02/14] edns? --- clients/oxide-client/src/lib.rs | 8 ++++---- dns-server/src/lib.rs | 4 +++- dns-server/tests/basic_test.rs | 8 +++++--- internal-dns/src/resolver.rs | 1 + nexus/src/app/external_dns.rs | 1 + nexus/test-utils/src/lib.rs | 5 +++-- wicketd/src/preflight_check/uplink.rs | 3 +++ 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/clients/oxide-client/src/lib.rs b/clients/oxide-client/src/lib.rs index 94d09ccdea..7068dcdb37 100644 --- a/clients/oxide-client/src/lib.rs +++ b/clients/oxide-client/src/lib.rs @@ -49,11 +49,11 @@ impl CustomDnsResolver { trust_negative_responses: false, bind_addr: None, }); + let mut resolver_opts = ResolverOpts::default(); + resolver_opts.edns0 = true; - let resolver = Arc::new(TokioAsyncResolver::tokio( - resolver_config, - ResolverOpts::default(), - )); + let resolver = + Arc::new(TokioAsyncResolver::tokio(resolver_config, resolver_opts)); Ok(CustomDnsResolver { dns_addr, resolver }) } diff --git a/dns-server/src/lib.rs b/dns-server/src/lib.rs index 7e8269bf3f..95598cd0a3 100644 --- a/dns-server/src/lib.rs +++ b/dns-server/src/lib.rs @@ -170,8 +170,10 @@ impl TransientServer { trust_negative_responses: false, bind_addr: None, }); + let mut resolver_opts = ResolverOpts::default(); + resolver_opts.edns0 = true; let resolver = - TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()); + TokioAsyncResolver::tokio(resolver_config, resolver_opts); Ok(resolver) } } diff --git a/dns-server/tests/basic_test.rs b/dns-server/tests/basic_test.rs index 0744ee0ea3..4709c9200d 100644 --- a/dns-server/tests/basic_test.rs +++ b/dns-server/tests/basic_test.rs @@ -374,16 +374,18 @@ async fn init_client_server( ) .await?; - let mut rc = ResolverConfig::new(); - rc.add_name_server(NameServerConfig { + let mut resolver_config = ResolverConfig::new(); + resolver_config.add_name_server(NameServerConfig { socket_addr: dns_server.local_address(), protocol: Protocol::Udp, tls_dns_name: None, trust_negative_responses: false, bind_addr: None, }); + let mut resolver_opts = ResolverOpts::default(); + resolver_opts.edns0 = true; - let resolver = TokioAsyncResolver::tokio(rc, ResolverOpts::default()); + let resolver = TokioAsyncResolver::tokio(resolver_config, resolver_opts); let client = Client::new(&format!("http://{}", dropshot_server.local_addr()), log); diff --git a/internal-dns/src/resolver.rs b/internal-dns/src/resolver.rs index c3734c3651..c5d2b75074 100644 --- a/internal-dns/src/resolver.rs +++ b/internal-dns/src/resolver.rs @@ -71,6 +71,7 @@ impl Resolver { }); } let mut opts = ResolverOpts::default(); + opts.edns0 = true; opts.use_hosts_file = false; opts.num_concurrent_reqs = dns_server_count; // The underlay is IPv6 only, so this helps avoid needless lookups of diff --git a/nexus/src/app/external_dns.rs b/nexus/src/app/external_dns.rs index 4a0cbb34fd..9e268a9a08 100644 --- a/nexus/src/app/external_dns.rs +++ b/nexus/src/app/external_dns.rs @@ -31,6 +31,7 @@ impl Resolver { }); } let mut opts = ResolverOpts::default(); + opts.edns0 = true; opts.use_hosts_file = false; // Do as many requests in parallel as we have configured servers opts.num_concurrent_reqs = dns_servers.len(); diff --git a/nexus/test-utils/src/lib.rs b/nexus/test-utils/src/lib.rs index 25dd9e7ebe..ce6916095a 100644 --- a/nexus/test-utils/src/lib.rs +++ b/nexus/test-utils/src/lib.rs @@ -1571,8 +1571,9 @@ pub async fn start_dns_server( trust_negative_responses: false, bind_addr: None, }); - let resolver = - TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default()); + let mut resolver_opts = ResolverOpts::default(); + resolver_opts.edns0 = true; + let resolver = TokioAsyncResolver::tokio(resolver_config, resolver_opts); Ok((dns_server, http_server, resolver)) } diff --git a/wicketd/src/preflight_check/uplink.rs b/wicketd/src/preflight_check/uplink.rs index b860df35e3..600bf55a3c 100644 --- a/wicketd/src/preflight_check/uplink.rs +++ b/wicketd/src/preflight_check/uplink.rs @@ -1234,6 +1234,9 @@ impl DnsLookupStep { fn build_resolver(&mut self, dns_ip: IpAddr) -> TokioAsyncResolver { let mut options = ResolverOpts::default(); + // Enable edns for potentially larger records + options.edns0 = true; + // We will retry ourselves; we don't want the resolver // retrying internally too. options.attempts = 1; From 98fbfe37f10572c50de54935badfa33614a20474 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Mon, 5 Aug 2024 16:18:52 -0700 Subject: [PATCH 03/14] update --- dns-server/src/dns_server.rs | 13 +++++++++++++ dns-server/src/storage.rs | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/dns-server/src/dns_server.rs b/dns-server/src/dns_server.rs index ea6d2db840..e312fa670c 100644 --- a/dns-server/src/dns_server.rs +++ b/dns-server/src/dns_server.rs @@ -13,6 +13,19 @@ use crate::storage::Store; use anyhow::anyhow; use anyhow::Context; use dns_server_api::DnsRecord; +use hickory_proto::op::Header; +use hickory_proto::op::ResponseCode; +use hickory_proto::rr::rdata::SRV; +use hickory_proto::rr::RData; +use hickory_proto::rr::Record; +use hickory_proto::rr::RecordType; +use hickory_proto::serialize::binary::BinDecodable; +use hickory_proto::serialize::binary::BinDecoder; +use hickory_proto::serialize::binary::BinEncoder; +use hickory_resolver::Name; +use hickory_server::authority::MessageRequest; +use hickory_server::authority::MessageResponse; +use hickory_server::authority::MessageResponseBuilder; use pretty_hex::*; use serde::Deserialize; use slog::{debug, error, info, o, trace, Logger}; diff --git a/dns-server/src/storage.rs b/dns-server/src/storage.rs index 482e8b0696..b3141f6751 100644 --- a/dns-server/src/storage.rs +++ b/dns-server/src/storage.rs @@ -95,6 +95,8 @@ use anyhow::{anyhow, Context}; use camino::Utf8PathBuf; use dns_server_api::{DnsConfig, DnsConfigParams, DnsConfigZone, DnsRecord}; +use hickory_proto::rr::LowerName; +use hickory_resolver::Name; use serde::{Deserialize, Serialize}; use sled::transaction::ConflictableTransactionError; use slog::{debug, error, info, o, warn}; @@ -782,6 +784,8 @@ mod test { use dns_server_api::DnsConfigParams; use dns_server_api::DnsConfigZone; use dns_server_api::DnsRecord; + use hickory_proto::rr::LowerName; + use hickory_resolver::Name; use omicron_test_utils::dev::test_setup_log; use std::collections::BTreeSet; use std::collections::HashMap; From ac6d453438e692df34bf29efe2ba4493edaad465 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Mon, 12 Aug 2024 15:51:22 -0700 Subject: [PATCH 04/14] tracing; first attempt (of many, I presume) --- .github/buildomat/jobs/deploy.sh | 3 +- Cargo.lock | 61 +++++++++++++++++++++++++++++++- Cargo.toml | 1 + dns-server/Cargo.toml | 1 + dns-server/src/bin/dns-server.rs | 10 +++++- workspace-hack/Cargo.toml | 2 ++ 6 files changed, 75 insertions(+), 3 deletions(-) diff --git a/.github/buildomat/jobs/deploy.sh b/.github/buildomat/jobs/deploy.sh index 8820378e1c..00c2d6e22d 100755 --- a/.github/buildomat/jobs/deploy.sh +++ b/.github/buildomat/jobs/deploy.sh @@ -13,7 +13,8 @@ #: "%/pool/ext/*/crypt/debug/global/oxide-sled-agent:default.log.*", #: "%/pool/ext/*/crypt/debug/oxz_*/oxide-*.log.*", #: "%/pool/ext/*/crypt/debug/oxz_*/system-illumos-*.log.*", -#: "!/pool/ext/*/crypt/debug/oxz_propolis-server_*/*.log.*" +#: "!/pool/ext/*/crypt/debug/oxz_propolis-server_*/*.log.*", +#: "%/pool/ext/*/crypt/zone/oxz_internal_dns_*/var/tmp/trace" #: ] #: skip_clone = true #: diff --git a/Cargo.lock b/Cargo.lock index 0a772d12a7..b6d6c1b7bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2082,6 +2082,7 @@ dependencies = [ "thiserror", "tokio", "toml 0.8.19", + "tracing-subscriber", "uuid", ] @@ -5413,6 +5414,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.50.0" @@ -6377,6 +6388,7 @@ dependencies = [ "toml_edit 0.19.15", "toml_edit 0.22.20", "tracing", + "tracing-core", "unicode-bidi", "unicode-normalization", "unicode-xid", @@ -6607,6 +6619,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "owo-colors" version = "4.0.0" @@ -8126,7 +8144,7 @@ dependencies = [ "crossterm 0.27.0", "fd-lock", "itertools 0.12.1", - "nu-ansi-term", + "nu-ansi-term 0.50.0", "serde", "strip-ansi-escapes", "strum", @@ -9118,6 +9136,15 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shell-words" version = "1.1.0" @@ -10573,6 +10600,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term 0.46.0", + "sharded-slab", + "smallvec 1.13.2", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -11081,6 +11134,12 @@ dependencies = [ "log", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index ebeed3c6fe..63fb22b085 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -566,6 +566,7 @@ tokio-util = { version = "0.7.11", features = ["io", "io-util"] } toml = "0.8.19" toml_edit = "0.22.20" tough = { version = "0.17.1", features = [ "http" ] } +tracing-subscriber = "0.3.18" trybuild = "1.0.99" tufaceous = { path = "tufaceous" } tufaceous-lib = { path = "tufaceous-lib" } diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index b4516b8b77..333b7b9514 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -33,6 +33,7 @@ tempfile.workspace = true thiserror.workspace = true tokio = { workspace = true, features = [ "full" ] } toml.workspace = true +tracing-subscriber.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/dns-server/src/bin/dns-server.rs b/dns-server/src/bin/dns-server.rs index 52a9c17c0d..dc93b7fd12 100644 --- a/dns-server/src/bin/dns-server.rs +++ b/dns-server/src/bin/dns-server.rs @@ -3,7 +3,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. //! Executable that starts the HTTP-configurable DNS server used for both -//! internal DNS (RFD 248) and extenral DNS (RFD 357) for the Oxide system +//! internal DNS (RFD 248) and external DNS (RFD 357) for the Oxide system use anyhow::anyhow; use anyhow::Context; @@ -35,6 +35,14 @@ pub struct Config { #[tokio::main] async fn main() -> Result<(), anyhow::Error> { + use tracing_subscriber::fmt::format::FmtSpan; + tracing_subscriber::fmt() + .with_thread_names(true) + .with_span_events(FmtSpan::ENTER) + .with_max_level(tracing_subscriber::filter::LevelFilter::TRACE) + .with_writer(std::fs::File::create("/var/tmp/trace").unwrap()) + .init(); + let args = Args::parse(); let config_file = &args.config_file; let config_file_contents = std::fs::read_to_string(config_file) diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 062c78d11d..820e39ee34 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -110,6 +110,7 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.20", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } +tracing-core = { version = "0.1.32" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } usdt = { version = "0.5.0" } @@ -215,6 +216,7 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.20", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } +tracing-core = { version = "0.1.32" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } unicode-xid = { version = "0.2.4" } From 3921dddb9151a38a6cf3af25c44cf20b01094a66 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Mon, 12 Aug 2024 20:52:00 -0700 Subject: [PATCH 05/14] write start of file --- dns-server/src/bin/dns-server.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/dns-server/src/bin/dns-server.rs b/dns-server/src/bin/dns-server.rs index dc93b7fd12..77a2f48604 100644 --- a/dns-server/src/bin/dns-server.rs +++ b/dns-server/src/bin/dns-server.rs @@ -35,6 +35,7 @@ pub struct Config { #[tokio::main] async fn main() -> Result<(), anyhow::Error> { + std::fs::write("/var/tmp/trace", "xxx\n").unwrap(); use tracing_subscriber::fmt::format::FmtSpan; tracing_subscriber::fmt() .with_thread_names(true) From 245cf7d73c1abef243eb9706c12cdd66b33c472a Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Mon, 12 Aug 2024 21:00:24 -0700 Subject: [PATCH 06/14] more error --- dns-server/src/dns_server.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dns-server/src/dns_server.rs b/dns-server/src/dns_server.rs index e312fa670c..4ecbe382c8 100644 --- a/dns-server/src/dns_server.rs +++ b/dns-server/src/dns_server.rs @@ -169,7 +169,10 @@ async fn handle_dns_packet(request: Request) { Err(error) => { let header = Header::response_from_request(mr.header()); let rb_servfail = MessageResponseBuilder::from_message_request(&mr); - error!(log, "failed to handle incoming DNS message: {:#}", error); + error!( + log, + "failed to handle incoming DNS message: {:#?} {:#}", mr, error + ); match error { RequestError::NxDomain(_) => { let rb_nxdomain = From 2eb67db90c61019e9cab9b616b274fdf2d72b554 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Tue, 13 Aug 2024 08:41:45 -0700 Subject: [PATCH 07/14] it's hard being dumb --- .github/buildomat/jobs/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/buildomat/jobs/deploy.sh b/.github/buildomat/jobs/deploy.sh index 00c2d6e22d..95d81baf41 100755 --- a/.github/buildomat/jobs/deploy.sh +++ b/.github/buildomat/jobs/deploy.sh @@ -14,7 +14,7 @@ #: "%/pool/ext/*/crypt/debug/oxz_*/oxide-*.log.*", #: "%/pool/ext/*/crypt/debug/oxz_*/system-illumos-*.log.*", #: "!/pool/ext/*/crypt/debug/oxz_propolis-server_*/*.log.*", -#: "%/pool/ext/*/crypt/zone/oxz_internal_dns_*/var/tmp/trace" +#: "%/pool/ext/*/crypt/zone/oxz_internal_dns_*/root/var/tmp/trace" #: ] #: skip_clone = true #: From f09596472ba690d52b6f631c6780a863ccbce950 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Tue, 13 Aug 2024 09:23:44 -0700 Subject: [PATCH 08/14] testing --- dns-server/src/storage.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dns-server/src/storage.rs b/dns-server/src/storage.rs index b3141f6751..36bf56bce4 100644 --- a/dns-server/src/storage.rs +++ b/dns-server/src/storage.rs @@ -610,10 +610,13 @@ impl Store { ) -> Result, QueryError> { let config = self.read_config().map_err(QueryError::QueryFail)?; + println!("zones"); + let zone_name = config .zones .iter() .find(|z| { + println!("zone {z}"); let zone_name = LowerName::from(Name::from_str(&z).unwrap()); zone_name.zone_of(name) }) From 3ae7ac9d935853f8cf3210886b0c06513692d1c5 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Tue, 13 Aug 2024 11:49:51 -0700 Subject: [PATCH 09/14] log = debug --- smf/internal-dns/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smf/internal-dns/config.toml b/smf/internal-dns/config.toml index b090d3391e..c7fdee546d 100644 --- a/smf/internal-dns/config.toml +++ b/smf/internal-dns/config.toml @@ -5,7 +5,7 @@ request_body_max_bytes = 104857600 [log] # Show log messages of this level and more severe -level = "info" +level = "debug" mode = "file" path = "/dev/stdout" if_exists = "append" From 8a67b94242e9434e9689d544603c2c4a472f1c07 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Tue, 13 Aug 2024 14:24:02 -0700 Subject: [PATCH 10/14] hail mary --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6d6c1b7bc..42a93057a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1481,7 +1481,7 @@ dependencies = [ "bitflags 2.6.0", "crossterm_winapi", "futures-core", - "mio 1.0.1", + "mio 1.0.2", "parking_lot 0.12.2", "rustix", "signal-hook", @@ -4295,7 +4295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -4656,9 +4656,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", @@ -9175,7 +9175,7 @@ checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", "mio 0.8.11", - "mio 1.0.1", + "mio 1.0.2", "signal-hook", ] From 10b92eb1b12d4ff5e137f5593c8c3ca1dc32ffe5 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Wed, 14 Aug 2024 20:36:16 -0700 Subject: [PATCH 11/14] edns for the system config case in dnswait --- dns-server/src/bin/dnsadm.rs | 8 ++++---- dns-server/src/storage.rs | 3 --- internal-dns-cli/src/bin/dnswait.rs | 6 ++---- internal-dns/src/resolver.rs | 12 ++++++++++++ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/dns-server/src/bin/dnsadm.rs b/dns-server/src/bin/dnsadm.rs index 76ba9bc2d4..dcd4cba58a 100644 --- a/dns-server/src/bin/dnsadm.rs +++ b/dns-server/src/bin/dnsadm.rs @@ -234,10 +234,10 @@ async fn main() -> Result<()> { /// ".oxide.test" name to ensure that it can never conflict with a real deployed /// zone name. fn verify_zone_name(zone_name: &str) -> Result<()> { - ensure!( - zone_name.trim_end_matches('.').ends_with(".oxide.test"), - "zone name must be under \".oxide.test\"" - ); + // ensure!( + // zone_name.trim_end_matches('.').ends_with(".oxide.test"), + // "zone name must be under \".oxide.test\"" + // ); Ok(()) } diff --git a/dns-server/src/storage.rs b/dns-server/src/storage.rs index 36bf56bce4..b3141f6751 100644 --- a/dns-server/src/storage.rs +++ b/dns-server/src/storage.rs @@ -610,13 +610,10 @@ impl Store { ) -> Result, QueryError> { let config = self.read_config().map_err(QueryError::QueryFail)?; - println!("zones"); - let zone_name = config .zones .iter() .find(|z| { - println!("zone {z}"); let zone_name = LowerName::from(Name::from_str(&z).unwrap()); zone_name.zone_of(name) }) diff --git a/internal-dns-cli/src/bin/dnswait.rs b/internal-dns-cli/src/bin/dnswait.rs index b650f2f307..8dbd675d64 100644 --- a/internal-dns-cli/src/bin/dnswait.rs +++ b/internal-dns-cli/src/bin/dnswait.rs @@ -65,10 +65,8 @@ async fn main() -> Result<()> { let resolver = if opt.nameserver_addresses.is_empty() { info!(&log, "using system configuration"); - let async_resolver = - hickory_resolver::AsyncResolver::tokio_from_system_conf() - .context("initializing resolver from system configuration")?; - Resolver::new_with_resolver(log.clone(), async_resolver) + Resolver::new_from_system_conf(log.clone()) + .context("initializing resolver from system configuration")? } else { let addrs = opt.nameserver_addresses; info!(&log, "using explicit nameservers"; "nameservers" => ?addrs); diff --git a/internal-dns/src/resolver.rs b/internal-dns/src/resolver.rs index 1787de04c5..4e4807a4aa 100644 --- a/internal-dns/src/resolver.rs +++ b/internal-dns/src/resolver.rs @@ -52,6 +52,18 @@ impl reqwest::dns::Resolve for Resolver { } impl Resolver { + /// Construct a new DNS resolver from the system configuration. + pub fn new_from_system_conf( + log: slog::Logger, + ) -> Result { + let (rc, mut opts) = hickory_resolver::system_conf::read_system_conf()?; + opts.edns0 = true; + + let resolver = TokioAsyncResolver::tokio(rc, opts); + + Ok(Self { log, resolver }) + } + /// Construct a new DNS resolver from specific DNS server addresses. pub fn new_from_addrs( log: slog::Logger, From 5b0a6bd840c79774efe38af091cf72cdf47becf9 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Wed, 14 Aug 2024 20:45:08 -0700 Subject: [PATCH 12/14] reenable dnsadm safeguard --- dns-server/src/bin/dnsadm.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dns-server/src/bin/dnsadm.rs b/dns-server/src/bin/dnsadm.rs index dcd4cba58a..76ba9bc2d4 100644 --- a/dns-server/src/bin/dnsadm.rs +++ b/dns-server/src/bin/dnsadm.rs @@ -234,10 +234,10 @@ async fn main() -> Result<()> { /// ".oxide.test" name to ensure that it can never conflict with a real deployed /// zone name. fn verify_zone_name(zone_name: &str) -> Result<()> { - // ensure!( - // zone_name.trim_end_matches('.').ends_with(".oxide.test"), - // "zone name must be under \".oxide.test\"" - // ); + ensure!( + zone_name.trim_end_matches('.').ends_with(".oxide.test"), + "zone name must be under \".oxide.test\"" + ); Ok(()) } From 8be2853eac1dbf5484ab3038517833316898304e Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Wed, 14 Aug 2024 22:33:34 -0700 Subject: [PATCH 13/14] cleanup --- .github/buildomat/jobs/deploy.sh | 3 +- Cargo.lock | 53 +------------------------------- Cargo.toml | 1 - clients/oxide-client/src/lib.rs | 1 + dns-server/Cargo.toml | 1 - dns-server/src/bin/dns-server.rs | 9 ------ dns-server/src/lib.rs | 1 + dns-server/tests/basic_test.rs | 1 + internal-dns/src/resolver.rs | 4 ++- nexus/src/app/external_dns.rs | 1 + smf/internal-dns/config.toml | 2 +- 11 files changed, 10 insertions(+), 67 deletions(-) diff --git a/.github/buildomat/jobs/deploy.sh b/.github/buildomat/jobs/deploy.sh index 95d81baf41..8820378e1c 100755 --- a/.github/buildomat/jobs/deploy.sh +++ b/.github/buildomat/jobs/deploy.sh @@ -13,8 +13,7 @@ #: "%/pool/ext/*/crypt/debug/global/oxide-sled-agent:default.log.*", #: "%/pool/ext/*/crypt/debug/oxz_*/oxide-*.log.*", #: "%/pool/ext/*/crypt/debug/oxz_*/system-illumos-*.log.*", -#: "!/pool/ext/*/crypt/debug/oxz_propolis-server_*/*.log.*", -#: "%/pool/ext/*/crypt/zone/oxz_internal_dns_*/root/var/tmp/trace" +#: "!/pool/ext/*/crypt/debug/oxz_propolis-server_*/*.log.*" #: ] #: skip_clone = true #: diff --git a/Cargo.lock b/Cargo.lock index 42a93057a7..16036b3cc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2082,7 +2082,6 @@ dependencies = [ "thiserror", "tokio", "toml 0.8.19", - "tracing-subscriber", "uuid", ] @@ -5414,16 +5413,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "nu-ansi-term" version = "0.50.0" @@ -6619,12 +6608,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "owo-colors" version = "4.0.0" @@ -8144,7 +8127,7 @@ dependencies = [ "crossterm 0.27.0", "fd-lock", "itertools 0.12.1", - "nu-ansi-term 0.50.0", + "nu-ansi-term", "serde", "strip-ansi-escapes", "strum", @@ -9136,15 +9119,6 @@ dependencies = [ "keccak", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "shell-words" version = "1.1.0" @@ -10603,31 +10577,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "nu-ansi-term 0.46.0", - "sharded-slab", - "smallvec 1.13.2", - "thread_local", - "tracing-core", - "tracing-log", -] - [[package]] name = "trust-dns-proto" version = "0.22.0" diff --git a/Cargo.toml b/Cargo.toml index 63fb22b085..ebeed3c6fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -566,7 +566,6 @@ tokio-util = { version = "0.7.11", features = ["io", "io-util"] } toml = "0.8.19" toml_edit = "0.22.20" tough = { version = "0.17.1", features = [ "http" ] } -tracing-subscriber = "0.3.18" trybuild = "1.0.99" tufaceous = { path = "tufaceous" } tufaceous-lib = { path = "tufaceous-lib" } diff --git a/clients/oxide-client/src/lib.rs b/clients/oxide-client/src/lib.rs index 7068dcdb37..249ea18146 100644 --- a/clients/oxide-client/src/lib.rs +++ b/clients/oxide-client/src/lib.rs @@ -50,6 +50,7 @@ impl CustomDnsResolver { bind_addr: None, }); let mut resolver_opts = ResolverOpts::default(); + // Enable edns for potentially larger records resolver_opts.edns0 = true; let resolver = diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index 333b7b9514..b4516b8b77 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -33,7 +33,6 @@ tempfile.workspace = true thiserror.workspace = true tokio = { workspace = true, features = [ "full" ] } toml.workspace = true -tracing-subscriber.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/dns-server/src/bin/dns-server.rs b/dns-server/src/bin/dns-server.rs index 77a2f48604..9e8d098ee2 100644 --- a/dns-server/src/bin/dns-server.rs +++ b/dns-server/src/bin/dns-server.rs @@ -35,15 +35,6 @@ pub struct Config { #[tokio::main] async fn main() -> Result<(), anyhow::Error> { - std::fs::write("/var/tmp/trace", "xxx\n").unwrap(); - use tracing_subscriber::fmt::format::FmtSpan; - tracing_subscriber::fmt() - .with_thread_names(true) - .with_span_events(FmtSpan::ENTER) - .with_max_level(tracing_subscriber::filter::LevelFilter::TRACE) - .with_writer(std::fs::File::create("/var/tmp/trace").unwrap()) - .init(); - let args = Args::parse(); let config_file = &args.config_file; let config_file_contents = std::fs::read_to_string(config_file) diff --git a/dns-server/src/lib.rs b/dns-server/src/lib.rs index 3769e71489..8abd3b945e 100644 --- a/dns-server/src/lib.rs +++ b/dns-server/src/lib.rs @@ -171,6 +171,7 @@ impl TransientServer { bind_addr: None, }); let mut resolver_opts = ResolverOpts::default(); + // Enable edns for potentially larger records resolver_opts.edns0 = true; let resolver = TokioAsyncResolver::tokio(resolver_config, resolver_opts); diff --git a/dns-server/tests/basic_test.rs b/dns-server/tests/basic_test.rs index b7075d09fa..fa5bfea468 100644 --- a/dns-server/tests/basic_test.rs +++ b/dns-server/tests/basic_test.rs @@ -383,6 +383,7 @@ async fn init_client_server( bind_addr: None, }); let mut resolver_opts = ResolverOpts::default(); + // Enable edns for potentially larger records resolver_opts.edns0 = true; let resolver = TokioAsyncResolver::tokio(resolver_config, resolver_opts); diff --git a/internal-dns/src/resolver.rs b/internal-dns/src/resolver.rs index 4e4807a4aa..b3dadf16d2 100644 --- a/internal-dns/src/resolver.rs +++ b/internal-dns/src/resolver.rs @@ -57,6 +57,7 @@ impl Resolver { log: slog::Logger, ) -> Result { let (rc, mut opts) = hickory_resolver::system_conf::read_system_conf()?; + // Enable edns for potentially larger records opts.edns0 = true; let resolver = TokioAsyncResolver::tokio(rc, opts); @@ -83,6 +84,7 @@ impl Resolver { }); } let mut opts = ResolverOpts::default(); + // Enable edns for potentially larger records opts.edns0 = true; opts.use_hosts_file = false; opts.num_concurrent_reqs = dns_server_count; @@ -326,7 +328,7 @@ impl Resolver { // (1) it returns `IpAddr`'s rather than `SocketAddr`'s // (2) it doesn't actually return all the addresses from the Additional // section of the DNS server's response. - // See bluejekyll/hickory-dns#1980 + // See hickory-dns/hickory-dns#1980 // // (1) is not a huge deal as we can try to match up the targets ourselves // to grab the port for creating a `SocketAddr` but (2) means we need to do diff --git a/nexus/src/app/external_dns.rs b/nexus/src/app/external_dns.rs index 9e268a9a08..4732146ce2 100644 --- a/nexus/src/app/external_dns.rs +++ b/nexus/src/app/external_dns.rs @@ -31,6 +31,7 @@ impl Resolver { }); } let mut opts = ResolverOpts::default(); + // Enable edns for potentially larger records opts.edns0 = true; opts.use_hosts_file = false; // Do as many requests in parallel as we have configured servers diff --git a/smf/internal-dns/config.toml b/smf/internal-dns/config.toml index c7fdee546d..b090d3391e 100644 --- a/smf/internal-dns/config.toml +++ b/smf/internal-dns/config.toml @@ -5,7 +5,7 @@ request_body_max_bytes = 104857600 [log] # Show log messages of this level and more severe -level = "debug" +level = "info" mode = "file" path = "/dev/stdout" if_exists = "append" From 42896ebe89e9e329a5d5f650aa64f91e7112fa14 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Wed, 14 Aug 2024 23:51:50 -0700 Subject: [PATCH 14/14] hakari --- Cargo.lock | 8 -------- workspace-hack/Cargo.toml | 2 -- 2 files changed, 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16036b3cc9..b54984e52e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6377,7 +6377,6 @@ dependencies = [ "toml_edit 0.19.15", "toml_edit 0.22.20", "tracing", - "tracing-core", "unicode-bidi", "unicode-normalization", "unicode-xid", @@ -10574,7 +10573,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", - "valuable", ] [[package]] @@ -11083,12 +11081,6 @@ dependencies = [ "log", ] -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "vcpkg" version = "0.2.15" diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 820e39ee34..062c78d11d 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -110,7 +110,6 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.20", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } -tracing-core = { version = "0.1.32" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } usdt = { version = "0.5.0" } @@ -216,7 +215,6 @@ tokio-util = { version = "0.7.11", features = ["codec", "io-util"] } toml = { version = "0.7.8" } toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.20", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } -tracing-core = { version = "0.1.32" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.23" } unicode-xid = { version = "0.2.4" }