Project

General

Profile

Bug #2705

GSM48_MMR_NREG_REQ followed by GSM48_MMR_REG_REQ don't attach to the network

Added by zecke 14 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
12/03/2017
Due date:
% Done:

0%

Resolution:
Spec Reference:

Description

The idea is to quickly IMSI DETACH followed by an attach/LU. The test sim code in subscriber.c is doing the same but somehow it doesn't start selecting the network. The subscriber.c code is doing more than just sending the request but from intended use NREG/REG should work.


        if new_state == 19 and new_substate == 1 then                                                
                osmo.ms():mmr(3)                                                                                       
        elseif new_state == 19 and new_substate == 4 then                                            
                osmo.ms():mmr(1) 
        end

diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
index 6e9c197c..2bdd3a00 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
@@ -1,6 +1,10 @@
 #ifndef _GSM48_MM_H
 #define _GSM48_MM_H

+#include <osmocom/core/timer.h>
+
+struct gsm_settings;
+
 /* GSM 04.07 9.2.2 */
 #define GSM48_MMXX_MASK                        0xf00
 #define GSM48_MMCC_CLASS               0x100
diff --git a/src/host/layer23/include/osmocom/bb/mobile/primitives.h b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
index 39b49454..c7d57f8f 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/primitives.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
@@ -20,6 +20,7 @@ enum mobile_prims {
        PRIM_MOB_SHUTDOWN,
        PRIM_MOB_SMS,
        PRIM_MOB_MM,
+       PRIM_MOB_MMR,
 };

 struct mobile_prim_intf {
@@ -75,6 +76,13 @@ struct mobile_mm_param {
        int prev_substate;              /*!< The previous substate */
 };

+/**
+ * Mobility Management Requests (MMR)
+ */
+struct mobile_mmr_param {
+       int req;                        /*!< MM event to submit */
+};
+
 struct mobile_prim {
        struct osmo_prim_hdr hdr;       /*!< Primitive base class */
        union {
@@ -83,6 +91,7 @@ struct mobile_prim {
                struct mobile_shutdown_param shutdown;
                struct mobile_sms_param sms;
                struct mobile_mm_param mm;
+               struct mobile_mmr_param mmr;
        } u;
 };

diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c
index fd486ea2..4bf56731 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -19,6 +19,7 @@
  */

 #include <osmocom/bb/mobile/primitives.h>
+#include <osmocom/bb/mobile/gsm48_mm.h>
 #include <osmocom/bb/common/logging.h>

 #include <osmocom/core/timer.h>
@@ -173,6 +174,15 @@ static int cancel_timer(struct mobile_prim_intf *intf, struct mobile_timer_param
        return -1;
 }

+static int submit_mmr(struct mobile_prim_intf *intf, struct mobile_mmr_param *param)
+{
+       struct msgb *nmsg;
+
+       nmsg = gsm48_mmr_msgb_alloc(param->req);
+       gsm48_mmr_downmsg(intf->ms, nmsg);
+       return 0;
+}
+
 int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim)
 {
        int rc = 0;
@@ -184,6 +194,9 @@ int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim
        case OSMO_PRIM(PRIM_MOB_TIMER_CANCEL, PRIM_OP_REQUEST):
                rc = cancel_timer(intf, &prim->u.timer);
                break;
+       case OSMO_PRIM(PRIM_MOB_MMR, PRIM_OP_REQUEST):
+               rc = submit_mmr(intf, &prim->u.mmr);
+               break;
        default:
                LOGP(DPRIM, LOGL_ERROR, "Unknown primitive: %d\n", OSMO_PRIM_HDR(&prim->hdr));
                break;
diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c
index e63d205a..37c8ce9a 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -389,6 +389,20 @@ static int lua_ms_sms_send_simple(lua_State *L)
        return 1;
 }

+static int lua_ms_mmr(lua_State *L)
+{
+       struct mobile_prim *prim;
+       int req;
+
+       luaL_argcheck(L, lua_isnumber(L, -1), 1, "event number");
+       req = (int) lua_tonumber(L, -1);
+
+       prim = mobile_prim_alloc(PRIM_MOB_MMR, PRIM_OP_REQUEST);
+       prim->u.mmr.req = req;
+       mobile_prim_intf_req(get_primitive(L), prim);
+       return 1;
+}
+
 static const struct luaL_Reg ms_funcs[] = {
        { "imsi", lua_ms_imsi },
        { "imei", lua_ms_imei },
@@ -398,6 +412,7 @@ static const struct luaL_Reg ms_funcs[] = {
        { "start", lua_ms_no_shutdown },
        { "stop", lua_ms_shutdown },
        { "sms_send_simple", lua_ms_sms_send_simple },
+       { "mmr", lua_ms_mmr },
        { NULL, NULL },
 };
 

Also available in: Atom PDF