forked from acouzens/open5gs
update it
This commit is contained in:
parent
70dc633a96
commit
c5eeffae47
|
@ -73,7 +73,6 @@ void emm_handle_attach_request(
|
|||
mme_ue, &attach_request->esm_message_container);
|
||||
|
||||
/* Store UE specific information */
|
||||
memcpy(&mme_ue->visited_plmn_id, &mme_self()->plmn_id, PLMN_ID_LEN);
|
||||
if (attach_request->presencemask &
|
||||
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)
|
||||
{
|
||||
|
@ -84,6 +83,12 @@ void emm_handle_attach_request(
|
|||
&last_visited_registered_tai->plmn_id,
|
||||
PLMN_ID_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME : what will do if we don't know last visited plmn_id */
|
||||
memcpy(&mme_ue->visited_plmn_id,
|
||||
&mme_self()->served_tai[0].plmn_id, PLMN_ID_LEN);
|
||||
}
|
||||
|
||||
memcpy(&mme_ue->ue_network_capability,
|
||||
&attach_request->ue_network_capability,
|
||||
|
|
|
@ -34,7 +34,6 @@ static int context_initialized = 0;
|
|||
|
||||
status_t mme_context_init()
|
||||
{
|
||||
|
||||
d_assert(context_initialized == 0, return CORE_ERROR,
|
||||
"MME context already has been context_initialized");
|
||||
|
||||
|
@ -57,10 +56,6 @@ status_t mme_context_init()
|
|||
self.imsi_ue_hash = hash_make();
|
||||
self.guti_ue_hash = hash_make();
|
||||
|
||||
/* MCC : 001, MNC : 01 */
|
||||
plmn_id_build(&self.plmn_id, 1, 1, 2);
|
||||
self.tracking_area_code = 12345;
|
||||
|
||||
context_initialized = 1;
|
||||
|
||||
return CORE_OK;
|
||||
|
@ -137,6 +132,13 @@ static status_t mme_context_validation()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
if (self.max_num_of_served_tai == 0)
|
||||
{
|
||||
d_error("No MME.TAI(PLMN_ID.MCC.MNC|TAC) in '%s'",
|
||||
context_self()->config.path);
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
if (self.num_of_integrity_order == 0)
|
||||
{
|
||||
d_error("No MME.SECURITY.INTEGRITY_ORDER in '%s'",
|
||||
|
@ -305,13 +307,17 @@ status_t mme_context_parse_config()
|
|||
for (q = 1; q > 0; p++, q--)
|
||||
{
|
||||
q += (t+m+p)->size;
|
||||
if (jsmntok_equal(json, t+m+p, "MCC") == 0)
|
||||
if (jsmntok_equal(
|
||||
json, t+m+p, "MCC") == 0)
|
||||
{
|
||||
mcc = jsmntok_to_string(json, t+m+p+1);
|
||||
mcc = jsmntok_to_string(
|
||||
json, t+m+p+1);
|
||||
}
|
||||
else if (jsmntok_equal(json, t+m+p, "MNC") == 0)
|
||||
else if (jsmntok_equal(
|
||||
json, t+m+p, "MNC") == 0)
|
||||
{
|
||||
mnc = jsmntok_to_string(json, t+m+p+1);
|
||||
mnc = jsmntok_to_string(
|
||||
json, t+m+p+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,23 +393,66 @@ status_t mme_context_parse_config()
|
|||
|
||||
for (arr = 0; arr < size; arr++)
|
||||
{
|
||||
char *mcc = NULL, *mnc = NULL, *tac = NULL;
|
||||
|
||||
for (n = 1; n > 0; m++, n--)
|
||||
{
|
||||
n += (t+m)->size;
|
||||
|
||||
if (jsmntok_equal(json, t+m, "MCC") == 0)
|
||||
if (jsmntok_equal(json, t+m, "PLMN_ID") == 0)
|
||||
{
|
||||
printf("mcc : %s\n", jsmntok_to_string(json, t+m+1));
|
||||
}
|
||||
else if (jsmntok_equal(json, t+m, "MNC") == 0)
|
||||
{
|
||||
printf("mnc : %s\n", jsmntok_to_string(json, t+m+1));
|
||||
p = 1;
|
||||
size1 = 1;
|
||||
|
||||
if ((t+m+1)->type == JSMN_ARRAY)
|
||||
{
|
||||
p = 2;
|
||||
}
|
||||
|
||||
for (arr1 = 0; arr1 < size1; arr1++)
|
||||
{
|
||||
for (q = 1; q > 0; p++, q--)
|
||||
{
|
||||
q += (t+m+p)->size;
|
||||
if (jsmntok_equal(
|
||||
json, t+m+p, "MCC") == 0)
|
||||
{
|
||||
mcc = jsmntok_to_string(
|
||||
json, t+m+p+1);
|
||||
}
|
||||
else if (jsmntok_equal(
|
||||
json, t+m+p, "MNC") == 0)
|
||||
{
|
||||
mnc = jsmntok_to_string(
|
||||
json, t+m+p+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (jsmntok_equal(json, t+m, "TAC") == 0)
|
||||
{
|
||||
printf("tac : %s\n", jsmntok_to_string(json, t+m+1));
|
||||
p = 1;
|
||||
|
||||
if ((t+m+1)->type == JSMN_ARRAY)
|
||||
{
|
||||
p = 2;
|
||||
}
|
||||
|
||||
tac = jsmntok_to_string(json, t+m+p);
|
||||
}
|
||||
}
|
||||
|
||||
if (mcc && mnc && tac)
|
||||
{
|
||||
tai_t *tai = &self.served_tai[
|
||||
self.max_num_of_served_tai];
|
||||
|
||||
plmn_id_build(&tai->plmn_id,
|
||||
atoi(mcc), atoi(mnc), strlen(mnc));
|
||||
tai->tac = atoi(tac);
|
||||
|
||||
self.max_num_of_served_tai++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (jsmntok_equal(json, t, "SECURITY") == 0)
|
||||
|
|
|
@ -25,7 +25,8 @@ extern "C" {
|
|||
#define GRP_PER_MME 256 /* According to spec it is 65535 */
|
||||
#define CODE_PER_MME 256 /* According to spec it is 256 */
|
||||
|
||||
#define MAX_NUM_OF_SERVED_GUMMEI 4
|
||||
#define MAX_NUM_OF_SERVED_TAI 16
|
||||
#define MAX_NUM_OF_SERVED_GUMMEI 8
|
||||
#define MAX_NUM_OF_ALGORITHM 8
|
||||
|
||||
typedef struct _served_gummei {
|
||||
|
@ -52,7 +53,6 @@ typedef struct _mme_context_t {
|
|||
gtp_xact_ctx_t gtp_xact_ctx; /* GTP Transaction Context for MME */
|
||||
|
||||
c_uint32_t mme_ue_s1ap_id; /** mme_ue_s1ap_id generator */
|
||||
plmn_id_t plmn_id;
|
||||
|
||||
/* defined in 'nas_ies.h'
|
||||
* #define NAS_SECURITY_ALGORITHMS_EIA0 0
|
||||
|
@ -70,7 +70,8 @@ typedef struct _mme_context_t {
|
|||
c_uint8_t integrity_order[MAX_NUM_OF_ALGORITHM];
|
||||
|
||||
/* S1SetupRequest */
|
||||
c_uint16_t tracking_area_code;
|
||||
c_uint8_t max_num_of_served_tai;
|
||||
tai_t served_tai[MAX_NUM_OF_SERVED_TAI];
|
||||
|
||||
/* S1SetupResponse */
|
||||
c_uint8_t max_num_of_served_gummei;
|
||||
|
|
|
@ -20,22 +20,24 @@
|
|||
S11_ADDR: "10.1.35.215",
|
||||
}
|
||||
GUMMEI:
|
||||
[
|
||||
{
|
||||
PLMN_ID :
|
||||
{
|
||||
MCC : "001",
|
||||
MNC : "01",
|
||||
MME_GID : 2,
|
||||
MME_CODE : 1
|
||||
MNC : "01"
|
||||
}
|
||||
]
|
||||
MME_GID : 2,
|
||||
MME_CODE : 1
|
||||
}
|
||||
TAI:
|
||||
[
|
||||
{
|
||||
PLMN_ID :
|
||||
{
|
||||
MCC: "001",
|
||||
MNC: "01",
|
||||
TAC: 12345
|
||||
}
|
||||
]
|
||||
TAC: 12345
|
||||
}
|
||||
SECURITY :
|
||||
{
|
||||
INTEGRITY_ORDER : [ "EIA1", "EIA2", "EIA0" ]
|
||||
|
|
|
@ -60,7 +60,7 @@ static void s1ap_sm_test1(abts_case *tc, void *data)
|
|||
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FULL);
|
||||
}
|
||||
|
||||
#define NUM_OF_TEST_ENB 1
|
||||
#define NUM_OF_TEST_ENB 32
|
||||
|
||||
static void s1ap_sm_test2(abts_case *tc, void *data)
|
||||
{
|
||||
|
@ -115,9 +115,7 @@ abts_suite *test_s1ap_sm(abts_suite *suite)
|
|||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
#if 0
|
||||
abts_run_test(suite, s1ap_sm_test1, NULL);
|
||||
#endif
|
||||
abts_run_test(suite, s1ap_sm_test2, NULL);
|
||||
|
||||
return suite;
|
||||
|
|
|
@ -80,17 +80,17 @@ status_t tests1ap_build_setup_req(pkbuf_t **pkbuf, c_uint32_t enb_id)
|
|||
|
||||
s1ap_uint32_to_ENB_ID(S1ap_ENB_ID_PR_macroENB_ID, enb_id,
|
||||
&ies->global_ENB_ID.eNB_ID);
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&mme_self()->plmn_id, PLMN_ID_LEN, &ies->global_ENB_ID.pLMNidentity);
|
||||
s1ap_buffer_to_OCTET_STRING(&mme_self()->served_tai[0].plmn_id,
|
||||
PLMN_ID_LEN, &ies->global_ENB_ID.pLMNidentity);
|
||||
|
||||
supportedTA = (S1ap_SupportedTAs_Item_t *)
|
||||
core_calloc(1, sizeof(S1ap_SupportedTAs_Item_t));
|
||||
s1ap_uint16_to_OCTET_STRING(
|
||||
mme_self()->tracking_area_code, &supportedTA->tAC);
|
||||
mme_self()->served_tai[0].tac, &supportedTA->tAC);
|
||||
plmnIdentity = (S1ap_PLMNidentity_t *)
|
||||
core_calloc(1, sizeof(S1ap_PLMNidentity_t));
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&mme_self()->plmn_id, PLMN_ID_LEN, plmnIdentity);
|
||||
s1ap_buffer_to_OCTET_STRING(&mme_self()->served_tai[0].plmn_id,
|
||||
PLMN_ID_LEN, plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&supportedTA->broadcastPLMNs, plmnIdentity);
|
||||
|
||||
ASN_SEQUENCE_ADD(&ies->supportedTAs, supportedTA);
|
||||
|
|
Loading…
Reference in New Issue