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_patch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbsc/src/gprs/gb_proxy_patch.c') diff --git a/openbsc/src/gprs/gb_proxy_patch.c b/openbsc/src/gprs/gb_proxy_patch.c index 5cac8a5d8..b14809495 100644 --- a/openbsc/src/gprs/gb_proxy_patch.c +++ b/openbsc/src/gprs/gb_proxy_patch.c @@ -172,7 +172,7 @@ static int gbproxy_patch_ptmsi(uint8_t *ptmsi_enc, to_bss ? GBPROX_PEER_CTR_PTMSI_PATCHED_SGSN : GBPROX_PEER_CTR_PTMSI_PATCHED_BSS; - memcpy(&ptmsi_be, ptmsi_enc + 1, sizeof(ptmsi_be)); + memcpy(&ptmsi_be, ptmsi_enc, sizeof(ptmsi_be)); ptmsi = ntohl(ptmsi_be); if (ptmsi == new_ptmsi) @@ -184,7 +184,7 @@ static int gbproxy_patch_ptmsi(uint8_t *ptmsi_enc, log_text, ptmsi, new_ptmsi); ptmsi_be = htonl(new_ptmsi); - memcpy(ptmsi_enc + 1, &ptmsi_be, sizeof(ptmsi_be)); + memcpy(ptmsi_enc, &ptmsi_be, sizeof(ptmsi_be)); rate_ctr_inc(&peer->ctrg->ctr[counter]); -- cgit v1.2.3