Closed
Description
steps to reproduce
- cargo build; sudo ./target/debug/demo
- ping 10.0.5.2 in another terminal
- press any key in the same terminal of the demo program
key code
loop {
select! {
r = tun_file.read(&mut tun_buf).fuse() => match r {
Ok(n) => {
println!("read {} bytes {:?} from tun", n, &tun_buf[..n]);
}
Err(e) => {
println!("read error: {}", e);
}
},
line = lines_from_stdin.next().fuse() => match line {
Some(line) => {
let line = line?;
println!("line: {}", line);
let buf: [u8; 32] = [0x45, 0x00, 0x00, 0x20, 0x91, 0xb3, 0x40, 0x00, 0x40, 0x11, 0x8d, 0x17, 0x0a, 0x00, 0x05, 0x01, 0x0a, 0x00, 0x05, 0x03, 0x83, 0x0d, 0x1f, 0x90, 0x00, 0x0c, 0x7c, 0xc9, 0x61, 0x62, 0x63, 0x0a];
match tun_file.write(&buf).await {
Ok(n) => {
println!("write {} bytes to tun", n);
},
Err(e) => {
println!("write error: {}", e); // Illegal seek
}
}
}
None => break,
}
}
}
Metadata
Metadata
Assignees
Labels
No labels