ikev2: start counting msgid from 0

This fixes an issue when initiator is expecting request with intitial
msgid being 0 but 1 is received instead which results in retransmission
(instead of normally processing the new request).

Type: fix

Change-Id: I60062276bd93de78128847c5b15f5d6cecf1df65
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
This commit is contained in:
Filip Tehlar
2021-02-15 14:06:45 +00:00
committed by Beno�t Ganne
parent ee5cd4e470
commit 428a442a5c

View File

@@ -2732,7 +2732,7 @@ ikev2_retransmit_resp (ikev2_sa_t * sa, ike_header_t * ike)
u32 msg_id = clib_net_to_host_u32 (ike->msgid);
/* new req */
if (msg_id > sa->last_msg_id)
if (msg_id > sa->last_msg_id || sa->last_msg_id == ~0)
{
sa->last_msg_id = msg_id;
return 0;
@@ -3146,6 +3146,7 @@ ikev2_node_internal (vlib_main_t *vm, vlib_node_runtime_t *node,
if (sa0->is_initiator)
{
sa0->last_msg_id = ~0;
ikev2_del_sa_init (sa0->ispi);
}
else
@@ -3153,7 +3154,6 @@ ikev2_node_internal (vlib_main_t *vm, vlib_node_runtime_t *node,
sa0->stats.n_sa_auth_req++;
stats->n_sa_auth_req++;
ike0->flags = IKEV2_HDR_FLAG_RESPONSE;
sa0->last_init_msg_id = 1;
slen =
ikev2_generate_message (b0, sa0, ike0, 0, udp0, stats);
if (~0 == slen)