Conversation
e7a316e to
f50e0a3
Compare
f50e0a3 to
0d68251
Compare
|
Does this subsume #134? |
|
Not really. Those are prs for different features, that just happen to be dependent on each other. |
0d68251 to
7d4bbbf
Compare
This will allow implementing other network topologies. Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
7d4bbbf to
3a16ac6
Compare
| .to_str() | ||
| .expect("server_path should not contain invalid UTF-8"), | ||
| ) | ||
| .context("Failed to process `muvm-guest` path as it contains NUL characters")?; |
There was a problem hiding this comment.
I'm guessing this is a copy and paste error, right?
There was a problem hiding this comment.
yeah... unlikely to ever be hit, but should probably fix that one
There was a problem hiding this comment.
The POSIX spec says:
The value of an environment variable is an arbitrary sequence of bytes, except for the null byte.
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html
So I think we can just change this to expect everywhere, e.g.
| .context("Failed to process `muvm-guest` path as it contains NUL characters")?; | |
| .expect("server_path should not contain NUL character"); |
(I can do this after the rest is merged, to not create more work for you...)
| let mut stream = | ||
| TcpStream::connect(format!("127.0.0.1:{server_port}")).map_err(LaunchError::Connection)?; | ||
| let run_path = env::var("XDG_RUNTIME_DIR") | ||
| .map_err(|e| anyhow!("unable to get XDG_RUNTIME_DIR: {:?}", e))?; |
There was a problem hiding this comment.
As done elsewhere...
| .map_err(|e| anyhow!("unable to get XDG_RUNTIME_DIR: {:?}", e))?; | |
| .context("Failed to read XDG_RUNTIME_DIR environment variable")?; |
This would already wrap the internal error.
(I can do this after the rest is merged, to not create more work for you...)
| let optslash = if self.ip.is_empty() { "" } else { "/" }; | ||
| [ | ||
| if self.udp { "-u" } else { "-t" }.to_owned(), | ||
| format!( | ||
| "{}{}{}-{}:{}-{}", | ||
| self.ip, | ||
| optslash, | ||
| self.host_range.0, | ||
| self.host_range.1, | ||
| self.guest_range.0, | ||
| self.guest_range.1 | ||
| ), | ||
| ] |
There was a problem hiding this comment.
Note to self:
| let optslash = if self.ip.is_empty() { "" } else { "/" }; | |
| [ | |
| if self.udp { "-u" } else { "-t" }.to_owned(), | |
| format!( | |
| "{}{}{}-{}:{}-{}", | |
| self.ip, | |
| optslash, | |
| self.host_range.0, | |
| self.host_range.1, | |
| self.guest_range.0, | |
| self.guest_range.1 | |
| ), | |
| ] | |
| [ | |
| if self.udp { "-u" } else { "-t" }.to_owned(), | |
| format!( | |
| "{ip}{slash}{host_start}-{host_end}:{guest_start}-{guest_end}", | |
| ip = self.ip, | |
| slash = if self.ip.is_empty() { "" } else { "/" }, | |
| host_start = self.host_range.0, | |
| host_end = self.host_range.1, | |
| guest_start = self.guest_range.0, | |
| guest_end = self.guest_range.1 | |
| ), | |
| ] |
Add an ability to configure the set of published ports via command line switches.
This is a continuation from #134 that moves all internal communications to vsock ports.