Commit 18ec5d80 authored by frtabu's avatar frtabu

abort execution when an unknown option is passed via the command line: add...

abort execution when an unknown option is passed via the command line: add config_check_cmdlineopt API to config module, create lte-softmodem-common.c source to remove duplicate code in lte-softmodem.c and lte-uesoftmodem.c, fix segfaults in exec_function of lte-uesoftmodem
parent 2811dc7c
...@@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem ...@@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
########################## ##########################
...@@ -1927,6 +1926,7 @@ add_executable(lte-softmodem ...@@ -1927,6 +1926,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c
...@@ -1966,6 +1966,7 @@ add_executable(lte-softmodem-nos1 ...@@ -1966,6 +1966,7 @@ add_executable(lte-softmodem-nos1
${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c
...@@ -2003,6 +2004,7 @@ add_executable(lte-uesoftmodem ...@@ -2003,6 +2004,7 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
...@@ -2041,6 +2043,7 @@ add_executable(lte-uesoftmodem-nos1 ...@@ -2041,6 +2043,7 @@ add_executable(lte-uesoftmodem-nos1
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
......
...@@ -140,12 +140,43 @@ char defbool[2]="1"; ...@@ -140,12 +140,43 @@ char defbool[2]="1";
return optisset; return optisset;
} }
int config_check_cmdlineopt(char *prefix)
{
int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH]="";
int finalcheck = 0;
if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1;
else if (strlen(prefix) > 0) {
sprintf(testprefix,"--%s.",prefix);
}
}
for (int i=1; i<config_get_if()->argc ; i++) {
if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue;
if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
fprintf(stderr,"[CONFIG] unknown option: %s\n",
config_get_if()->argv[i] );
unknowndetected++;
}
}
printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
unknowndetected,testprefix,((prefix==NULL)?"":prefix));
return unknowndetected;
} /* parse_cmdline*/
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
{ {
int c = config_get_if()->argc; int c = config_get_if()->argc;
int i,j; int i,j;
char *pp; char *pp;
char cfgpath[512]; /* 512 should be enough for the sprintf below */ char cfgpath[CONFIG_MAXOPTLENGTH];
j = 0; j = 0;
i = 0; i = 0;
...@@ -155,6 +186,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -155,6 +186,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) { if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
char *tokctx; char *tokctx;
pp=strtok_r(oneargv, "_",&tokctx); pp=strtok_r(oneargv, "_",&tokctx);
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) { if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
if( prefix == NULL) { if( prefix == NULL) {
config_printhelp(cfgoptions,numoptions); config_printhelp(cfgoptions,numoptions);
...@@ -189,6 +221,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -189,6 +221,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) { ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
char *valptr=NULL; char *valptr=NULL;
int ret; int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
if (c > 0) { if (c > 0) {
pp = config_get_if()->argv[i+1]; pp = config_get_if()->argv[i+1];
if (pp != NULL ) { if (pp != NULL ) {
...@@ -204,6 +237,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -204,6 +237,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
j += processoption(&(cfgoptions[n]), valptr); j += processoption(&(cfgoptions[n]), valptr);
if ( valptr != NULL ) { if ( valptr != NULL ) {
i++; i++;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
c--; c--;
} }
break; break;
...@@ -215,5 +249,13 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -215,5 +249,13 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
c--; c--;
} /* fin du while */ } /* fin du while */
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j); printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) {
i=config_check_cmdlineopt(prefix);
if (i > 0) {
fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n",
i,((prefix==NULL)?"\"root section\"":prefix));
exit_fun(" Exiting after detecting errors in command line \n");
}
}
return j; return j;
} /* parse_cmdline*/ } /* parse_cmdline*/
...@@ -178,12 +178,14 @@ char *strtokctx=NULL; ...@@ -178,12 +178,14 @@ char *strtokctx=NULL;
char *atoken; char *atoken;
uint32_t tmpflags=0; uint32_t tmpflags=0;
int i; int i;
int OoptIdx=-1;
/* first parse the command line to look for the -O option */ /* first parse the command line to look for the -O option */
for (i = 0;i<argc;i++) { for (i = 0;i<argc;i++) {
if (strlen(argv[i]) < 2) continue; if (strlen(argv[i]) < 2) continue;
if ( argv[i][1] == 'O' && i < (argc -1)) { if ( argv[i][1] == 'O' && i < (argc -1)) {
cfgparam = argv[i+1]; cfgparam = argv[i+1];
OoptIdx=i;
} }
if ( strstr(argv[i], "help_config") != NULL ) { if ( strstr(argv[i], "help_config") != NULL ) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
...@@ -218,8 +220,13 @@ int i; ...@@ -218,8 +220,13 @@ int i;
cfgmode=NULL; //strdup(CONFIG_LIBCONFIGFILE); cfgmode=NULL; //strdup(CONFIG_LIBCONFIGFILE);
} }
cfgptr = malloc(sizeof(configmodule_interface_t)); cfgptr = calloc(sizeof(configmodule_interface_t),1);
memset(cfgptr,0,sizeof(configmodule_interface_t)); cfgptr->argv_info = calloc(sizeof(int32_t), argc);
cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED;
if (OoptIdx >= 0) {
cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED;
cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED;
}
cfgptr->rtflags = cfgptr->rtflags | tmpflags; cfgptr->rtflags = cfgptr->rtflags | tmpflags;
cfgptr->argc = argc; cfgptr->argc = argc;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "common/config/config_paramdesc.h" #include "common/config/config_paramdesc.h"
#include "common/utils/T/T.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2... #define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module #define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
...@@ -44,12 +45,14 @@ ...@@ -44,12 +45,14 @@
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file #define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
#define CONFIG_CMDLINEONLY "cmdline" // use only command line options #define CONFIG_CMDLINEONLY "cmdline" // use only command line options
#define DEFAULT_CFGFILENAME "oai.conf" // default config file #define DEFAULT_CFGFILENAME "oai.conf" // default config file
/* bit position definition for the argv_info mask of the configmodule_interface_t structure */
/* rtflags bit position definitions */ #define CONFIG_CMDLINEOPT_PROCESSED (1<<0) // command line option has been processed
/* bit position definitions for the rtflags mask of the configmodule_interface_t structure*/
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing #define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages #define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages #define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails #define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help #define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
#define CONFIG_HELP (1<<20) // print help message #define CONFIG_HELP (1<<20) // print help message
#define CONFIG_ABORT (1<<21) // config failed,abort execution #define CONFIG_ABORT (1<<21) // config failed,abort execution
...@@ -62,6 +65,7 @@ typedef struct configmodule_interface ...@@ -62,6 +65,7 @@ typedef struct configmodule_interface
{ {
int argc; int argc;
char **argv; char **argv;
uint32_t *argv_info;
char *cfgmode; char *cfgmode;
int num_cfgP; int num_cfgP;
char *cfgP[CONFIG_MAX_OOPT_PARAMS]; char *cfgP[CONFIG_MAX_OOPT_PARAMS];
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define MAX_OPTNAME_SIZE 64 #define MAX_OPTNAME_SIZE 64
#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[<index>].prefix2.optname */
/* parameter flags definitions */ /* parameter flags definitions */
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions #define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions #define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */ /* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20 #define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t; typedef struct paramdef paramdef_t;
......
...@@ -197,20 +197,20 @@ int config_get(paramdef_t *params,int numparams, char *prefix) ...@@ -197,20 +197,20 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
{ {
int ret= -1; int ret= -1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix); fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix);
return ret; return ret;
} }
configmodule_interface_t *cfgif = config_get_if(); configmodule_interface_t *cfgif = config_get_if();
if (cfgif != NULL) { if (cfgif != NULL) {
ret = config_get_if()->get(params, numparams,prefix); ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) { if (ret >= 0) {
config_process_cmdline(params,numparams,prefix); config_process_cmdline(params,numparams,prefix);
config_execcheck(params,numparams,prefix); config_execcheck(params,numparams,prefix);
} }
return ret; return ret;
} }
return ret; return ret;
} }
int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
......
...@@ -55,7 +55,9 @@ extern void config_assign_processedint(paramdef_t *cfgoption, int val); ...@@ -55,7 +55,9 @@ extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr); extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
/* apis to get parameters, to be used by oai modules, at configuration time */ /* apis to get/check parameters, to be used by oai modules, at configuration time */
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
extern int config_check_cmdlineopt(char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix); extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix); extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
#include "vcd_signal_dumper.h" #include "vcd_signal_dumper.h"
#include "assertions.h" #include "assertions.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
# include <pthread.h> # include <pthread.h>
# include <string.h> # include <string.h>
...@@ -242,7 +239,7 @@ void log_getconfig(log_t *g_log) { ...@@ -242,7 +239,7 @@ void log_getconfig(log_t *g_log) {
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS]; paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)]; paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)]; paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX); int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
if (ret <0) { if (ret <0) {
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed"); fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
...@@ -319,6 +316,7 @@ void log_getconfig(log_t *g_log) { ...@@ -319,6 +316,7 @@ void log_getconfig(log_t *g_log) {
logparams_dump[i].numelt = 0; logparams_dump[i].numelt = 0;
} }
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */ /* set the debug mask according to the debug parameters values */
for (int i=0; log_maskmap[i].name != NULL ; i++) { for (int i=0; log_maskmap[i].name != NULL ; i++) {
...@@ -358,6 +356,14 @@ int computed_compidx=compidx; ...@@ -358,6 +356,14 @@ int computed_compidx=compidx;
return computed_compidx; return computed_compidx;
} }
int isLogInitDone (void){
if (g_log == NULL)
return 0;
if (!(g_log->flag & FLAG_INITIALIZED))
return 0;
return 1;
}
int logInit (void) int logInit (void)
{ {
int i; int i;
...@@ -437,6 +443,7 @@ int logInit (void) ...@@ -437,6 +443,7 @@ int logInit (void)
for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
memset(&(g_log->log_component[i]),0,sizeof(log_component_t)); memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
} }
g_log->flag = g_log->flag | FLAG_INITIALIZED;
printf("log init done\n"); printf("log init done\n");
return 0; return 0;
...@@ -656,13 +663,12 @@ int is_newline( char *str, int size) ...@@ -656,13 +663,12 @@ int is_newline( char *str, int size)
void logClean (void) void logClean (void)
{ {
int i; int i;
LOG_UI(PHY,"\n");
if(isLogInitDone()) {
LOG_UI(PHY,"\n");
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { close_component_filelog(i);
close_component_filelog(i); }
} }
} }
......
...@@ -115,12 +115,11 @@ extern "C" { ...@@ -115,12 +115,11 @@ extern "C" {
* @{*/ * @{*/
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */ #define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */ #define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */ #define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
#define FLAG_FUNCT 0x0020 #define FLAG_TIME 0x0100
#define FLAG_FILE_LINE 0x0040 #define FLAG_INITIALIZED 0x8000
#define FLAG_TIME 0x0100
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O) #define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O)) #define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
...@@ -283,6 +282,7 @@ extern log_t *g_log; ...@@ -283,6 +282,7 @@ extern log_t *g_log;
# include "log_if.h" # include "log_if.h"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int logInit (void); int logInit (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7))); void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... ); void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... );
int set_log(int component, int level); int set_log(int component, int level);
......
...@@ -289,7 +289,7 @@ void RCconfig_L1(void) { ...@@ -289,7 +289,7 @@ void RCconfig_L1(void) {
} }
}// j=0..num_inst }// j=0..num_inst
printf("Initializing northbound interface for L1\n"); LOG_I(ENB_APP,"Initializing northbound interface for L1\n");
l1_north_init_eNB(); l1_north_init_eNB();
} else { } else {
LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found"); LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
...@@ -360,16 +360,16 @@ void RCconfig_macrlc() { ...@@ -360,16 +360,16 @@ void RCconfig_macrlc() {
RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE; RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); LOG_I(ENB_APP,"**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc); configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
} else { // other midhaul } else { // other midhaul
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
} }
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0) { if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0) {
global_scheduler_mode=SCHED_MODE_DEFAULT; global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); LOG_I(ENB_APP,"sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
} else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0) { } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0) {
global_scheduler_mode=SCHED_MODE_FAIR_RR; global_scheduler_mode=SCHED_MODE_FAIR_RR;
printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
...@@ -550,7 +550,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { ...@@ -550,7 +550,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr); enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
} }
printf("RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); LOG_I(ENB_APP,"RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr));
if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {
} else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { } else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
...@@ -2494,8 +2494,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { ...@@ -2494,8 +2494,7 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
int RCconfig_parallel(void) { int RCconfig_parallel(void) {
char *parallel_conf = NULL; char *parallel_conf = NULL;
char *worker_conf = NULL; char *worker_conf = NULL;
extern char *parallel_config;
extern char *worker_config;
paramdef_t ThreadParams[] = THREAD_CONF_DESC; paramdef_t ThreadParams[] = THREAD_CONF_DESC;
paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0}; paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0};
config_getlist( &THREADParamList,NULL,0,NULL); config_getlist( &THREADParamList,NULL,0,NULL);
...@@ -2514,9 +2513,10 @@ int RCconfig_parallel(void) { ...@@ -2514,9 +2513,10 @@ int RCconfig_parallel(void) {
worker_conf = strdup("WORKER_ENABLE"); worker_conf = strdup("WORKER_ENABLE");
} }
if(parallel_config == NULL) set_parallel_conf(parallel_conf);
if(worker_config == NULL) set_worker_conf(worker_conf); set_parallel_conf(parallel_conf);
set_worker_conf(worker_conf);
return 0; return 0;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
*/ */
#include "assertions.h" #include "assertions.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_extern.h"
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern int phy_test;
uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
...@@ -660,7 +660,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, ...@@ -660,7 +660,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
if ((subframeP == 0) && (frameP & 3) == 0) if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP); schedule_mib(module_idP, frameP, subframeP);
if (phy_test == 0){ if (get_softmodem_params()->phy_test == 0){
// This schedules SI for legacy LTE and eMTC starting in subframeP // This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI(module_idP, frameP, subframeP); schedule_SI(module_idP, frameP, subframeP);
// This schedules Paging in subframeP // This schedules Paging in subframeP
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#define DEBUG_HEADER_PARSING 1 #define DEBUG_HEADER_PARSING 1
#define ENABLE_MAC_PAYLOAD_DEBUG 1 #define ENABLE_MAC_PAYLOAD_DEBUG 1
extern uint8_t usim_test;
extern UL_IND_t *UL_INFO; extern UL_IND_t *UL_INFO;
...@@ -2020,7 +2019,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2020,7 +2019,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
{ {
// Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU // Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU
if ((usim_test == 0) && (lcid == DCCH1) if (( get_softmodem_params()->usim_test == 0) && (lcid == DCCH1)
&& (lcid_rlc_pdu_count == 0) && (num_sdus)) { && (lcid_rlc_pdu_count == 0) && (num_sdus)) {
// Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed
......
This diff is collapsed.
...@@ -68,14 +68,9 @@ Description Defines the authentication EMM procedure executed by the ...@@ -68,14 +68,9 @@ Description Defines the authentication EMM procedure executed by the
#include "usim_api.h" #include "usim_api.h"
#include "secu_defs.h" #include "secu_defs.h"
#include "Authentication.h" #include "Authentication.h"
#include "targets/RT/USER/lte-softmodem.h"
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
extern uint8_t usim_test;
/****************************************************************************/ /****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/ /******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/ /****************************************************************************/
...@@ -211,7 +206,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, ...@@ -211,7 +206,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
* of the core network by means of the received AUTN parameter and * of the core network by means of the received AUTN parameter and
* request the USIM to compute RES, CK and IK for given RAND * request the USIM to compute RES, CK and IK for given RAND
*/ */
if(usim_test == 0) if(get_softmodem_params()->usim_test == 0)
{ {
rc = usim_api_authenticate(&user->usim_data, rand, autn, &auts, &res, &ck, &ik); rc = usim_api_authenticate(&user->usim_data, rand, autn, &auts, &res, &ck, &ik);
} }
......
...@@ -47,7 +47,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -47,7 +47,7 @@ Description Implements the EPS Mobility Management procedures executed
#include "commonDef.h" #include "commonDef.h"
#include "networkDef.h" #include "networkDef.h"
#include "nas_log.h" #include "nas_log.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "emm_proc.h" #include "emm_proc.h"
#include <assert.h> #include <assert.h>
...@@ -55,7 +55,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -55,7 +55,7 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************/ /****************************************************************************/
/**************** 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 ****************/
/****************************************************************************/ /****************************************************************************/
extern uint8_t usim_test;
/****************************************************************************/ /****************************************************************************/