gbproxy: Parse RA_UPD_REJ and invalidate TLLI

Since this message puts the MS into DEREGISTERED state (like a detach
procedure), this message is parsed and the invalidate_tlli field is
set accordingly.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2014-09-16 12:16:58 +02:00
parent cdd37837b3
commit 85e5c8f905
3 changed files with 39 additions and 5 deletions

View File

@ -279,6 +279,36 @@ static int gprs_gb_parse_gmm_ra_upd_req(uint8_t *data, size_t data_len,
return 1;
}
static int gprs_gb_parse_gmm_ra_upd_rej(uint8_t *data, size_t data_len,
struct gprs_gb_parse_context *parse_ctx)
{
uint8_t *value;
uint8_t cause;
int force_standby;
parse_ctx->llc_msg_name = "RA_UPD_REJ";
/* GMM cause */
if (v_fixed_shift(&data, &data_len, 1, &value) <= 0)
return 0;
cause = value[0];
/* Force to standby, 1/2 */
/* spare bits, 1/2 */
if (v_fixed_shift(&data, &data_len, 1, &value) <= 0)
return 0;
force_standby = (value[0] & 0x07) == 0x01;
if (cause == GMM_CAUSE_IMPL_DETACHED && !force_standby)
parse_ctx->await_reattach = 1;
parse_ctx->invalidate_tlli = 1;
return 1;
}
static int gprs_gb_parse_gmm_ra_upd_ack(uint8_t *data, size_t data_len,
struct gprs_gb_parse_context *parse_ctx)
{
@ -418,6 +448,9 @@ int gprs_gb_parse_dtap(uint8_t *data, size_t data_len,
case GSM48_MT_GMM_RA_UPD_REQ:
return gprs_gb_parse_gmm_ra_upd_req(data, data_len, parse_ctx);
case GSM48_MT_GMM_RA_UPD_REJ:
return gprs_gb_parse_gmm_ra_upd_rej(data, data_len, parse_ctx);
case GSM48_MT_GMM_RA_UPD_ACK:
return gprs_gb_parse_gmm_ra_upd_ack(data, data_len, parse_ctx);

View File

@ -2895,9 +2895,10 @@ static void test_gbproxy_keep_info()
dump_peers(stdout, 0, 0, &gbcfg);
/* TODO: This should have de-registered the TLLI which it did not. Add
* assertions when this is fixed.
*/
OSMO_ASSERT(!gbproxy_find_tlli(peer, local_tlli));
tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi, sizeof(imsi));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->is_deregistered);
/* Bad case: Re-Attach with wrong (initial) P-TMSI */
send_llc_ul_ui(nsi, "ATTACH REQUEST", &bss_peer[0], 0x1002,

View File

@ -4610,7 +4610,7 @@ Peers:
Attach Request count : 4
TLLI cache size : 1
TLLI-Cache: 1
TLLI efe2b700 -> efe2b700, 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 39 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 e4 e8 65
@ -4629,7 +4629,7 @@ Peers:
TLLI cache size : 2
TLLI-Cache: 2
TLLI afe2b700 -> afe2b700, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
TLLI efe2b700 -> efe2b700, IMSI 12131415161718, AGE 0
TLLI 00000000, IMSI 12131415161718, AGE 0, DE-REGISTERED
PROCESSING ATTACH ACCEPT from 0x05060708:32000
00 00 10 02 00 af e2 b7 00 00 50 20 16 82 02 58 13 99 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 0a 82 08 02 0d 88 11 12 13 14 15 16 17 18 00 81 00 0e 9e 41 c0 29 08 02 01 49 04 21 63 54 40 50 60 19 cd d7 08 17 16 18 05 f4 ef e2 b7 00 d2 d1 3e