gbproxy: Honour the BSS TLLI type when creating an SGSN TLLI

Currently gbproxy_make_sgsn_tlli always returns a foreign TLLI when
it uses the (SGSN) P-TMSI to generate one.

This patch changes the implementation to return a SGSN TLLI of the
same type like the BSS TLLI in that case.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2014-10-31 10:47:29 +01:00 committed by Holger Hans Peter Freyther
parent e3b6a1143f
commit 233a847893
1 changed files with 6 additions and 1 deletions

View File

@ -254,9 +254,14 @@ uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_peer *peer,
int max_retries = 23;
if (!peer->cfg->patch_ptmsi) {
sgsn_tlli = bss_tlli;
} else if (link_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI) {
} else if (link_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI &&
gprs_tlli_type(bss_tlli) == TLLI_FOREIGN) {
sgsn_tlli = gprs_tmsi2tlli(link_info->sgsn_tlli.ptmsi,
TLLI_FOREIGN);
} else if (link_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI &&
gprs_tlli_type(bss_tlli) == TLLI_LOCAL) {
sgsn_tlli = gprs_tmsi2tlli(link_info->sgsn_tlli.ptmsi,
TLLI_LOCAL);
} else {
do {
/* create random TLLI, 0b01111xxx... */