add more debug info

This commit is contained in:
Jett Chen 2023-11-10 13:04:14 +08:00
parent 14f9745aa9
commit 614e17d2d5
3 changed files with 2 additions and 1 deletions

View file

@ -40,7 +40,6 @@ pub async fn daemon_main() -> Result<()> {
let (commands_tx, commands_rx) = async_channel::unbounded(); let (commands_tx, commands_rx) = async_channel::unbounded();
let (response_tx, response_rx) = async_channel::unbounded(); let (response_tx, response_rx) = async_channel::unbounded();
let mut inst = DaemonInstance::new(commands_rx, response_tx); let mut inst = DaemonInstance::new(commands_rx, response_tx);
// tokio::try_join!(inst.run(), listen(commands_tx, response_rx)).map(|_| ())
let mut _tun = tun::TunInterface::new()?; let mut _tun = tun::TunInterface::new()?;
_tun.set_ipv4_addr(Ipv4Addr::from([192, 168, 1, 10]))?; _tun.set_ipv4_addr(Ipv4Addr::from([192, 168, 1, 10]))?;

View file

@ -138,6 +138,7 @@ fn aead_chacha20_open(
nonce[4..].copy_from_slice(&counter.to_le_bytes()); nonce[4..].copy_from_slice(&counter.to_le_bytes());
log::debug!("TAG A"); log::debug!("TAG A");
log::debug!("{:?};{:?};{:?};{:?};{}", key, data, aad, nonce, counter);
aead_chacha20_open_inner(buffer, key, nonce, data, aad) aead_chacha20_open_inner(buffer, key, nonce, data, aad)
.map_err(|_| WireGuardError::InvalidAeadTag)?; .map_err(|_| WireGuardError::InvalidAeadTag)?;

View file

@ -106,6 +106,7 @@ impl PeerPcb {
} }
TunnResult::WriteToNetwork(packet) => { TunnResult::WriteToNetwork(packet) => {
let socket = self.socket().await?; let socket = self.socket().await?;
tracing::debug!("Our Encapsulated packet: {:?}", packet);
socket.send(packet).await?; socket.send(packet).await?;
} }
_ => panic!("Unexpected result from encapsulate"), _ => panic!("Unexpected result from encapsulate"),