summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Soller <jackpot51@gmail.com>2017-02-07 22:34:23 -0700
committerJeremy Soller <jackpot51@gmail.com>2017-02-07 22:34:23 -0700
commit6fa887ff1812d87bb381f8ccdc752511bc498eae (patch)
tree9155dd5f9ab20e43ea56c211d76c823658a033bf
parent9de8be3c045939faa4a08b7d8335aa3e69ca34de (diff)
Update to fix network stack0.0.8
-rw-r--r--schemes/ethernetd/src/main.rs20
-rw-r--r--schemes/ipd/src/main.rs20
-rw-r--r--schemes/tcpd/src/main.rs20
-rw-r--r--schemes/udpd/src/main.rs20
4 files changed, 44 insertions, 36 deletions
diff --git a/schemes/ethernetd/src/main.rs b/schemes/ethernetd/src/main.rs
index 8444081..7185435 100644
--- a/schemes/ethernetd/src/main.rs
+++ b/schemes/ethernetd/src/main.rs
@@ -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) => {
diff --git a/schemes/ipd/src/main.rs b/schemes/ipd/src/main.rs
index 019a5e1..49e332f 100644
--- a/schemes/ipd/src/main.rs
+++ b/schemes/ipd/src/main.rs
@@ -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) => {
diff --git a/schemes/tcpd/src/main.rs b/schemes/tcpd/src/main.rs
index 9dfbd02..5344abf 100644
--- a/schemes/tcpd/src/main.rs
+++ b/schemes/tcpd/src/main.rs
@@ -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) => {
diff --git a/schemes/udpd/src/main.rs b/schemes/udpd/src/main.rs
index 2c9396a..0715105 100644
--- a/schemes/udpd/src/main.rs
+++ b/schemes/udpd/src/main.rs
@@ -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) => {