Skip to content

Commit b728828

Browse files
committed
Incorporate review comments
Signed-off-by: Guvenc Gulce <[email protected]>
1 parent ec6506d commit b728828

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

.github/workflows/release-oci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
- feat/container
8-
- feature/prefix_delegation
97
tags:
108
- '*'
119
paths-ignore:

src/daemon.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ impl FeosGrpc for FeOSAPI {
251251
.map_err(|_| Status::invalid_argument("Failed to parse UUID"))?;
252252

253253
self.vmm.boot_vm(id).map_err(|e| self.handle_error(e))?;
254+
//TODO remove this sleep
254255
sleep(Duration::from_secs(2)).await;
255256
self.network
256257
.start_dhcp(id)

src/filesystem.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use log::debug;
22
use nix::mount::{mount, MsFlags};
3-
use std::fs::File;
4-
use std::io::{Error, Write};
53

64
pub fn mount_virtual_filesystems() {
75
const NONE: Option<&'static [u8]> = None;
@@ -55,17 +53,4 @@ pub fn mount_virtual_filesystems() {
5553
NONE,
5654
)
5755
.unwrap_or_else(|e| panic!("/sys/fs/cgroup mount failed: {e}"));
58-
59-
enable_ipv6_forwarding().unwrap_or_else(|e| panic!("Failed to enable ipv6 forwarding: {e}"));
60-
}
61-
62-
fn enable_ipv6_forwarding() -> Result<(), Error> {
63-
let forwarding_paths = ["/proc/sys/net/ipv6/conf/all/forwarding"];
64-
65-
for path in forwarding_paths {
66-
let mut file = File::create(path)?;
67-
file.write_all(b"1")?;
68-
}
69-
70-
Ok(())
7156
}

src/isolated_container/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ impl IsolatedContainerService for IsolatedContainerAPI {
193193
let id = Uuid::new_v4();
194194

195195
self.prepare_vm(id).map_err(|e| self.handle_error(e))?;
196+
//TODO get rid of sleep
196197
sleep(Duration::from_secs(2)).await;
197198

198199
self.network

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::{env::args, ffi::CString};
99
use tokio::io;
1010
use tokio::io::{AsyncBufReadExt, BufReader};
1111

12+
//TODO remove this in future, the reason https://github.com/youki-dev/youki/issues/2144
1213
#[tokio::main(flavor = "current_thread")]
1314
async fn main() -> Result<(), String> {
1415
let mut ipv6_address = Ipv6Addr::UNSPECIFIED;

src/network/utils.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use std::error::Error;
1+
use std::fs::File;
22
use std::io;
3+
use std::io::Write;
34

45
use crate::network::dhcpv6::*;
56
use futures::stream::TryStreamExt;
@@ -33,6 +34,8 @@ pub async fn configure_network_devices() -> Result<Option<(Ipv6Addr, u8)>, Strin
3334
let mut delegated_prefix_option: Option<(Ipv6Addr, u8)> = None;
3435
tokio::spawn(connection);
3536

37+
enable_ipv6_forwarding().map_err(|e| format!("Failed to enable ipv6 forwarding: {}", e))?;
38+
3639
let mut link_ts = handle
3740
.link()
3841
.get()
@@ -157,12 +160,23 @@ pub async fn configure_network_devices() -> Result<Option<(Ipv6Addr, u8)>, Strin
157160
Ok(delegated_prefix_option)
158161
}
159162

163+
pub fn enable_ipv6_forwarding() -> Result<(), std::io::Error> {
164+
let forwarding_paths = ["/proc/sys/net/ipv6/conf/all/forwarding"];
165+
166+
for path in forwarding_paths {
167+
let mut file = File::create(path)?;
168+
file.write_all(b"1")?;
169+
}
170+
171+
Ok(())
172+
}
173+
160174
// Keep for debugging purposes
161175
async fn _print_ipv6_routes(
162176
handle: &Handle,
163177
iface_index: u32,
164178
interface_name: &str,
165-
) -> Result<(), Box<dyn Error>> {
179+
) -> Result<(), Box<dyn std::error::Error>> {
166180
info!("IPv6 Routes:");
167181

168182
let mut route_ts = handle.route().get(IpVersion::V6).execute();

0 commit comments

Comments
 (0)