diff --git a/sled-agent/src/illumos/running_zone.rs b/sled-agent/src/illumos/running_zone.rs index a58b4c9d18..fee2318768 100644 --- a/sled-agent/src/illumos/running_zone.rs +++ b/sled-agent/src/illumos/running_zone.rs @@ -11,6 +11,7 @@ use crate::illumos::zone::{AddressRequest, ZONE_PREFIX}; use crate::opte::OptePort; use ipnetwork::IpNetwork; use slog::Logger; +use std::net::Ipv6Addr; use std::path::PathBuf; #[cfg(test)] @@ -171,17 +172,17 @@ impl RunningZone { Ok(network) } - pub async fn add_route( + pub async fn add_default_route( &self, - destination: ipnetwork::Ipv6Network, + gateway: Ipv6Addr, ) -> Result<(), RunCommandError> { self.run_cmd(&[ "/usr/sbin/route", "add", "-inet6", - &format!("{}/{}", destination.network(), destination.prefix()), + "default", "-inet6", - &destination.ip().to_string(), + &gateway.to_string(), ])?; Ok(()) } diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index aafd89b221..72444a79b1 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -10,8 +10,7 @@ use crate::illumos::vnic::VnicAllocator; use crate::illumos::zone::AddressRequest; use crate::params::{ServiceEnsureBody, ServiceRequest}; use crate::zone::Zones; -use ipnetwork::Ipv6Network; -use omicron_common::address::{AZ_PREFIX, DNS_PORT, DNS_SERVER_PORT}; +use omicron_common::address::{DNS_PORT, DNS_SERVER_PORT}; use slog::Logger; use std::collections::HashSet; use std::iter::FromIterator; @@ -229,7 +228,7 @@ impl ServiceManager { })?; } - let gz_route_subnet = if !service.gz_addresses.is_empty() { + let gateway = if !service.gz_addresses.is_empty() { // If this service supplies its own GZ address, add a route. // // This is currently being used for the DNS service. @@ -238,16 +237,18 @@ impl ServiceManager { // can be supplied - now that we're actively using it, we // aren't really handling the "many GZ addresses" case, and it // doesn't seem necessary now. - Ipv6Network::new(service.gz_addresses[0], AZ_PREFIX).unwrap() + service.gz_addresses[0] } else { - // Otherwise, add a route to the global Zone's sled address for - // everything within the AZ. - Ipv6Network::new(self.underlay_address, AZ_PREFIX).unwrap() + self.underlay_address }; - running_zone.add_route(gz_route_subnet).await.map_err(|err| { + + running_zone.add_default_route(gateway).await.map_err(|err| { Error::ZoneCommand { intent: "Adding Route".to_string(), err } })?; + // TODO: Related to + // https://github.com/oxidecomputer/omicron/pull/1124 , should we + // avoid importing this manifest? debug!(self.log, "importing manifest"); running_zone diff --git a/sled-agent/src/storage_manager.rs b/sled-agent/src/storage_manager.rs index ee364b4031..a02e68baae 100644 --- a/sled-agent/src/storage_manager.rs +++ b/sled-agent/src/storage_manager.rs @@ -15,9 +15,7 @@ use crate::params::DatasetKind; use futures::stream::FuturesOrdered; use futures::FutureExt; use futures::StreamExt; -use ipnetwork::Ipv6Network; use nexus_client::types::{DatasetPutRequest, ZpoolPutRequest}; -use omicron_common::address::AZ_PREFIX; use omicron_common::api::external::{ByteCount, ByteCountRangeError}; use omicron_common::backoff; use schemars::JsonSchema; @@ -497,9 +495,10 @@ async fn ensure_running_zone( zone.ensure_address(address_request).await?; - let gz_subnet = - Ipv6Network::new(underlay_address, AZ_PREFIX).unwrap(); - zone.add_route(gz_subnet).await.map_err(Error::ZoneCommand)?; + let gateway = underlay_address; + zone.add_default_route(gateway) + .await + .map_err(Error::ZoneCommand)?; dataset_info .start_zone(log, &zone, dataset_info.address, do_format)