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/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/12411 Change subject: Reply to CHECK-IMEI GSUP messages ...................................................................... Reply to CHECK-IMEI GSUP messages Decode the IMEI from incoming CHECK-IMEI messages, print the IMEI to the log and always send ACK back to the VLR/MSC. In the future, we will not only log the IMEI, but store it in the HLR (OS#2541). This is not the original intention of CHECK-IMEI from the 3GPP spec, but an useful side effect. Depends: I085819df0ea7f3bfeb0cabebb5fd1942a23c6155 (libosmocore) Related: OS#3733 Change-Id: Ib240474b0c3c603ba840cf26babb38a44dfc9364 --- M src/hlr.c 1 file changed, 35 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/11/12411/1 diff --git a/src/hlr.c b/src/hlr.c index 4873a66..7a37518 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -399,6 +399,38 @@ return osmo_gsup_conn_send(conn, msg_out); } +static int rx_check_imei_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup) +{ + struct osmo_gsup_message gsup_reply = {0}; + struct msgb *msg_out; + char imei[GSM23003_IMEI_NUM_DIGITS+1] = {0}; + + /* Encoded IMEI length check */ + if (!gsup->imei_enc || gsup->imei_enc_len < 1 || gsup->imei_enc[0] >= sizeof(imei)) { + LOGP(DMAIN, LOGL_ERROR, "%s: wrong encoded IMEI length\n", gsup->imsi); + gsup_send_err_reply(conn, gsup->imsi, gsup->message_type, GMM_CAUSE_INV_MAND_INFO); + return -1; + } + + /* Decode IMEI */ + if (gsm48_decode_bcd_number(imei, sizeof(imei), gsup->imei_enc, 0) < 0) { + LOGP(DMAIN, LOGL_ERROR, "%s: failed to decode IMEI\n", gsup->imsi); + gsup_send_err_reply(conn, gsup->imsi, gsup->message_type, GMM_CAUSE_INV_MAND_INFO); + return -1; + } + + /* Only print the IMEI for now, it's planned to store it here (OS#2541) */ + LOGP(DMAIN, LOGL_INFO, "%s: has IMEI: %s\n", gsup->imsi, imei); + + /* Accept all IMEIs */ + gsup_reply.imei_result = OSMO_GSUP_IMEI_RESULT_ACK; + gsup_reply.message_type = OSMO_GSUP_MSGT_CHECK_IMEI_RESULT; + msg_out = msgb_alloc_headroom(1024+16, 16, "GSUP Check_IMEI response"); + memcpy(gsup_reply.imsi, gsup->imsi, sizeof(gsup_reply.imsi)); + osmo_gsup_encode(msg_out, &gsup_reply); + return osmo_gsup_conn_send(conn, msg_out); +} + static int read_cb(struct osmo_gsup_conn *conn, struct msgb *msg) { static struct osmo_gsup_message gsup; @@ -459,6 +491,9 @@ lu_op_rx_gsup(luop, &gsup); } break; + case OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST: + rx_check_imei_req(conn, &gsup); + break; default: LOGP(DMAIN, LOGL_DEBUG, "Unhandled GSUP message type %s\n", osmo_gsup_message_type_name(gsup.message_type)); -- To view, visit https://gerrit.osmocom.org/12411 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ib240474b0c3c603ba840cf26babb38a44dfc9364 Gerrit-Change-Number: 12411 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181221/6104ceda/attachment.htm>