tap is ok
This commit is contained in:
parent
c130dcc83e
commit
1a5e1d8be3
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
.client
|
.client
|
||||||
.output
|
.output
|
||||||
sdlan
|
sdlan
|
||||||
|
sdlan.exe
|
||||||
@ -742,6 +742,7 @@ async fn handle_tun_packet(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let data = origin.unwrap();
|
let data = origin.unwrap();
|
||||||
|
debug!("ether size is {}", data.len());
|
||||||
let msg_size = data.len() as u64;
|
let msg_size = data.len() as u64;
|
||||||
|
|
||||||
let Ok(dst_mac) = pkt.dst_mac.try_into() else {
|
let Ok(dst_mac) = pkt.dst_mac.try_into() else {
|
||||||
@ -766,8 +767,10 @@ async fn handle_tun_packet(
|
|||||||
debug!("got packet from sock, will send to tun");
|
debug!("got packet from sock, will send to tun");
|
||||||
match Ethernet2Header::from_slice(&data) {
|
match Ethernet2Header::from_slice(&data) {
|
||||||
Ok((hdr, rest)) => {
|
Ok((hdr, rest)) => {
|
||||||
|
debug!("ip size is {}", rest.len());
|
||||||
let edge = get_edge();
|
let edge = get_edge();
|
||||||
let self_mac = edge.device_config.get_mac();
|
let self_mac = edge.device_config.get_mac();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if hdr.destination != self_mac && hdr.destination != BROADCAST_MAC {
|
if hdr.destination != self_mac && hdr.destination != BROADCAST_MAC {
|
||||||
error!(
|
error!(
|
||||||
@ -860,7 +863,14 @@ async fn handle_tun_packet(
|
|||||||
} else {
|
} else {
|
||||||
println!("got ip packet");
|
println!("got ip packet");
|
||||||
println!("got data: {:?}", rest);
|
println!("got data: {:?}", rest);
|
||||||
edge.device.send(rest);
|
match edge.device.send(rest) {
|
||||||
|
Ok(size) => {
|
||||||
|
debug!("send to tun {} bytes", size);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
error!("failed to send to device");
|
||||||
|
}
|
||||||
|
}
|
||||||
// edge.tun.send_data_to_tun(Vec::from(hdr.1)).await;
|
// edge.tun.send_data_to_tun(Vec::from(hdr.1)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
wintun.dll
Normal file
BIN
wintun.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user