libimcv: Reset of IMC state for new measurement cycle

This commit is contained in:
Andreas Steffen
2018-08-01 15:44:49 +02:00
parent 25973c0350
commit 731e043c8e
13 changed files with 101 additions and 58 deletions
+9 -1
View File
@@ -410,6 +410,7 @@ METHOD(imc_agent_t, change_state, TNC_Result,
imc_state_t **state_p)
{
imc_state_t *state;
TNC_ConnectionState old_state;
switch (new_state)
{
@@ -425,7 +426,7 @@ METHOD(imc_agent_t, change_state, TNC_Result,
this->id, this->name, connection_id);
return TNC_RESULT_FATAL;
}
state->change_state(state, new_state);
old_state = state->change_state(state, new_state);
DBG2(DBG_IMC, "IMC %u \"%s\" changed state of Connection ID %u to '%N'",
this->id, this->name, connection_id,
TNC_Connection_State_names, new_state);
@@ -433,6 +434,13 @@ METHOD(imc_agent_t, change_state, TNC_Result,
{
*state_p = state;
}
if (new_state == TNC_CONNECTION_STATE_HANDSHAKE &&
old_state != TNC_CONNECTION_STATE_CREATE)
{
state->reset(state);
DBG2(DBG_IMC, "IMC %u \"%s\" reset state of Connection ID %u",
this->id, this->name, connection_id);
}
break;
case TNC_CONNECTION_STATE_CREATE:
DBG1(DBG_IMC, "state '%N' should be handled by create_state()",