cloudflare / cloudflare/boringtun

Send a queued data packet when a Handshake response packet is received

Open
#61 2 comments 0 reactions 0 assignees View on GitHub
enhancement security review
Dominant language
Rust
Stars
7.2k
Forks
532
PR merge metrics
No merged PRs in 30d

Description

Right now when a Handshake response is received (in reply to an Initiation message), a Keep-Alive message is sent. Instead it should try to send a queued message when available (which is what others implementations do).

Relevant code in src/noise/handshake.rs:

```rust
2 => {
self.log(Verbosity::Debug, "Received handhsake_response");
let mut handshake = self.handshake.lock();
match handshake.receive_handshake_response(src) {
Ok(session) => {
let keepalive_packet = session.format_packet_data(&[], dst);
let index = session.local_index();
*self.sessions[index % N_SESSIONS].write() = Some(session);
// Make session the current session
self.current.store(index, Ordering::SeqCst);
self.timer_tick_session_established(true); // New session established, we are the initiator
self.timer_tick(TimerName::TimeLastPacketReceived);
TunnResult::WriteToNetwork(keepalive_packet) // Send a keepalive as a response
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.