Review at  https://gerrit.osmocom.org/3357

vty_interface.c: use RPLMN from settings if preset

Previously, when testcard was attached via VTY interface, the
initial values were used for MCC / MNC, LAC and TMSI, even if
correct RPLMN settings were set.

Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
---
M src/host/layer23/src/mobile/vty_interface.c
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/57/3357/1

diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index d909153..b26d471 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -472,6 +472,9 @@
        int attached)
 {
        struct osmocom_ms *ms;
+       struct gsm_settings *set;
+
+       /* Initial testcard settings */
        uint16_t mcc = 0x001, mnc = 0x01f, lac = 0x0000;
        uint32_t tmsi = 0xffffffff;
 
@@ -485,6 +488,18 @@
                return CMD_WARNING;
        }
 
+       set = &ms->settings;
+       if (set->test_rplmn_valid) {
+               mcc = set->test_rplmn_mcc;
+               mnc = set->test_rplmn_mnc;
+
+               if (set->test_lac > 0x0000 && set->test_lac < 0xfffe)
+                       lac = set->test_lac;
+
+               if (set->test_tmsi != 0xffffffff)
+                       tmsi = set->test_tmsi;
+       }
+
        if (argc == 2) {
                vty_out(vty, "Give MNC together with MCC%s", VTY_NEWLINE);
                return CMD_WARNING;

-- 
To view, visit https://gerrit.osmocom.org/3357
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>

Reply via email to