Handshake state collision between parralel RoutineHandshake threads

Laura Zelenku laura.zelenku at wandera.com
Tue Dec 22 11:16:24 CET 2020

Hello devs,
I’m getting errors "handshake initiation must be consumed first” caused by handshake state is not set to HandshakeInitiationConsumed when processing handshake initiation from a peer. The handshake state is changed between “ConsumeMessageInitiation” and “CreateMessageResponse” by processing handshake response from the same peer in different thread.
You know, UDP packet can be delayed or lost mainly from mobile devices with worse mobile signal. After some time (handshake timeout) the peer that initiated connection doesn’t send any handshake (handshake is not delivered) to other side, the other side starts to send its own handshake initiation requests. And now there are both sides sending handshakes.

In a log I’ve found “Received handshake response”, “Received handshake initiation” and “Failed to create response message” on the same time (ms).

1) lower log level of "handshake initiation must be consumed first”
2) start only one RoutineHandshake (not based on nr. of CPUs)
3) extend critical section over whole MessageInitiation processing

thanks and I’m looking forward for following discussions
*IMPORTANT NOTICE*: This email, its attachments and any rights attaching 
hereto are confidential and intended exclusively for the person to whom the 
email is addressed. If you are not the intended recipient, do not read, 
copy, disclose or use the contents in any way. Wandera accepts no liability 
for any loss, damage or consequence resulting directly or indirectly from 
the use of this email and attachments.

More information about the WireGuard mailing list