Commit 8f0ac37e authored by Aikaterini's avatar Aikaterini

modifications in UE NAS to allow OAI UE to connect to. Note this is hard-coded...

modifications in UE NAS to allow OAI UE to connect to. Note this is hard-coded in NAS, it will no longer work with openairCN.  To be fixed before merging into develop branch
.
parent f6beede7
......@@ -253,8 +253,8 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
*/
// printf("rb_alloc[1]=%x,rb_alloc[0]=%x\n",rb_alloc2[1],rb_alloc2[0]);
} else {
LOG_E(PHY,"resource type 1 not supported for N_RB_DL=100\n");
mac_xface->macphy_exit("resource type 1 not supported for N_RB_DL=100\n");
LOG_E(PHY,"resource type 1 not supported for N_RB_DL=50\n");
// mac_xface->macphy_exit("resource type 1 not supported for N_RB_DL=100\n");
/*
subset = rb_alloc&1;
shift = (rb_alloc>>1)&1;
......@@ -284,7 +284,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
}
} else {
LOG_E(PHY,"resource type 1 not supported for N_RB_DL=100\n");
mac_xface->macphy_exit("resource type 1 not supported for N_RB_DL=100\n");
// mac_xface->macphy_exit("resource type 1 not supported for N_RB_DL=100\n");
/*
subset = rb_alloc&1;
shift = (rb_alloc>>1)&1;
......
......@@ -1382,7 +1382,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif
if (abstraction_flag == 0) {
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n",
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n",
Mod_id,
frame_tx,
subframe_tx,
......
......@@ -58,21 +58,23 @@ Description Defines a list of PLMN network operators
#define SFR1 1
#define SFR2 2
#define SFR3 3
#define TM1 4
#define FCT1 5
#define VDF1 6
#define VDF2 7
#define VDF3 8
#define VDF4 9
#define VDF5 10
#define OAI_LTEBOX 4
#define TM1 5
#define FCT1 6
#define VDF1 7
#define VDF2 8
#define VDF3 9
#define VDF4 10
#define VDF5 11
#define SELECTED_PLMN SFR1
#define SELECTED_PLMN OAI_LTEBOX //SFR1
#define TEST_PLMN {0,0,0x0f,1,1,0} // 00101
#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810
#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
#define OAI_LTEBOX_PLMN {0,2,0x0f,8,3,9} //20893
#define TM_PLMN_1 {1,3,0,0,8,2} // 310280
#define FCT_PLMN_1 {1,3,8,0,2,0} // 310028
#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210
......@@ -81,6 +83,7 @@ Description Defines a list of PLMN network operators
#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
......@@ -110,6 +113,7 @@ network_record_t network_records[] = {
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd},
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd},
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd},
{20893, OAI_LTEBOX_PLMN, "OAI LTEBOX", "OAIALU", 0x0001, 0xfffd},
{310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd},
{310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd},
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd},
......
......@@ -354,6 +354,36 @@ static void _gen_emm_data(emm_nvdata_t* data)
data->rplmn.MNCdigit2 = 0;
data->rplmn.MNCdigit3 = 0xf;
#endif
#if (SELECTED_PLMN == OAI_LTEBOX)
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 93 (OAI) + 00001110
*/
data->imsi.length = 8;
data->imsi.u.num.parity = ODD_PARITY; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 9; // MNC digit 1
data->imsi.u.num.digit5 = 3; // MNC digit 2
data->imsi.u.num.digit6 = 0; // MNC digit 3
data->imsi.u.num.digit7 = 1;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 0;
data->imsi.u.num.digit10 = 0;
data->imsi.u.num.digit11 = 0;
data->imsi.u.num.digit12 = 1;
data->imsi.u.num.digit13 = 1;
data->imsi.u.num.digit14 = 1;
data->imsi.u.num.digit15 = 0;
data->rplmn.MCCdigit1 = 2;
data->rplmn.MCCdigit2 = 0;
data->rplmn.MCCdigit3 = 8;
data->rplmn.MNCdigit1 = 9;
data->rplmn.MNCdigit2 = 3;
data->rplmn.MNCdigit3 = 0xf;
#endif
#if (SELECTED_PLMN == TEST1)
/*
* International Mobile Subscriber Identity
......
......@@ -61,7 +61,7 @@ Description Implements the utility used to generate data stored in the
#define KSI USIM_KSI_NOT_AVAILABLE
#define KSI_ASME USIM_KSI_NOT_AVAILABLE
#define INT_ALGO USIM_INT_EIA1
#define INT_ALGO USIM_INT_EIA2
#define ENC_ALGO USIM_ENC_EEA0
#define SECURITY_ALGORITHMS (ENC_ALGO | INT_ALGO)
......@@ -159,12 +159,13 @@ int main (int argc, const char* argv[])
usim_data.imsi.u.num.digit15 = 0b1111;
#endif
#if (SELECTED_PLMN == SFR1)
#warning "IMSI 208.10.00001234"
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
#warning "IMSI 208.10.00001234"
#warning "IMSI 208.10.00001234"
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
......@@ -183,6 +184,31 @@ int main (int argc, const char* argv[])
usim_data.imsi.u.num.digit14 = 4;
usim_data.imsi.u.num.digit15 = 0b1111;
#endif
#if (SELECTED_PLMN == OAI_LTEBOX)
#warning "IMSI 208.93.00001110"
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
#warning "IMSI 208.93.0100001110"
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = ODD_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
usim_data.imsi.u.num.digit4 = 9; // MNC digit 1
usim_data.imsi.u.num.digit5 = 3; // MNC digit 2
usim_data.imsi.u.num.digit6 = 0; // MNC digit 3
usim_data.imsi.u.num.digit7 = 1;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 0;
usim_data.imsi.u.num.digit10 = 0;
usim_data.imsi.u.num.digit11 = 0;
usim_data.imsi.u.num.digit12 = 1;
usim_data.imsi.u.num.digit13 = 1;
usim_data.imsi.u.num.digit14 = 1;
usim_data.imsi.u.num.digit15 = 0;
#endif
#if (SELECTED_PLMN == TEST1)
#warning "IMSI 001.01.000001234"
usim_data.imsi.length = 8;
......@@ -470,13 +496,14 @@ static void _display_usim_data(const usim_data_t* data)
printf("\tparity\t= %s\n", data->imsi.u.num.parity == EVEN_PARITY ? "Even" : "Odd");
digits = (data->imsi.length * 2) - 1 - (data->imsi.u.num.parity == EVEN_PARITY ? 1 : 0);
printf("\tdigits\t= %d\n", digits);
printf("\tdigits\t= %u%u%u%u%u%x%u%u%u%u",
data->imsi.u.num.digit1, // MCC digit 1
data->imsi.u.num.digit2, // MCC digit 2
data->imsi.u.num.digit3, // MCC digit 3
data->imsi.u.num.digit4, // MNC digit 1
data->imsi.u.num.digit5, // MNC digit 2
data->imsi.u.num.digit6, // MNC digit 3
data->imsi.u.num.digit6==0xf?0:data->imsi.u.num.digit6, // MNC digit 3
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
......
......@@ -21,9 +21,21 @@
/*--------- Operator Variant Algorithm Configuration Field --------*/
/*------- Insert your value of OP here -------*/
/* PFT OP used currently in HSS (OPENAIRHSS/auc/kdf.c) */
#define OAI_LTEBOX
#ifdef OAI_LTEBOX
//1006020f0a478bf6b699f15c062e42b3
/*u8 OP[16] = {0xb3, 0x42, 0x2e, 0x06, 0x5c, 0xf1, 0x99, 0xb6,
0xf6, 0x8b, 0x47, 0x0a, 0x0f, 0x02, 0x06, 0x10
};*/
u8 OP[16] = {0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3
};
#else
u8 OP[16] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11
};
#endif
/*------- Insert your value of OP here -------*/
/*-------------------------------------------------------------------
......
......@@ -77,7 +77,7 @@ Description Implements the API used by the NAS layer to read/write
* Subscriber authentication security key
*/
#define USIM_API_K_SIZE 16
#define USIM_API_K_VALUE "8BAF473F2F8FD09487CCCBD7097C6862"
#define USIM_API_K_VALUE "fec86ba6eb707ed08905757b1bb44b8f"
static uint8_t _usim_api_k[USIM_API_K_SIZE];
......@@ -85,9 +85,13 @@ static uint8_t _usim_api_k[USIM_API_K_SIZE];
/*
* List of last used Sequence Numbers SQN
*/
#define USIM_API_AK_SIZE 6
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
static struct _usim_api_data_s {
/* Highest sequence number the USIM has ever accepted */
uint32_t sqn_ms;
uint8_t sqn_ms[USIM_API_SQNMS_SIZE];
/* List of the last used sequence numbers */
#define USIM_API_SQN_LIST_SIZE 32
uint8_t n_sqns;
......@@ -230,25 +234,25 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
/* Compute the cipher key CK = f3K (RAND) */
/* Compute the integrity key IK = f4K (RAND) */
/* Compute the anonymity key AK = f5K (RAND) */
#define USIM_API_AK_SIZE 6
u8 ak[USIM_API_AK_SIZE];
f2345(_usim_api_k, rand_pP->value,
res_pP->value, ck_pP->value, ik_pP->value, ak);
LOG_TRACE(DEBUG, "USIM-API - res(f2) :%s",dump_octet_string(res_pP));
LOG_TRACE(DEBUG, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP));
LOG_TRACE(DEBUG, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP));
LOG_TRACE(DEBUG, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X",
LOG_TRACE(INFO, "USIM-API - res(f2) :%s",dump_octet_string(res_pP));
LOG_TRACE(INFO, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP));
LOG_TRACE(INFO, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP));
LOG_TRACE(INFO, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X",
ak[0],ak[1],ak[2],ak[3],ak[4],ak[5]);
/* Retrieve the sequence number SQN = (SQN ⊕ AK) ⊕ AK */
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
u8 sqn[USIM_API_SQN_SIZE];
for (i = 0; i < USIM_API_SQN_SIZE; i++) {
sqn[i] = autn_pP->value[i] ^ ak[i];
}
LOG_TRACE(DEBUG, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X",
LOG_TRACE(INFO, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X",
sqn[0],sqn[1],sqn[2],sqn[3],sqn[4],sqn[5]);
/* Compute XMAC = f1K (SQN || RAND || AMF) */
......@@ -267,14 +271,15 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
USIM_API_XMAC_SIZE) != 0 ) {
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Failed");
rc = RETURNerror;
//LOG_FUNC_RETURN (RETURNerror);
} else {
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
/* Verify that the received sequence number SQN is in the correct range */
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
}
/* Verify that the received sequence number SQN is in the correct range */
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
if (rc != RETURNok) {
/* Synchronisation failure; compute the AUTS parameter */
......@@ -283,15 +288,16 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
* Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */
f5star(_usim_api_k, rand_pP->value, ak);
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
u8 sqn_ms[USIM_API_SQNMS_SIZE];
memset(sqn_ms, 0, USIM_API_SQNMS_SIZE);
#define USIM_API_SQN_MS_SIZE 3
for (i = 0; i < USIM_API_SQN_MS_SIZE; i++) {
//#define USIM_API_SQN_MS_SIZE 3
printf("_usim_api_data.sqn_ms %p\n",_usim_api_data.sqn_ms);
for (i = 0; i < USIM_API_SQNMS_SIZE; i++) {
#warning "LG:BUG HERE TODO"
printf("i %d: ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d\n",i, ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i]);
sqn_ms[USIM_API_SQNMS_SIZE - i] =
((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQN_MS_SIZE - i];
((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i];
}
u8 sqnms[USIM_API_SQNMS_SIZE];
......@@ -317,6 +323,8 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
* AUTS = Conc(SQNMS) || MACS */
memcpy(&auts_pP->value[0], sqnms, USIM_API_SQNMS_SIZE);
memcpy(&auts_pP->value[USIM_API_SQNMS_SIZE], macs, USIM_API_MACS_SIZE);
auts_pP->length = USIM_API_SQNMS_SIZE + USIM_API_MACS_SIZE;
LOG_FUNC_RETURN (RETURNerror);
}
LOG_FUNC_RETURN (RETURNok);
......
......@@ -249,7 +249,7 @@ int emm_proc_attach(emm_proc_attach_type_t type)
esm_sap.data.pdn_connect.is_defined = TRUE;
esm_sap.data.pdn_connect.cid = 1;
/* TODO: PDN type should be set according to the IP capability of the UE */
esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4V6;
esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4;
esm_sap.data.pdn_connect.apn = NULL;
esm_sap.data.pdn_connect.is_emergency = _emm_data.is_emergency;
rc = esm_sap_send(&esm_sap);
......
......@@ -99,6 +99,7 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
void *lib_handle;
oai_device_initfunc_t dp ;
oai_transport_initfunc_t tp ;
int ret=0;
if (flag == BBU_LOCAL_RADIO_HEAD) {
lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
......@@ -110,7 +111,10 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
dp = dlsym(lib_handle,"device_init");
if (dp != NULL ) {
dp(device,openair0_cfg);
ret = dp(device,openair0_cfg);
if (ret<0) {
fprintf(stderr, "%s %d:oai device intialization failed %s\n", __FILE__, __LINE__, dlerror());
}
} else {
fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
return -1;
......@@ -132,14 +136,14 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
}
}
return 0;
return ret;
}
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg) {
int rc;
int rc=0;
//ToDo: EXMIMO harmonization is not complete. That is the reason for this ifdef
#ifdef EXMIMO
device_init(device, openair0_cfg);
......@@ -152,7 +156,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
}
}
#endif
return 0;
return rc;
}
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
......
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