Skip to content

Commit c75fdb6

Browse files
committed
ipv6 all the things
1 parent 078f636 commit c75fdb6

File tree

20 files changed

+616
-94
lines changed

20 files changed

+616
-94
lines changed

Cargo.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ digest = "0.10.7"
462462
dns-server = { path = "dns-server" }
463463
dns-server-api = { path = "dns-server-api" }
464464
dns-service-client = { path = "clients/dns-service-client" }
465-
dpd-client = { git = "https://github.com/oxidecomputer/dendrite", rev = "ab30fa91227fd478bfe0e023310ca83dec0bc22b" }
465+
dpd-client = { git = "https://github.com/oxidecomputer/dendrite", rev = "21fbf39f63b25567b25aeadf0d9a73a01c842512" }
466466
dropshot = { version = "0.16.6", features = [ "usdt-probes" ] }
467467
dropshot-api-manager = "0.2.4"
468468
dropshot-api-manager-types = "0.2.4"
@@ -566,8 +566,8 @@ ntp-admin-api = { path = "ntp-admin/api" }
566566
ntp-admin-client = { path = "clients/ntp-admin-client" }
567567
ntp-admin-types = { path = "ntp-admin/types" }
568568
ntp-admin-types-versions = { path = "ntp-admin/types/versions" }
569-
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "205b3ccf75b527ac7a565285fdcc0c78f4fcee95" }
570-
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "205b3ccf75b527ac7a565285fdcc0c78f4fcee95" }
569+
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
570+
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
571571
multimap = "0.10.1"
572572
nexus-auth = { path = "nexus/auth" }
573573
nexus-background-task-interface = { path = "nexus/background-task-interface" }
@@ -626,7 +626,7 @@ omicron-workspace-hack = "0.1.0"
626626
omicron-zone-package = "0.12.2"
627627
oxide-client = { path = "clients/oxide-client" }
628628
oxide-tokio-rt = "0.1.2"
629-
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "795a1e0aeefb7a2c6fe4139779fdf66930d09b80", features = [ "api", "std" ] }
629+
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "a1ed0960673b6ca2e6b68835537f53cc86110a77", features = [ "api", "std" ] }
630630
oxlog = { path = "dev-tools/oxlog" }
631631
oxnet = "0.1.3"
632632
once_cell = "1.21.3"
@@ -635,7 +635,7 @@ openapiv3 = "2.2.0"
635635
# must match samael's crate!
636636
openssl = "0.10"
637637
openssl-sys = "0.9"
638-
opte-ioctl = { git = "https://github.com/oxidecomputer/opte", rev = "795a1e0aeefb7a2c6fe4139779fdf66930d09b80" }
638+
opte-ioctl = { git = "https://github.com/oxidecomputer/opte", rev = "a1ed0960673b6ca2e6b68835537f53cc86110a77" }
639639
oso = "0.27"
640640
owo-colors = "4.2.2"
641641
oximeter = { path = "oximeter/oximeter" }
@@ -697,7 +697,7 @@ rats-corim = { git = "https://github.com/oxidecomputer/rats-corim.git", rev = "f
697697
raw-cpuid = { git = "https://github.com/oxidecomputer/rust-cpuid.git", rev = "a4cf01df76f35430ff5d39dc2fe470bcb953503b" }
698698
rayon = "1.10"
699699
rcgen = "0.12.1"
700-
rdb-types = { git = "https://github.com/oxidecomputer/maghemite", rev = "205b3ccf75b527ac7a565285fdcc0c78f4fcee95" }
700+
rdb-types = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
701701
reconfigurator-cli = { path = "dev-tools/reconfigurator-cli" }
702702
reedline = "0.40.0"
703703
ref-cast = "1.0"

illumos-utils/src/running_zone.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -353,30 +353,30 @@ impl RunningZone {
353353
Ok(network)
354354
}
355355

356-
// TODO-completeness: Handle dual-stack OPTE ports here. This works for
357-
// either IPv4 or IPv6 addresses, but not both.
358-
// See https://github.com/oxidecomputer/omicron/issues/9247.
359356
pub async fn ensure_address_for_port(
360357
&self,
361358
name: &str,
362359
port_idx: usize,
363-
) -> Result<IpNetwork, EnsureAddressError> {
360+
) -> Result<(), EnsureAddressError> {
364361
info!(self.inner.log, "Ensuring address for OPTE port");
362+
365363
let port = self.opte_ports().nth(port_idx).ok_or_else(|| {
366364
EnsureAddressError::MissingOptePort {
367365
zone: self.inner.name.clone(),
368366
port_idx,
369367
}
370368
})?;
371-
let addrobj = AddrObject::new(port.name(), name).map_err(|err| {
372-
EnsureAddressError::AddrObject {
373-
request: AddressRequest::Dhcp,
374-
zone: self.inner.name.clone(),
375-
err,
376-
}
377-
})?;
378369
let zone = Some(self.inner.name.as_ref());
379370
if let Some(gateway) = port.gateway().ipv4_addr() {
371+
let v4_name = format!("{}4", name);
372+
let addrobj =
373+
AddrObject::new(port.name(), &v4_name).map_err(|err| {
374+
EnsureAddressError::AddrObject {
375+
request: AddressRequest::Dhcp,
376+
zone: self.inner.name.clone(),
377+
err,
378+
}
379+
})?;
380380
let addr =
381381
Zones::ensure_address(zone, &addrobj, AddressRequest::Dhcp)
382382
.await?;
@@ -403,8 +403,17 @@ impl RunningZone {
403403
"default",
404404
&gateway_ip,
405405
])?;
406-
Ok(addr)
407-
} else {
406+
}
407+
if port.gateway().ipv6_addr().is_some() {
408+
let v6_name = format!("{}6", name);
409+
let addrobj =
410+
AddrObject::new(port.name(), &v6_name).map_err(|err| {
411+
EnsureAddressError::AddrObject {
412+
request: AddressRequest::Dhcp,
413+
zone: self.inner.name.clone(),
414+
err,
415+
}
416+
})?;
408417
// If the port is using IPv6 addressing we still want it to use
409418
// DHCP(v6) which requires first creating a link-local address.
410419
Zones::ensure_has_link_local_v6_address(zone, &addrobj)
@@ -430,15 +439,13 @@ impl RunningZone {
430439
)
431440
})?;
432441

433-
// Ipv6Addr::is_unicast_link_local is sadly not stable
434-
let is_ll =
435-
|ip: Ipv6Addr| (ip.segments()[0] & 0xffc0) == 0xfe80;
436-
437442
// Look for a non link-local addr
438443
addrs
439444
.into_iter()
440445
.find(|addr| match addr {
441-
IpNetwork::V6(ip) => !is_ll(ip.ip()),
446+
IpNetwork::V6(ip) => {
447+
!ip.ip().is_unicast_link_local()
448+
}
442449
_ => false,
443450
})
444451
.ok_or_else(|| {
@@ -458,8 +465,9 @@ impl RunningZone {
458465
);
459466
},
460467
)
461-
.await
468+
.await?;
462469
}
470+
Ok(())
463471
}
464472

465473
pub fn add_default_route(

nexus/db-queries/src/db/datastore/address_lot.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,22 @@ impl DataStore {
9595
let found_blocks: Vec<AddressLotBlock> =
9696
block_dsl::address_lot_block
9797
.filter(block_dsl::address_lot_id.eq(db_lot.id()))
98-
.filter(
99-
block_dsl::first_address.eq_any(
100-
desired_blocks
101-
.iter()
102-
.map(|b| b.first_address)
103-
.collect::<Vec<_>>(),
104-
),
105-
)
106-
.filter(
107-
block_dsl::last_address.eq_any(
108-
desired_blocks
109-
.iter()
110-
.map(|b| b.last_address)
111-
.collect::<Vec<_>>(),
112-
),
113-
)
11498
.get_results_async(&conn)
11599
.await?;
116100

117101
let mut blocks = vec![];
118102

119103
// If the block is found in the database, use the found block.
120104
// If the block is not found in the database, insert it.
121-
for desired_block in desired_blocks {
105+
for desired_block in &desired_blocks {
122106
let block = match found_blocks.iter().find(|db_b| {
123107
db_b.first_address == desired_block.first_address
124108
&& db_b.last_address == desired_block.last_address
125109
}) {
126110
Some(block) => block.clone(),
127111
None => {
128112
diesel::insert_into(block_dsl::address_lot_block)
129-
.values(desired_block)
113+
.values(desired_block.clone())
130114
.returning(AddressLotBlock::as_returning())
131115
.get_results_async(&conn)
132116
.await?[0]
@@ -136,6 +120,21 @@ impl DataStore {
136120
blocks.push(block);
137121
}
138122

123+
// If the block is found in the database, but not desired,
124+
// remove it.
125+
for found_block in &found_blocks {
126+
if !desired_blocks.iter().any(|x| {
127+
x.first_address == found_block.first_address
128+
&& x.last_address == found_block.last_address
129+
}) {
130+
diesel::delete(block_dsl::address_lot_block)
131+
.filter(block_dsl::address_lot_id.eq(db_lot.id()))
132+
.filter(block_dsl::id.eq(found_block.id))
133+
.execute_async(&conn)
134+
.await?;
135+
}
136+
}
137+
139138
Ok(AddressLotCreateResult { lot: db_lot, blocks })
140139
})
141140
.await

nexus/external-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ pub trait NexusExternalApi {
16961696

16971697
/// Create instance
16981698
#[endpoint {
1699-
operation_id = "disk_create",
1699+
operation_id = "instance_create",
17001700
method = POST,
17011701
path = "/v1/instances",
17021702
tags = ["instances"],

0 commit comments

Comments
 (0)