[PATCH 4/4] [gsm_04_08_gprs] Change GMM ATTACH REQUEST identity req logic

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Sylvain Munaut 246tnt at gmail.com
Wed Nov 18 22:40:11 UTC 2009


From: Sylvain Munaut <tnt at 246tNt.com>

Instead of trying to guess what we need, we just try to
authorize the user and the authorize method will check
and do identity requests as needed.

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
---
 openbsc/src/gsm_04_08_gprs.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/openbsc/src/gsm_04_08_gprs.c b/openbsc/src/gsm_04_08_gprs.c
index dc1c69f..d954266 100644
--- a/openbsc/src/gsm_04_08_gprs.c
+++ b/openbsc/src/gsm_04_08_gprs.c
@@ -240,6 +240,10 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx, struct msgb *msg)
 	if (strlen(ctx->imei) && strlen(ctx->imsi)) {
 		ctx->mm_state = GMM_REGISTERED_NORMAL;
 		return gsm48_tx_gmm_att_ack(msg);
+	} else if (!strlen(ctx->imei)) {
+		return gsm48_tx_gmm_id_req(msg, GSM_MI_TYPE_IMEI);
+	} else if (!strlen(ctx->imsi)) {
+		return gsm48_tx_gmm_id_req(msg, GSM_MI_TYPE_IMSI);
 	}
 
 	return 0;
@@ -371,8 +375,6 @@ static int gsm48_rx_gmm_att_req(struct msgb *msg)
 			strncpy(ctx->imsi, mi_string, sizeof(ctx->imsi));
 #endif
 		}
-		/* we always want the IMEI, too */
-		gsm48_tx_gmm_id_req(msg, GSM_MI_TYPE_IMEI);
 		/* FIXME: Start some timer */
 		ctx->mm_state = GMM_COMMON_PROC_INIT;
 		ctx->tlli = msg->tlli;
@@ -383,8 +385,6 @@ static int gsm48_rx_gmm_att_req(struct msgb *msg)
 		ctx = sgsn_mm_ctx_by_ptmsi(tmsi);
 		if (!ctx) {
 			ctx = sgsn_mm_ctx_alloc(msg->tlli, &ra_id);
-			/* Send MM INFO request for IMSI */
-			gsm48_tx_gmm_id_req(msg, GSM_MI_TYPE_IMSI);
 			/* FIXME: Start some timer */
 			ctx->mm_state = GMM_COMMON_PROC_INIT;
 			ctx->tlli = msg->tlli;
@@ -397,8 +397,9 @@ static int gsm48_rx_gmm_att_req(struct msgb *msg)
 	/* FIXME: allocate a new P-TMSI (+ P-TMSI signature) */
 	/* FIXME: update the TLLI with the new local TLLI based on the P-TMSI */
 
-	//return gsm48_tx_gmm_att_ack(msg);
-	return 0;
+	DEBUGPC(DMM, "\n");
+
+	return ctx ? gsm48_gmm_authorize(ctx, msg) : 0;
 
 err_inval:
 	DEBUGPC(DMM, "\n");
-- 
1.6.5.1





More information about the OpenBSC mailing list