Ok for MNC 2 and 3 digits, tested wit 208.10 and 310.028
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5846 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -64,7 +64,10 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
|
|||||||
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_AUTH_INFO_REQ);
|
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_AUTH_INFO_REQ);
|
||||||
|
|
||||||
auth_info_req = &message_p->ittiMsg.s6a_auth_info_req;
|
auth_info_req = &message_p->ittiMsg.s6a_auth_info_req;
|
||||||
MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
|
memset(auth_info_req, 0, sizeof(*auth_info_req));
|
||||||
|
|
||||||
|
auth_info_req->imsi_length = MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
|
||||||
|
|
||||||
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
|
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
|
||||||
MME_APP_DEBUG("%s visited_plmn MCC %X%X%X MNC %X%X%X\n",
|
MME_APP_DEBUG("%s visited_plmn MCC %X%X%X MNC %X%X%X\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
@@ -75,11 +78,11 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
|
|||||||
auth_info_req->visited_plmn.MNCdigit2,
|
auth_info_req->visited_plmn.MNCdigit2,
|
||||||
auth_info_req->visited_plmn.MNCdigit3);
|
auth_info_req->visited_plmn.MNCdigit3);
|
||||||
uint8_t *ptr = (uint8_t *)&auth_info_req->visited_plmn;
|
uint8_t *ptr = (uint8_t *)&auth_info_req->visited_plmn;
|
||||||
MME_APP_DEBUG("%s visited_plmn %X%X%X%X%X%X\n",
|
MME_APP_DEBUG("%s visited_plmn %02X%02X%02X\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
ptr[0],
|
ptr[0],
|
||||||
ptr[1],
|
ptr[1],
|
||||||
ptr[2]);
|
ptr[2]);
|
||||||
|
|
||||||
auth_info_req->nb_of_vectors = nb_of_vectors;
|
auth_info_req->nb_of_vectors = nb_of_vectors;
|
||||||
if (auts != NULL) {
|
if (auts != NULL) {
|
||||||
@@ -273,6 +276,7 @@ request_auth: {
|
|||||||
/* We have no vector for this UE, send an authentication request
|
/* We have no vector for this UE, send an authentication request
|
||||||
* to the HSS.
|
* to the HSS.
|
||||||
*/
|
*/
|
||||||
|
AssertFatal(0, "Hardcoded MCC/MNC");
|
||||||
plmn_t plmn = {
|
plmn_t plmn = {
|
||||||
.MCCdigit2 = 0,
|
.MCCdigit2 = 0,
|
||||||
.MCCdigit1 = 8,
|
.MCCdigit1 = 8,
|
||||||
@@ -357,9 +361,9 @@ mme_app_handle_nas_auth_param_req(
|
|||||||
//visited_plmn = &visited_plmn_dongle;
|
//visited_plmn = &visited_plmn_dongle;
|
||||||
visited_plmn = &visited_plmn_from_req;
|
visited_plmn = &visited_plmn_from_req;
|
||||||
|
|
||||||
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[0];
|
visited_plmn_from_req.MCCdigit1 = nas_auth_param_req_pP->imsi[0];
|
||||||
visited_plmn_from_req.MCCdigit2 = nas_auth_param_req_pP->imsi[1];
|
visited_plmn_from_req.MCCdigit2 = nas_auth_param_req_pP->imsi[1];
|
||||||
visited_plmn_from_req.MCCdigit1 = nas_auth_param_req_pP->imsi[2];
|
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[2];
|
||||||
|
|
||||||
mnc_length = find_mnc_length(nas_auth_param_req_pP->imsi[0],
|
mnc_length = find_mnc_length(nas_auth_param_req_pP->imsi[0],
|
||||||
nas_auth_param_req_pP->imsi[1],
|
nas_auth_param_req_pP->imsi[1],
|
||||||
@@ -369,9 +373,9 @@ mme_app_handle_nas_auth_param_req(
|
|||||||
nas_auth_param_req_pP->imsi[5]
|
nas_auth_param_req_pP->imsi[5]
|
||||||
);
|
);
|
||||||
if (mnc_length == 2) {
|
if (mnc_length == 2) {
|
||||||
visited_plmn_from_req.MNCdigit1 = 0;
|
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
|
||||||
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[3];
|
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[4];
|
||||||
visited_plmn_from_req.MNCdigit3 = nas_auth_param_req_pP->imsi[4];
|
visited_plmn_from_req.MNCdigit3 = "F";
|
||||||
} else if (mnc_length == 3) {
|
} else if (mnc_length == 3) {
|
||||||
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
|
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
|
||||||
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[4];
|
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[4];
|
||||||
@@ -383,7 +387,10 @@ mme_app_handle_nas_auth_param_req(
|
|||||||
MME_APP_STRING_TO_IMSI(nas_auth_param_req_pP->imsi, &imsi);
|
MME_APP_STRING_TO_IMSI(nas_auth_param_req_pP->imsi, &imsi);
|
||||||
|
|
||||||
MME_APP_DEBUG("%s Handling imsi %"IMSI_FORMAT"\n", __FUNCTION__, imsi);
|
MME_APP_DEBUG("%s Handling imsi %"IMSI_FORMAT"\n", __FUNCTION__, imsi);
|
||||||
MME_APP_DEBUG("%s Handling imsi from req %s\n", __FUNCTION__, nas_auth_param_req_pP->imsi);
|
MME_APP_DEBUG("%s Handling imsi from req %s (mnc length %d)\n",
|
||||||
|
__FUNCTION__,
|
||||||
|
nas_auth_param_req_pP->imsi,
|
||||||
|
mnc_length);
|
||||||
|
|
||||||
/* Fetch the context associated with this IMSI */
|
/* Fetch the context associated with this IMSI */
|
||||||
ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi);
|
ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ Description Implements the API used by the NAS layer running in the MME
|
|||||||
|
|
||||||
#include "mme_api.h"
|
#include "mme_api.h"
|
||||||
#include "nas_log.h"
|
#include "nas_log.h"
|
||||||
|
#include "assertions.h"
|
||||||
|
|
||||||
#include <string.h> // memcpy
|
#include <string.h> // memcpy
|
||||||
|
|
||||||
@@ -261,15 +262,27 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
LOG_FUNC_IN;
|
LOG_FUNC_IN;
|
||||||
|
AssertFatal(mme_config_p->gummei.nb_plmns >= 1, "No PLMN configured");
|
||||||
|
AssertFatal(mme_config_p->gummei.nb_mmec >= 1, "No MME Code configured");
|
||||||
|
AssertFatal(mme_config_p->gummei.nb_mme_gid >= 1, "No MME Group ID configured");
|
||||||
|
|
||||||
config->gummei.plmn.MCCdigit1 = 2;
|
config->gummei.plmn.MCCdigit1 = (mme_config_p->gummei.plmn_mcc[0]/100)%10;
|
||||||
config->gummei.plmn.MCCdigit2 = 0;
|
config->gummei.plmn.MCCdigit2 = (mme_config_p->gummei.plmn_mcc[0]/10)%10;
|
||||||
config->gummei.plmn.MCCdigit3 = 8;
|
config->gummei.plmn.MCCdigit3 = mme_config_p->gummei.plmn_mcc[0]%10;
|
||||||
config->gummei.plmn.MNCdigit1 = 1;
|
if (mme_config_p->gummei.plmn_mnc_len[0] == 2) {
|
||||||
config->gummei.plmn.MNCdigit2 = 0;
|
config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/10)%10;
|
||||||
config->gummei.plmn.MNCdigit3 = 0xf;
|
config->gummei.plmn.MNCdigit2 = mme_config_p->gummei.plmn_mnc[0]%10;
|
||||||
config->gummei.MMEgid = MME_API_MME_GID;
|
config->gummei.plmn.MNCdigit3 = 0xf;
|
||||||
config->gummei.MMEcode = MME_API_MME_CODE;
|
} else if (mme_config_p->gummei.plmn_mnc_len[0] == 3) {
|
||||||
|
config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/100)%10;
|
||||||
|
config->gummei.plmn.MNCdigit2 = (mme_config_p->gummei.plmn_mnc[0]/10)%10;
|
||||||
|
config->gummei.plmn.MNCdigit3 = mme_config_p->gummei.plmn_mnc[0]%10;
|
||||||
|
} else {
|
||||||
|
AssertFatal((mme_config_p->gummei.plmn_mnc_len[0] >= 2) &&
|
||||||
|
(mme_config_p->gummei.plmn_mnc_len[0] <= 3), "BAD MNC length for GUMMEI");
|
||||||
|
}
|
||||||
|
config->gummei.MMEgid = mme_config_p->gummei.mme_gid[0];
|
||||||
|
config->gummei.MMEcode = mme_config_p->gummei.mmec[0];
|
||||||
#if defined(EPC_BUILD)
|
#if defined(EPC_BUILD)
|
||||||
/* SR: this config param comes from MME global config */
|
/* SR: this config param comes from MME global config */
|
||||||
if (mme_config_p->emergency_attach_supported != 0) {
|
if (mme_config_p->emergency_attach_supported != 0) {
|
||||||
@@ -371,6 +384,7 @@ int mme_api_identify_imsi(const imsi_t *imsi, auth_vector_t *vector)
|
|||||||
int rc = RETURNok;
|
int rc = RETURNok;
|
||||||
|
|
||||||
LOG_FUNC_IN;
|
LOG_FUNC_IN;
|
||||||
|
AssertFatal(0, "Hardcoded values");
|
||||||
|
|
||||||
memcpy(vector->rand, _mme_api_rand, AUTH_RAND_SIZE);
|
memcpy(vector->rand, _mme_api_rand, AUTH_RAND_SIZE);
|
||||||
memcpy(vector->autn, _mme_api_autn, AUTH_AUTN_SIZE);
|
memcpy(vector->autn, _mme_api_autn, AUTH_AUTN_SIZE);
|
||||||
@@ -435,6 +449,7 @@ int mme_api_new_guti(const imsi_t *imsi, GUTI_t *guti, tac_t *tac, int *n_tacs)
|
|||||||
static unsigned int tmsi = 1;
|
static unsigned int tmsi = 1;
|
||||||
|
|
||||||
LOG_FUNC_IN;
|
LOG_FUNC_IN;
|
||||||
|
AssertFatal(0, "Hardcoded values");
|
||||||
|
|
||||||
guti->gummei.plmn = mme_api_plmn;
|
guti->gummei.plmn = mme_api_plmn;
|
||||||
guti->gummei.MMEgid = MME_API_MME_GID;
|
guti->gummei.MMEgid = MME_API_MME_GID;
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ Description Defines the attach related EMM procedure executed by the
|
|||||||
|
|
||||||
#ifdef NAS_MME
|
#ifdef NAS_MME
|
||||||
#include "mme_api.h"
|
#include "mme_api.h"
|
||||||
|
#include "mme_config.h"
|
||||||
# if defined(EPC_BUILD)
|
# if defined(EPC_BUILD)
|
||||||
# include "nas_itti_messaging.h"
|
# include "nas_itti_messaging.h"
|
||||||
# endif
|
# endif
|
||||||
@@ -2507,6 +2508,7 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
|
|||||||
int umts_present, int gprs_present,
|
int umts_present, int gprs_present,
|
||||||
const OctetString *esm_msg)
|
const OctetString *esm_msg)
|
||||||
{
|
{
|
||||||
|
int mnc_length;
|
||||||
LOG_FUNC_IN;
|
LOG_FUNC_IN;
|
||||||
/* UE identifier */
|
/* UE identifier */
|
||||||
ctx->ueid = ueid;
|
ctx->ueid = ueid;
|
||||||
@@ -2538,24 +2540,62 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ctx->guti == NULL) {
|
if (ctx->guti == NULL) {
|
||||||
ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t));
|
ctx->guti = (GUTI_t *)calloc(1, sizeof(GUTI_t));
|
||||||
}
|
}
|
||||||
if (ctx->guti != NULL) {
|
#warning "LG: We should assign the GUTI accordingly to the visited plmn id"
|
||||||
/* TODO: FIXME */
|
if ((ctx->guti != NULL) && (imsi)) {
|
||||||
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI hardcoded PLMN 208.92 and tac 15 to emm_data_context");
|
ctx->tac = mme_config.gummei.plmn_tac[0];
|
||||||
ctx->guti->gummei.plmn.MCCdigit1 = 2;
|
ctx->guti->gummei.MMEcode = mme_config.gummei.mmec[0];
|
||||||
ctx->guti->gummei.plmn.MCCdigit2 = 0;
|
ctx->guti->gummei.MMEgid = mme_config.gummei.mme_gid[0];
|
||||||
ctx->guti->gummei.plmn.MCCdigit3 = 8;
|
|
||||||
ctx->guti->gummei.plmn.MNCdigit1 = 9;
|
|
||||||
ctx->guti->gummei.plmn.MNCdigit2 = 2;
|
|
||||||
ctx->guti->gummei.plmn.MNCdigit3 = 15;
|
|
||||||
ctx->tac = 15;
|
|
||||||
ctx->guti->gummei.MMEcode = 29;
|
|
||||||
ctx->guti->gummei.MMEgid = 30;
|
|
||||||
ctx->guti->m_tmsi = (uint32_t) ctx;
|
ctx->guti->m_tmsi = (uint32_t) ctx;
|
||||||
LOG_TRACE(WARNING, "EMM-PROC - Set ctx->guti_is_new to emm_data_context");
|
|
||||||
ctx->guti_is_new = TRUE;
|
|
||||||
|
|
||||||
|
mnc_length = mme_config_find_mnc_length(
|
||||||
|
imsi->u.num.digit1,
|
||||||
|
imsi->u.num.digit2,
|
||||||
|
imsi->u.num.digit3,
|
||||||
|
imsi->u.num.digit4,
|
||||||
|
imsi->u.num.digit5,
|
||||||
|
imsi->u.num.digit6);
|
||||||
|
|
||||||
|
if ((mnc_length == 2) || (mnc_length == 3)) {
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit1 = imsi->u.num.digit1;
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit2 = imsi->u.num.digit2;
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit3 = imsi->u.num.digit3;
|
||||||
|
if (mnc_length == 2) {
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit5;
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit6;
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit3 = 15;
|
||||||
|
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X.%04X.%02X.%08X to emm_data_context",
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit1,
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit2,
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit3,
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit1,
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit2,
|
||||||
|
ctx->guti->gummei.MMEgid,
|
||||||
|
ctx->guti->gummei.MMEcode,
|
||||||
|
ctx->guti->m_tmsi
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit5;
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit6;
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit3 = imsi->u.num.digit4;
|
||||||
|
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X%01X.%04X.%02X.%08X to emm_data_context",
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit1,
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit2,
|
||||||
|
ctx->guti->gummei.plmn.MCCdigit3,
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit1,
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit2,
|
||||||
|
ctx->guti->gummei.plmn.MNCdigit3,
|
||||||
|
ctx->guti->gummei.MMEgid,
|
||||||
|
ctx->guti->gummei.MMEcode,
|
||||||
|
ctx->guti->m_tmsi
|
||||||
|
);
|
||||||
|
}
|
||||||
|
LOG_TRACE(WARNING, "EMM-PROC - Set ctx->guti_is_new to emm_data_context");
|
||||||
|
ctx->guti_is_new = TRUE;
|
||||||
|
} else {
|
||||||
|
LOG_FUNC_RETURN (RETURNerror);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_FUNC_RETURN (RETURNerror);
|
LOG_FUNC_RETURN (RETURNerror);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ int decode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAnd
|
|||||||
|
|
||||||
voicedomainpreferenceandueusagesetting->ue_usage_setting = (*(buffer + decoded) >> 2) & 0x1;
|
voicedomainpreferenceandueusagesetting->ue_usage_setting = (*(buffer + decoded) >> 2) & 0x1;
|
||||||
voicedomainpreferenceandueusagesetting->voice_domain_for_eutran = *(buffer + decoded) & 0x3;
|
voicedomainpreferenceandueusagesetting->voice_domain_for_eutran = *(buffer + decoded) & 0x3;
|
||||||
|
decoded++;
|
||||||
|
|
||||||
#if defined (NAS_DEBUG)
|
#if defined (NAS_DEBUG)
|
||||||
dump_voice_domain_preference_and_ue_usage_setting_xml(voicedomainpreferenceandueusagesetting, iei);
|
dump_voice_domain_preference_and_ue_usage_setting_xml(voicedomainpreferenceandueusagesetting, iei);
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ TARGETS = $(USIM_TARGET) $(UE_TARGET)
|
|||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
#-DIMSI_USA_MNC_3DIGITS
|
||||||
%.o: %.c Makefile
|
%.o: %.c Makefile
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(USIM_TARGET): $(USIM_OBJ) $(LIBSUTIL)
|
$(USIM_TARGET): $(USIM_OBJ) $(LIBSUTIL)
|
||||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SECUDIR)/*.o -lnettle -lcrypto -lm
|
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SECUDIR)/*.o -lnettle -lcrypto -lm
|
||||||
|
|||||||
@@ -55,11 +55,13 @@ Description Defines a list of PLMN network operators
|
|||||||
#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810
|
#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_2 {0,2,0x0f,8,1,1} // 20811
|
||||||
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
|
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
|
||||||
|
#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
|
#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210
|
||||||
#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141
|
#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141
|
||||||
#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146
|
#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146
|
||||||
#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622
|
#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622
|
||||||
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
|
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/************************ G L O B A L T Y P E S ************************/
|
/************************ G L O B A L T Y P E S ************************/
|
||||||
@@ -72,11 +74,13 @@ enum {
|
|||||||
SFR1=0,
|
SFR1=0,
|
||||||
SFR2,
|
SFR2,
|
||||||
SFR3,
|
SFR3,
|
||||||
|
TM1,
|
||||||
|
FCT1,
|
||||||
VDF1,
|
VDF1,
|
||||||
VDF2,
|
VDF2,
|
||||||
VDF3,
|
VDF3,
|
||||||
VDF4,
|
VDF4,
|
||||||
VDF5
|
VDF5,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -100,14 +104,16 @@ typedef struct {
|
|||||||
* The list of PLMN network operator records
|
* The list of PLMN network operator records
|
||||||
*/
|
*/
|
||||||
network_record_t network_records[] = {
|
network_record_t network_records[] = {
|
||||||
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0000, 0xfffe},
|
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd},
|
||||||
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0000, 0xfffe},
|
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd},
|
||||||
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0000, 0xfffe},
|
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd},
|
||||||
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0000, 0xfffe},
|
{310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd},
|
||||||
{2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0000, 0xfffe},
|
{310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd},
|
||||||
{2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0000, 0xfffe},
|
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd},
|
||||||
{2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0000, 0xfffe},
|
{2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
|
||||||
{2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0000, 0xfffe},
|
{2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
|
||||||
|
{2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
|
||||||
|
{2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ Description Implements the utility used to generate data stored in the
|
|||||||
#include <stdlib.h> // exit, free
|
#include <stdlib.h> // exit, free
|
||||||
#include <string.h> // memset, strncpy
|
#include <string.h> // memset, strncpy
|
||||||
|
|
||||||
|
//#define SELECTED_PLMN SFR1
|
||||||
|
#define SELECTED_PLMN FCT1
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -286,19 +289,70 @@ static void _gen_user_data(user_nvdata_t* data)
|
|||||||
*/
|
*/
|
||||||
static void _gen_emm_data(emm_nvdata_t* data)
|
static void _gen_emm_data(emm_nvdata_t* data)
|
||||||
{
|
{
|
||||||
|
//#if (SELECTED_PLMN == FCT1)
|
||||||
|
#if 1
|
||||||
|
/*
|
||||||
|
* International Mobile Subscriber Identity
|
||||||
|
* IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150
|
||||||
|
*/
|
||||||
|
#warning "IMSI 310.028.90832150"
|
||||||
|
data->imsi.length = 8;
|
||||||
|
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
|
||||||
|
data->imsi.u.num.digit1 = 3; // MCC digit 1
|
||||||
|
data->imsi.u.num.digit2 = 1; // MCC digit 2
|
||||||
|
data->imsi.u.num.digit3 = 0; // MCC digit 3
|
||||||
|
data->imsi.u.num.digit4 = 0; // MNC digit 1
|
||||||
|
data->imsi.u.num.digit5 = 2; // MNC digit 2
|
||||||
|
data->imsi.u.num.digit6 = 8; // MNC digit 3
|
||||||
|
data->imsi.u.num.digit7 = 9;
|
||||||
|
data->imsi.u.num.digit8 = 0;
|
||||||
|
data->imsi.u.num.digit9 = 8;
|
||||||
|
data->imsi.u.num.digit10 = 3;
|
||||||
|
data->imsi.u.num.digit11 = 2;
|
||||||
|
data->imsi.u.num.digit12 = 1;
|
||||||
|
data->imsi.u.num.digit13 = 5;
|
||||||
|
data->imsi.u.num.digit14 = 0;
|
||||||
|
data->imsi.u.num.digit15 = 0xF;
|
||||||
|
/*
|
||||||
|
* Last registered home PLMN
|
||||||
|
*/
|
||||||
|
data->rplmn.MCCdigit1 = 3;
|
||||||
|
data->rplmn.MCCdigit2 = 1;
|
||||||
|
data->rplmn.MCCdigit3 = 0;
|
||||||
|
data->rplmn.MNCdigit1 = 0;
|
||||||
|
data->rplmn.MNCdigit2 = 2;
|
||||||
|
data->rplmn.MNCdigit3 = 8;
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* International Mobile Subscriber Identity
|
* International Mobile Subscriber Identity
|
||||||
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
|
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
|
||||||
*/
|
*/
|
||||||
data->imsi.length = 8;
|
#warning "IMSI 208.10.000001234"
|
||||||
|
/* data->imsi.length = 8;
|
||||||
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
|
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
|
||||||
data->imsi.u.num.digit1 = 2; // MCC digit 1
|
data->imsi.u.num.digit1 = 2; // MCC digit 1
|
||||||
data->imsi.u.num.digit2 = 0; // MCC digit 2
|
data->imsi.u.num.digit2 = 0; // MCC digit 2
|
||||||
data->imsi.u.num.digit3 = 8; // MCC digit 3
|
data->imsi.u.num.digit3 = 8; // MCC digit 3
|
||||||
data->imsi.u.num.digit4 = 1; // MNC digit 1
|
data->imsi.u.num.digit4 = 1; // MNC digit 1
|
||||||
data->imsi.u.num.digit5 = 0; // MNC digit 2
|
data->imsi.u.num.digit5 = 0; // MNC digit 2
|
||||||
data->imsi.u.num.digit6 = 0; // MNC digit 3
|
data->imsi.u.num.digit6 = 0xF; // MNC digit 3
|
||||||
//LG data->imsi.u.num.digit6 = 0xF; // MNC digit 3
|
data->imsi.u.num.digit7 = 0;
|
||||||
|
data->imsi.u.num.digit8 = 0;
|
||||||
|
data->imsi.u.num.digit9 = 0;
|
||||||
|
data->imsi.u.num.digit10 = 0;
|
||||||
|
data->imsi.u.num.digit11 = 1;
|
||||||
|
data->imsi.u.num.digit12 = 2;
|
||||||
|
data->imsi.u.num.digit13 = 3;
|
||||||
|
data->imsi.u.num.digit14 = 4;
|
||||||
|
data->imsi.u.num.digit15 = 0xF;*/
|
||||||
|
data->imsi.length = 8;
|
||||||
|
data->imsi.u.num.parity = 0x0; // 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 = 1; // MNC digit 1
|
||||||
|
data->imsi.u.num.digit5 = 0; // MNC digit 2
|
||||||
|
data->imsi.u.num.digit6 = 0;
|
||||||
data->imsi.u.num.digit7 = 0;
|
data->imsi.u.num.digit7 = 0;
|
||||||
data->imsi.u.num.digit8 = 0;
|
data->imsi.u.num.digit8 = 0;
|
||||||
data->imsi.u.num.digit9 = 0;
|
data->imsi.u.num.digit9 = 0;
|
||||||
@@ -308,6 +362,7 @@ static void _gen_emm_data(emm_nvdata_t* data)
|
|||||||
data->imsi.u.num.digit13 = 3;
|
data->imsi.u.num.digit13 = 3;
|
||||||
data->imsi.u.num.digit14 = 4;
|
data->imsi.u.num.digit14 = 4;
|
||||||
data->imsi.u.num.digit15 = 0xF;
|
data->imsi.u.num.digit15 = 0xF;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Last registered home PLMN
|
* Last registered home PLMN
|
||||||
*/
|
*/
|
||||||
@@ -317,6 +372,7 @@ static void _gen_emm_data(emm_nvdata_t* data)
|
|||||||
data->rplmn.MNCdigit1 = 1;
|
data->rplmn.MNCdigit1 = 1;
|
||||||
data->rplmn.MNCdigit2 = 0;
|
data->rplmn.MNCdigit2 = 0;
|
||||||
data->rplmn.MNCdigit3 = 0xf;
|
data->rplmn.MNCdigit3 = 0xf;
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* List of Equivalent PLMNs
|
* List of Equivalent PLMNs
|
||||||
*/
|
*/
|
||||||
@@ -356,20 +412,79 @@ static void _display_ue_data(const user_nvdata_t* data)
|
|||||||
static void _display_emm_data(const emm_nvdata_t* data)
|
static void _display_emm_data(const emm_nvdata_t* data)
|
||||||
{
|
{
|
||||||
printf("IMSI\t\t= ");
|
printf("IMSI\t\t= ");
|
||||||
printf("%u%u%u%u%u%u%u%u%u%u%u%u%u\n",
|
if (data->imsi.u.num.digit6 == 0b1111) {
|
||||||
data->imsi.u.num.digit1,
|
if (data->imsi.u.num.digit15 == 0b1111) {
|
||||||
data->imsi.u.num.digit2,
|
printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u\n",
|
||||||
data->imsi.u.num.digit3,
|
data->imsi.u.num.digit1,
|
||||||
data->imsi.u.num.digit4,
|
data->imsi.u.num.digit2,
|
||||||
data->imsi.u.num.digit5,
|
data->imsi.u.num.digit3,
|
||||||
data->imsi.u.num.digit7,
|
data->imsi.u.num.digit4,
|
||||||
data->imsi.u.num.digit8,
|
data->imsi.u.num.digit5,
|
||||||
data->imsi.u.num.digit9,
|
|
||||||
data->imsi.u.num.digit10,
|
data->imsi.u.num.digit7,
|
||||||
data->imsi.u.num.digit11,
|
data->imsi.u.num.digit8,
|
||||||
data->imsi.u.num.digit12,
|
data->imsi.u.num.digit9,
|
||||||
data->imsi.u.num.digit13,
|
data->imsi.u.num.digit10,
|
||||||
data->imsi.u.num.digit14);
|
data->imsi.u.num.digit11,
|
||||||
|
data->imsi.u.num.digit12,
|
||||||
|
data->imsi.u.num.digit13,
|
||||||
|
data->imsi.u.num.digit14);
|
||||||
|
} else {
|
||||||
|
printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u%u\n",
|
||||||
|
data->imsi.u.num.digit1,
|
||||||
|
data->imsi.u.num.digit2,
|
||||||
|
data->imsi.u.num.digit3,
|
||||||
|
data->imsi.u.num.digit4,
|
||||||
|
data->imsi.u.num.digit5,
|
||||||
|
|
||||||
|
data->imsi.u.num.digit7,
|
||||||
|
data->imsi.u.num.digit8,
|
||||||
|
data->imsi.u.num.digit9,
|
||||||
|
data->imsi.u.num.digit10,
|
||||||
|
data->imsi.u.num.digit11,
|
||||||
|
data->imsi.u.num.digit12,
|
||||||
|
data->imsi.u.num.digit13,
|
||||||
|
data->imsi.u.num.digit14,
|
||||||
|
data->imsi.u.num.digit15);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (data->imsi.u.num.digit15 == 0b1111) {
|
||||||
|
printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n",
|
||||||
|
data->imsi.u.num.digit1,
|
||||||
|
data->imsi.u.num.digit2,
|
||||||
|
data->imsi.u.num.digit3,
|
||||||
|
data->imsi.u.num.digit4,
|
||||||
|
data->imsi.u.num.digit5,
|
||||||
|
data->imsi.u.num.digit6,
|
||||||
|
|
||||||
|
data->imsi.u.num.digit7,
|
||||||
|
data->imsi.u.num.digit8,
|
||||||
|
data->imsi.u.num.digit9,
|
||||||
|
data->imsi.u.num.digit10,
|
||||||
|
data->imsi.u.num.digit11,
|
||||||
|
data->imsi.u.num.digit12,
|
||||||
|
data->imsi.u.num.digit13,
|
||||||
|
data->imsi.u.num.digit14);
|
||||||
|
} else {
|
||||||
|
printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n",
|
||||||
|
data->imsi.u.num.digit1,
|
||||||
|
data->imsi.u.num.digit2,
|
||||||
|
data->imsi.u.num.digit3,
|
||||||
|
data->imsi.u.num.digit4,
|
||||||
|
data->imsi.u.num.digit5,
|
||||||
|
data->imsi.u.num.digit6,
|
||||||
|
|
||||||
|
data->imsi.u.num.digit7,
|
||||||
|
data->imsi.u.num.digit8,
|
||||||
|
data->imsi.u.num.digit9,
|
||||||
|
data->imsi.u.num.digit10,
|
||||||
|
data->imsi.u.num.digit11,
|
||||||
|
data->imsi.u.num.digit12,
|
||||||
|
data->imsi.u.num.digit13,
|
||||||
|
data->imsi.u.num.digit14,
|
||||||
|
data->imsi.u.num.digit15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("RPLMN\t\t= "); PRINT_PLMN(data->rplmn);
|
printf("RPLMN\t\t= "); PRINT_PLMN(data->rplmn);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ Description Implements the utility used to generate data stored in the
|
|||||||
#include <stdlib.h> // exit
|
#include <stdlib.h> // exit
|
||||||
#include <string.h> // memset, memcpy, strncpy
|
#include <string.h> // memset, memcpy, strncpy
|
||||||
|
|
||||||
|
//#define SELECTED_PLMN SFR1
|
||||||
|
#define SELECTED_PLMN FCT1
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -60,7 +63,7 @@ Description Implements the utility used to generate data stored in the
|
|||||||
#define KSI USIM_KSI_NOT_AVAILABLE
|
#define KSI USIM_KSI_NOT_AVAILABLE
|
||||||
#define KSI_ASME USIM_KSI_NOT_AVAILABLE
|
#define KSI_ASME USIM_KSI_NOT_AVAILABLE
|
||||||
#define INT_ALGO USIM_INT_EIA1
|
#define INT_ALGO USIM_INT_EIA1
|
||||||
#define ENC_ALGO USIM_ENC_EEA1
|
#define ENC_ALGO USIM_ENC_EEA0
|
||||||
#define SECURITY_ALGORITHMS (ENC_ALGO | INT_ALGO)
|
#define SECURITY_ALGORITHMS (ENC_ALGO | INT_ALGO)
|
||||||
|
|
||||||
#define MIN_TAC 0x0000
|
#define MIN_TAC 0x0000
|
||||||
@@ -135,19 +138,45 @@ int main (int argc, const char* argv[])
|
|||||||
* Initialize USIM data
|
* Initialize USIM data
|
||||||
*/
|
*/
|
||||||
memset(&usim_data, 0, sizeof(usim_data_t));
|
memset(&usim_data, 0, sizeof(usim_data_t));
|
||||||
|
|
||||||
|
//#if (SELECTED_PLMN == FCT1)
|
||||||
|
#if 1
|
||||||
|
/*
|
||||||
|
* International Mobile Subscriber Identity
|
||||||
|
* IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150
|
||||||
|
*/
|
||||||
|
#warning "IMSI 310.028.90832150"
|
||||||
|
usim_data.imsi.length = 8;
|
||||||
|
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
|
||||||
|
usim_data.imsi.u.num.digit1 = 3; // MCC digit 1
|
||||||
|
usim_data.imsi.u.num.digit2 = 1; // MCC digit 2
|
||||||
|
usim_data.imsi.u.num.digit3 = 0; // MCC digit 3
|
||||||
|
usim_data.imsi.u.num.digit4 = 0; // MNC digit 1
|
||||||
|
usim_data.imsi.u.num.digit5 = 2; // MNC digit 2
|
||||||
|
usim_data.imsi.u.num.digit6 = 8; // MNC digit 3
|
||||||
|
usim_data.imsi.u.num.digit7 = 9;
|
||||||
|
usim_data.imsi.u.num.digit8 = 0;
|
||||||
|
usim_data.imsi.u.num.digit9 = 8;
|
||||||
|
usim_data.imsi.u.num.digit10 = 3;
|
||||||
|
usim_data.imsi.u.num.digit11 = 2;
|
||||||
|
usim_data.imsi.u.num.digit12 = 1;
|
||||||
|
usim_data.imsi.u.num.digit13 = 5;
|
||||||
|
usim_data.imsi.u.num.digit14 = 0;
|
||||||
|
usim_data.imsi.u.num.digit15 = 0b1111;
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* International Mobile Subscriber Identity
|
* International Mobile Subscriber Identity
|
||||||
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
|
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
|
||||||
*/
|
*/
|
||||||
usim_data.imsi.length = 8;
|
#warning "IMSI 208.10.00001234"
|
||||||
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
|
/* 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
|
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.digit2 = 0; // MCC digit 2
|
||||||
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
|
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
|
||||||
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
|
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
|
||||||
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
|
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
|
||||||
// LG usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
|
usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
|
||||||
usim_data.imsi.u.num.digit6 = 0; // MNC digit 3
|
|
||||||
usim_data.imsi.u.num.digit7 = 0;
|
usim_data.imsi.u.num.digit7 = 0;
|
||||||
usim_data.imsi.u.num.digit8 = 0;
|
usim_data.imsi.u.num.digit8 = 0;
|
||||||
usim_data.imsi.u.num.digit9 = 0;
|
usim_data.imsi.u.num.digit9 = 0;
|
||||||
@@ -156,7 +185,25 @@ int main (int argc, const char* argv[])
|
|||||||
usim_data.imsi.u.num.digit12 = 2;
|
usim_data.imsi.u.num.digit12 = 2;
|
||||||
usim_data.imsi.u.num.digit13 = 3;
|
usim_data.imsi.u.num.digit13 = 3;
|
||||||
usim_data.imsi.u.num.digit14 = 4;
|
usim_data.imsi.u.num.digit14 = 4;
|
||||||
usim_data.imsi.u.num.digit15 = 0b1111;
|
usim_data.imsi.u.num.digit15 = 0b1111;*/
|
||||||
|
usim_data.imsi.length = 8;
|
||||||
|
usim_data.imsi.u.num.parity = 0x0; // Type of identity = IMSI, 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 = 1; // MNC digit 1
|
||||||
|
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
|
||||||
|
usim_data.imsi.u.num.digit6 = 0;
|
||||||
|
usim_data.imsi.u.num.digit7 = 0;
|
||||||
|
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 = 1;
|
||||||
|
usim_data.imsi.u.num.digit12 = 2;
|
||||||
|
usim_data.imsi.u.num.digit13 = 3;
|
||||||
|
usim_data.imsi.u.num.digit14 = 4;
|
||||||
|
usim_data.imsi.u.num.digit15 = 0xF;
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Ciphering and Integrity Keys
|
* Ciphering and Integrity Keys
|
||||||
*/
|
*/
|
||||||
@@ -178,7 +225,7 @@ int main (int argc, const char* argv[])
|
|||||||
* Location Information
|
* Location Information
|
||||||
*/
|
*/
|
||||||
usim_data.loci.tmsi = DEFAULT_TMSI;
|
usim_data.loci.tmsi = DEFAULT_TMSI;
|
||||||
usim_data.loci.lai.plmn = network_records[SFR1].plmn;
|
usim_data.loci.lai.plmn = network_records[SELECTED_PLMN].plmn;
|
||||||
usim_data.loci.lai.lac = DEFAULT_LAC;
|
usim_data.loci.lai.lac = DEFAULT_LAC;
|
||||||
usim_data.loci.status = USIM_LOCI_NOT_UPDATED;
|
usim_data.loci.status = USIM_LOCI_NOT_UPDATED;
|
||||||
/*
|
/*
|
||||||
@@ -188,7 +235,7 @@ int main (int argc, const char* argv[])
|
|||||||
usim_data.psloci.signature[0] = 0x01;
|
usim_data.psloci.signature[0] = 0x01;
|
||||||
usim_data.psloci.signature[1] = 0x02;
|
usim_data.psloci.signature[1] = 0x02;
|
||||||
usim_data.psloci.signature[2] = 0x03;
|
usim_data.psloci.signature[2] = 0x03;
|
||||||
usim_data.psloci.rai.plmn = network_records[SFR1].plmn;
|
usim_data.psloci.rai.plmn = network_records[SELECTED_PLMN].plmn;
|
||||||
usim_data.psloci.rai.lac = DEFAULT_LAC;
|
usim_data.psloci.rai.lac = DEFAULT_LAC;
|
||||||
usim_data.psloci.rai.rac = DEFAULT_RAC;
|
usim_data.psloci.rai.rac = DEFAULT_RAC;
|
||||||
usim_data.psloci.status = USIM_PSLOCI_NOT_UPDATED;
|
usim_data.psloci.status = USIM_PSLOCI_NOT_UPDATED;
|
||||||
@@ -279,7 +326,7 @@ int main (int argc, const char* argv[])
|
|||||||
/*
|
/*
|
||||||
* Home PLMN Selector with Access Technology
|
* Home PLMN Selector with Access Technology
|
||||||
*/
|
*/
|
||||||
usim_data.hplmn.plmn = network_records[SFR1].plmn;
|
usim_data.hplmn.plmn = network_records[SELECTED_PLMN].plmn;
|
||||||
usim_data.hplmn.AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
|
usim_data.hplmn.AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
|
||||||
/*
|
/*
|
||||||
* List of user controlled PLMN selector with Access Technology
|
* List of user controlled PLMN selector with Access Technology
|
||||||
@@ -306,7 +353,7 @@ int main (int argc, const char* argv[])
|
|||||||
/*
|
/*
|
||||||
* EPS Location Information
|
* EPS Location Information
|
||||||
*/
|
*/
|
||||||
usim_data.epsloci.guti.gummei.plmn = network_records[SFR1].plmn;
|
usim_data.epsloci.guti.gummei.plmn = network_records[SELECTED_PLMN].plmn;
|
||||||
usim_data.epsloci.guti.gummei.MMEgid = DEFAULT_MME_ID;
|
usim_data.epsloci.guti.gummei.MMEgid = DEFAULT_MME_ID;
|
||||||
usim_data.epsloci.guti.gummei.MMEcode = DEFAULT_MME_CODE;
|
usim_data.epsloci.guti.gummei.MMEcode = DEFAULT_MME_CODE;
|
||||||
usim_data.epsloci.guti.m_tmsi = DEFAULT_M_TMSI;
|
usim_data.epsloci.guti.m_tmsi = DEFAULT_M_TMSI;
|
||||||
|
|||||||
@@ -348,7 +348,16 @@ int s6a_generate_authentication_info_req(s6a_auth_info_req_t *air_p)
|
|||||||
CHECK_FCT(fd_msg_avp_new(s6a_fd_cnf.dataobj_s6a_visited_plmn_id, 0, &avp));
|
CHECK_FCT(fd_msg_avp_new(s6a_fd_cnf.dataobj_s6a_visited_plmn_id, 0, &avp));
|
||||||
|
|
||||||
|
|
||||||
PLMN_T_TO_TBCD(air_p->visited_plmn, plmn);
|
PLMN_T_TO_TBCD(air_p->visited_plmn,
|
||||||
|
plmn,
|
||||||
|
mme_config_find_mnc_length(air_p->visited_plmn.MCCdigit1,
|
||||||
|
air_p->visited_plmn.MCCdigit2,
|
||||||
|
air_p->visited_plmn.MCCdigit3,
|
||||||
|
air_p->visited_plmn.MNCdigit1,
|
||||||
|
air_p->visited_plmn.MNCdigit2,
|
||||||
|
air_p->visited_plmn.MNCdigit3
|
||||||
|
)
|
||||||
|
);
|
||||||
value.os.data = plmn;
|
value.os.data = plmn;
|
||||||
value.os.len = 3;
|
value.os.len = 3;
|
||||||
CHECK_FCT(fd_msg_avp_setvalue(avp, &value));
|
CHECK_FCT(fd_msg_avp_setvalue(avp, &value));
|
||||||
|
|||||||
@@ -245,7 +245,16 @@ int s6a_generate_update_location(s6a_update_location_req_t *ulr_pP)
|
|||||||
|
|
||||||
CHECK_FCT(fd_msg_avp_new(s6a_fd_cnf.dataobj_s6a_visited_plmn_id, 0, &avp_p));
|
CHECK_FCT(fd_msg_avp_new(s6a_fd_cnf.dataobj_s6a_visited_plmn_id, 0, &avp_p));
|
||||||
|
|
||||||
PLMN_T_TO_TBCD(ulr_pP->visited_plmn, plmn);
|
PLMN_T_TO_TBCD(ulr_pP->visited_plmn,
|
||||||
|
plmn,
|
||||||
|
mme_config_find_mnc_length(ulr_pP->visited_plmn.MCCdigit1,
|
||||||
|
ulr_pP->visited_plmn.MCCdigit2,
|
||||||
|
ulr_pP->visited_plmn.MCCdigit3,
|
||||||
|
ulr_pP->visited_plmn.MNCdigit1,
|
||||||
|
ulr_pP->visited_plmn.MNCdigit2,
|
||||||
|
ulr_pP->visited_plmn.MNCdigit3
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
printf("PLMN: %3s\n", plmn);
|
printf("PLMN: %3s\n", plmn);
|
||||||
|
|
||||||
|
|||||||
@@ -238,15 +238,15 @@ do { \
|
|||||||
(pLMN)->MNCdigit1 = ((tBCDsTRING)->buf[2] & 0x0f); \
|
(pLMN)->MNCdigit1 = ((tBCDsTRING)->buf[2] & 0x0f); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define PLMN_T_TO_TBCD(pLMN, tBCDsTRING) \
|
#define PLMN_T_TO_TBCD(pLMN, tBCDsTRING, mNClENGTH) \
|
||||||
do { \
|
do { \
|
||||||
tBCDsTRING[0] = (pLMN.MCCdigit2 << 4) | pLMN.MCCdigit3; \
|
tBCDsTRING[0] = (pLMN.MCCdigit2 << 4) | pLMN.MCCdigit1; \
|
||||||
/* ambiguous (think about len 2) */ \
|
/* ambiguous (think about len 2) */ \
|
||||||
if (pLMN.MNCdigit1 == 0) { \
|
if (mNClENGTH == 2) { \
|
||||||
tBCDsTRING[1] = (0x0F << 4) | pLMN.MCCdigit1; \
|
tBCDsTRING[1] = (0x0F << 4) | pLMN.MCCdigit3; \
|
||||||
tBCDsTRING[2] = (pLMN.MNCdigit3 << 4) | pLMN.MNCdigit2; \
|
tBCDsTRING[2] = (pLMN.MNCdigit2 << 4) | pLMN.MNCdigit1; \
|
||||||
} else { \
|
} else { \
|
||||||
tBCDsTRING[1] = (pLMN.MNCdigit3 << 4) | pLMN.MCCdigit1; \
|
tBCDsTRING[1] = (pLMN.MNCdigit3 << 4) | pLMN.MCCdigit3; \
|
||||||
tBCDsTRING[2] = (pLMN.MNCdigit2 << 4) | pLMN.MNCdigit1; \
|
tBCDsTRING[2] = (pLMN.MNCdigit2 << 4) | pLMN.MNCdigit1; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|||||||
@@ -1777,8 +1777,8 @@ int find_mnc_length(const char mcc_digit1P,
|
|||||||
"BAD MCC PARAMETER (%d%d%d)!\n",
|
"BAD MCC PARAMETER (%d%d%d)!\n",
|
||||||
mcc_digit1P, mcc_digit2P, mcc_digit3P);
|
mcc_digit1P, mcc_digit2P, mcc_digit3P);
|
||||||
|
|
||||||
AssertFatal((mnc_digit2P >= '0') && (mnc_digit2P <= '9')
|
AssertFatal((mnc_digit1P >= '0') && (mnc_digit1P <= '9')
|
||||||
&& (mnc_digit3P >= '0') && (mnc_digit3P <= '9') ,
|
&& (mnc_digit2P >= '0') && (mnc_digit2P <= '9') ,
|
||||||
"BAD MNC PARAMETER ((%d)%d%d)!\n",
|
"BAD MNC PARAMETER ((%d)%d%d)!\n",
|
||||||
mnc_digit1P, mnc_digit2P, mnc_digit3P);
|
mnc_digit1P, mnc_digit2P, mnc_digit3P);
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,46 @@
|
|||||||
|
|
||||||
mme_config_t mme_config;
|
mme_config_t mme_config;
|
||||||
|
|
||||||
|
int mme_config_find_mnc_length(const char mcc_digit1P,
|
||||||
|
const char mcc_digit2P,
|
||||||
|
const char mcc_digit3P,
|
||||||
|
const char mnc_digit1P,
|
||||||
|
const char mnc_digit2P,
|
||||||
|
const char mnc_digit3P) {
|
||||||
|
|
||||||
|
uint16_t mcc = 100*mcc_digit1P + 10*mcc_digit2P + mcc_digit3P;
|
||||||
|
uint16_t mnc3= 100*mnc_digit1P + 10*mnc_digit2P + mnc_digit3P;
|
||||||
|
uint16_t mnc2= 10*mnc_digit1P + mnc_digit2P;
|
||||||
|
int plmn_index = 0;
|
||||||
|
|
||||||
|
AssertFatal((mcc_digit1P >= 0) && (mcc_digit1P <= 9)
|
||||||
|
&& (mcc_digit2P >= 0) && (mcc_digit2P <= 9)
|
||||||
|
&& (mcc_digit3P >= 0) && (mcc_digit3P <= 9) ,
|
||||||
|
"BAD MCC PARAMETER (%d%d%d)!\n",
|
||||||
|
mcc_digit1P, mcc_digit2P, mcc_digit3P);
|
||||||
|
|
||||||
|
AssertFatal((mnc_digit2P >= 0) && (mnc_digit2P <= 9)
|
||||||
|
&& (mnc_digit1P >= 0) && (mnc_digit1P <= 9) ,
|
||||||
|
"BAD MNC PARAMETER (%d.%d.%d)!\n",
|
||||||
|
mnc_digit1P, mnc_digit2P, mnc_digit3P);
|
||||||
|
|
||||||
|
|
||||||
|
while (plmn_index < mme_config.gummei.nb_plmns) {
|
||||||
|
if (mme_config.gummei.plmn_mcc[plmn_index] == mcc) {
|
||||||
|
if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc2) &&
|
||||||
|
(mme_config.gummei.plmn_mnc_len[plmn_index] == 2)) {
|
||||||
|
return 2;
|
||||||
|
} else if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc3) &&
|
||||||
|
(mme_config.gummei.plmn_mnc_len[plmn_index] == 3)) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plmn_index += 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void mme_config_init(mme_config_t *mme_config_p)
|
void mme_config_init(mme_config_t *mme_config_p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,6 +169,12 @@ typedef struct mme_config_s {
|
|||||||
|
|
||||||
extern mme_config_t mme_config;
|
extern mme_config_t mme_config;
|
||||||
|
|
||||||
|
int mme_config_find_mnc_length(const char mcc_digit1P,
|
||||||
|
const char mcc_digit2P,
|
||||||
|
const char mcc_digit3P,
|
||||||
|
const char mnc_digit1P,
|
||||||
|
const char mnc_digit2P,
|
||||||
|
const char mnc_digit3P);
|
||||||
int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config);
|
int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config);
|
||||||
|
|
||||||
#define config_read_lock(mMEcONFIG) pthread_rwlock_rdlock(&(mMEcONFIG)->rw_lock)
|
#define config_read_lock(mMEcONFIG) pthread_rwlock_rdlock(&(mMEcONFIG)->rw_lock)
|
||||||
|
|||||||
Reference in New Issue
Block a user