Commit 5e323eef authored by Cedric Roux's avatar Cedric Roux

improve logging in oaisim

- print current working directory
- print git version (if available)
- print security keys
  this last one is a security breach, but as of today
  it's not a problem
parent 430a8c4e
...@@ -248,6 +248,14 @@ void display_usim_data(const char *filename) { ...@@ -248,6 +248,14 @@ void display_usim_data(const char *filename) {
memcpy(key, data.keys.ik, USIM_IK_SIZE); memcpy(key, data.keys.ik, USIM_IK_SIZE);
printf("\tIK\t: \"%s\"\n", key); printf("\tIK\t: \"%s\"\n", key);
printf("\n\tusim_api_k:");
for (int i = 0; i < 16; i++)
printf(" %2.2x", data.keys.usim_api_k[i]);
printf("\n\topc :");
for (int i = 0; i < 16; i++)
printf(" %2.2x", data.keys.opc[i]);
printf("\n\n");
printf("EPS NAS security context:\n"); printf("EPS NAS security context:\n");
printf("\tKSIasme\t: 0x%.2x\n", data.securityctx.KSIasme.value[0]); printf("\tKSIasme\t: 0x%.2x\n", data.securityctx.KSIasme.value[0]);
char kasme[USIM_K_ASME_SIZE + 1]; char kasme[USIM_K_ASME_SIZE + 1];
......
...@@ -203,6 +203,52 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -203,6 +203,52 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
LOG_TRACE(INFO, "EMM-MAIN - USIM application data successfully read"); LOG_TRACE(INFO, "EMM-MAIN - USIM application data successfully read");
user->emm_data->usim_is_valid = TRUE; user->emm_data->usim_is_valid = TRUE;
/* print keys (for debugging) */
{
char usim_api_k[256];
char opc[256];
sprintf(usim_api_k,
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x "
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x",
user->usim_data.keys.usim_api_k[0],
user->usim_data.keys.usim_api_k[1],
user->usim_data.keys.usim_api_k[2],
user->usim_data.keys.usim_api_k[3],
user->usim_data.keys.usim_api_k[4],
user->usim_data.keys.usim_api_k[5],
user->usim_data.keys.usim_api_k[6],
user->usim_data.keys.usim_api_k[7],
user->usim_data.keys.usim_api_k[8],
user->usim_data.keys.usim_api_k[9],
user->usim_data.keys.usim_api_k[10],
user->usim_data.keys.usim_api_k[11],
user->usim_data.keys.usim_api_k[12],
user->usim_data.keys.usim_api_k[13],
user->usim_data.keys.usim_api_k[14],
user->usim_data.keys.usim_api_k[15]);
sprintf(opc,
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x "
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x",
user->usim_data.keys.opc[0],
user->usim_data.keys.opc[1],
user->usim_data.keys.opc[2],
user->usim_data.keys.opc[3],
user->usim_data.keys.opc[4],
user->usim_data.keys.opc[5],
user->usim_data.keys.opc[6],
user->usim_data.keys.opc[7],
user->usim_data.keys.opc[8],
user->usim_data.keys.opc[9],
user->usim_data.keys.opc[10],
user->usim_data.keys.opc[11],
user->usim_data.keys.opc[12],
user->usim_data.keys.opc[13],
user->usim_data.keys.opc[14],
user->usim_data.keys.opc[15]);
LOG_TRACE(INFO, "EMM-MAIN - usim_api_k: %s", usim_api_k);
LOG_TRACE(INFO, "EMM-MAIN - opc: %s", opc);
}
/* Get the Home PLMN derived from the IMSI */ /* Get the Home PLMN derived from the IMSI */
user->emm_data->hplmn.MCCdigit1 = user->usim_data.imsi.u.num.digit1; user->emm_data->hplmn.MCCdigit1 = user->usim_data.imsi.u.num.digit1;
user->emm_data->hplmn.MCCdigit2 = user->usim_data.imsi.u.num.digit2; user->emm_data->hplmn.MCCdigit2 = user->usim_data.imsi.u.num.digit2;
......
...@@ -1188,6 +1188,15 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */ ...@@ -1188,6 +1188,15 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */ int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
#endif #endif
static void print_current_directory(void)
{
char dir[8192]; /* arbitrary size (should be big enough) */
if (getcwd(dir, 8192) == NULL)
printf("ERROR getting working directory\n");
else
printf("working directory: %s\n", dir);
}
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
int int
main (int argc, char **argv) main (int argc, char **argv)
...@@ -1195,6 +1204,8 @@ main (int argc, char **argv) ...@@ -1195,6 +1204,8 @@ main (int argc, char **argv)
clock_t t; clock_t t;
print_current_directory();
start_background_system(); start_background_system();
#ifdef SMBV #ifdef SMBV
...@@ -1350,6 +1361,11 @@ main (int argc, char **argv) ...@@ -1350,6 +1361,11 @@ main (int argc, char **argv)
LOG_N(EMU, LOG_N(EMU,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n"); ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
LOG_I(EMU, "Version: %s\n", PACKAGE_VERSION);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated // Handle signals until all tasks are terminated
......
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