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/.
Max gerrit-no-reply at lists.osmocom.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/95/13395/1 diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index f63fac3..828997a 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -49,35 +49,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) { @@ -142,7 +113,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, 17, 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 */ @@ -200,12 +171,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, 17, 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/13395 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Iec5c65776fc54b2f9e5dd55c711ace2471662db1 Gerrit-Change-Number: 13395 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190324/4e7dd942/attachment.htm>