gbproxy: Fix radio status routing by TMSI

If a radio status message contains a TMSI it should be routed as if it
was a TLLI. Convert the TMSI to (foreign) TLLI so NRI-routing works.

Both foreign and local TLLIs are routed the same.

Fixes: OS#4954
Change-Id: Ifd64f02fa16b44f8e2e19eb8ba973f50a829ead5
diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index b573adc..1dc3114 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -417,6 +417,8 @@
 		} else if (TLVP_PRESENT(&tp, BSSGP_IE_TMSI)) {
 			/* we treat the TMSI like a TLLI and extract the NRI from it */
 			tlli = osmo_load32be(TLVP_VAL(&tp, BSSGP_IE_TMSI));
+			/* Convert the TMSI into a FOREIGN TLLI so it is routed appropriately */
+			tlli = gprs_tmsi2tlli(tlli, TLLI_FOREIGN);
 			rc = gbprox_bss2sgsn_tlli(bss_bvc->cell, msg, &tlli, false);
 		} else if (TLVP_PRESENT(&tp, BSSGP_IE_IMSI)) {
 			/* FIXME: Use the IMSI as selector? */