pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/32435 )


Change subject: layer23: Use GSM_RESERVED_TMSI from libosmocore everywhere
......................................................................

layer23: Use GSM_RESERVED_TMSI from libosmocore everywhere

Change-Id: Ib9483b8ae4067994aef523291733ae706ffabe7a
---
M src/host/layer23/src/common/settings.c
M src/host/layer23/src/common/subscriber.c
M src/host/layer23/src/common/vty.c
M src/host/layer23/src/mobile/gsm48_mm.c
M src/host/layer23/src/mobile/vty_interface.c
5 files changed, 25 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/35/32435/1

diff --git a/src/host/layer23/src/common/settings.c 
b/src/host/layer23/src/common/settings.c
index d391f7d..565da96 100644
--- a/src/host/layer23/src/common/settings.c
+++ b/src/host/layer23/src/common/settings.c
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <string.h>
 #include <osmocom/core/talloc.h>
+#include <osmocom/gsm/gsm48.h>

 #include <osmocom/bb/common/settings.h>
 #include <osmocom/bb/common/utils.h>
@@ -69,7 +70,7 @@
        strcpy(set->test_imsi, "001010000000000");
        set->test_rplmn_mcc = set->test_rplmn_mnc = 1;
        set->test_lac = 0x0000;
-       set->test_tmsi = 0xffffffff;
+       set->test_tmsi = GSM_RESERVED_TMSI;

        /* set all supported features */
        set->sms_ptp = sup->sms_ptp;
diff --git a/src/host/layer23/src/common/subscriber.c 
b/src/host/layer23/src/common/subscriber.c
index d80515d..1683b09 100644
--- a/src/host/layer23/src/common/subscriber.c
+++ b/src/host/layer23/src/common/subscriber.c
@@ -22,6 +22,7 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/crypt/auth.h>
 #include <osmocom/gsm/gsm23003.h>
+#include <osmocom/gsm/gsm48.h>

 #include <osmocom/bb/common/logging.h>
 #include <osmocom/bb/common/osmocom_data.h>
@@ -77,7 +78,7 @@
        subscr->ms = ms;

        /* set TMSI / LAC invalid */
-       subscr->tmsi = 0xffffffff;
+       subscr->tmsi = GSM_RESERVED_TMSI;
        subscr->lac = 0x0000;

        /* set key invalid */
@@ -1161,7 +1162,7 @@
                        subscr->sms_sca);
        print(priv, " Status: %s  IMSI %s", subscr_ustate_names[subscr->ustate],
                (subscr->imsi_attached) ? "attached" : "detached");
-       if (subscr->tmsi != 0xffffffff)
+       if (subscr->tmsi != GSM_RESERVED_TMSI)
                print(priv, "  TMSI 0x%08x", subscr->tmsi);
        if (subscr->lac > 0x0000 && subscr->lac < 0xfffe) {
                print(priv, "\n");
diff --git a/src/host/layer23/src/common/vty.c 
b/src/host/layer23/src/common/vty.c
index dc6e580..58ddf06 100644
--- a/src/host/layer23/src/common/vty.c
+++ b/src/host/layer23/src/common/vty.c
@@ -635,7 +635,7 @@
        if (argc >= 4)
                set->test_tmsi = strtoul(argv[3], NULL, 16);
        else
-               set->test_tmsi = 0xffffffff;
+               set->test_tmsi = GSM_RESERVED_TMSI;

        if (attached)
                set->test_imsi_attached = 1;
diff --git a/src/host/layer23/src/mobile/gsm48_mm.c 
b/src/host/layer23/src/mobile/gsm48_mm.c
index 6c5a860..77f3094 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -1601,12 +1601,12 @@
                gsm48_mm_tx_tmsi_reall_cpl(ms);
                break;
        case GSM_MI_TYPE_IMSI:
-               subscr->tmsi = 0xffffffff;
+               subscr->tmsi = GSM_RESERVED_TMSI;
                LOGP(DMM, LOGL_INFO, "TMSI removed.\n");
                gsm48_mm_tx_tmsi_reall_cpl(ms);
                break;
        default:
-               subscr->tmsi = 0xffffffff;
+               subscr->tmsi = GSM_RESERVED_TMSI;
                LOGP(DMM, LOGL_NOTICE, "TMSI reallocation with unknown MI "
                        "type %d.\n", mi_type);
                gsm48_mm_tx_mm_status(ms, GSM48_REJECT_INCORRECT_MESSAGE);
@@ -1698,7 +1698,7 @@
        subscr->sim_valid = 0;

        /* TMSI and LAI invalid */
-       subscr->tmsi = 0xffffffff;
+       subscr->tmsi = GSM_RESERVED_TMSI;
        subscr->lac = 0x0000;

        /* key is invalid */
@@ -2017,7 +2017,7 @@
                subscr->sim_valid = 0;

                /* TMSI and LAI invalid */
-               subscr->tmsi = 0xffffffff;
+               subscr->tmsi = GSM_RESERVED_TMSI;
                subscr->lac = 0x0000;

                /* key is invalid */
@@ -2487,7 +2487,7 @@
                        break;
                case GSM_MI_TYPE_IMSI:
                        LOGP(DMM, LOGL_INFO, "TMSI removed\n");
-                       subscr->tmsi = 0xffffffff;
+                       subscr->tmsi = GSM_RESERVED_TMSI;

                        /* store LOCI on sim */
                        gsm_subscr_write_loci(ms);
@@ -2582,7 +2582,7 @@
        case GSM48_REJECT_LOC_NOT_ALLOWED:
        case GSM48_REJECT_ROAMING_NOT_ALLOWED:
                /* TMSI and LAI invalid */
-               subscr->tmsi = 0xffffffff;
+               subscr->tmsi = GSM_RESERVED_TMSI;
                subscr->lac = 0x0000;

                /* key is invalid */
@@ -2705,7 +2705,7 @@
        }

        /* TMSI and LAI invalid */
-       subscr->tmsi = 0xffffffff;
+       subscr->tmsi = GSM_RESERVED_TMSI;
        subscr->lac = 0x0000;

        /* key is invalid */
@@ -2913,7 +2913,7 @@
                abort_any = 1;

                /* TMSI and LAI invalid */
-               subscr->tmsi = 0xffffffff;
+               subscr->tmsi = GSM_RESERVED_TMSI;
                subscr->lac = 0x0000;

                /* key is invalid */
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index e7f0454..8751de6 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -438,7 +438,7 @@

        /* Initial testcard settings */
        uint16_t mcc = 0x001, mnc = 0x01f, lac = 0x0000;
-       uint32_t tmsi = 0xffffffff;
+       uint32_t tmsi = GSM_RESERVED_TMSI;

        ms = l23_vty_get_ms(argv[0], vty);
        if (!ms)
@@ -719,7 +719,7 @@
        ms->subscr.mcc = mcc;
        ms->subscr.mnc = mnc;
        ms->subscr.lac = lac;
-       ms->subscr.tmsi = 0xffffffff;
+       ms->subscr.tmsi = GSM_RESERVED_TMSI;

        gsm_subscr_write_loci(ms);


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32435
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ib9483b8ae4067994aef523291733ae706ffabe7a
Gerrit-Change-Number: 32435
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to