aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-28 17:39:20 +0200
committerHarald Welte <laforge@gnumonks.org>2016-07-04 08:42:37 +0000
commit3955025c2a83a334f65322def52466c1cc86ed89 (patch)
tree97883e76b75401e0711e4d8b11fc35226d7e78eb
parent93408ae72719590b9a0df9ce565694956f0cc34a (diff)
SGSN: move TLLI unassignment into separate function
-rw-r--r--openbsc/include/openbsc/gprs_llc.h1
-rw-r--r--openbsc/src/gprs/gprs_gmm.c26
-rw-r--r--openbsc/src/gprs/gprs_llc.c7
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c2
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c2
5 files changed, 18 insertions, 20 deletions
diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h
index d54b72e4a..8cd0c2621 100644
--- a/openbsc/include/openbsc/gprs_llc.h
+++ b/openbsc/include/openbsc/gprs_llc.h
@@ -218,6 +218,7 @@ int gprs_llgmm_reset_oldmsg(struct msgb* oldmsg, uint8_t sapi);
int gprs_llgmm_assign(struct gprs_llc_llme *llme,
uint32_t old_tlli, uint32_t new_tlli,
enum gprs_ciph_algo alg, const uint8_t *kc);
+int gprs_llgmm_unassign(struct gprs_llc_llme *llme);
int gprs_llc_init(const char *cipher_plugin_path);
int gprs_llc_vty_init(void);
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 5848a63f5..5db69ddad 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -982,8 +982,7 @@ rejected:
if (ctx)
mm_ctx_cleanup_free(ctx, "GPRS ATTACH REJ");
else
- /* TLLI unassignment */
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff, GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(llme);
return rc;
@@ -1286,11 +1285,8 @@ rejected:
if (mmctx)
mm_ctx_cleanup_free(mmctx, "GPRS RA UPDATE REJ");
else {
- if (llme) {
- /* TLLI unassignment */
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
- GPRS_ALGO_GEA0, NULL);
- }
+ if (llme)
+ gprs_llgmm_unassign(llme);
}
return rc;
@@ -1323,17 +1319,13 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
/* 4.7.10 */
if (gh->msg_type == GSM48_MT_GMM_STATUS) {
/* TLLI unassignment */
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
- GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(llme);
return 0;
}
/* Don't reply or establish a LLME on DETACH_ACK */
- if (gh->msg_type == GSM48_MT_GMM_DETACH_ACK) {
- /* TLLI unassignment */
- return gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
- GPRS_ALGO_GEA0, NULL);
- }
+ if (gh->msg_type == GSM48_MT_GMM_DETACH_ACK)
+ return gprs_llgmm_unassign(llme);
gprs_llgmm_reset(llme);
@@ -1343,8 +1335,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
rc = gsm48_rx_gmm_det_req(NULL, msg);
/* TLLI unassignment */
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
- GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(llme);
return rc;
}
@@ -1352,8 +1343,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
rc = sgsn_force_reattach_oldmsg(msg);
/* TLLI unassignment */
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
- GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(llme);
return rc;
}
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index 71178c92e..64d22b374 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -745,6 +745,13 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
return 0;
}
+/* TLLI unassignment */
+int gprs_llgmm_unassign(struct gprs_llc_llme *llme)
+{
+ return gprs_llgmm_assign(llme, llme->tlli, 0xffffffff, GPRS_ALGO_GEA0,
+ NULL);
+}
+
/* Chapter 7.2.1.2 LLGMM-RESET.req */
int gprs_llgmm_reset(struct gprs_llc_llme *llme)
{
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 8f9f45334..98439de21 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -770,7 +770,7 @@ static void sgsn_llme_cleanup_free(struct gprs_llc_llme *llme)
/* No MM context found */
LOGP(DGPRS, LOGL_INFO, "Deleting orphaned LLME, TLLI 0x%08x\n",
llme->tlli);
- gprs_llgmm_assign(llme, llme->tlli, 0xffffffff, GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(llme);
}
static void sgsn_llme_check_cb(void *data_)
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index f425c3349..d568807dd 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -222,7 +222,7 @@ static void test_llme(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* unassign which should delete it*/
- gprs_llgmm_assign(lle->llme, lle->llme->tlli, 0xffffffff, GPRS_ALGO_GEA0, NULL);
+ gprs_llgmm_unassign(lle->llme);
/* Check that everything was cleaned up */
OSMO_ASSERT(count(gprs_llme_list()) == 0);