nitb: Allow the network to decide if a subscriber should be created
This commit is contained in:
parent
120250ad6f
commit
1ba0730a71
|
@ -278,6 +278,7 @@ struct gsm_network {
|
||||||
struct osmo_bsc_data *bsc_data;
|
struct osmo_bsc_data *bsc_data;
|
||||||
|
|
||||||
/* subscriber related features */
|
/* subscriber related features */
|
||||||
|
int create_subscriber;
|
||||||
struct gsm_subscriber_group *subscr_group;
|
struct gsm_subscriber_group *subscr_group;
|
||||||
struct gsm_sms_queue *sms_queue;
|
struct gsm_sms_queue *sms_queue;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,9 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod
|
||||||
net->bsc_data->auto_off_timeout = -1;
|
net->bsc_data->auto_off_timeout = -1;
|
||||||
net->bsc_data->network = net;
|
net->bsc_data->network = net;
|
||||||
INIT_LLIST_HEAD(&net->bsc_data->mscs);
|
INIT_LLIST_HEAD(&net->bsc_data->mscs);
|
||||||
|
|
||||||
net->subscr_group->net = net;
|
net->subscr_group->net = net;
|
||||||
|
net->create_subscriber = 1;
|
||||||
|
|
||||||
net->country_code = country_code;
|
net->country_code = country_code;
|
||||||
net->network_code = network_code;
|
net->network_code = network_code;
|
||||||
|
|
|
@ -269,7 +269,7 @@ static int authorize_subscriber(struct gsm_loc_updating_operation *loc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_loc_updating_req(struct gsm_subscriber_connection *conn)
|
static void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release)
|
||||||
{
|
{
|
||||||
if (!conn->loc_operation)
|
if (!conn->loc_operation)
|
||||||
return;
|
return;
|
||||||
|
@ -280,14 +280,15 @@ static void release_loc_updating_req(struct gsm_subscriber_connection *conn)
|
||||||
osmo_timer_del(&conn->loc_operation->updating_timer);
|
osmo_timer_del(&conn->loc_operation->updating_timer);
|
||||||
talloc_free(conn->loc_operation);
|
talloc_free(conn->loc_operation);
|
||||||
conn->loc_operation = NULL;
|
conn->loc_operation = NULL;
|
||||||
msc_release_connection(conn);
|
if (release)
|
||||||
|
msc_release_connection(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void allocate_loc_updating_req(struct gsm_subscriber_connection *conn)
|
static void allocate_loc_updating_req(struct gsm_subscriber_connection *conn)
|
||||||
{
|
{
|
||||||
if (conn->loc_operation)
|
if (conn->loc_operation)
|
||||||
LOGP(DMM, LOGL_ERROR, "Connection already had operation.\n");
|
LOGP(DMM, LOGL_ERROR, "Connection already had operation.\n");
|
||||||
release_loc_updating_req(conn);
|
release_loc_updating_req(conn, 0);
|
||||||
|
|
||||||
conn->loc_operation = talloc_zero(tall_locop_ctx,
|
conn->loc_operation = talloc_zero(tall_locop_ctx,
|
||||||
struct gsm_loc_updating_operation);
|
struct gsm_loc_updating_operation);
|
||||||
|
@ -301,7 +302,7 @@ static int _gsm0408_authorize_sec_cb(unsigned int hooknum, unsigned int event,
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GSM_SECURITY_AUTH_FAILED:
|
case GSM_SECURITY_AUTH_FAILED:
|
||||||
release_loc_updating_req(conn);
|
release_loc_updating_req(conn, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GSM_SECURITY_ALREADY:
|
case GSM_SECURITY_ALREADY:
|
||||||
|
@ -362,7 +363,7 @@ void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t caus
|
||||||
* Cancel any outstanding location updating request
|
* Cancel any outstanding location updating request
|
||||||
* operation taking place on the subscriber connection.
|
* operation taking place on the subscriber connection.
|
||||||
*/
|
*/
|
||||||
release_loc_updating_req(conn);
|
release_loc_updating_req(conn, 1);
|
||||||
|
|
||||||
/* We might need to cancel the paging response or such. */
|
/* We might need to cancel the paging response or such. */
|
||||||
if (conn->sec_operation && conn->sec_operation->cb) {
|
if (conn->sec_operation && conn->sec_operation->cb) {
|
||||||
|
@ -500,10 +501,15 @@ static int mm_rx_id_resp(struct gsm_subscriber_connection *conn, struct msgb *ms
|
||||||
if (!conn->subscr) {
|
if (!conn->subscr) {
|
||||||
conn->subscr = subscr_get_by_imsi(net->subscr_group,
|
conn->subscr = subscr_get_by_imsi(net->subscr_group,
|
||||||
mi_string);
|
mi_string);
|
||||||
if (!conn->subscr)
|
if (!conn->subscr && net->create_subscriber)
|
||||||
conn->subscr = subscr_create_subscriber(
|
conn->subscr = subscr_create_subscriber(
|
||||||
net->subscr_group, mi_string);
|
net->subscr_group, mi_string);
|
||||||
}
|
}
|
||||||
|
if (!conn->subscr && conn->loc_operation) {
|
||||||
|
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
|
||||||
|
release_loc_updating_req(conn, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (conn->loc_operation)
|
if (conn->loc_operation)
|
||||||
conn->loc_operation->waiting_for_imsi = 0;
|
conn->loc_operation->waiting_for_imsi = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -532,7 +538,7 @@ static void loc_upd_rej_cb(void *data)
|
||||||
|
|
||||||
LOGP(DMM, LOGL_DEBUG, "Location Updating Request procedure timedout.\n");
|
LOGP(DMM, LOGL_DEBUG, "Location Updating Request procedure timedout.\n");
|
||||||
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
|
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
|
||||||
release_loc_updating_req(conn);
|
release_loc_updating_req(conn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void schedule_reject(struct gsm_subscriber_connection *conn)
|
static void schedule_reject(struct gsm_subscriber_connection *conn)
|
||||||
|
@ -613,10 +619,15 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
|
||||||
|
|
||||||
/* look up subscriber based on IMSI, create if not found */
|
/* look up subscriber based on IMSI, create if not found */
|
||||||
subscr = subscr_get_by_imsi(bts->network->subscr_group, mi_string);
|
subscr = subscr_get_by_imsi(bts->network->subscr_group, mi_string);
|
||||||
if (!subscr) {
|
if (!subscr && bts->network->create_subscriber) {
|
||||||
subscr = subscr_create_subscriber(
|
subscr = subscr_create_subscriber(
|
||||||
bts->network->subscr_group, mi_string);
|
bts->network->subscr_group, mi_string);
|
||||||
}
|
}
|
||||||
|
if (!subscr) {
|
||||||
|
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
|
||||||
|
release_loc_updating_req(conn, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GSM_MI_TYPE_TMSI:
|
case GSM_MI_TYPE_TMSI:
|
||||||
DEBUGPC(DMM, "\n");
|
DEBUGPC(DMM, "\n");
|
||||||
|
@ -1109,7 +1120,7 @@ static int gsm0408_rcv_mm(struct gsm_subscriber_connection *conn, struct msgb *m
|
||||||
conn->subscr ?
|
conn->subscr ?
|
||||||
subscr_name(conn->subscr) :
|
subscr_name(conn->subscr) :
|
||||||
"unknown subscriber");
|
"unknown subscriber");
|
||||||
release_loc_updating_req(conn);
|
release_loc_updating_req(conn, 1);
|
||||||
break;
|
break;
|
||||||
case GSM48_MT_MM_IMSI_DETACH_IND:
|
case GSM48_MT_MM_IMSI_DETACH_IND:
|
||||||
rc = gsm48_rx_mm_imsi_detach_ind(conn, msg);
|
rc = gsm48_rx_mm_imsi_detach_ind(conn, msg);
|
||||||
|
|
Loading…
Reference in New Issue