Commit 7578cd31 authored by Konstantinos Alexandris's avatar Konstantinos Alexandris Committed by Robert Schmidt

fixes: segmentation faults issues in RRC CM for RRC Measurement report,...

fixes: segmentation faults issues in RRC CM for RRC Measurement report, clean-up and re-implementation of functions in RAN API
parent 7410e80d
...@@ -412,7 +412,6 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -412,7 +412,6 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
Protocol__FlexEutraMeasurements **eutra_meas = NULL; Protocol__FlexEutraMeasurements **eutra_meas = NULL;
if (neigh_meas->n_eutra_meas > 0) { if (neigh_meas->n_eutra_meas > 0) {
eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas); eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
if (eutra_meas == NULL) { if (eutra_meas == NULL) {
free(neigh_meas); free(neigh_meas);
...@@ -438,6 +437,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -438,6 +437,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, rnti, j); eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, rnti, j);
eutra_meas[j]->has_phys_cell_id = 1; eutra_meas[j]->has_phys_cell_id = 1;
if (flexran_get_rrc_neigh_cgi(mod_id, rnti, j)) {
/* Initialize CGI measurements. */ /* Initialize CGI measurements. */
Protocol__FlexEutraCgiMeasurements *cgi_meas; Protocol__FlexEutraCgiMeasurements *cgi_meas;
cgi_meas = malloc(sizeof(Protocol__FlexEutraCgiMeasurements)); cgi_meas = malloc(sizeof(Protocol__FlexEutraCgiMeasurements));
...@@ -450,10 +450,10 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -450,10 +450,10 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
protocol__flex_cell_global_eutra_id__init(cgi); protocol__flex_cell_global_eutra_id__init(cgi);
cgi->cell_id = flexran_get_rrc_neigh_cgi_cell_id(mod_id, rnti, eutra_meas[j]->phys_cell_id); cgi->cell_id = flexran_get_rrc_neigh_cgi_cell_id(mod_id, rnti, j);
cgi->has_cell_id = 1; cgi->has_cell_id = 1;
cgi_meas->tracking_area_code = flexran_get_rrc_neigh_cgi_tac(mod_id, rnti, eutra_meas[j]->phys_cell_id); cgi_meas->tracking_area_code = flexran_get_rrc_neigh_cgi_tac(mod_id, rnti, j);
cgi_meas->has_tracking_area_code = 1; cgi_meas->has_tracking_area_code = 1;
/* PLMN for neighbouring cell */ /* PLMN for neighbouring cell */
...@@ -463,13 +463,22 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -463,13 +463,22 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
protocol__flex_plmn_identity__init(plmn_id); protocol__flex_plmn_identity__init(plmn_id);
plmn_id->mcc = 0; plmn_id->mcc = 0;
for (int m = 0; m < flexran_get_rrc_neigh_cgi_num_mcc(mod_id, rnti, eutra_meas[j]->phys_cell_id); m++) { plmn_id->n_mcc = flexran_get_rrc_neigh_cgi_num_mcc(mod_id, rnti, j);
plmn_id->mcc += flexran_get_rrc_neigh_cgi_mcc(mod_id, rnti, eutra_meas[j]->phys_cell_id, m);
for (int m = 0; m < plmn_id->n_mcc; m++) {
plmn_id->mcc += flexran_get_rrc_neigh_cgi_mcc(mod_id, rnti, j, m);
} }
plmn_id->mnc = 0; plmn_id->mnc = 0;
for (int m = 0; m < flexran_get_rrc_neigh_cgi_num_mnc(mod_id, rnti, eutra_meas[j]->phys_cell_id); m++) { plmn_id->n_mnc = flexran_get_rrc_neigh_cgi_num_mnc(mod_id, rnti, j);
plmn_id->mnc += flexran_get_rrc_neigh_cgi_mnc(mod_id, rnti, eutra_meas[j]->phys_cell_id, m);
for (int m = 0; m < plmn_id->n_mnc; m++) {
plmn_id->mnc += flexran_get_rrc_neigh_cgi_mnc(mod_id, rnti, j, m);
}
cgi->plmn_id = plmn_id;
cgi_meas->cgi = cgi;
eutra_meas[j]->cgi_meas = cgi_meas;
} }
/*RSRP/RSRQ of the neighbouring cell */ /*RSRP/RSRQ of the neighbouring cell */
...@@ -478,13 +487,12 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -478,13 +487,12 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
protocol__flex_eutra_ref_signal_meas__init(meas_result); protocol__flex_eutra_ref_signal_meas__init(meas_result);
meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, rnti, eutra_meas[j]->phys_cell_id); meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, rnti, j);
meas_result->has_rsrp = 1; meas_result->has_rsrp = 1;
meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, rnti, eutra_meas[j]->phys_cell_id); meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, rnti, j);
meas_result->has_rsrq = 1; meas_result->has_rsrq = 1;
eutra_meas[j]->cgi_meas = cgi_meas;
eutra_meas[j]->meas_result = meas_result; eutra_meas[j]->meas_result = meas_result;
} }
...@@ -500,11 +508,8 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -500,11 +508,8 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
} }
} }
} }
return 0; return 0;
error: error:
for (int i = 0; i < report_config->nr_ue; i++) { for (int i = 0; i < report_config->nr_ue; i++) {
if (ue_report[i]->rrc_measurements && ue_report[i]->rrc_measurements->neigh_meas != NULL) { if (ue_report[i]->rrc_measurements && ue_report[i]->rrc_measurements->neigh_meas != NULL) {
for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++) { for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++) {
...@@ -518,7 +523,6 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, ...@@ -518,7 +523,6 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
free(cell_report); free(cell_report);
if (ue_report != NULL) if (ue_report != NULL)
free(ue_report); free(ue_report);
return -1; return -1;
} }
......
This diff is collapsed.
...@@ -513,6 +513,9 @@ int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti); ...@@ -513,6 +513,9 @@ int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti);
/* Get neighbouring physical cell id */ /* Get neighbouring physical cell id */
long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id); long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get neighbouring cgi */
int flexran_get_rrc_neigh_cgi(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get neighbouring cgi info cell id */ /* Get neighbouring cgi info cell id */
uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_id); uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_id);
...@@ -520,10 +523,10 @@ uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_ ...@@ -520,10 +523,10 @@ uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_
uint32_t flexran_get_rrc_neigh_cgi_tac(mid_t mod_id, rnti_t rnti, long cell_id); uint32_t flexran_get_rrc_neigh_cgi_tac(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get the number of neighbouring cgi mnc */ /* Get the number of neighbouring cgi mnc */
uint32_t flexran_get_rrc_neigh_cgi_num_mnc(mid_t mod_id, rnti_t rnti, long cell_id); int flexran_get_rrc_neigh_cgi_num_mnc(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get the number of neighbouring cgi mcc */ /* Get the number of neighbouring cgi mcc */
uint32_t flexran_get_rrc_neigh_cgi_num_mcc(mid_t mod_id, rnti_t rnti, long cell_id); int flexran_get_rrc_neigh_cgi_num_mcc(mid_t mod_id, rnti_t rnti, long cell_id);
/* Get neighbouring cgi mnc */ /* Get neighbouring cgi mnc */
uint32_t flexran_get_rrc_neigh_cgi_mnc(mid_t mod_id, rnti_t rnti, long cell_id, int mnc_id); uint32_t flexran_get_rrc_neigh_cgi_mnc(mid_t mod_id, rnti_t rnti, long cell_id, int mnc_id);
......
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