aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_04_08.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-08-19 12:53:57 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-09-28 05:14:25 +0200
commit2223025e218263af6e1157ef1eeca1686cefe4b9 (patch)
treec3d9f36d3d14bf650f86b85d4bcc83492c741e1b /openbsc/src/gsm_04_08.c
parent6b0b103bdcfaf15ca1c33d3c61f211cb40661e92 (diff)
[tmsi] Make the tmsi a 4 octet number
tmsi is four octets long, there is no need to make it a string and then jump through hoops to convert it to a number. Keep the database using it as a string to benefit from the NULL handling of the db. Introduce the reserved tmsi which has all bits set to 1 according to GSM 03.03 ยง2.4 and start checking for it and make sure the db code will never allocate such a tmsi.
Diffstat (limited to 'openbsc/src/gsm_04_08.c')
-rw-r--r--openbsc/src/gsm_04_08.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index d6fe09fa2..196fdca11 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -291,15 +291,12 @@ static void allocate_loc_updating_req(struct gsm_lchan *lchan)
static int gsm0408_authorize(struct gsm_lchan *lchan, struct msgb *msg)
{
- u_int32_t tmsi;
-
if (authorize_subscriber(lchan->loc_operation, lchan->subscr)) {
int rc;
db_subscriber_alloc_tmsi(lchan->subscr);
- tmsi = strtoul(lchan->subscr->tmsi, NULL, 10);
release_loc_updating_req(lchan);
- rc = gsm0408_loc_upd_acc(msg->lchan, tmsi);
+ rc = gsm0408_loc_upd_acc(msg->lchan, lchan->subscr->tmsi);
/* call subscr_update after putting the loc_upd_acc
* in the transmit queue, since S_SUBSCR_ATTACHED might
* trigger further action like SMS delivery */
@@ -1054,7 +1051,8 @@ static int mm_rx_loc_upd_req(struct msgb *msg)
lchan->loc_operation->waiting_for_imei = 1;
/* look up the subscriber based on TMSI, request IMSI if it fails */
- subscr = subscr_get_by_tmsi(bts->network, mi_string);
+ subscr = subscr_get_by_tmsi(bts->network,
+ tmsi_from_string(mi_string));
if (!subscr) {
/* send IDENTITY REQUEST message to get IMSI */
rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMSI);
@@ -1352,7 +1350,8 @@ static int gsm48_rx_mm_serv_req(struct msgb *msg)
if (is_siemens_bts(bts))
send_siemens_mrpci(msg->lchan, classmark2-1);
- subscr = subscr_get_by_tmsi(bts->network, mi_string);
+ subscr = subscr_get_by_tmsi(bts->network,
+ tmsi_from_string(mi_string));
/* FIXME: if we don't know the TMSI, inquire abit IMSI and allocate new TMSI */
if (!subscr)
@@ -1389,7 +1388,8 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
switch (mi_type) {
case GSM_MI_TYPE_TMSI:
- subscr = subscr_get_by_tmsi(bts->network, mi_string);
+ subscr = subscr_get_by_tmsi(bts->network,
+ tmsi_from_string(mi_string));
break;
case GSM_MI_TYPE_IMSI:
subscr = subscr_get_by_imsi(bts->network, mi_string);
@@ -1495,7 +1495,8 @@ static int gsm48_rr_rx_pag_resp(struct msgb *msg)
switch (mi_type) {
case GSM_MI_TYPE_TMSI:
- subscr = subscr_get_by_tmsi(bts->network, mi_string);
+ subscr = subscr_get_by_tmsi(bts->network,
+ tmsi_from_string(mi_string));
break;
case GSM_MI_TYPE_IMSI:
subscr = subscr_get_by_imsi(bts->network, mi_string);