From 91e9f555b6a091663c192c9cd3b8d022a2690eed Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 20 Oct 2014 16:30:06 +0200 Subject: gbproxy: Fix P-TMSI generation for repeated Attach Accept messages Currently, when P-TMSI patching is enabled, a new BSS P-TMSI is generated for each Attach Accept. So two duplicated, subsequent Attach Accept messages will be mapped to different BSS side P-TMSI. Because the last one will replace former ones in the link_info struct, the MS will fail to access the SGSN if it uses the former P-TMSI to derive the new TLLI. This patch checks the SGSN P-TMSI already assigned to the link_info and only generates a new BSS P-TMSI on mismatch (or if the BSS P-TMSI hasn't been set yet). Ticket: OW#1322 Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gb_proxy_tlli.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'openbsc/src/gprs/gb_proxy_tlli.c') diff --git a/openbsc/src/gprs/gb_proxy_tlli.c b/openbsc/src/gprs/gb_proxy_tlli.c index 138837eff..467006e87 100644 --- a/openbsc/src/gprs/gb_proxy_tlli.c +++ b/openbsc/src/gprs/gb_proxy_tlli.c @@ -557,9 +557,14 @@ struct gbproxy_link_info *gbproxy_update_link_state_dl( /* A new P-TMSI has been signalled in the message, * register new TLLI */ uint32_t new_sgsn_ptmsi; - uint32_t new_bss_ptmsi; + uint32_t new_bss_ptmsi = GSM_RESERVED_TMSI; gprs_parse_tmsi(parse_ctx->new_ptmsi_enc, &new_sgsn_ptmsi); - new_bss_ptmsi = gbproxy_make_bss_ptmsi(peer, new_sgsn_ptmsi); + + if (link_info->sgsn_tlli.ptmsi == new_sgsn_ptmsi) + new_bss_ptmsi = link_info->tlli.ptmsi; + + if (new_bss_ptmsi == GSM_RESERVED_TMSI) + new_bss_ptmsi = gbproxy_make_bss_ptmsi(peer, new_sgsn_ptmsi); LOGP(DGPRS, LOGL_INFO, "Got new PTMSI %08x from SGSN, using %08x for BSS\n", -- cgit v1.2.3