Skip to content

Do not create a link local for tfpkt links - #2903

Merged
jmpesp merged 2 commits into
oxidecomputer:mainfrom
jmpesp:no_link_local_for_tfpkt
Apr 21, 2023
Merged

jmpesp merged 2 commits into
oxidecomputer:mainfrom
jmpesp:no_link_local_for_tfpkt

Conversation

@jmpesp

@jmpesp jmpesp commented Apr 21, 2023

Copy link
Copy Markdown
Contributor

Change links_needed to return whether or not a link needs a link local address in the zone. This was required for non-gimlet testing but broke gimlets - see: oxidecomputer/stlouis#391.

This also changes links_needed to check all service requests for required links, not just stopping at the first one found.

Change `links_needed` to return whether or not a link needs a link local
address in the zone. This was required for non-gimlet testing but broke
gimlets - see: oxidecomputer/stlouis#391.

This also changes `links_needed` to check all service requests for
required links, not just stopping at the first one found.
@jmpesp
jmpesp requested a review from jgallagher April 21, 2023 18:14

@jgallagher jgallagher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. Building a ramdisk with this change now to test on madrid; will update here once that's done.

Comment thread sled-agent/src/services.rs Outdated
) -> Result<Vec<Link>, Error> {
) -> Result<Vec<(Link, bool)>, Error> {
let mut links: Vec<(Link, bool)> =
Vec::with_capacity(req.services.len());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit - I'd probably just make this Vec::new() because (a) it looks like Nexus/Ntp/ExternalDns may not need a link at all in the future and (b) Maghemite looks like it needs multiple links.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in b8a8fd8

&AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME).unwrap(),
)?;
for (link, needs_link_local) in
running_zone.links().iter().zip(links_need_link_local)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a lark I tried using .filter_map() here (since we're already doing .iter().zip(..)):

@@ -787,22 +787,21 @@ impl ServiceManager {

         let running_zone = RunningZone::boot(installed_zone).await?;

-        for (link, needs_link_local) in
-            running_zone.links().iter().zip(links_need_link_local)
+        for link in
+            running_zone.links().iter().zip(links_need_link_local).filter_map(
+                |(link, needs_link_local)| needs_link_local.then_some(link),
+            )
         {
-            if needs_link_local {
-                info!(
-                    self.inner.log,
-                    "Ensuring {}/{} exists in zone",
-                    link.name(),
-                    IPV6_LINK_LOCAL_NAME
-                );
-                Zones::ensure_has_link_local_v6_address(
-                    Some(running_zone.name()),
-                    &AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME)
-                        .unwrap(),
-                )?;
-            }
+            info!(
+                self.inner.log,
+                "Ensuring {}/{} exists in zone",
+                link.name(),
+                IPV6_LINK_LOCAL_NAME
+            );
+            Zones::ensure_has_link_local_v6_address(
+                Some(running_zone.name()),
+                &AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME).unwrap(),
+            )?;
         }

I don't feel like either version is clearly better; take your pick.

@jgallagher jgallagher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

madrid is back to working with this change, thank you!

root@oxz_switch:~# ping -i gimlet14 fe80::aa40:25ff:fe04:345
fe80::aa40:25ff:fe04:345 is alive

@jmpesp
jmpesp marked this pull request as ready for review April 21, 2023 19:26
@jmpesp
jmpesp enabled auto-merge (squash) April 21, 2023 22:03
@jmpesp
jmpesp merged commit 09fe471 into oxidecomputer:main Apr 21, 2023
@jmpesp
jmpesp deleted the no_link_local_for_tfpkt branch April 24, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants