Allow Gb PAGING-PS without P-TMSI

P-TMSI is optional IE, but IE is mandatory and hence always available.
Since the encoding is actually a Mobile Identity, the IMSI is used in
case P-TMSI is not available.

Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1
This commit is contained in:
Pau Espin 2019-12-10 19:26:27 +01:00 committed by laforge
parent d7c3265223
commit 5530f12f71
5 changed files with 27 additions and 27 deletions

View File

@ -729,7 +729,7 @@ void Encoding::write_packet_downlink_assignment(RlcMacDownlink_t * block,
}
/* Generate paging request. See 44.018, sections 10 and 9.1.22 */
int Encoding::write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len)
int Encoding::write_paging_request(bitvec * dest, const uint8_t *mi, uint8_t mi_len)
{
unsigned wp = 0;
int plen;
@ -741,14 +741,9 @@ int Encoding::write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi
bitvec_write_field(dest, &wp,0x0,4); // Page Mode
bitvec_write_field(dest, &wp,0x0,4); // Channel Needed
// Mobile Identity
bitvec_write_field(dest, &wp,ptmsi_len+1,8); // Mobile Identity length
bitvec_write_field(dest, &wp,0xf,4); // unused
bitvec_write_field(dest, &wp,0x4,4); // PTMSI type
for (int i = 0; i < ptmsi_len; i++)
{
bitvec_write_field(dest, &wp,ptmsi[i],8); // PTMSI
}
bitvec_write_field(dest, &wp, mi_len, 8); // Mobile Identity length
bitvec_set_bytes(dest, mi, mi_len); // Mobile Identity
wp += mi_len * 8;
if ((wp % 8))
log_alert_exit("Length of PAG.REQ without rest octets is not "

View File

@ -77,7 +77,7 @@ public:
bitvec * dest, struct gprs_rlcmac_ul_tbf *tbf, bool is_final,
uint8_t rrbp);
static int write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len);
static int write_paging_request(bitvec * dest, const uint8_t *mi, uint8_t mi_len);
static unsigned write_repeated_page_info(bitvec * dest, unsigned& wp, uint8_t len,
uint8_t *identity, uint8_t chan_needed);

View File

@ -175,25 +175,18 @@ static int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, struct tlv_parsed *tp)
{
char imsi[16];
uint16_t pgroup;
uint8_t *ptmsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_TMSI);
uint16_t ptmsi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);
const uint8_t *mi;
uint8_t mi_len;
int rc;
LOGP(DBSSGP, LOGL_NOTICE, " P-TMSI = ");
for (int i = 0; i < ptmsi_len; i++)
{
LOGPC(DBSSGP, LOGL_NOTICE, "%02x", ptmsi[i]);
}
LOGPC(DBSSGP, LOGL_NOTICE, "\n");
if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI)) {
LOGP(DBSSGP, LOGL_ERROR, "No IMSI\n");
return -EINVAL;
return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg);
}
/* gsm48_mi_to_string() returns number of bytes written, including '\0' */
rc = gsm48_mi_to_string(imsi, sizeof(imsi), TLVP_VAL(tp, BSSGP_IE_IMSI),
TLVP_LEN(tp, BSSGP_IE_IMSI));
TLVP_LEN(tp, BSSGP_IE_IMSI));
if (rc != GSM23003_IMSI_MAX_DIGITS + 1) {
LOGP(DBSSGP, LOGL_NOTICE, "Failed to parse IMSI IE (rc=%d)\n", rc);
return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
@ -204,7 +197,15 @@ static int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, struct tlv_parsed *tp)
return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
}
return gprs_rlcmac_paging_request(ptmsi, ptmsi_len, pgroup);
if (TLVP_PRESENT(tp, BSSGP_IE_TMSI)) {
mi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);
mi = TLVP_VAL(tp, BSSGP_IE_TMSI);
} else { /* Use IMSI if TMSI not available: */
mi_len = TLVP_LEN(tp, BSSGP_IE_IMSI);
mi = TLVP_VAL(tp, BSSGP_IE_IMSI);
}
return gprs_rlcmac_paging_request(mi, mi_len, pgroup);
}
/* Receive a BSSGP PDU from a BSS on a PTP BVCI */

View File

@ -19,6 +19,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
extern "C" {
#include <osmocom/gsm/gsm48.h>
}
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
#include <bts.h>
@ -28,13 +32,13 @@
extern void *tall_pcu_ctx;
int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,
uint16_t pgroup)
int gprs_rlcmac_paging_request(const uint8_t *mi, uint8_t mi_len, uint16_t pgroup)
{
LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH)\n");
LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH) MI=%s\n",
osmo_mi_name(mi, mi_len));
bitvec *paging_request = bitvec_alloc(22, tall_pcu_ctx);
bitvec_unhex(paging_request, DUMMY_VEC);
int plen = Encoding::write_paging_request(paging_request, ptmsi, ptmsi_len);
int plen = Encoding::write_paging_request(paging_request, mi, mi_len);
pcu_l1if_tx_pch(paging_request, plen, pgroup);
bitvec_free(paging_request);

View File

@ -93,7 +93,7 @@ enum gprs_rlcmac_block_type {
int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, uint16_t pgroup);
int gprs_rlcmac_paging_request(const uint8_t *mi, uint8_t mi_len, uint16_t pgroup);
struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);