ikev2: Destroy IKE_SA if INVALID_SYNTAX notify is received in response

RFC 7296, section 2.21.3:

   If a peer parsing a request notices that it is badly formatted (after
   it has passed the message authentication code checks and window
   checks) and it returns an INVALID_SYNTAX notification, then this
   error notification is considered fatal in both peers, meaning that
   the IKE SA is deleted without needing an explicit Delete payload.
This commit is contained in:
Tobias Brunner
2019-12-09 12:26:54 +01:00
parent 10e0faf477
commit a84aeb01aa
+17
View File
@@ -704,6 +704,23 @@ static status_t process_response(private_task_manager_t *this,
return DESTROY_ME;
}
/* handle fatal INVALID_SYNTAX notifies */
switch (message->get_exchange_type(message))
{
case CREATE_CHILD_SA:
case INFORMATIONAL:
if (message->get_notify(message, INVALID_SYNTAX))
{
DBG1(DBG_IKE, "received %N notify error, destroying IKE_SA",
notify_type_names, INVALID_SYNTAX);
charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
return DESTROY_ME;
}
break;
default:
break;
}
enumerator = array_create_enumerator(this->active_tasks);
while (enumerator->enumerate(enumerator, &task))
{