Enable unknown packet forwarding
This commit is contained in:
parent
8d7b2ac638
commit
3e53b9b08a
|
|
@ -386,6 +386,9 @@ int facilities_config() {
|
|||
// Replay
|
||||
facilities.replay = etsi_its_cfg->networking.replay.activate;
|
||||
|
||||
// Forward unknown packets (in-stack)
|
||||
facilities.upf = etsi_its_cfg->general.unknown_packet_forwarding;
|
||||
|
||||
// PZ
|
||||
if (facilities.station_type == 15) {
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ typedef struct facilities {
|
|||
int station_type;
|
||||
bool use_security;
|
||||
bool replay;
|
||||
bool upf;
|
||||
|
||||
struct {
|
||||
uint16_t width;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
asn_TYPE_descriptor_t *its_msg_def = NULL;
|
||||
|
||||
bool fwd = true;
|
||||
bool process_msg = true;
|
||||
|
||||
uint64_t transmission_duration = 0;
|
||||
uint32_t transmission_interval = 0;
|
||||
|
|
@ -121,7 +122,6 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
npr->transport.choice.btp.destinationPort = Port_ivim;
|
||||
npr->network.choice.gn.packetTransportType = PacketTransportType_shb;
|
||||
npr->network.choice.gn.trafficClass = 1;
|
||||
|
||||
break;
|
||||
|
||||
case ItsMessageType_cpm:
|
||||
|
|
@ -141,18 +141,17 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
break;
|
||||
|
||||
default:
|
||||
if (!facilities.upf) {
|
||||
log_error("unrecognized FR message type (%lld)", frm->itsMessageType);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
} else {
|
||||
process_msg = false;
|
||||
npr->transport.choice.btp.destinationPort = 7120;
|
||||
npr->network.choice.gn.packetTransportType = PacketTransportType_shb;
|
||||
npr->network.choice.gn.trafficClass = 1;
|
||||
}
|
||||
|
||||
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_warn("invalid FR %s received", its_msg_def->name);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
uint64_t id = 0;
|
||||
|
|
@ -163,11 +162,20 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
}
|
||||
|
||||
bool is_update = false;
|
||||
|
||||
int managed_msg = false;
|
||||
if (frm->itsMessageType == ItsMessageType_denm) {
|
||||
managed_msg = true;
|
||||
|
||||
if (process_msg) {
|
||||
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_warn("invalid FR %s received", its_msg_def->name);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
switch (frm->itsMessageType) {
|
||||
case ItsMessageType_denm:
|
||||
managed_msg = true;
|
||||
uint8_t event_type = event_manage(its_msg, &id, NULL, 0);
|
||||
// Do not free its_msg! event_manage takes care of the msg
|
||||
// id will get set to another val if EVENT NEW or UPDATE or CANCELLATION or NEGATION
|
||||
|
|
@ -274,9 +282,9 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (frm->itsMessageType == ItsMessageType_ivim) {
|
||||
break;
|
||||
case ItsMessageType_ivim:
|
||||
managed_msg = true;
|
||||
|
||||
uint8_t service_type = service_eval(SERVICE_IVI, its_msg, &id, NULL, 0);
|
||||
|
||||
if (service_type != SERVICE_NEW &&
|
||||
|
|
@ -311,13 +319,15 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
transmission_interval = facilities.infrastructure.replay_interval;
|
||||
transmission_duration = valid_to - valid_from;
|
||||
}
|
||||
} else if (frm->itsMessageType == ItsMessageType_evrsr) {
|
||||
managed_msg = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!facilities.replay) {
|
||||
transmission_interval = 0;
|
||||
transmission_duration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Respond to [applications]
|
||||
facilities_request_result_accepted(responder);
|
||||
|
|
@ -641,6 +651,7 @@ static int networking_packet_indication_btp(NetworkingPacketIndication_t* npi, v
|
|||
|
||||
bool fwd = false;
|
||||
bool stored = false;
|
||||
bool process_msg = true;
|
||||
|
||||
uint16_t buf_len = 2048;
|
||||
uint8_t buf[buf_len];
|
||||
|
|
@ -704,10 +715,17 @@ static int networking_packet_indication_btp(NetworkingPacketIndication_t* npi, v
|
|||
break;
|
||||
|
||||
default:
|
||||
if (!facilities.upf) {
|
||||
log_debug("messsage with unhandled BTP port received (%lld), ignoring", bpi->destinationPort);
|
||||
goto cleanup;
|
||||
} else {
|
||||
process_msg = false;
|
||||
fwd = true;
|
||||
its_msg_type = 7120;
|
||||
}
|
||||
}
|
||||
|
||||
if (process_msg) {
|
||||
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_descriptor, (void **)&its_msg, npi->data.buf, npi->data.size);
|
||||
if (dec.code) {
|
||||
log_debug("<- invalid %s received", its_msg_descriptor->name);
|
||||
|
|
@ -849,6 +867,7 @@ static int networking_packet_indication_btp(NetworkingPacketIndication_t* npi, v
|
|||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Forward to [applications]
|
||||
if (fwd) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue