Commit 4829fa05 authored by Guido Casati's avatar Guido Casati

Refactor E1AP Bearer Context Setup Request struct members

* cleanup struct members not compliant to specs 3GPP TS 38.463
* add defines whenever necessary
parent 13d1c34d
...@@ -35,10 +35,11 @@ ...@@ -35,10 +35,11 @@
#define E1AP_MAX_NUM_PLMNS 4 #define E1AP_MAX_NUM_PLMNS 4
#define E1AP_MAX_NUM_SLICES 1024 #define E1AP_MAX_NUM_SLICES 1024
#define E1AP_MAX_NUM_CELL_GROUPS 4 #define E1AP_MAX_NUM_CELL_GROUPS 4
#define E1AP_MAX_NUM_QOS_FLOWS 4 #define E1AP_MAX_NUM_QOS_FLOWS 64
#define E1AP_MAX_NUM_PDU_SESSIONS 4 #define E1AP_MAX_NUM_PDU_SESSIONS 4
#define E1AP_MAX_NUM_DRBS 32 #define E1AP_MAX_NUM_DRBS 32
#define E1AP_MAX_NUM_UP_PARAM 4 #define E1AP_MAX_NUM_UP_PARAM 4
#define E1AP_SECURITY_KEY_SIZE 16 // keys have 128 bits length
#define E1AP_REGISTER_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_register_req #define E1AP_REGISTER_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_register_req
#define E1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_setup_req #define E1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_setup_req
...@@ -60,6 +61,17 @@ typedef enum BEARER_CONTEXT_STATUS_e { ...@@ -60,6 +61,17 @@ typedef enum BEARER_CONTEXT_STATUS_e {
BEARER_RESUME, BEARER_RESUME,
} BEARER_CONTEXT_STATUS_t; } BEARER_CONTEXT_STATUS_t;
typedef enum activity_notification_level_e {
ANL_DRB = 0,
ANL_PDU_SESSION,
ANL_UE,
} activity_notification_level_t;
typedef enum cell_group_id_e {
MCG = 0,
SCG,
} cell_group_id_t;
typedef struct PLMN_ID_s { typedef struct PLMN_ID_s {
int mcc; int mcc;
int mnc; int mnc;
...@@ -107,7 +119,7 @@ typedef struct e1ap_setup_fail_s { ...@@ -107,7 +119,7 @@ typedef struct e1ap_setup_fail_s {
} e1ap_setup_fail_t; } e1ap_setup_fail_t;
typedef struct cell_group_s { typedef struct cell_group_s {
long id; cell_group_id_t id;
} cell_group_t; } cell_group_t;
typedef struct up_params_s { typedef struct up_params_s {
...@@ -149,16 +161,21 @@ typedef struct drb_to_setup_s { ...@@ -149,16 +161,21 @@ typedef struct drb_to_setup_s {
typedef struct qos_characteristics_s { typedef struct qos_characteristics_s {
union { union {
struct { struct {
long fiveqi; uint16_t fiveqi;
long qos_priority_level; uint8_t qos_priority_level;
} non_dynamic; } non_dynamic;
struct { struct {
long fiveqi; // -1 -> optional // Range 5QI [0 - 255]
long qos_priority_level; uint16_t fiveqi;
long packet_delay_budget; /* Range [0 - 15]
15 = "no priority," 1-14 = decreasing priority (1 highest), 0 = logical error if received */
uint8_t qos_priority_level;
// Range [0, 1023]: Upper bound for packet delay in 0.5ms units
uint16_t packet_delay_budget;
struct { struct {
long per_scalar; // PER = Scalar x 10^-k (k: 0-9)
long per_exponent; uint8_t per_scalar;
uint8_t per_exponent;
} packet_error_rate; } packet_error_rate;
} dynamic; } dynamic;
}; };
...@@ -167,8 +184,10 @@ typedef struct qos_characteristics_s { ...@@ -167,8 +184,10 @@ typedef struct qos_characteristics_s {
typedef struct ngran_allocation_retention_priority_s { typedef struct ngran_allocation_retention_priority_s {
uint16_t priority_level; uint16_t priority_level;
long preemption_capability; // Pre-emption capability on other QoS flows
long preemption_vulnerability; uint8_t preemption_capability;
// Vulnerability of the QoS flow to pre-emption of other QoS flows
uint8_t preemption_vulnerability;
} ngran_allocation_retention_priority_t; } ngran_allocation_retention_priority_t;
typedef struct qos_flow_level_qos_parameters_s { typedef struct qos_flow_level_qos_parameters_s {
...@@ -209,6 +228,24 @@ typedef struct DRB_nGRAN_to_setup_s { ...@@ -209,6 +228,24 @@ typedef struct DRB_nGRAN_to_setup_s {
qos_flow_to_setup_t qosFlows[E1AP_MAX_NUM_QOS_FLOWS]; qos_flow_to_setup_t qosFlows[E1AP_MAX_NUM_QOS_FLOWS];
} DRB_nGRAN_to_setup_t, DRB_nGRAN_to_mod_t; } DRB_nGRAN_to_setup_t, DRB_nGRAN_to_mod_t;
typedef enum e1ap_indication_e {
SECURITY_REQUIRED = 0,
SECURITY_PREFERRED,
SECURITY_NOT_NEEDED
} e1ap_indication_t;
typedef struct security_indication_s {
e1ap_indication_t integrityProtectionIndication;
e1ap_indication_t confidentialityProtectionIndication;
// Maximum Integrity Protected Data Rate
long maxIPrate;
} security_indication_t;
typedef struct UP_TL_information_s {
in_addr_t tlAddress;
int32_t teId;
} UP_TL_information_t;
/** /**
* PDU Session Resource To Setup List (clause 9.3.3.10) * PDU Session Resource To Setup List (clause 9.3.3.10)
* PDU Session Resource To Modify List (clause 9.3.3.11) * PDU Session Resource To Modify List (clause 9.3.3.11)
...@@ -217,14 +254,8 @@ typedef struct pdu_session_to_setup_s { ...@@ -217,14 +254,8 @@ typedef struct pdu_session_to_setup_s {
long sessionId; long sessionId;
long sessionType; long sessionType;
e1ap_nssai_t nssai; e1ap_nssai_t nssai;
long integrityProtectionIndication; security_indication_t securityIndication;
long confidentialityProtectionIndication; UP_TL_information_t UP_TL_information;
in_addr_t tlAddress;
in_addr_t tlAddress_dl;
int32_t teId;
int32_t teId_dl;
int tl_port;
int tl_port_dl;
long numDRB2Setup; long numDRB2Setup;
DRB_nGRAN_to_setup_t DRBnGRanList[E1AP_MAX_NUM_DRBS]; DRB_nGRAN_to_setup_t DRBnGRanList[E1AP_MAX_NUM_DRBS];
long numDRB2Modify; long numDRB2Modify;
...@@ -238,15 +269,15 @@ typedef struct pdu_session_to_setup_s { ...@@ -238,15 +269,15 @@ typedef struct pdu_session_to_setup_s {
*/ */
typedef struct e1ap_bearer_setup_req_s { typedef struct e1ap_bearer_setup_req_s {
uint32_t gNB_cu_cp_ue_id; uint32_t gNB_cu_cp_ue_id;
uint32_t gNB_cu_up_ue_id; uint32_t gNB_cu_up_ue_id; // Bearer Context Modification Request only
uint64_t cipheringAlgorithm; uint64_t cipheringAlgorithm;
uint64_t integrityProtectionAlgorithm; uint64_t integrityProtectionAlgorithm;
char encryptionKey[128]; char encryptionKey[E1AP_SECURITY_KEY_SIZE];
char integrityProtectionKey[128]; char integrityProtectionKey[E1AP_SECURITY_KEY_SIZE];
long ueDlAggMaxBitRate; long ueDlAggMaxBitRate;
PLMN_ID_t servingPLMNid; PLMN_ID_t servingPLMNid;
BEARER_CONTEXT_STATUS_t bearerContextStatus; BEARER_CONTEXT_STATUS_t bearerContextStatus;
long activityNotificationLevel; activity_notification_level_t activityNotificationLevel;
int numPDUSessions; int numPDUSessions;
pdu_session_to_setup_t pduSession[E1AP_MAX_NUM_PDU_SESSIONS]; pdu_session_to_setup_t pduSession[E1AP_MAX_NUM_PDU_SESSIONS];
int numPDUSessionsMod; int numPDUSessionsMod;
......
...@@ -652,13 +652,13 @@ static int fill_BEARER_CONTEXT_SETUP_REQUEST(e1ap_bearer_setup_req_t *const bear ...@@ -652,13 +652,13 @@ static int fill_BEARER_CONTEXT_SETUP_REQUEST(e1ap_bearer_setup_req_t *const bear
INT24_TO_OCTET_STRING(i->nssai.sd, ieC6_1->sNSSAI.sD); INT24_TO_OCTET_STRING(i->nssai.sd, ieC6_1->sNSSAI.sD);
} }
ieC6_1->securityIndication.integrityProtectionIndication = i->integrityProtectionIndication; ieC6_1->securityIndication.integrityProtectionIndication = i->securityIndication.integrityProtectionIndication;
ieC6_1->securityIndication.confidentialityProtectionIndication = i->confidentialityProtectionIndication; ieC6_1->securityIndication.confidentialityProtectionIndication = i->securityIndication.confidentialityProtectionIndication;
ieC6_1->nG_UL_UP_TNL_Information.present = E1AP_UP_TNL_Information_PR_gTPTunnel; ieC6_1->nG_UL_UP_TNL_Information.present = E1AP_UP_TNL_Information_PR_gTPTunnel;
asn1cCalloc(ieC6_1->nG_UL_UP_TNL_Information.choice.gTPTunnel, gTPTunnel); asn1cCalloc(ieC6_1->nG_UL_UP_TNL_Information.choice.gTPTunnel, gTPTunnel);
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(i->tlAddress, &gTPTunnel->transportLayerAddress); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(i->UP_TL_information.tlAddress, &gTPTunnel->transportLayerAddress);
INT32_TO_OCTET_STRING(i->teId, &gTPTunnel->gTP_TEID); INT32_TO_OCTET_STRING(i->UP_TL_information.teId, &gTPTunnel->gTP_TEID);
for (DRB_nGRAN_to_setup_t *j = i->DRBnGRanList; j < i->DRBnGRanList + i->numDRB2Setup; j++) { for (DRB_nGRAN_to_setup_t *j = i->DRBnGRanList; j < i->DRBnGRanList + i->numDRB2Setup; j++) {
asn1cSequenceAdd(ieC6_1->dRB_To_Setup_List_NG_RAN.list, E1AP_DRB_To_Setup_Item_NG_RAN_t, ieC6_1_1); asn1cSequenceAdd(ieC6_1->dRB_To_Setup_List_NG_RAN.list, E1AP_DRB_To_Setup_Item_NG_RAN_t, ieC6_1_1);
...@@ -951,15 +951,18 @@ static void extract_BEARER_CONTEXT_SETUP_REQUEST(const E1AP_E1AP_PDU_t *pdu, e1a ...@@ -951,15 +951,18 @@ static void extract_BEARER_CONTEXT_SETUP_REQUEST(const E1AP_E1AP_PDU_t *pdu, e1a
if (pdu2Setup->sNSSAI.sD != NULL) if (pdu2Setup->sNSSAI.sD != NULL)
OCTET_STRING_TO_INT24(pdu2Setup->sNSSAI.sD, pdu_session->nssai.sd); OCTET_STRING_TO_INT24(pdu2Setup->sNSSAI.sD, pdu_session->nssai.sd);
pdu_session->integrityProtectionIndication = pdu2Setup->securityIndication.integrityProtectionIndication; pdu_session->securityIndication.integrityProtectionIndication =
pdu_session->confidentialityProtectionIndication = pdu2Setup->securityIndication.confidentialityProtectionIndication; pdu2Setup->securityIndication.integrityProtectionIndication;
pdu_session->securityIndication.confidentialityProtectionIndication =
pdu2Setup->securityIndication.confidentialityProtectionIndication;
if (pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel) { // Optional IE if (pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel) { // Optional IE
DevAssert(pdu2Setup->nG_UL_UP_TNL_Information.present == DevAssert(pdu2Setup->nG_UL_UP_TNL_Information.present ==
E1AP_UP_TNL_Information_PR_gTPTunnel); E1AP_UP_TNL_Information_PR_gTPTunnel);
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel->transportLayerAddress, BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel->transportLayerAddress,
pdu_session->tlAddress); pdu_session->UP_TL_information.tlAddress);
OCTET_STRING_TO_INT32(&pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel->gTP_TEID, pdu_session->teId); OCTET_STRING_TO_INT32(&pdu2Setup->nG_UL_UP_TNL_Information.choice.gTPTunnel->gTP_TEID,
pdu_session->UP_TL_information.teId);
} }
E1AP_DRB_To_Setup_List_NG_RAN_t *drb2SetupList = &pdu2Setup->dRB_To_Setup_List_NG_RAN; E1AP_DRB_To_Setup_List_NG_RAN_t *drb2SetupList = &pdu2Setup->dRB_To_Setup_List_NG_RAN;
......
...@@ -88,11 +88,12 @@ static void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const ...@@ -88,11 +88,12 @@ static void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const
pdcp_config->t_Reordering = calloc(1, sizeof(*pdcp_config->t_Reordering)); pdcp_config->t_Reordering = calloc(1, sizeof(*pdcp_config->t_Reordering));
*pdcp_config->t_Reordering = drb->pdcp_config.reorderingTimer; *pdcp_config->t_Reordering = drb->pdcp_config.reorderingTimer;
pdcp_config->ext1 = NULL; pdcp_config->ext1 = NULL;
if (pdu->integrityProtectionIndication == 0 || // Required const security_indication_t *sec = &pdu->securityIndication;
pdu->integrityProtectionIndication == 1) { // Preferred if (sec->integrityProtectionIndication == SECURITY_REQUIRED ||
sec->integrityProtectionIndication == SECURITY_PREFERRED) {
asn1cCallocOne(drbCfg->integrityProtection, NR_PDCP_Config__drb__integrityProtection_enabled); asn1cCallocOne(drbCfg->integrityProtection, NR_PDCP_Config__drb__integrityProtection_enabled);
} }
if (pdu->confidentialityProtectionIndication == 2) { // Not Needed if (sec->confidentialityProtectionIndication == SECURITY_NOT_NEEDED) {
asn1cCalloc(pdcp_config->ext1, ext1); asn1cCalloc(pdcp_config->ext1, ext1);
asn1cCallocOne(ext1->cipheringDisabled, NR_PDCP_Config__ext1__cipheringDisabled_true); asn1cCallocOne(ext1->cipheringDisabled, NR_PDCP_Config__ext1__cipheringDisabled_true);
} }
...@@ -188,8 +189,8 @@ void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) ...@@ -188,8 +189,8 @@ void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req)
req_drb->id, req_drb->id,
req_pdu->sessionId, req_pdu->sessionId,
qfi, qfi,
req_pdu->tlAddress, req_pdu->UP_TL_information.tlAddress,
req_pdu->teId, req_pdu->UP_TL_information.teId,
nr_pdcp_data_req_drb, nr_pdcp_data_req_drb,
sdap_data_req, sdap_data_req,
&resp_n3); &resp_n3);
......
...@@ -349,11 +349,13 @@ void trigger_bearer_setup(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, int n, pdusession ...@@ -349,11 +349,13 @@ void trigger_bearer_setup(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, int n, pdusession
if (cuup_nssai.sst == 0) if (cuup_nssai.sst == 0)
cuup_nssai = pdu->nssai; /* for CU-UP selection below */ cuup_nssai = pdu->nssai; /* for CU-UP selection below */
pdu->integrityProtectionIndication = rrc->security.do_drb_integrity ? E1AP_IntegrityProtectionIndication_required : E1AP_IntegrityProtectionIndication_not_needed; security_indication_t *sec = &pdu->securityIndication;
sec->integrityProtectionIndication = rrc->security.do_drb_integrity ? SECURITY_REQUIRED
pdu->confidentialityProtectionIndication = rrc->security.do_drb_ciphering ? E1AP_ConfidentialityProtectionIndication_required : E1AP_ConfidentialityProtectionIndication_not_needed; : SECURITY_NOT_NEEDED;
pdu->teId = session->gtp_teid; sec->confidentialityProtectionIndication = rrc->security.do_drb_ciphering ? SECURITY_REQUIRED
memcpy(&pdu->tlAddress, session->upf_addr.buffer, 4); // Fixme: dirty IPv4 target : SECURITY_NOT_NEEDED;
pdu->UP_TL_information.teId = session->gtp_teid;
memcpy(&pdu->UP_TL_information.tlAddress, session->upf_addr.buffer, 4); // Fixme: dirty IPv4 target
/* we assume for the moment one DRB per PDU session. Activate the bearer, /* we assume for the moment one DRB per PDU session. Activate the bearer,
* and configure in RRC. */ * and configure in RRC. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment