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/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/13714 Change subject: add lu-ignore-nam-cs ...................................................................... add lu-ignore-nam-cs Change-Id: I62e750faab92b142b9ca89ad2de5dc63afaeb61c --- M src/hlr.c M src/hlr.h M src/hlr_vty.c 3 files changed, 50 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/14/13714/1 diff --git a/src/hlr.c b/src/hlr.c index b739e71..882362d 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -320,8 +320,15 @@ /* Check if subscriber is generally permitted on CS or PS * service (as requested) */ if (!luop->is_ps && !luop->subscr.nam_cs) { - lu_op_tx_error(luop, GMM_CAUSE_PLMN_NOTALLOWED); - return 0; + if (g_hlr->lu_ignore_nam_cs) + /* Subscriber will be kicked later in the IMEI check, which the operator must enable together + * with lu-ignore-nam-cs. See rx_check_imei_req() below. */ + LOGP(DMAIN, LOGL_DEBUG, "LU REQ: subscriber not allowed for CS, but allowing anyway" + " (lu-ignore-nam-cs)"); + else { + lu_op_tx_error(luop, GMM_CAUSE_PLMN_NOTALLOWED); + return 0; + } } else if (luop->is_ps && !luop->subscr.nam_ps) { lu_op_tx_error(luop, GMM_CAUSE_GPRS_NOTALLOWED); return 0; @@ -413,6 +420,7 @@ static int rx_check_imei_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup) { + struct hlr_subscriber subscr; struct osmo_gsup_message gsup_reply = {0}; struct msgb *msg_out; char imei[GSM23003_IMEI_NUM_DIGITS+1] = {0}; @@ -431,6 +439,12 @@ return -1; } + /* Get subscriber */ + 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; + } + /* Save in DB if desired */ if (g_hlr->store_imei) { LOGP(DAUC, LOGL_DEBUG, "IMSI='%s': storing IMEI = %s\n", gsup->imsi, imei); @@ -438,18 +452,21 @@ 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 */ + } else 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; + + /* lu-ignore-nam-cs: use Check IMEI to do a late check for CS/PS enabled. This would usually be done in the LU + * REQ, but then the ME will immediatelly disconnect without sending the IMEI. */ + if (g_hlr->lu_ignore_nam_cs && !subscr.nam_cs && !subscr.nam_ps) { + LOGP(DAUC, LOGL_DEBUG, "IMSI='%s': pretending that the IMEI is not allowed, because subscriber" + " has both CS and PS NAM disabled (lu-ignore-nam-cs)", gsup->imsi); + gsup_reply.imei_result = OSMO_GSUP_IMEI_RESULT_NACK; + } + + /* Send response */ 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)); diff --git a/src/hlr.h b/src/hlr.h index dc1c720..ad9ef7e 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -54,6 +54,7 @@ bool store_imei; bool create_subscr_on_demand; + bool lu_ignore_nam_cs; }; extern struct hlr *g_hlr; diff --git a/src/hlr_vty.c b/src/hlr_vty.c index 7bf27da..2804fd0 100644 --- a/src/hlr_vty.c +++ b/src/hlr_vty.c @@ -342,6 +342,26 @@ return CMD_SUCCESS; } +DEFUN(cfg_lu_ignore_nam_cs, cfg_lu_ignore_nam_cs_cmd, + "lu-ignore-nam-cs", + "Allow subscribers to do the LU (Location Update) for the CS domain, even if they should not have access to it." + " OsmoHLR will do the CS domain check again after the LU, during the Check IMEI procedure, and pretend that the" + " IMEI is not allowed on the network if the CS domain is disabled for the subscriber. This is needed to make" + " store-imei work with subscriber-create-on-demand. ONLY ENABLE TOGETHER WITH ENFORCED IMEI CHECKING IN YOUR" + " MSC! (OsmoMSC: 'check-imei-rqd 1')") +{ + g_hlr->lu_ignore_nam_cs = true; + return CMD_SUCCESS; +} + +DEFUN(cfg_no_lu_ignore_nam_cs, cfg_no_lu_ignore_nam_cs_cmd, + "no lu-ignore-nam-cs", + "Only allow LU (Location Update) for the CS domain, if the subscriber has access to it.") +{ + g_hlr->lu_ignore_nam_cs = false; + return CMD_SUCCESS; +} + /*********************************************************************** * Common Code ***********************************************************************/ @@ -410,6 +430,8 @@ install_element(HLR_NODE, &cfg_no_store_imei_cmd); install_element(HLR_NODE, &cfg_subscr_create_on_demand_cmd); install_element(HLR_NODE, &cfg_no_subscr_create_on_demand_cmd); + install_element(HLR_NODE, &cfg_lu_ignore_nam_cs_cmd); + install_element(HLR_NODE, &cfg_no_lu_ignore_nam_cs_cmd); hlr_vty_subscriber_init(); } -- To view, visit https://gerrit.osmocom.org/13714 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: I62e750faab92b142b9ca89ad2de5dc63afaeb61c Gerrit-Change-Number: 13714 Gerrit-PatchSet: 1 Gerrit-Owner: 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/20190420/b764c847/attachment.htm>