summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-05-11 11:01:06 +0200
committerHolger Freyther <holger@freyther.de>2016-05-20 16:32:37 +0000
commite21cf38da4ae4fe89845a48f5af055439f33818b (patch)
tree6fdcc72c6e9bdc2c672f3c7364b51b75f8a8889f /openbsc/src/libmsc/gsm_04_08.c
parent8a4d2e756d80dd35cb9a3cf1bc3c2d2dc469fccb (diff)
Make extending subscriber creation easier
* rename variable controlling subscriber creation * use enum for subscriber creation policy * move check for subscriber creation policy into separate static function Related: OS#1658, OS#1647 Change-Id: I3b10a9a764fd3a7bb96717a990e52caae16266da Reviewed-on: https://gerrit.osmocom.org/42 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_08.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index f02f784fe..0f00db151 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -507,6 +507,14 @@ static int mm_tx_identity_req(struct gsm_subscriber_connection *conn, uint8_t id
return gsm48_conn_sendmsg(msg, conn, NULL);
}
+static struct gsm_subscriber *subscr_create(const struct gsm_network *net,
+ const char *imsi)
+{
+ if (net->subscr_creation_mode != GSM_SUBSCR_DONT_CREATE)
+ return subscr_create_subscriber(net->subscr_group, imsi);
+
+ return NULL;
+}
/* Parse Chapter 9.2.11 Identity Response */
static int mm_rx_id_resp(struct gsm_subscriber_connection *conn, struct msgb *msg)
@@ -530,9 +538,8 @@ static int mm_rx_id_resp(struct gsm_subscriber_connection *conn, struct msgb *ms
if (!conn->subscr) {
conn->subscr = subscr_get_by_imsi(net->subscr_group,
mi_string);
- if (!conn->subscr && net->create_subscriber)
- conn->subscr = subscr_create_subscriber(
- net->subscr_group, mi_string);
+ if (!conn->subscr)
+ conn->subscr = subscr_create(net, mi_string);
}
if (!conn->subscr && conn->loc_operation) {
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
@@ -641,10 +648,9 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
/* look up subscriber based on IMSI, create if not found */
subscr = subscr_get_by_imsi(bts->network->subscr_group, mi_string);
- if (!subscr && bts->network->create_subscriber) {
- subscr = subscr_create_subscriber(
- bts->network->subscr_group, mi_string);
- }
+ if (!subscr)
+ subscr = subscr_create(bts->network, mi_string);
+
if (!subscr) {
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
release_loc_updating_req(conn, 0);