This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-pcu/+/13395 )
Change subject: Use libosmocore for IMSI parsing
......................................................................
Use libosmocore for IMSI parsing
Change-Id: Iec5c65776fc54b2f9e5dd55c711ace2471662db1
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 4 insertions(+), 32 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 22abc6b..a4a5875 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -54,35 +54,6 @@
static void bvc_timeout(void *_priv);
static int gprs_ns_reconnect(struct gprs_nsvc *nsvc);
-static int parse_imsi(struct tlv_parsed *tp, char *imsi)
-{
- uint8_t imsi_len;
- uint8_t *bcd_imsi;
- int i, j;
-
- if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI))
- return -EINVAL;
-
- imsi_len = TLVP_LEN(tp, BSSGP_IE_IMSI);
- bcd_imsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_IMSI);
-
- if ((bcd_imsi[0] & 0x08))
- imsi_len = imsi_len * 2 - 1;
- else
- imsi_len = (imsi_len - 1) * 2;
- for (i = 0, j = 0; j < imsi_len && j < 15; j++)
- {
- if (!(j & 1)) {
- imsi[j] = (bcd_imsi[i] >> 4) + '0';
- i++;
- } else
- imsi[j] = (bcd_imsi[i] & 0xf) + '0';
- }
- imsi[j] = '\0';
-
- return 0;
-}
-
#if 0
static int parse_ra_cap(struct tlv_parsed *tp, MS_Radio_Access_capability_t *rac)
{
@@ -147,7 +118,7 @@
/* read IMSI. if no IMSI exists, use first paging block (any paging),
* because during attachment the IMSI might not be known, so the MS
* will listen to all paging blocks. */
- parse_imsi(tp, imsi);
+ gsm48_mi_to_string(imsi, sizeof(imsi), TLVP_VAL(tp, BSSGP_IE_IMSI), TLVP_LEN(tp, BSSGP_IE_IMSI));
#if 0 /* Do not rely on this IE. TODO: make this configurable */
/* parse ms radio access capability */
@@ -205,12 +176,13 @@
}
LOGPC(DBSSGP, LOGL_NOTICE, "\n");
- if (parse_imsi(tp, imsi))
- {
+ if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI)) {
LOGP(DBSSGP, LOGL_ERROR, "No IMSI\n");
return -EINVAL;
}
+ gsm48_mi_to_string(imsi, sizeof(imsi), TLVP_VAL(tp, BSSGP_IE_IMSI), TLVP_LEN(tp, BSSGP_IE_IMSI));
+
return gprs_rlcmac_paging_request(ptmsi, ptmsi_len, imsi);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/13395
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Iec5c65776fc54b2f9e5dd55c711ace2471662db1
Gerrit-Change-Number: 13395
Gerrit-PatchSet: 5
Gerrit-Owner: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: msuraev <suraev at alumni.ntnu.no>
Gerrit-CC: fixeria <axilirator at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190716/6d3a85f8/attachment.htm>