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

Support multicast with sp-sim #7545

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jmpesp
Copy link
Contributor

@jmpesp jmpesp commented Feb 14, 2025

Previously the simulated SP did not truly support listening in a multicast group. This commit changes the network configuration for the simulated SP so that either "simulated" or "real" is explicitly configured:

  • if "simulated", then most of the current behaviour is preserved: listen on a bind address but don't join a multicast group. Note: the current behaviour when multicast_addr is supplied is incorrect because without the interface index matching the interface that is physically connected to MGS (or faux-mgs), it doesn't work.

  • if "real", then require all the necessary parameters to correctly configure joining a multicast group for an interface, and set it up.

Previously the simulated SP did not truly support listening in a
multicast group. This commit changes the network configuration for the
simulated SP so that either "simulated" or "real" is explicitly
configured:

- if "simulated", then most of the current behaviour is preserved:
  listen on a bind address but don't join a multicast group. Note: the
  current behaviour when `multicast_addr` is supplied is incorrect
  because without the interface index matching the interface that is
  physically connected to MGS (or faux-mgs), it doesn't work.

- if "real", then require all the necessary parameters to correctly
  configure joining a multicast group for an interface, and set it up.
@jmpesp jmpesp requested a review from jgallagher February 14, 2025 17:07
Copy link
Contributor

@jgallagher jgallagher left a comment

Choose a reason for hiding this comment

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

Thanks! Mostly nits, with one more serious question about how we want the provided example config to be used.

@@ -17,15 +17,64 @@ use std::path::Path;
use std::path::PathBuf;
use thiserror::Error;

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum NetworkConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nit - could we drop a #[serde(rename_all = "snake_case")] on this so the TOML keys are lowercase like the others in the config files?

Comment on lines +33 to +34
[[simulated_sps.sidecar.network_config]]
[simulated_sps.sidecar.network_config.Real]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[[simulated_sps.sidecar.network_config]]
[simulated_sps.sidecar.network_config.Real]
[[simulated_sps.gimlet.network_config]]
[simulated_sps.gimlet.network_config.Real]

Comment on lines +78 to +79
[[simulated_sps.sidecar.network_config]]
[simulated_sps.sidecar.network_config.Real]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[[simulated_sps.sidecar.network_config]]
[simulated_sps.sidecar.network_config.Real]
[[simulated_sps.gimlet.network_config]]
[simulated_sps.gimlet.network_config.Real]

[simulated_sps.sidecar.network_config.Real]
bind_addr = "[::1]:33300"
multicast_addr = "ff15:0:1de::0"
multicast_interface = "net0"
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems quite unfortunate that this file no longer works without replacing net0 / net1 with real interface names on whatever system this is being run. I'm not sure what to suggest; if we have to have this, we at least need to update the wicket README to tell people to edit these values before running sp-sim (but to what?).

Could we make multicast_interface optional and continue to pass index 0 to join_multicast_v6() if it isn't provided? Or if that is nonsensical, can we change this config to use simulated instead of real?

}

let interface_index =
if_nametoindex(multicast_interface.as_str())?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add context with the interface name we tried to look up to this error? As written if the interface name doesn't exist, I get

sp-sim: ENODEV: No such device

sock.join_multicast_v6(&multicast_addr, interface_index)
.with_context(|| {
format!(
"failed to join multicast group {} for index {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also include the interface name here?

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