Cleaned up quick mode notify processing
This commit is contained in:
@@ -595,24 +595,45 @@ METHOD(task_t, build_i, status_t,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t process_notify(notify_payload_t *notify)
|
/**
|
||||||
|
* Check for notify errors, return TRUE if error found
|
||||||
|
*/
|
||||||
|
static bool has_notify_errors(private_quick_mode_t *this, message_t *message)
|
||||||
{
|
{
|
||||||
if(notify->get_notify_type(notify) < 16384)
|
enumerator_t *enumerator;
|
||||||
|
payload_t *payload;
|
||||||
|
bool err = FALSE;
|
||||||
|
|
||||||
|
enumerator = message->create_payload_enumerator(message);
|
||||||
|
while (enumerator->enumerate(enumerator, &payload))
|
||||||
{
|
{
|
||||||
DBG1(DBG_IKE, "Received %N error notification.", notify_type_names, notify->get_notify_type(notify));
|
if (payload->get_type(payload) == NOTIFY_V1)
|
||||||
return FAILED;
|
{
|
||||||
|
notify_payload_t *notify;
|
||||||
|
notify_type_t type;
|
||||||
|
|
||||||
|
notify = (notify_payload_t*)payload;
|
||||||
|
type = notify->get_notify_type(notify);
|
||||||
|
if (type < 16384)
|
||||||
|
{
|
||||||
|
DBG1(DBG_IKE, "received %N error notify",
|
||||||
|
notify_type_names, type);
|
||||||
|
err = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBG1(DBG_IKE, "received %N notify", notify_type_names, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DBG1(DBG_IKE, "Received %N notification.", notify_type_names, notify->get_notify_type(notify));
|
enumerator->destroy(enumerator);
|
||||||
return SUCCESS;
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(task_t, process_r, status_t,
|
METHOD(task_t, process_r, status_t,
|
||||||
private_quick_mode_t *this, message_t *message)
|
private_quick_mode_t *this, message_t *message)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
|
||||||
payload_t *payload;
|
|
||||||
status_t status;
|
|
||||||
|
|
||||||
switch (this->state)
|
switch (this->state)
|
||||||
{
|
{
|
||||||
case QM_INIT:
|
case QM_INIT:
|
||||||
@@ -705,19 +726,10 @@ METHOD(task_t, process_r, status_t,
|
|||||||
}
|
}
|
||||||
case QM_NEGOTIATED:
|
case QM_NEGOTIATED:
|
||||||
{
|
{
|
||||||
enumerator = message->create_payload_enumerator(message);
|
if (has_notify_errors(this, message))
|
||||||
while(enumerator->enumerate(enumerator, &payload))
|
|
||||||
{
|
{
|
||||||
if(payload->get_type(payload) == NOTIFY_V1)
|
return FAILED;
|
||||||
{
|
|
||||||
status = process_notify((notify_payload_t *)payload);
|
|
||||||
if(status != SUCCESS)
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
|
||||||
if (!install(this))
|
if (!install(this))
|
||||||
{
|
{
|
||||||
return FAILED;
|
return FAILED;
|
||||||
|
|||||||
Reference in New Issue
Block a user