Commit d72294b9 authored by Cedric Roux's avatar Cedric Roux

fix gen_emm_data

It was not setting emm_data->eplmn.plmn[X], only emm_data->eplmn.n_plmns,
leading to the UE to dig for PLMN 00000.

(It's not the end of the story, seems like the PLMN selection
does not work, the UE only tries one from what I've seen, but
I didn't dig much, may be wrong.)
parent ea6fb5c4
...@@ -4,10 +4,18 @@ ...@@ -4,10 +4,18 @@
#include "conf_emm.h" #include "conf_emm.h"
#include "fs.h" #include "fs.h"
void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, int ehplmn_count, const networks_t networks) { void gen_emm_data(
emm_nvdata_t *emm_data,
const char *hplmn,
const char *msin,
const plmns_list *eplmn,
const networks_t networks)
{
memset(emm_data, 0, sizeof(emm_nvdata_t)); memset(emm_data, 0, sizeof(emm_nvdata_t));
int hplmn_index = get_plmn_index(hplmn, networks); int hplmn_index = get_plmn_index(hplmn, networks);
plmn_conf_param_t *conf = &networks.items[hplmn_index].conf; plmn_conf_param_t *conf = &networks.items[hplmn_index].conf;
int i;
emm_data->imsi.length = 8; emm_data->imsi.length = 8;
emm_data->imsi.u.num.parity = get_msin_parity(msin, conf->mcc, conf->mnc); emm_data->imsi.u.num.parity = get_msin_parity(msin, conf->mcc, conf->mnc);
emm_data->imsi.u.num.digit1 = conf->mcc[0]; emm_data->imsi.u.num.digit1 = conf->mcc[0];
...@@ -30,7 +38,6 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i ...@@ -30,7 +38,6 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i
emm_data->imsi.u.num.digit13 = msin[6]; emm_data->imsi.u.num.digit13 = msin[6];
emm_data->imsi.u.num.digit14 = msin[7]; emm_data->imsi.u.num.digit14 = msin[7];
emm_data->imsi.u.num.digit15 = msin[8]; emm_data->imsi.u.num.digit15 = msin[8];
} else { } else {
emm_data->rplmn.MNCdigit3 = 0xf; emm_data->rplmn.MNCdigit3 = 0xf;
...@@ -44,7 +51,6 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i ...@@ -44,7 +51,6 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i
emm_data->imsi.u.num.digit13 = msin[7]; emm_data->imsi.u.num.digit13 = msin[7];
emm_data->imsi.u.num.digit14 = msin[8]; emm_data->imsi.u.num.digit14 = msin[8];
emm_data->imsi.u.num.digit15 = msin[9]; emm_data->imsi.u.num.digit15 = msin[9];
} }
emm_data->rplmn.MCCdigit1 = conf->mcc[0]; emm_data->rplmn.MCCdigit1 = conf->mcc[0];
...@@ -53,7 +59,10 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i ...@@ -53,7 +59,10 @@ void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, i
emm_data->rplmn.MNCdigit1 = conf->mnc[0]; emm_data->rplmn.MNCdigit1 = conf->mnc[0];
emm_data->rplmn.MNCdigit2 = conf->mnc[1]; emm_data->rplmn.MNCdigit2 = conf->mnc[1];
emm_data->eplmn.n_plmns = ehplmn_count; emm_data->eplmn.n_plmns = eplmn->size;
for (i = 0; i < eplmn->size; i++) {
emm_data->eplmn.plmn[i] = networks.items[eplmn->items[i]].plmn;
}
} }
bool write_emm_data(const char *directory, int user_id, emm_nvdata_t *emm_data) { bool write_emm_data(const char *directory, int user_id, emm_nvdata_t *emm_data) {
......
...@@ -3,8 +3,15 @@ ...@@ -3,8 +3,15 @@
#include "emmData.h" #include "emmData.h"
#include "conf_network.h" #include "conf_network.h"
#include "conf_user_plmn.h"
void gen_emm_data(
emm_nvdata_t *emm_data,
const char *hplmn,
const char *msin,
const plmns_list *eplmn,
const networks_t networks);
void gen_emm_data(emm_nvdata_t *emm_data, const char *hplmn, const char *msin, int ehplmn_count, const networks_t networks);
bool write_emm_data(const char *directory, int user_id, emm_nvdata_t *emm_data); bool write_emm_data(const char *directory, int user_id, emm_nvdata_t *emm_data);
int get_msin_parity(const char * msin, const char *mcc, const char *mnc); int get_msin_parity(const char * msin, const char *mcc, const char *mnc);
......
...@@ -74,7 +74,7 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou ...@@ -74,7 +74,7 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
gen_usim_data(&usim_data_conf, &usim_data, &user_plmns, networks); gen_usim_data(&usim_data_conf, &usim_data, &user_plmns, networks);
gen_emm_data(&emm_data, usim_data_conf.hplmn, usim_data_conf.msin, gen_emm_data(&emm_data, usim_data_conf.hplmn, usim_data_conf.msin,
user_plmns.equivalents_home.size, networks); &user_plmns.equivalents_home, networks);
if ( output_flags & OUTPUT_UEDATA ) { if ( output_flags & OUTPUT_UEDATA ) {
write_user_data(output_dir, i, &user_data); write_user_data(output_dir, i, &user_data);
......
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