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
This commit is contained in:
Jacob Erlbeck 2014-09-22 10:42:05 +02:00 committed by Holger Hans Peter Freyther
parent 73e4f5fe7b
commit 538bee0753
3 changed files with 23 additions and 1 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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