aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-22 10:42:05 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-09 17:48:37 +0200
commit9c65c8116fac1c99ba6eeb380e2cced26fbb5052 (patch)
treeb475712ea64f65869fd79db8c353ffb4aa8dd304
parent2bf326186a01a65762d73034975017d515eb4a01 (diff)
gbproxy: Parse Attach Reject messages
That message is currently ignored but should invalidate the TLLI and de-register the logical link instead. This patch extends the parser to recognize such messages and to set the invalidate_tlli flag. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gprs_gb_parse.c20
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c2
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.ok2
3 files changed, 23 insertions, 1 deletions
diff --git a/openbsc/src/gprs/gprs_gb_parse.c b/openbsc/src/gprs/gprs_gb_parse.c
index 2baaa069c..a0a4469b3 100644
--- a/openbsc/src/gprs/gprs_gb_parse.c
+++ b/openbsc/src/gprs/gprs_gb_parse.c
@@ -219,6 +219,23 @@ static int gprs_gb_parse_gmm_attach_ack(uint8_t *data, size_t data_len,
return 1;
}
+static int gprs_gb_parse_gmm_attach_rej(uint8_t *data, size_t data_len,
+ struct gprs_gb_parse_context *parse_ctx)
+{
+ uint8_t *value;
+
+ parse_ctx->llc_msg_name = "ATTACH_REJ";
+
+ /* GMM cause */
+ if (v_fixed_shift(&data, &data_len, 1, &value) <= 0)
+ return 0;
+
+ parse_ctx->invalidate_tlli = 1;
+
+ return 1;
+}
+
+
static int gprs_gb_parse_gmm_detach_req(uint8_t *data, size_t data_len,
struct gprs_gb_parse_context *parse_ctx)
{
@@ -442,6 +459,9 @@ int gprs_gb_parse_dtap(uint8_t *data, size_t data_len,
case GSM48_MT_GMM_ATTACH_REQ:
return gprs_gb_parse_gmm_attach_req(data, data_len, parse_ctx);
+ case GSM48_MT_GMM_ATTACH_REJ:
+ return gprs_gb_parse_gmm_attach_rej(data, data_len, parse_ctx);
+
case GSM48_MT_GMM_ATTACH_ACK:
return gprs_gb_parse_gmm_attach_ack(data, data_len, parse_ctx);
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 9b2218cf3..a128b39fc 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -3418,6 +3418,8 @@ static void test_gbproxy_keep_info()
dump_peers(stdout, 0, 0, &gbcfg);
+ OSMO_ASSERT(!gbproxy_link_info_by_tlli(peer, foreign_tlli));
+
/* Attach (incomplete) and Detach (MO) */
gbproxy_delete_link_infos(peer);
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index f37443b47..16e9d48f4 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -5487,7 +5487,7 @@ Peers:
Attach Reject count : 1
TLLI cache size : 1
TLLI-Cache: 1
- TLLI afe2b700 -> afe2b700, IMSI 12131415161718, AGE 0
+ TLLI 00000000, IMSI 12131415161718, AGE 0, DE-REGISTERED
PROCESSING ATTACH REQUEST from 0x01020304:1111
00 00 10 02 01 af e2 b7 00 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 34 01 c0 51 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 a0 bd 72