ikev2: start counting msgid from 0 89/31289/3
authorFilip Tehlar <ftehlar@cisco.com>
Mon, 15 Feb 2021 14:06:45 +0000 (14:06 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Fri, 19 Feb 2021 09:32:35 +0000 (09:32 +0000)
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>
src/plugins/ikev2/ikev2.c

index f33496c..d5dd013 100644 (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)