aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-21 09:52:05 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-27 15:21:31 +0100
commitb9ab0d4f398aff18e1f0c28d4aac09ac4707a24b (patch)
treef3100c6c0a71f4339dff7e04dc118440ccf371f8
parent189999d65424b6d2bdc1c1beeac2cec8ee90a35c (diff)
sgsn: Only send Detach Accept (MO) if power_off isn't set
Currently, every time the SGSN received a Detach Request from the MS via an established logical link, it is answered by a Detach Accept. This violates the specification (GSM 04.08, 4.7.4.1.2 and .3), which states, that it should only be sent, if "the detach type IE value indicates that the detach request has not been sent due to switching off". This patch adds a conditional to limit the sending of Detach Accept accordingly. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gprs_gmm.c8
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index db0c2dbf7..ff852eb80 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -875,8 +875,12 @@ static int gsm48_rx_gmm_det_req(struct sgsn_mm_ctx *ctx, struct msgb *msg)
msgb_tlli(msg), get_value_string(gprs_det_t_mo_strs, detach_type),
power_off ? "Power-off" : "");
- /* force_stby = 0 */
- rc = gsm48_tx_gmm_det_ack(ctx, 0);
+ /* Only sent the Detach Accept (MO) if power off isn't indicated,
+ * see 04.08, 4.7.4.1.2/3 for details */
+ if (!power_off) {
+ /* force_stby = 0 */
+ rc = gsm48_tx_gmm_det_ack(ctx, 0);
+ }
mm_ctx_cleanup_free(ctx, "GPRS DETACH REQUEST");
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index 00ee86679..cb3c29472 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -213,7 +213,7 @@ static void test_gmm_detach_power_off(void)
/* verify that no message (and therefore no Detach Accept) has been
* sent by the SGSN */
- /* OSMO_ASSERT(sgsn_tx_counter_old == sgsn_tx_counter); */
+ OSMO_ASSERT(sgsn_tx_counter_old == sgsn_tx_counter);
/* verify that things are gone */
OSMO_ASSERT(count(gprs_llme_list()) == 0);