Commit edb790ab authored by rmagueta's avatar rmagueta

Merge remote-tracking branch 'origin/NR_SA_F1AP_5GRECORDS' into develop-NR_SA_F1AP_5GRECORDS

parents 987455b9 19ba8dd7
......@@ -364,7 +364,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if (itti_create_task (TASK_GTPV1_U, &gtpv1u_gNB_task, NULL) < 0) {
if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
}
......
......@@ -1039,14 +1039,14 @@ rrc_gNB_process_RRCReconfigurationComplete(
SRB_configList, // NULL,
DRB_configList,
DRB_Release_configList2,
0xff, // already configured during the securitymodecommand
0, // already configured during the securitymodecommand
kRRCenc,
kRRCint,
kUPenc,
NULL,
NULL,
NULL,
NULL);
ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList);
/* Refresh SRBs/DRBs */
if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
nr_rrc_rlc_config_asn1_req(ctxt_pP,
......@@ -1054,7 +1054,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
DRB_configList,
DRB_Release_configList2,
NULL,
NULL,
ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList,
NULL);
}
#endif
......
......@@ -54,6 +54,8 @@ int encode_pdu_session_establishment_request(pdu_session_establishment_request_m
encoded++;
IES_ENCODE_U16(buffer, encoded, pdusessionestablishrequest->maxdatarate);
*(buffer + encoded) = pdusessionestablishrequest->pdusessiontype;
encoded++;
return encoded;
}
......
......@@ -53,6 +53,7 @@ typedef struct pdu_session_establishment_request_msg_tag {
uint8_t pti;
MessageType pdusessionestblishmsgtype;
uint16_t maxdatarate;
uint8_t pdusessiontype;
/* Optional fields */
} pdu_session_establishment_request_msg;
......
......@@ -40,12 +40,20 @@
#include "PduSessionEstablishRequest.h"
# include "intertask_interface.h"
char netName[] = "5G:mnc093.mcc208.3gppnetwork.org";
/*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org";
char imsi[] = "2089300007487";
// USIM_API_K: 5122250214c33e723a5dd523fc145fc0
uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0};
// OPC: 981d464c7c52eb6e5036234984ad0bcf
const uint8_t opc[16] = {0x98, 0x1d, 0x46, 0x4c,0x7c,0x52,0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf};
const uint8_t opc[16] = {0x98, 0x1d, 0x46, 0x4c,0x7c,0x52,0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf};*/
char netName[] = "5G:mnc099.mcc208.3gppnetwork.org";
char imsi[] = "2089900007487"; //"208990100001100";
// USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f
uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f};
// OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1
const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1};
uint8_t *registration_request_buf;
uint32_t registration_request_len;
......@@ -275,14 +283,14 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
mm_msg->registration_request.fgsregistrationtype = INITIAL_REGISTRATION;
mm_msg->registration_request.naskeysetidentifier.naskeysetidentifier = 1;
size += 1;
if(1){
if(0){
mm_msg->registration_request.fgsmobileidentity.guti.typeofidentity = FGS_MOBILE_IDENTITY_5G_GUTI;
mm_msg->registration_request.fgsmobileidentity.guti.amfregionid = 0xca;
mm_msg->registration_request.fgsmobileidentity.guti.amfpointer = 0;
mm_msg->registration_request.fgsmobileidentity.guti.amfsetid = 1016;
mm_msg->registration_request.fgsmobileidentity.guti.tmsi = 10;
mm_msg->registration_request.fgsmobileidentity.guti.mncdigit1 = 9;
mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = 3;
mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = 9;
mm_msg->registration_request.fgsmobileidentity.guti.mncdigit3 = 0xf;
mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = 2;
mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = 0;
......@@ -293,7 +301,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
} else {
mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = 9;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 3;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 9;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = 0xf;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0;
......@@ -350,7 +358,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype
if(identitytype == FGS_MOBILE_IDENTITY_SUCI){
mm_msg->fgs_identity_response.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit1 = 9;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = 3;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = 9;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit3 = 0xf;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = 2;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = 0;
......@@ -614,14 +622,15 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
memset(&nas_msg, 0, sizeof(fgs_nas_message_t));
// setup pdu session establishment request
uint16_t req_length = 6;
uint16_t req_length = 7;
uint8_t *req_buffer = malloc(req_length);
pdu_session_establishment_request_msg pdu_session_establish;
pdu_session_establish.protocoldiscriminator = FGS_SESSION_MANAGEMENT_MESSAGE;
pdu_session_establish.pdusessionid = 10;
pdu_session_establish.pti = 0;
pdu_session_establish.pti = 1;
pdu_session_establish.pdusessionestblishmsgtype = FGS_PDU_SESSION_ESTABLISHMENT_REQ;
pdu_session_establish.maxdatarate = 0xffff;
pdu_session_establish.pdusessiontype = 0x91;
encode_pdu_session_establishment_request(&pdu_session_establish, req_buffer);
......@@ -629,9 +638,8 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
MM_msg *mm_msg;
nas_stream_cipher_t stream_cipher;
uint8_t mac[4];
uint8_t nssai[]={1,1,2,3};
uint8_t dnn[9]={0x8,0x69,0x6e,0x74,0x65,0x72,0x6e,0x65,0x74};
// set security protected header
uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1
uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai"
nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE;
nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX;
size += 7;
......@@ -663,9 +671,9 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
mm_msg->uplink_nas_transport.snssai.length = 4;
mm_msg->uplink_nas_transport.snssai.value = nssai;
size += (1+1+4);
mm_msg->uplink_nas_transport.dnn.length = 9;
mm_msg->uplink_nas_transport.dnn.length = 4;
mm_msg->uplink_nas_transport.dnn.value = dnn;
size += (1+1+9);
size += (1+1+4);
// encode the message
initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t));
......
......@@ -144,7 +144,6 @@ extern int asn1_xer_print;
if (ie == NULL ) { \
NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
} \
if (mandatory) DevAssert(ie != NULL); \
} while(0)
/** \brief Function callback prototype.
**/
......
......@@ -1061,12 +1061,31 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AllowedNSSAI, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
//if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL;
NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0);
DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs);
NGAP_WARN("AllowedNSSAI.list.count %d\n", ie != NULL ? ie->value.choice.AllowedNSSAI.list.count : 2);
//NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
//DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0);
//DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs);
if (ie == NULL) {
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = 2;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sST = 01;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD_flag = 1;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[0] = 01;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[1] = 02;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sD[2] = 03;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sST = 01;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD_flag = 1;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[0] = 00;//11;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[1] = 00;//22;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[2] = 01;//33;
} else {
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count;
......@@ -1082,9 +1101,10 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[2] = allow_nssai_item_p->s_NSSAI.sD->buf[2];
}
}
} else {/* ie != NULL */
return -1;
}
}
//} else {/* ie != NULL */
// return -1;
//}
/* id-UESecurityCapabilities */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
......
......@@ -932,7 +932,7 @@ int ngap_gNB_ue_capabilities(instance_t instance,
/* mandatory */
ie = (NGAP_UERadioCapabilityInfoIndicationIEs_t *)calloc(1, sizeof(NGAP_UERadioCapabilityInfoIndicationIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_UERadioCapability;
ie->criticality = NGAP_Criticality_reject;
ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_UERadioCapability;
ie->value.choice.UERadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer;
ie->value.choice.UERadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length;
......
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