SAEM save neighbour sec ID
This commit is contained in:
parent
63567a5f74
commit
e00d7fc88c
|
|
@ -198,7 +198,12 @@ static int transport_indication(facilities_t *facilities, void* responder, void*
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Port_saem:
|
case Port_saem:
|
||||||
saem_check(facilities, &facilities->bulletin, its_msg);
|
saem_check(
|
||||||
|
facilities,
|
||||||
|
&facilities->bulletin,
|
||||||
|
its_msg,
|
||||||
|
tpi->choice.btp.gn.securityNeighbour ? tpi->choice.btp.gn.securityNeighbour->buf : NULL
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7011:
|
case 7011:
|
||||||
|
|
|
||||||
9
src/sa.c
9
src/sa.c
|
|
@ -21,7 +21,7 @@
|
||||||
#define syslog_debug(msg, ...)
|
#define syslog_debug(msg, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem) {
|
SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem, uint8_t* neighbour) {
|
||||||
|
|
||||||
facilities_t* facilities = (facilities_t*) fc;
|
facilities_t* facilities = (facilities_t*) fc;
|
||||||
|
|
||||||
|
|
@ -97,6 +97,11 @@ SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (neighbour) {
|
||||||
|
bulletin->to_consume[bulletin->to_consume_len]->certificate_id = malloc(8);
|
||||||
|
memcpy(bulletin->to_consume[bulletin->to_consume_len]->certificate_id, neighbour, 8);
|
||||||
|
}
|
||||||
|
|
||||||
index = bulletin->to_consume_len;
|
index = bulletin->to_consume_len;
|
||||||
++bulletin->to_consume_len;
|
++bulletin->to_consume_len;
|
||||||
}
|
}
|
||||||
|
|
@ -343,7 +348,7 @@ void *sa_service(void *fc) {
|
||||||
|
|
||||||
switch (facilities->tolling.protocol) {
|
switch (facilities->tolling.protocol) {
|
||||||
case TOLLING_PROTOCOL_SIMPLE:
|
case TOLLING_PROTOCOL_SIMPLE:
|
||||||
tpm_pay(facilities);
|
tpm_pay(facilities, bulletin->to_consume[a]->certificate_id);
|
||||||
++bulletin->to_consume[a]->n_trigger;
|
++bulletin->to_consume[a]->n_trigger;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
4
src/sa.h
4
src/sa.h
|
|
@ -10,6 +10,8 @@ typedef struct announcement {
|
||||||
uint8_t protocol_id;
|
uint8_t protocol_id;
|
||||||
uint8_t traffic_class;
|
uint8_t traffic_class;
|
||||||
|
|
||||||
|
uint8_t* certificate_id; /* neighbour security-layer identity */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t ipv6_addr[16];
|
uint8_t ipv6_addr[16];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
@ -46,6 +48,6 @@ typedef enum SAEM_CODE {
|
||||||
|
|
||||||
void bulletin_init(bulletin_t* bulletin);
|
void bulletin_init(bulletin_t* bulletin);
|
||||||
|
|
||||||
SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem);
|
SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem, uint8_t* neighbour);
|
||||||
|
|
||||||
void* sa_service(void* fc);
|
void* sa_service(void* fc);
|
||||||
|
|
|
||||||
13
src/tpm.c
13
src/tpm.c
|
|
@ -7,7 +7,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int tpm_pay(void* fc) {
|
int tpm_pay(void* fc, uint8_t* neighbour) {
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
facilities_t* facilities = (facilities_t*) fc;
|
facilities_t* facilities = (facilities_t*) fc;
|
||||||
|
|
@ -112,6 +112,14 @@ int tpm_pay(void* fc) {
|
||||||
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
||||||
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
||||||
|
|
||||||
|
bpr->gn.securityProfile.encrypt = true;
|
||||||
|
bpr->gn.securityProfile.sign = true;
|
||||||
|
|
||||||
|
bpr->gn.securityNeighbour = calloc(1, sizeof(OCTET_STRING_t));
|
||||||
|
bpr->gn.securityNeighbour->size = 8;
|
||||||
|
bpr->gn.securityNeighbour->buf = malloc(8);
|
||||||
|
memcpy(bpr->gn.securityNeighbour->buf, neighbour, 8);
|
||||||
|
|
||||||
bpr->data.size = tpm_uper_len;
|
bpr->data.size = tpm_uper_len;
|
||||||
bpr->data.buf = malloc(tpm_uper_len);
|
bpr->data.buf = malloc(tpm_uper_len);
|
||||||
memcpy(bpr->data.buf, buf, tpm_uper_len);
|
memcpy(bpr->data.buf, buf, tpm_uper_len);
|
||||||
|
|
@ -209,6 +217,9 @@ static void rsu_handle_recv(facilities_t* facilities, TollRequest_t* req, uint8_
|
||||||
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
||||||
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
||||||
|
|
||||||
|
bpr->gn.securityProfile.encrypt = true;
|
||||||
|
bpr->gn.securityProfile.sign = true;
|
||||||
|
|
||||||
bpr->data.size = tpm_uper_len;
|
bpr->data.size = tpm_uper_len;
|
||||||
bpr->data.buf = malloc(tpm_uper_len);
|
bpr->data.buf = malloc(tpm_uper_len);
|
||||||
memcpy(bpr->data.buf, buf, tpm_uper_len);
|
memcpy(bpr->data.buf, buf, tpm_uper_len);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue