aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Santos <jrsantos@jonathanrsantos.com>2011-06-10 15:54:57 -0400
committerJonathan Santos <jrsantos@jonathanrsantos.com>2011-06-23 15:30:31 -0400
commitfe7724f1d4d6312a527e01f21defd8af2e313f6a (patch)
tree1c238e93f4e086118cebfa379e0b105167b7af22
parentac9341c9c351e952c0650ad820aaecdf174f13be (diff)
gprs: Fix bugs that reset LLC sequence numbers improperly
-rw-r--r--src/gprs/gprs_gmm.c15
-rw-r--r--src/gprs/gprs_llc.c8
2 files changed, 10 insertions, 13 deletions
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index cf6cecf91..d90293355 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -1016,28 +1016,20 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
DEBUGP(DMM, "-> ATTACH COMPLETE\n");
mmctx_timer_stop(mmctx, 3350);
mmctx->p_tmsi_old = 0;
- /* Unassign the old TLLI */
mmctx->tlli = mmctx->tlli_new;
- gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new,
- GPRS_ALGO_GEA0, NULL);
break;
case GSM48_MT_GMM_RA_UPD_COMPL:
/* only in case SGSN offered new P-TMSI */
DEBUGP(DMM, "-> ROUTEING AREA UPDATE COMPLETE\n");
mmctx_timer_stop(mmctx, 3350);
mmctx->p_tmsi_old = 0;
- /* Unassign the old TLLI */
mmctx->tlli = mmctx->tlli_new;
- gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new,
- GPRS_ALGO_GEA0, NULL);
break;
case GSM48_MT_GMM_PTMSI_REALL_COMPL:
DEBUGP(DMM, "-> PTMSI REALLLICATION COMPLETE\n");
mmctx_timer_stop(mmctx, 3350);
mmctx->p_tmsi_old = 0;
- /* Unassign the old TLLI */
mmctx->tlli = mmctx->tlli_new;
- //gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new, GPRS_ALGO_GEA0, NULL);
break;
case GSM48_MT_GMM_AUTH_CIPH_RESP:
rc = gsm48_rx_gmm_auth_ciph_resp(mmctx, msg);
@@ -1513,7 +1505,12 @@ int gsm0408_gprs_rcvmsg(struct msgb *msg, struct gprs_llc_llme *llme)
int rc = -EINVAL;
bssgp_parse_cell_id(&ra_id, msgb_bcid(msg));
- mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &ra_id);
+ mmctx = sgsn_mm_ctx_by_tlli(llme->tlli, &ra_id);
+
+ if (!mmctx && (llme->old_tlli != 0xffffffff)) {
+ mmctx = sgsn_mm_ctx_by_tlli(llme->old_tlli, &ra_id);
+ }
+
if (mmctx) {
msgid2mmctx(mmctx, msg);
rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_SIG_IN]);
diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index bc80440a0..37bd8804f 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -808,12 +808,12 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
* received from peer. */
if (llme->old_tlli != 0xffffffff) {
llme->old_tlli = 0xffffffff;
- llme->tlli = new_tlli;
+ llme->tlli = tlli_foreign2local(new_tlli);
} else {
/* If TLLI old == 0xffffffff was assigned to LLME, then this is
* TLLI assignmemt according to 8.3.1 */
llme->old_tlli = 0xffffffff;
- llme->tlli = new_tlli;
+ llme->tlli = tlli_foreign2local(new_tlli);
llme->state = GPRS_LLMS_ASSIGNED;
/* 8.5.3.1 For all LLE's */
for (i = 0; i < ARRAY_SIZE(llme->lle); i++) {
@@ -828,8 +828,8 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
/* TLLI Change 8.3.2 */
/* Both TLLI Old and TLLI New are assigned; use New when
* (re)transmitting. Accept toth Old and New on Rx */
- llme->old_tlli = llme->tlli;
- llme->tlli = new_tlli;
+ llme->old_tlli = tlli_foreign2local(llme->tlli);
+ llme->tlli = tlli_foreign2local(new_tlli);
llme->state = GPRS_LLMS_ASSIGNED;
} else if (old_tlli != 0xffffffff && new_tlli == 0xffffffff) {
/* TLLI Unassignment 8.3.3) */