Fix various problems in 4G NAS handling

- rename as_nas_info_t member data to nas_data to have a uniq name to
  trace between complex malloc/free of this pointer
- fix, maybe not perfect, these pais od malloc/free
- remove typedef name changes across transmission of these as_nas_info_t
  over itti, as name changing makes it even more confusing
- remove globals that are likely possible races
- in as_message_decode() fix memcpy size, it is hard to understand the
  initial idea, likely the author beleives a struct of struct makes a
  intermediate pointer
- in network_api.c remove globals (static but used globally)
- remove casts that are there to hide gcc warnings on probable unaligned
  access
- remain a weird mix of packed/unpacked versions of the same typedef,
  but gcc is happy
This commit is contained in:
Laurent THOMAS
2024-10-22 11:05:20 +02:00
parent 8df8de894b
commit e48e38650d
15 changed files with 203 additions and 330 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ typedef struct as_stmsi_s {
/* Dedicated NAS information */
typedef struct as_nas_info_s {
uint32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */
Byte_t* nas_data; /* Dedicated NAS information data container */
} as_nas_info_t;
/* Radio Access Bearer identity */
+15 -15
View File
@@ -57,26 +57,26 @@ MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigura
MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req)
// UE: NAS -> RRC messages
MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req)
MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req)
MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req)
MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req)
MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, NasDetachReq, nas_detach_req)
MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, NasDeregistrationReq, nas_deregistration_req)
MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, kenb_refresh_req_t, nas_kenb_refresh_req)
MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, cell_info_req_t, nas_cell_selection_req)
MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, nas_establish_req_t, nas_conn_establi_req)
MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, ul_info_transfer_req_t, nas_ul_data_req)
MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, nas_detach_req_t, nas_detach_req)
MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, nas_deregistration_req_t, nas_deregistration_req)
MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp)
MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, rab_establish_rsp_t, nas_rab_est_rsp)
MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, NasOaiTunNsa, nas_oai_tun_nsa)
MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, nas_oai_tun_nsa_t, nas_oai_tun_nsa)
// UE: RRC -> NAS messages
MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf)
MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelectionInd, nas_cell_selection_ind)
MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, NasPagingInd, nas_paging_ind)
MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, NasConnEstabCnf, nas_conn_establi_cnf)
MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NasConnReleaseInd, nas_conn_release_ind)
MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, cell_info_cnf_t, nas_cell_selection_cnf)
MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, cell_info_ind_t, nas_cell_selection_ind)
MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, paging_ind_t, nas_paging_ind)
MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, nas_establish_cnf_t, nas_conn_establi_cnf)
MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, nas_release_ind_t, nas_conn_release_ind)
MESSAGE_DEF(NR_NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NRNasConnReleaseInd, nr_nas_conn_release_ind)
MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, NasUlDataCnf, nas_ul_data_cnf)
MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd, nas_dl_data_ind)
MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, ul_info_transfer_cnf_t, nas_ul_data_cnf)
MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t, nas_dl_data_ind)
// xNB: realtime -> RRC messages
MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process)
+1 -22
View File
@@ -422,28 +422,7 @@ typedef struct NRDuDlReq_s {
rnti_t rnti;
uint8_t *buf;
uint64_t srb_id;
} NRDuDlReq_t;
// UE: NAS -> RRC messages
typedef kenb_refresh_req_t NasKenbRefreshReq;
typedef cell_info_req_t NasCellSelectionReq;
typedef nas_establish_req_t NasConnEstabliReq;
typedef ul_info_transfer_req_t NasUlDataReq;
typedef nas_deregistration_req_t NasDeregistrationReq;
typedef nas_detach_req_t NasDetachReq;
typedef rab_establish_rsp_t NasRabEstRsp;
typedef nas_oai_tun_nsa_t NasOaiTunNsa;
// UE: RRC -> NAS messages
typedef cell_info_cnf_t NasCellSelectionCnf;
typedef cell_info_ind_t NasCellSelectionInd;
typedef paging_ind_t NasPagingInd;
typedef nas_establish_cnf_t NasConnEstabCnf;
typedef nas_release_ind_t NasConnReleaseInd;
typedef ul_info_transfer_cnf_t NasUlDataCnf;
typedef dl_info_transfer_ind_t NasDlDataInd;
} NRDuDlReq_t;
// eNB: realtime -> RRC messages
typedef struct rrc_subframe_process_s {