From 404d9b8bbaf8f06afa0ccba6a8a5e96eccf7a553 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 12 Aug 2019 17:49:09 +0200 Subject: Introduce define TLLI_UNASSIGNED Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d --- include/osmocom/sgsn/gprs_llc.h | 3 +++ src/gprs/gprs_gmm.c | 6 +++--- src/gprs/gprs_llc.c | 22 +++++++++++----------- src/gprs/gprs_sgsn.c | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/osmocom/sgsn/gprs_llc.h b/include/osmocom/sgsn/gprs_llc.h index 5b1224804..8a0b9efbd 100644 --- a/include/osmocom/sgsn/gprs_llc.h +++ b/include/osmocom/sgsn/gprs_llc.h @@ -192,6 +192,9 @@ struct gprs_llc_llme { #define GPRS_LLME_RESET_AGE (0) +/* 3GPP TS 44.064 ยง 8.3 TLLI assignment procedures */ +#define TLLI_UNASSIGNED (0xffffffff) + extern struct llist_head gprs_llc_llmes; /* LLC low level types */ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 5a6ea2832..c8bc0f790 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -2077,7 +2077,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, /* Unassign the old TLLI */ mmctx->gb.tlli = mmctx->gb.tlli_new; gprs_llme_copy_key(mmctx, mmctx->gb.llme); - gprs_llgmm_assign(mmctx->gb.llme, 0xffffffff, + gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED, mmctx->gb.tlli_new); } mmctx->gmm_state = GMM_REGISTERED_NORMAL; @@ -2102,7 +2102,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) { /* Unassign the old TLLI */ mmctx->gb.tlli = mmctx->gb.tlli_new; - gprs_llgmm_assign(mmctx->gb.llme, 0xffffffff, + gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED, mmctx->gb.tlli_new); } mmctx->gmm_state = GMM_REGISTERED_NORMAL; @@ -2125,7 +2125,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) { /* Unassign the old TLLI */ mmctx->gb.tlli = mmctx->gb.tlli_new; - //gprs_llgmm_assign(mmctx->gb.llme, 0xffffffff, mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL); + //gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED, mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL); } rc = 0; break; diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c index acf4b5474..a301a63e5 100644 --- a/src/gprs/gprs_llc.c +++ b/src/gprs/gprs_llc.c @@ -527,7 +527,7 @@ static struct gprs_llc_lle *lle_for_rx_by_tlli_sapi(const uint32_t tlli, lle = &llme->lle[sapi]; return lle; } - + LOGP(DLLC, LOGL_NOTICE, "unknown TLLI(0x%08x)/SAPI(%d): Silently dropping\n", tlli, sapi); @@ -556,7 +556,7 @@ static struct gprs_llc_llme *llme_alloc(uint32_t tlli) return NULL; llme->tlli = tlli; - llme->old_tlli = 0xffffffff; + llme->old_tlli = TLLI_UNASSIGNED; llme->state = GPRS_LLMS_UNASSIGNED; llme->age_timestamp = GPRS_LLME_RESET_AGE; llme->cksn = GSM_KEY_SEQ_INVAL; @@ -1042,19 +1042,19 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme, { unsigned int i; - if (old_tlli == 0xffffffff && new_tlli != 0xffffffff) { + if (old_tlli == TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) { /* TLLI Assignment 8.3.1 */ /* New TLLI shall be assigned and used when (re)transmitting LLC frames */ - /* If old TLLI != 0xffffffff was assigned to LLME, then TLLI + /* If old TLLI != TLLI_UNASSIGNED was assigned to LLME, then TLLI * old is unassigned. Only TLLI new shall be accepted when * received from peer. */ - if (llme->old_tlli != 0xffffffff) { - llme->old_tlli = 0xffffffff; + if (llme->old_tlli != TLLI_UNASSIGNED) { + llme->old_tlli = TLLI_UNASSIGNED; llme->tlli = new_tlli; } else { - /* If TLLI old == 0xffffffff was assigned to LLME, then this is + /* If TLLI old == TLLI_UNASSIGNED was assigned to LLME, then this is * TLLI assignmemt according to 8.3.1 */ - llme->old_tlli = 0xffffffff; + llme->old_tlli = TLLI_UNASSIGNED; llme->tlli = new_tlli; llme->state = GPRS_LLMS_ASSIGNED; /* 8.5.3.1 For all LLE's */ @@ -1066,14 +1066,14 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme, /* FIXME Set parameters according to table 9 */ } } - } else if (old_tlli != 0xffffffff && new_tlli != 0xffffffff) { + } else if (old_tlli != TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) { /* TLLI Change 8.3.2 */ /* Both TLLI Old and TLLI New are assigned; use New when * (re)transmitting. Accept both Old and New on Rx */ llme->old_tlli = old_tlli; llme->tlli = new_tlli; llme->state = GPRS_LLMS_ASSIGNED; - } else if (old_tlli != 0xffffffff && new_tlli == 0xffffffff) { + } else if (old_tlli != TLLI_UNASSIGNED && new_tlli == TLLI_UNASSIGNED) { /* TLLI Unassignment 8.3.3) */ llme->tlli = llme->old_tlli = 0; llme->state = GPRS_LLMS_UNASSIGNED; @@ -1091,7 +1091,7 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme, /* TLLI unassignment */ int gprs_llgmm_unassign(struct gprs_llc_llme *llme) { - return gprs_llgmm_assign(llme, llme->tlli, 0xffffffff); + return gprs_llgmm_assign(llme, llme->tlli, TLLI_UNASSIGNED); } /* Chapter 7.2.1.2 LLGMM-RESET.req */ diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 9a5de4108..e01bc5c90 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -362,7 +362,7 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm) if (llme) { /* TLLI unassignment, must be called after sgsn_mm_ctx_free */ - gprs_llgmm_assign(llme, tlli, 0xffffffff); + gprs_llgmm_assign(llme, tlli, TLLI_UNASSIGNED); } } -- cgit v1.2.3