aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-11-24 15:04:15 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-02 09:18:45 +0100
commitde4bbc714600b9db0b913705efc3064defacae18 (patch)
treec778dc943b3d37373f8feff8e3de3246d3043e68 /openbsc
parentaec03a1f136abcd9bf59f4ec7cce9bd490fe8c81 (diff)
sgsn/test: Add test case for unexpected Detach Accepts
The commit "sgsn: Don't send XID reset after Detach Accept" fixed the SGSN to not respond to a Detach Accept message when there is no MM context. This patch adds a test case to verify, that there is really no message sent in that case. The test fails when the commit mentioned aboved is reverted. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c35
-rw-r--r--openbsc/tests/sgsn/sgsn_test.ok1
2 files changed, 36 insertions, 0 deletions
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index 464f4d742..533c393c8 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -257,6 +257,40 @@ static void test_gmm_detach_no_mmctx(void)
}
/*
+ * Test that a single GMM Detach Accept message will not cause the SGSN to send
+ * any message or leave an MM context at the SGSN.
+ */
+static void test_gmm_detach_accept_unexpected(void)
+{
+ struct gprs_llc_lle *lle;
+ uint32_t local_tlli;
+
+ printf("Testing GMM detach accept (unexpected)\n");
+
+ /* DTAP - Detach Accept (MT) */
+ /* normal detach */
+ static const unsigned char detach_acc[] = {
+ 0x08, 0x06
+ };
+
+ /* Create an LLME */
+ OSMO_ASSERT(count(gprs_llme_list()) == 0);
+ local_tlli = gprs_tmsi2tlli(0x23, TLLI_LOCAL);
+ lle = gprs_lle_get_or_create(local_tlli, 3);
+
+ /* inject the detach */
+ send_0408_message(lle->llme, local_tlli,
+ detach_acc, ARRAY_SIZE(detach_acc));
+
+ /* verify that no message (and therefore no Status or XID reset) has been
+ * sent by the SGSN */
+ OSMO_ASSERT(sgsn_tx_counter == 0);
+
+ /* verify that things are gone */
+ OSMO_ASSERT(count(gprs_llme_list()) == 0);
+}
+
+/*
* Test that a GMM Status will remove the associated LLME if there is no MMCTX.
*/
static void test_gmm_status_no_mmctx(void)
@@ -812,6 +846,7 @@ int main(int argc, char **argv)
test_gmm_detach();
test_gmm_detach_power_off();
test_gmm_detach_no_mmctx();
+ test_gmm_detach_accept_unexpected();
test_gmm_status_no_mmctx();
test_gmm_attach();
test_gmm_reject();
diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok
index 6f6204ff5..db9631193 100644
--- a/openbsc/tests/sgsn/sgsn_test.ok
+++ b/openbsc/tests/sgsn/sgsn_test.ok
@@ -2,6 +2,7 @@ Testing LLME allocations
Testing GMM detach
Testing GMM detach (power off)
Testing GMM detach (no MMCTX)
+Testing GMM detach accept (unexpected)
Testing GMM Status (no MMCTX)
Testing GMM attach
Testing GMM reject