[mobile] Adding security warning, if default IMEI is not changed
[osmocom-bb.git] / src / host / layer23 / src / mobile / app_mobile.c
index 1dc585a..164f3ed 100644 (file)
@@ -42,6 +42,8 @@
 #include <osmocom/core/select.h>
 #include <osmocom/core/signal.h>
 
+#include <l1ctl_proto.h>
+
 extern void *l23_ctx;
 extern struct llist_head ms_list;
 extern int vty_reading;
@@ -143,8 +145,7 @@ int mobile_exit(struct osmocom_ms *ms, int force)
        gsm_subscr_exit(ms);
        gsm48_cc_exit(ms);
        gsm_sim_exit(ms);
-       lapdm_exit(&ms->l2_entity.lapdm_acch);
-       lapdm_exit(&ms->l2_entity.lapdm_dcch);
+       lapdm_channel_exit(&ms->lapdm_channel);
 
        ms->shutdown = 2; /* being down */
        vty_notify(ms, NULL);
@@ -160,8 +161,10 @@ int mobile_init(struct osmocom_ms *ms)
        int rc;
 
        gsm_settings_arfcn(ms);
-       lapdm_init(&ms->l2_entity.lapdm_dcch, ms);
-       lapdm_init(&ms->l2_entity.lapdm_acch, ms);
+
+       lapdm_channel_init(&ms->lapdm_channel, LAPDM_MODE_MS);
+       lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
+
        gsm_sim_init(ms);
        gsm48_cc_init(ms);
        gsm_subscr_init(ms);
@@ -200,6 +203,13 @@ int mobile_init(struct osmocom_ms *ms)
        ms->shutdown = 0;
        ms->started = 0;
 
+       if (!strcmp(ms->settings.imei, "000000000000000")) {
+               printf("***\nWarning: Mobile '%s' has default IMEI: %s\n",
+                       ms->name, ms->settings.imei);
+               printf("This could relate your identitiy to other users with "
+                       "default IMEI.\n***\n");
+       }
+
        l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
        printf("Mobile '%s' initialized, please start phone now!\n", ms->name);
        return 0;