From 49389178cc6059f4e80f30dda2192560e580b29d Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 2 Oct 2014 16:14:47 +0200 Subject: gbproxy: Use pointer to PTMSI value instead of MI Currently, ptmsi_enc and new_ptmsi_enc point to the beginning of the mobile identity. Since all P-TMSI in 04.08 (MM) are encoded this way (1 byte header + 4 byte P-TMSI value). This is different to the P-TMSI encoding in 08.18 (BSSGP), where the P-TMSI is encoded into 4 byte without MI header. This patch changes the code to use pointers to the P-TMSI value, which is encoded in the same way in both specifications. Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gb_proxy_tlli.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 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 9b337fef9..138837eff 100644 --- a/openbsc/src/gprs/gb_proxy_tlli.c +++ b/openbsc/src/gprs/gb_proxy_tlli.c @@ -481,13 +481,8 @@ struct gbproxy_link_info *gbproxy_get_link_info_ul( if (!link_info && parse_ctx->ptmsi_enc && !parse_ctx->old_raid_is_foreign) { uint32_t bss_ptmsi; - if (!gprs_parse_mi_tmsi(parse_ctx->ptmsi_enc, GSM48_TMSI_LEN, - &bss_ptmsi)) - LOGP(DGPRS, LOGL_ERROR, - "Failed to parse P-TMSI (TLLI is %08x)\n", - parse_ctx->tlli); - else - link_info = gbproxy_link_info_by_ptmsi(peer, bss_ptmsi); + gprs_parse_tmsi(parse_ctx->ptmsi_enc, &bss_ptmsi); + link_info = gbproxy_link_info_by_ptmsi(peer, bss_ptmsi); } if (link_info) @@ -563,13 +558,7 @@ struct gbproxy_link_info *gbproxy_update_link_state_dl( * register new TLLI */ uint32_t new_sgsn_ptmsi; uint32_t new_bss_ptmsi; - if (!gprs_parse_mi_tmsi(parse_ctx->new_ptmsi_enc, GSM48_TMSI_LEN, - &new_sgsn_ptmsi)) { - LOGP(DGPRS, LOGL_ERROR, - "Failed to parse new TLLI/PTMSI (current is %08x)\n", - parse_ctx->tlli); - return link_info; - } + gprs_parse_tmsi(parse_ctx->new_ptmsi_enc, &new_sgsn_ptmsi); new_bss_ptmsi = gbproxy_make_bss_ptmsi(peer, new_sgsn_ptmsi); LOGP(DGPRS, LOGL_INFO, @@ -584,13 +573,7 @@ struct gbproxy_link_info *gbproxy_update_link_state_dl( * TLLI, create a new link_info */ /* TODO: Add a test case for this branch */ uint32_t new_ptmsi; - if (!gprs_parse_mi_tmsi(parse_ctx->new_ptmsi_enc, GSM48_TMSI_LEN, - &new_ptmsi)) { - LOGP(DGPRS, LOGL_ERROR, - "Failed to parse new PTMSI (TLLI is %08x)\n", - parse_ctx->tlli); - return link_info; - } + gprs_parse_tmsi(parse_ctx->new_ptmsi_enc, &new_ptmsi); LOGP(DGPRS, LOGL_INFO, "Adding TLLI %08x to list (SGSN, new P-TMSI is %08x)\n", @@ -620,13 +603,7 @@ struct gbproxy_link_info *gbproxy_update_link_state_dl( return link_info; /* A new P-TMSI has been signalled in the message */ - if (!gprs_parse_mi_tmsi(parse_ctx->new_ptmsi_enc, - GSM48_TMSI_LEN, &new_ptmsi)) { - LOGP(DGPRS, LOGL_ERROR, - "Failed to parse new PTMSI (TLLI is %08x)\n", - parse_ctx->tlli); - return link_info; - } + gprs_parse_tmsi(parse_ctx->new_ptmsi_enc, &new_ptmsi); LOGP(DGPRS, LOGL_INFO, "Assigning new P-TMSI %08x\n", new_ptmsi); /* Setup P-TMSIs */ -- cgit v1.2.3