From 44ec846f4ad1c11cc596c9fa6b73284511131ed4 Mon Sep 17 00:00:00 2001 From: Alexander Chernavin Date: Wed, 20 Jul 2022 10:48:56 +0000 Subject: wireguard: add processing of received cookie messages Type: feature Currently, if a handshake message is sent and a cookie message is received in reply, the cookie message will be ignored. Thus, further handshake messages will not have valid mac2 and handshake will not be able to be completed. With this change, process received cookie messages to be able to calculate mac2 for further handshake messages sent. Cover this with tests. Signed-off-by: Alexander Chernavin Change-Id: I6d51459778b7145be7077badec479b2aa85960b9 --- src/plugins/wireguard/wireguard_timer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/wireguard/wireguard_timer.h') diff --git a/src/plugins/wireguard/wireguard_timer.h b/src/plugins/wireguard/wireguard_timer.h index 9d5c071c86e..ebde47e9067 100644 --- a/src/plugins/wireguard/wireguard_timer.h +++ b/src/plugins/wireguard/wireguard_timer.h @@ -57,6 +57,8 @@ void wg_timers_any_authenticated_packet_traversal (wg_peer_t * peer); static inline bool wg_birthdate_has_expired (f64 birthday_seconds, f64 expiration_seconds) { + if (birthday_seconds == 0.0) + return true; f64 now_seconds = vlib_time_now (vlib_get_main ()); return (birthday_seconds + expiration_seconds) < now_seconds; } -- cgit 1.2.3-korg