From 703937ec01fb873f2e6159ccbbf18b2a32a577f1 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 3 May 2019 14:24:42 +0200 Subject: [PATCH] move sanity check for MBMS parameters to parse_args to avoid segfault on mismatch --- srsue/src/main.cc | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 4a4f7880e..084d77089 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -442,6 +442,29 @@ void parse_args(all_args_t* args, int argc, char* argv[]) args->log.usim_hex_limit = args->log.all_hex_limit; } } + + if (args->expert.mbms_service > -1) { + if (!args->expert.phy.interpolate_subframe_enabled) { + fprintf(stderr, + "interpolate_subframe_enabled = %d, While using MBMS, " + "please set interpolate_subframe_enabled to true\n", + args->expert.phy.interpolate_subframe_enabled); + exit(1); + } + if (args->expert.phy.nof_phy_threads > 2) { + fprintf(stderr, + "nof_phy_threads = %d, While using MBMS, please set " + "number of phy threads to 1 or 2\n", + args->expert.phy.nof_phy_threads); + exit(1); + } + if ((0 == args->expert.phy.snr_estim_alg.find("refs"))) { + fprintf(stderr, + "snr_estim_alg = refs, While using MBMS, please set " + "algorithm to pss or empty \n"); + exit(1); + } + } } static int sigcnt = 0; @@ -536,26 +559,6 @@ int main(int argc, char* argv[]) exit(1); } - if (args.expert.mbms_service > -1) { - if (!args.expert.phy.interpolate_subframe_enabled) { - fprintf(stderr, "interpolate_subframe_enabled = %d, While using MBMS, " - "please set interpolate_subframe_enabled to true\n", - args.expert.phy.interpolate_subframe_enabled); - exit(1); - } - if (args.expert.phy.nof_phy_threads > 2) { - fprintf(stderr, "nof_phy_threads = %d, While using MBMS, please set " - "number of phy threads to 1 or 2\n", - args.expert.phy.nof_phy_threads); - exit(1); - } - if ((0 == args.expert.phy.snr_estim_alg.find("refs"))) { - fprintf(stderr, "snr_estim_alg = refs, While using MBMS, please set " - "algorithm to pss or empty \n"); - exit(1); - } - } - metricshub.init(ue, args.expert.metrics_period_secs); metricshub.add_listener(&metrics_screen); metrics_screen.set_ue_handle(ue);