Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow trust-dns to its new name: hickory #5912

Merged
merged 17 commits into from
Aug 15, 2024
Next Next commit
follow trust-dns to its new name: hickory
ahl committed Jun 18, 2024
commit 3dbf0a16d15b7d3242b267ffc94c51adff876b00
204 changes: 119 additions & 85 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
2 changes: 1 addition & 1 deletion clients/oxide-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 9 additions & 9 deletions clients/oxide-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 })
}

13 changes: 6 additions & 7 deletions dns-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 11 additions & 13 deletions dns-server/src/dns_server.rs
Original file line number Diff line number Diff line change
@@ -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,15 +220,15 @@ 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)
}

DnsRecord::AAAA(addr) => {
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)
}

15 changes: 7 additions & 8 deletions dns-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)
}
}
10 changes: 5 additions & 5 deletions dns-server/src/storage.rs
Original file line number Diff line number Diff line change
@@ -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<Vec<DnsRecord>, 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.
17 changes: 8 additions & 9 deletions dns-server/tests/basic_test.rs
Original file line number Diff line number Diff line change
@@ -9,19 +9,19 @@ 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::{
collections::HashMap,
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);

2 changes: 1 addition & 1 deletion end-to-end-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion end-to-end-tests/src/helpers/ctx.rs
Original file line number Diff line number Diff line change
@@ -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!(
2 changes: 1 addition & 1 deletion internal-dns-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion internal-dns-cli/src/bin/dnswait.rs
Original file line number Diff line number Diff line change
@@ -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 {
2 changes: 1 addition & 1 deletion internal-dns/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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

31 changes: 15 additions & 16 deletions internal-dns/src/resolver.rs
Original file line number Diff line number Diff line change
@@ -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<dns_service_client::types::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 { .. }
)
);

4 changes: 2 additions & 2 deletions nexus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 9 additions & 12 deletions nexus/src/app/external_dns.rs
Original file line number Diff line number Diff line change
@@ -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,18 +26,15 @@ 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,
});
}
let mut opts = ResolverOpts::default();
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,
2 changes: 1 addition & 1 deletion nexus/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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

15 changes: 7 additions & 8 deletions nexus/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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))
}
4 changes: 2 additions & 2 deletions nexus/tests/integration_tests/silos.rs
Original file line number Diff line number Diff line change
@@ -37,14 +37,14 @@ 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};
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 {
2 changes: 1 addition & 1 deletion wicketd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 13 additions & 22 deletions wicketd/src/preflight_check/uplink.rs
Original file line number Diff line number Diff line change
@@ -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<TokioAsyncResolver, ResolveError> {
fn build_resolver(&mut self, dns_ip: IpAddr) -> TokioAsyncResolver {
let mut options = ResolverOpts::default();

// We will retry ourselves; we don't want the resolver
4 changes: 2 additions & 2 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }