Update to fix network stack

This commit is contained in:
Jeremy Soller 2017-02-07 22:34:23 -07:00
parent 9de8be3c04
commit 6fa887ff18
4 changed files with 44 additions and 36 deletions

View file

@ -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) => {

View file

@ -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) => {

View file

@ -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) => {

View file

@ -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) => {