use base IMC ID if src IMC ID is not supported
[strongswan.git] / src / libimcv / plugins / imc_test / imc_test.c
index 6283309..ee8e5b2 100644 (file)
@@ -284,6 +284,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
        imc_state_t *state;
        enumerator_t *enumerator;
        TNC_Result result;
+       TNC_UInt32 target_imc_id;
        bool fatal_error = FALSE;
 
        if (!imc_test)
@@ -307,6 +308,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
        {
                return result;
        }
+       target_imc_id = (dst_imc_id == TNC_IMCID_ANY) ? imc_id : dst_imc_id;
 
        /* preprocess any IETF standard error attributes */
        fatal_error = pa_tnc_msg->process_ietf_std_errors(pa_tnc_msg);
@@ -322,7 +324,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
                        ietf_attr_assess_result_t *ietf_attr;
 
                        ietf_attr = (ietf_attr_assess_result_t*)attr;
-                       state->set_result(state, dst_imc_id,
+                       state->set_result(state, target_imc_id,
                                                          ietf_attr->get_result(ietf_attr));
                }
                else if (attr_type.vendor_id == PEN_ITA)
@@ -354,7 +356,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
        }
 
        /* if no assessment result is known then repeat the measurement */
-       return state->get_result(state, dst_imc_id, NULL) ?
+       return state->get_result(state, target_imc_id, NULL) ?
                   TNC_RESULT_SUCCESS : send_message(state, dst_imc_id, src_imv_id);
 }