From 8dd62b32e3edf5b0d78baea47d97cba1f244ee64 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Fri, 2 Nov 2018 17:29:05 +0100 Subject: [PATCH] fix bad build_oai directive to compile libconfig for phy-simulators, fix load_configmodule crash because config source not set. --- cmake_targets/build_oai | 2 +- common/config/config_load_configmodule.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 37f8d711db..51d6ac6d01 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -652,7 +652,7 @@ function main() { lte-simulators coding \ libcoding.so $dbin/libcoding.so compilations \ - phy_simulators $config_libconfig_shlib \ + lte-simulators $config_libconfig_shlib \ lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so fi diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 7c8c61135b..cfb6e38440 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -201,12 +201,20 @@ int OoptIdx=-1; cfgparam = getenv("OAI_CONFIGMODULE"); } -/* default */ +/* default different for UE and softmodem because UE doesn't use config file*/ +/* and -O option is not mandatory for UE */ +/* phy simulators behave as UE */ +/* test of exec name would better be replaced by a parameter to the l */ +/* oad_configmodule function */ if (cfgparam == NULL) { tmpflags = tmpflags | CONFIG_NOOOPT; - cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; + if (strstr(argv[0],"uesoftmodem") == NULL || strstr(argv[0],"lsim") == NULL) { + cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME; + } else { + cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; + } } - + /* parse the config parameters to set the config source */ i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams); if (i< 0) { @@ -215,9 +223,9 @@ int OoptIdx=-1; } else if ( i == 1 ) { /* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig - with one parameter, the path to the configuration file */ + with one parameter, the path to the configuration file cfgmode must not be NULL */ modeparams=cfgmode; - cfgmode=NULL; //strdup(CONFIG_LIBCONFIGFILE); + cfgmode=strdup(CONFIG_LIBCONFIGFILE); } cfgptr = calloc(sizeof(configmodule_interface_t),1); -- GitLab