VCM: check reply nonce vs. session nonce in own req mnvrs

This commit is contained in:
emanuel 2023-03-17 10:28:17 +00:00
parent 648f9c506c
commit 57fb624719
2 changed files with 17 additions and 16 deletions

View File

@ -117,7 +117,7 @@ int facilities_request_single_message(void* responder, FacilitiesMessageRequest_
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_def, (void**) &its_msg, frm->data.buf, frm->data.size);
if (dec.code) {
log_debug("invalid FR %s received", its_msg_def->name);
log_warn("invalid FR %s received", its_msg_def->name);
facilities_request_result_rejected(responder);
rv = 1;
goto cleanup;

View File

@ -284,7 +284,7 @@ static bool commit() {
return false;
}
log_debug("[vc] issuing COMMIT for session %d", coordination->session.nonce);
log_debug("[vc] issuing COMMIT - session %d", coordination->session.nonce);
VCM_t* vcm_com = calloc(1, sizeof(VCM_t));
vcm_com->header.messageID = 43;
@ -599,6 +599,10 @@ static int vcm_check_handle_reply(VCM_t* vcm, mc_neighbour_s* neighbour) {
CoordinationReply_t* reply = &vcm->vcm.maneuverContainer.choice.vehicle.negotiation->choice.reply;
if (reply->nonce != coordination->session.nonce) {
return 1;
}
itss_time_lock();
uint64_t now_us = itss_ts_get(TIME_MICROSECONDS);
itss_time_unlock();
@ -630,28 +634,25 @@ static int vcm_check_handle_reply(VCM_t* vcm, mc_neighbour_s* neighbour) {
}
}
neighbour->intersecting = false;
neighbour->proposed = false;
if (!is_maneuver_approved()) {
return 1;
}
log_info("[vc] received VCM.reply from %d with %d accepted trajectories - session: %d | took %ld us",
vcm->header.stationID,
reply->acceptedTrajectoriesIds.list.count,
coordination->session.nonce,
now_us-neighbour->t_iid);
if (coordination->protocol == MC_PROTOCOL_VCM_RR) {
session_cleanup();
}
log_info("[vc] received VCM.reply from %d with %d accepted trajectories | took %ld us",
vcm->header.stationID,
reply->acceptedTrajectoriesIds.list.count,
now_us-neighbour->t_iid);
neighbour->intersecting = false;
neighbour->proposed = false;
} else { /* REPLIER */
log_debug("[vc] received VCM.reply is response to another ITS-S VCM.request");
if (reply->nonce != coordination->session.nonce) {
return 1;
}
log_debug("[vc] received VCM.reply is response to another ITS-S VCM.request - session: %d", coordination->session.nonce);
if (reply->acceptedTrajectoriesIds.list.count == 0) {
session_cleanup();
@ -845,7 +846,7 @@ static int intersection_detected(VCM_t* vcm, mc_neighbour_s* neighbour) {
wr += sprintf(buffer + wr, " %d", intneigh[i]->station_id);
#endif
}
log_debug("[vc] this VCM.request affects %d station(s):%s", n_intneigh, buffer);
log_debug("[vc] this VCM.request affects %d station(s):%s - session: %d", n_intneigh, buffer, coordination->session.nonce);
coordination->session.own_req = vcm_req;
coordination->session.ts = now;