Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ expectorate = "1"
futures = "0.3"
http = "1.4.0"
humantime = "2.3"
iddqd = "0.3.18"
kstat-rs = "0.2.4"
lazy_static = "1.5"
libc = "0.2"
Expand Down
25 changes: 22 additions & 3 deletions common/src/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ pub mod smf;

type Result<T> = std::result::Result<T, IllumosError>;

/// The suffix for the addrobj name for IPv6 link-local addresses on each tfport.
///
/// E.g., all IPv6 addresses are named like `tfportrear0_0/ll`.
pub const IPV6_LINK_LOCAL_NAME: &str = "ll";

#[derive(Debug, PartialEq, thiserror::Error)]
pub enum IllumosError {
/// This error indicates that the requested command wasn't able to run
Expand Down Expand Up @@ -148,9 +153,8 @@ pub async fn address_add(

let addr: oxnet::IpNet = addr.into();
if addr.is_ipv6() {
let tag = "ll";
if !address_exists(iface, tag).await? {
linklocal_add(iface, tag).await?;
if !address_exists(iface, IPV6_LINK_LOCAL_NAME).await? {
linklocal_add(iface, IPV6_LINK_LOCAL_NAME).await?;
}
}

Expand All @@ -171,6 +175,21 @@ pub async fn linklocal_add(iface: &str, tag: &str) -> Result<()> {
ipadm_quiet(&["create-addr", "-t", "-T", "addrconf", &addr_obj]).await
}

/// Add link-local and DHCPv6 addresses to an existing link.
pub async fn linklocal_add_with_dhcpv6(iface: &str, tag: &str) -> Result<()> {
let addr_obj = format!("{iface}/{tag}");
ipadm_quiet(&[
"create-addr",
"-t",
"-T",
"addrconf",
"-p",
"stateful=yes,stateless=no",
&addr_obj,
])
.await
}

/// Create a vlan link on top of the specified link
pub async fn vlan_create(over: &str, vlan_id: u16, vlan: &str) -> Result<()> {
let vlan_id = vlan_id.to_string();
Expand Down
5 changes: 5 additions & 0 deletions common/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ impl MacAddr {
self.a[5],
]
}

/// Return the bytes of the MAC as a slice.
pub const fn as_slice(&self) -> &[u8] {
self.a.as_slice()
}
}

#[derive(Error, Debug, Clone)]
Expand Down
1 change: 1 addition & 0 deletions dpd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dpd-api.workspace = true
dpd-types.workspace = true

anyhow.workspace = true
bytes.workspace = true
cfg-if.workspace = true
chrono.workspace = true
clap.workspace = true
Expand Down
8 changes: 8 additions & 0 deletions dpd/misc/ndpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Do not run DHCPv6 on any interfaces by default.
#
# DHCPv6 servers rely on unique identifiers, DUIDs, to identify clients.
# Those are usually based on the link-layer address. The Omicron switch zone
# starts with a random locally-administered MAC, which means we _don't_ have a
# stable ID. Dendrite software manually creates the DUID once we've collected
# stable MAC addresses from the Sidecar SP.
ifdefault StatefulAddrConf false
2 changes: 1 addition & 1 deletion dpd/src/api_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2900,7 +2900,7 @@ fn path_to_qsfp(path: Path<PortIdPathParams>) -> Result<QsfpPort, HttpError> {
}
}

fn build_info() -> BuildInfo {
pub(crate) fn build_info() -> BuildInfo {
BuildInfo {
version: env!("CARGO_PKG_VERSION").to_string(),
git_sha: env!("VERGEN_GIT_SHA").to_string(),
Expand Down
Loading