Commit 6fa887ff authored by Jeremy Soller's avatar Jeremy Soller

Update to fix network stack

parent 9de8be3c
......@@ -88,16 +88,18 @@ fn daemon(network_fd: usize, socket_fd: usize) {
fn main() {
match syscall::open("network:", syscall::O_RDWR | syscall::O_NONBLOCK) {
Ok(network_fd) => match syscall::open(":ethernet", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK) {
Ok(socket_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
daemon(network_fd, socket_fd);
Ok(network_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
match syscall::open(":ethernet", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK) {
Ok(socket_fd) => {
daemon(network_fd, socket_fd);
},
Err(err) => {
println!("ethernetd: failed to create ethernet scheme: {}", err);
process::exit(1);
}
}
},
Err(err) => {
println!("ethernetd: failed to create ethernet scheme: {}", err);
process::exit(1);
}
},
Err(err) => {
......
......@@ -314,16 +314,18 @@ fn daemon(arp_fd: usize, ip_fd: usize, scheme_fd: usize) {
fn main() {
match syscall::open("ethernet:806", syscall::O_RDWR | syscall::O_NONBLOCK) {
Ok(arp_fd) => match syscall::open("ethernet:800", syscall::O_RDWR | syscall::O_NONBLOCK) {
Ok(ip_fd) => match syscall::open(":ip", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK) {
Ok(scheme_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
daemon(arp_fd, ip_fd, scheme_fd);
Ok(ip_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
match syscall::open(":ip", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK) {
Ok(scheme_fd) => {
daemon(arp_fd, ip_fd, scheme_fd);
},
Err(err) => {
println!("ipd: failed to create ip scheme: {}", err);
process::exit(1);
}
}
},
Err(err) => {
println!("ipd: failed to create ip scheme: {}", err);
process::exit(1);
}
},
Err(err) => {
......
......@@ -809,16 +809,18 @@ fn daemon(tcp_fd: usize, scheme_fd: usize) {
fn main() {
match syscall::open("ip:6", O_RDWR | O_NONBLOCK) {
Ok(tcp_fd) => match syscall::open(":tcp", O_RDWR | O_CREAT | O_NONBLOCK) {
Ok(scheme_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
daemon(tcp_fd, scheme_fd);
Ok(tcp_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
match syscall::open(":tcp", O_RDWR | O_CREAT | O_NONBLOCK) {
Ok(scheme_fd) => {
daemon(tcp_fd, scheme_fd);
},
Err(err) => {
println!("tcpd: failed to create tcp scheme: {}", err);
process::exit(1);
}
}
},
Err(err) => {
println!("tcpd: failed to create tcp scheme: {}", err);
process::exit(1);
}
},
Err(err) => {
......
......@@ -476,16 +476,18 @@ fn daemon(udp_fd: usize, scheme_fd: usize) {
fn main() {
match syscall::open("ip:11", O_RDWR | O_NONBLOCK) {
Ok(udp_fd) => match syscall::open(":udp", O_RDWR | O_CREAT | O_NONBLOCK) {
Ok(scheme_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
daemon(udp_fd, scheme_fd);
Ok(udp_fd) => {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
match syscall::open(":udp", O_RDWR | O_CREAT | O_NONBLOCK) {
Ok(scheme_fd) => {
daemon(udp_fd, scheme_fd);
},
Err(err) => {
println!("udpd: failed to create udp scheme: {}", err);
process::exit(1);
}
}
},
Err(err) => {
println!("udpd: failed to create udp scheme: {}", err);
process::exit(1);
}
},
Err(err) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment