Commit 20653cd3 authored by matzakos's avatar matzakos

Modify configuration of NGAP and NAS messages to comply with OAI CN...

Modify configuration of NGAP and NAS messages to comply with OAI CN configuration according to Fujitsu patch

-Hardcodings to be removed later when the NAS extensions will be integrated for OAI UE
parent a8adcf86
...@@ -40,12 +40,20 @@ ...@@ -40,12 +40,20 @@
#include "PduSessionEstablishRequest.h" #include "PduSessionEstablishRequest.h"
# include "intertask_interface.h" # include "intertask_interface.h"
char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; /*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org";
char imsi[] = "2089300007487"; char imsi[] = "2089300007487";
// USIM_API_K: 5122250214c33e723a5dd523fc145fc0 // USIM_API_K: 5122250214c33e723a5dd523fc145fc0
uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0}; uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0};
// OPC: 981d464c7c52eb6e5036234984ad0bcf // 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; uint8_t *registration_request_buf;
uint32_t registration_request_len; uint32_t registration_request_len;
...@@ -275,14 +283,14 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { ...@@ -275,14 +283,14 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
mm_msg->registration_request.fgsregistrationtype = INITIAL_REGISTRATION; mm_msg->registration_request.fgsregistrationtype = INITIAL_REGISTRATION;
mm_msg->registration_request.naskeysetidentifier.naskeysetidentifier = 1; mm_msg->registration_request.naskeysetidentifier.naskeysetidentifier = 1;
size += 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.typeofidentity = FGS_MOBILE_IDENTITY_5G_GUTI;
mm_msg->registration_request.fgsmobileidentity.guti.amfregionid = 0xca; mm_msg->registration_request.fgsmobileidentity.guti.amfregionid = 0xca;
mm_msg->registration_request.fgsmobileidentity.guti.amfpointer = 0; mm_msg->registration_request.fgsmobileidentity.guti.amfpointer = 0;
mm_msg->registration_request.fgsmobileidentity.guti.amfsetid = 1016; mm_msg->registration_request.fgsmobileidentity.guti.amfsetid = 1016;
mm_msg->registration_request.fgsmobileidentity.guti.tmsi = 10; mm_msg->registration_request.fgsmobileidentity.guti.tmsi = 10;
mm_msg->registration_request.fgsmobileidentity.guti.mncdigit1 = 9; 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.mncdigit3 = 0xf;
mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = 2; mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = 2;
mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = 0; mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = 0;
...@@ -293,7 +301,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { ...@@ -293,7 +301,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
} else { } else {
mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI; 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.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.mncdigit3 = 0xf;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2; mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0; mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0;
...@@ -350,7 +358,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype ...@@ -350,7 +358,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype
if(identitytype == FGS_MOBILE_IDENTITY_SUCI){ 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.typeofidentity = FGS_MOBILE_IDENTITY_SUCI;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit1 = 9; 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.mncdigit3 = 0xf;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = 2; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = 2;
mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = 0; mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = 0;
...@@ -614,14 +622,15 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ ...@@ -614,14 +622,15 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
memset(&nas_msg, 0, sizeof(fgs_nas_message_t)); memset(&nas_msg, 0, sizeof(fgs_nas_message_t));
// setup pdu session establishment request // setup pdu session establishment request
uint16_t req_length = 6; uint16_t req_length = 7;
uint8_t *req_buffer = malloc(req_length); uint8_t *req_buffer = malloc(req_length);
pdu_session_establishment_request_msg pdu_session_establish; pdu_session_establishment_request_msg pdu_session_establish;
pdu_session_establish.protocoldiscriminator = FGS_SESSION_MANAGEMENT_MESSAGE; pdu_session_establish.protocoldiscriminator = FGS_SESSION_MANAGEMENT_MESSAGE;
pdu_session_establish.pdusessionid = 10; 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.pdusessionestblishmsgtype = FGS_PDU_SESSION_ESTABLISHMENT_REQ;
pdu_session_establish.maxdatarate = 0xffff; pdu_session_establish.maxdatarate = 0xffff;
pdu_session_establish.pdusessiontype = 0x91;
encode_pdu_session_establishment_request(&pdu_session_establish, req_buffer); encode_pdu_session_establishment_request(&pdu_session_establish, req_buffer);
...@@ -629,9 +638,8 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ ...@@ -629,9 +638,8 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
MM_msg *mm_msg; MM_msg *mm_msg;
nas_stream_cipher_t stream_cipher; nas_stream_cipher_t stream_cipher;
uint8_t mac[4]; uint8_t mac[4];
uint8_t nssai[]={1,1,2,3}; uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1
uint8_t dnn[9]={0x8,0x69,0x6e,0x74,0x65,0x72,0x6e,0x65,0x74}; uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai"
// set security protected header
nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE; nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE;
nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX; nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX;
size += 7; size += 7;
...@@ -663,9 +671,9 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ ...@@ -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.length = 4;
mm_msg->uplink_nas_transport.snssai.value = nssai; mm_msg->uplink_nas_transport.snssai.value = nssai;
size += (1+1+4); 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; mm_msg->uplink_nas_transport.dnn.value = dnn;
size += (1+1+9); size += (1+1+4);
// encode the message // encode the message
initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t));
......
...@@ -144,7 +144,6 @@ extern int asn1_xer_print; ...@@ -144,7 +144,6 @@ extern int asn1_xer_print;
if (ie == NULL ) { \ if (ie == NULL ) { \
NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
} \ } \
if (mandatory) DevAssert(ie != NULL); \
} while(0) } while(0)
/** \brief Function callback prototype. /** \brief Function callback prototype.
**/ **/
......
...@@ -1061,12 +1061,31 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -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_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AllowedNSSAI, true); 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_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL;
NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); NGAP_WARN("AllowedNSSAI.list.count %d\n", ie != NULL ? ie->value.choice.AllowedNSSAI.list.count : 2);
DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); //NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); //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; 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, ...@@ -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]; 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 */ /* id-UESecurityCapabilities */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
......
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