Error reporting for invalid IKEv2 responses fixed.
This commit is contained in:
@@ -945,10 +945,8 @@ static void send_notify_response(private_task_manager_t *this,
|
|||||||
static status_t parse_message(private_task_manager_t *this, message_t *msg)
|
static status_t parse_message(private_task_manager_t *this, message_t *msg)
|
||||||
{
|
{
|
||||||
status_t status;
|
status_t status;
|
||||||
bool is_request;
|
|
||||||
u_int8_t type = 0;
|
u_int8_t type = 0;
|
||||||
|
|
||||||
is_request = msg->get_request(msg);
|
|
||||||
status = msg->parse_body(msg, this->ike_sa->get_keymat(this->ike_sa));
|
status = msg->parse_body(msg, this->ike_sa->get_keymat(this->ike_sa));
|
||||||
|
|
||||||
if (status == SUCCESS)
|
if (status == SUCCESS)
|
||||||
@@ -975,47 +973,46 @@ static status_t parse_message(private_task_manager_t *this, message_t *msg)
|
|||||||
|
|
||||||
if (status != SUCCESS)
|
if (status != SUCCESS)
|
||||||
{
|
{
|
||||||
if (is_request)
|
bool is_request = msg->get_request(msg);
|
||||||
|
|
||||||
|
switch (status)
|
||||||
{
|
{
|
||||||
switch (status)
|
case NOT_SUPPORTED:
|
||||||
{
|
DBG1(DBG_IKE, "critical unknown payloads found");
|
||||||
case NOT_SUPPORTED:
|
if (is_request)
|
||||||
DBG1(DBG_IKE, "critical unknown payloads found");
|
{
|
||||||
if (is_request)
|
send_notify_response(this, msg,
|
||||||
{
|
UNSUPPORTED_CRITICAL_PAYLOAD,
|
||||||
send_notify_response(this, msg,
|
chunk_from_thing(type));
|
||||||
UNSUPPORTED_CRITICAL_PAYLOAD,
|
incr_mid(this, FALSE);
|
||||||
chunk_from_thing(type));
|
}
|
||||||
incr_mid(this, FALSE);
|
break;
|
||||||
}
|
case PARSE_ERROR:
|
||||||
break;
|
DBG1(DBG_IKE, "message parsing failed");
|
||||||
case PARSE_ERROR:
|
if (is_request)
|
||||||
DBG1(DBG_IKE, "message parsing failed");
|
{
|
||||||
if (is_request)
|
send_notify_response(this, msg,
|
||||||
{
|
INVALID_SYNTAX, chunk_empty);
|
||||||
send_notify_response(this, msg,
|
incr_mid(this, FALSE);
|
||||||
INVALID_SYNTAX, chunk_empty);
|
}
|
||||||
incr_mid(this, FALSE);
|
break;
|
||||||
}
|
case VERIFY_ERROR:
|
||||||
break;
|
DBG1(DBG_IKE, "message verification failed");
|
||||||
case VERIFY_ERROR:
|
if (is_request)
|
||||||
DBG1(DBG_IKE, "message verification failed");
|
{
|
||||||
if (is_request)
|
send_notify_response(this, msg,
|
||||||
{
|
INVALID_SYNTAX, chunk_empty);
|
||||||
send_notify_response(this, msg,
|
incr_mid(this, FALSE);
|
||||||
INVALID_SYNTAX, chunk_empty);
|
}
|
||||||
incr_mid(this, FALSE);
|
break;
|
||||||
}
|
case FAILED:
|
||||||
break;
|
DBG1(DBG_IKE, "integrity check failed");
|
||||||
case FAILED:
|
/* ignored */
|
||||||
DBG1(DBG_IKE, "integrity check failed");
|
break;
|
||||||
/* ignored */
|
case INVALID_STATE:
|
||||||
break;
|
DBG1(DBG_IKE, "found encrypted message, but no keys available");
|
||||||
case INVALID_STATE:
|
default:
|
||||||
DBG1(DBG_IKE, "found encrypted message, but no keys available");
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DBG1(DBG_IKE, "%N %s with message ID %d processing failed",
|
DBG1(DBG_IKE, "%N %s with message ID %d processing failed",
|
||||||
exchange_type_names, msg->get_exchange_type(msg),
|
exchange_type_names, msg->get_exchange_type(msg),
|
||||||
|
|||||||
Reference in New Issue
Block a user