Fix tlsc time check
This commit is contained in:
parent
a392ac1d64
commit
abf97c2a61
15
src/tpm.c
15
src/tpm.c
|
|
@ -140,7 +140,7 @@ int tpm_pay(void* fc, tolling_info_t* info, void* security_socket, uint8_t* neig
|
||||||
uint8_t b_tep[1024];
|
uint8_t b_tep[1024];
|
||||||
asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_TPM, NULL, tolling->station.obu.entry_proof, b_tep, 1024);
|
asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_TPM, NULL, tolling->station.obu.entry_proof, b_tep, 1024);
|
||||||
if (e_tep.encoded == -1) {
|
if (e_tep.encoded == -1) {
|
||||||
syslog_err("[facilities] [tolling] error encoding TPM entry proof");
|
syslog_err("[facilities] [tolling] error encoding TPM entry proof (%s)", e_tep.failed_type->name);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
@ -1026,6 +1026,17 @@ static void veh_handle_recv(tolling_t* tolling, TPM_t* tpm_rx, void* security_so
|
||||||
buf[0] = 4;
|
buf[0] = 4;
|
||||||
enc = oer_encode_to_buffer(&asn_DEF_TransportRequest, NULL, sreq, buf+1, buf_len-1);
|
enc = oer_encode_to_buffer(&asn_DEF_TransportRequest, NULL, sreq, buf+1, buf_len-1);
|
||||||
it2s_tender_queue_send(tx_queue, buf, enc.encoded+1, ITSS_TRANSPORT, id, "TR.data.tcp.connClose");
|
it2s_tender_queue_send(tx_queue, buf, enc.encoded+1, ITSS_TRANSPORT, id, "TR.data.tcp.connClose");
|
||||||
|
|
||||||
|
free(tlsc);
|
||||||
|
for (int i = 0; i < tolling->protocol.c.tls.n_tlsc; ++i) {
|
||||||
|
if (tlsc == tolling->protocol.c.tls.tls_conns[i]) {
|
||||||
|
for (int j = i; j < tolling->protocol.c.tls.n_tlsc-1; ++j) {
|
||||||
|
tolling->protocol.c.tls.tls_conns[j] = tolling->protocol.c.tls.tls_conns[j+1];
|
||||||
|
}
|
||||||
|
--tolling->protocol.c.tls.n_tlsc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
syslog_debug("[facilities] [tolling] unable to close TLS connection, not found");
|
syslog_debug("[facilities] [tolling] unable to close TLS connection, not found");
|
||||||
}
|
}
|
||||||
|
|
@ -1215,7 +1226,7 @@ void tolling_tlsc_mgmt(tolling_t* tolling, it2s_tender_epv_t* epv, it2s_tender_q
|
||||||
uint64_t now = it2s_tender_get_clock(epv);
|
uint64_t now = it2s_tender_get_clock(epv);
|
||||||
for (int i = 0; i < tolling->protocol.c.tls.n_tlsc; ++i) {
|
for (int i = 0; i < tolling->protocol.c.tls.n_tlsc; ++i) {
|
||||||
tlsc_t* tlsc = tolling->protocol.c.tls.tls_conns[i];
|
tlsc_t* tlsc = tolling->protocol.c.tls.tls_conns[i];
|
||||||
if (tlsc->ts + TOLLING_CONN_TIMEOUT_MS > now) {
|
if (tlsc->ts + TOLLING_CONN_TIMEOUT_MS < now) {
|
||||||
SecurityRequest_t* sreq = NULL;
|
SecurityRequest_t* sreq = NULL;
|
||||||
TransportRequest_t* tr = NULL;
|
TransportRequest_t* tr = NULL;
|
||||||
const uint32_t buf_len = 1024;
|
const uint32_t buf_len = 1024;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue