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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12526 ) Change subject: Optionally store IMEI in subscriber table ...................................................................... Optionally store IMEI in subscriber table Add VTY config option "store-imei". When it is set, store the IMEI sent from the VLR with CHECK-IMEI in the database. Related: OS#2541 Change-Id: I09274ecbed64224f7ae305e09ede773931da2a57 --- M src/hlr.c M src/hlr.h M src/hlr_vty.c M tests/test_nodes.vty 4 files changed, 43 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Neels Hofmeyr: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/hlr.c b/src/hlr.c index 614e99f..0098a32 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -419,8 +419,22 @@ 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); + /* Save in DB if desired */ + if (g_hlr->store_imei) { + LOGP(DAUC, LOGL_DEBUG, "IMSI='%s': storing IMEI = %s\n", gsup->imsi, imei); + if (db_subscr_update_imei_by_imsi(g_hlr->dbc, gsup->imsi, imei) < 0) { + gsup_send_err_reply(conn, gsup->imsi, gsup->message_type, GMM_CAUSE_INV_MAND_INFO); + return -1; + } + } else { + /* Check if subscriber exists and print IMEI */ + LOGP(DMAIN, LOGL_INFO, "IMSI='%s': has IMEI = %s (consider setting 'store-imei')\n", gsup->imsi, imei); + struct hlr_subscriber subscr; + if (db_subscr_get_by_imsi(g_hlr->dbc, gsup->imsi, &subscr) < 0) { + gsup_send_err_reply(conn, gsup->imsi, gsup->message_type, GMM_CAUSE_INV_MAND_INFO); + return -1; + } + } /* Accept all IMEIs */ gsup_reply.imei_result = OSMO_GSUP_IMEI_RESULT_ACK; diff --git a/src/hlr.h b/src/hlr.h index e9cc747..00fa43c 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -51,6 +51,8 @@ struct llist_head ussd_routes; struct llist_head ss_sessions; + + bool store_imei; }; extern struct hlr *g_hlr; diff --git a/src/hlr_vty.c b/src/hlr_vty.c index 6706aa4..04e0191 100644 --- a/src/hlr_vty.c +++ b/src/hlr_vty.c @@ -71,6 +71,8 @@ static int config_write_hlr(struct vty *vty) { vty_out(vty, "hlr%s", VTY_NEWLINE); + if (g_hlr->store_imei) + vty_out(vty, " store-imei%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -305,6 +307,23 @@ return CMD_SUCCESS; } +DEFUN(cfg_store_imei, cfg_store_imei_cmd, + "store-imei", + "Save the IMEI in the database when receiving Check IMEI requests. Note that an MSC does not necessarily send" + " Check IMEI requests (for OsmoMSC, you may want to set 'check-imei-rqd 1').") +{ + g_hlr->store_imei = true; + return CMD_SUCCESS; +} + +DEFUN(cfg_no_store_imei, cfg_no_store_imei_cmd, + "no store-imei", + "Do not save the IMEI in the database, when receiving Check IMEI requests.") +{ + g_hlr->store_imei = false; + return CMD_SUCCESS; +} + /*********************************************************************** * Common Code ***********************************************************************/ @@ -368,6 +387,8 @@ install_element(HLR_NODE, &cfg_ussd_defaultroute_cmd); install_element(HLR_NODE, &cfg_ussd_no_defaultroute_cmd); install_element(HLR_NODE, &cfg_ncss_guard_timeout_cmd); + install_element(HLR_NODE, &cfg_store_imei_cmd); + install_element(HLR_NODE, &cfg_no_store_imei_cmd); hlr_vty_subscriber_init(); } diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty index 63d3da0..6e72ed0 100644 --- a/tests/test_nodes.vty +++ b/tests/test_nodes.vty @@ -79,6 +79,8 @@ ussd default-route external EUSE no ussd default-route ncss-guard-timeout <0-255> + store-imei + no store-imei OsmoHLR(config-hlr)# gsup OsmoHLR(config-hlr-gsup)# list @@ -98,6 +100,7 @@ OsmoHLR(config)# exit OsmoHLR# configure terminal OsmoHLR(config)# hlr +OsmoHLR(config-hlr)# store-imei OsmoHLR(config-hlr)# gsup OsmoHLR(config-hlr-gsup)# end OsmoHLR# disable @@ -116,6 +119,7 @@ logging level ss info ... hlr + store-imei gsup bind ip 127.0.0.1 ussd route prefix *#100# internal own-msisdn -- To view, visit https://gerrit.osmocom.org/12526 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I09274ecbed64224f7ae305e09ede773931da2a57 Gerrit-Change-Number: 12526 Gerrit-PatchSet: 8 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com> Gerrit-Reviewer: osmith <osmith at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190124/beccd8b7/attachment.htm>