diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-07-23 19:21:02 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-07-23 19:21:02 +0200 |
commit | 761e944182255225bd2d48caa7d66a28ec7dea65 (patch) | |
tree | cc2ed755d1957f1d296ae0940aeadaef612dc6a8 /openbsc/src/gsm_04_08.c | |
parent | b3c3faee940cda77afa9ba2500afa9ae9919851e (diff) |
make sure subscr->net is always set
since a subscriber is an element of the gsm_network, we have to ensure
subscr->net is always set correctly. We do this by using gsm_network
as an argument to all functions that resolve or create a subscriber.
Diffstat (limited to 'openbsc/src/gsm_04_08.c')
-rw-r--r-- | openbsc/src/gsm_04_08.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index 4359f8709..507daf998 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -1131,6 +1131,8 @@ static int mm_rx_id_resp(struct msgb *msg) { struct gsm48_hdr *gh = msgb_l3(msg); struct gsm_lchan *lchan = msg->lchan; + struct gsm_bts *bts = lchan->ts->trx->bts; + struct gsm_network *net = bts->network; u_int8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK; char mi_string[MI_SIZE]; @@ -1141,7 +1143,7 @@ static int mm_rx_id_resp(struct msgb *msg) switch (mi_type) { case GSM_MI_TYPE_IMSI: if (!lchan->subscr) - lchan->subscr = db_create_subscriber(mi_string); + lchan->subscr = db_create_subscriber(net, mi_string); if (lchan->loc_operation) lchan->loc_operation->waiting_for_imsi = 0; break; @@ -1198,6 +1200,7 @@ static int mm_rx_loc_upd_req(struct msgb *msg) struct gsm48_loc_upd_req *lu; struct gsm_subscriber *subscr = NULL; struct gsm_lchan *lchan = msg->lchan; + struct gsm_bts *bts = lchan->ts->trx->bts; u_int8_t mi_type; char mi_string[MI_SIZE]; int rc; @@ -1232,7 +1235,7 @@ static int mm_rx_loc_upd_req(struct msgb *msg) lchan->loc_operation->waiting_for_imei = 1; /* look up subscriber based on IMSI */ - subscr = db_create_subscriber(mi_string); + subscr = db_create_subscriber(bts->network, mi_string); break; case GSM_MI_TYPE_TMSI: DEBUGPC(DMM, "\n"); @@ -1241,7 +1244,7 @@ static int mm_rx_loc_upd_req(struct msgb *msg) lchan->loc_operation->waiting_for_imei = 1; /* look up the subscriber based on TMSI, request IMSI if it fails */ - subscr = subscr_get_by_tmsi(mi_string); + subscr = subscr_get_by_tmsi(bts->network, mi_string); if (!subscr) { /* send IDENTITY REQUEST message to get IMSI */ rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMSI); @@ -1423,6 +1426,7 @@ static int gsm48_rx_mm_serv_req(struct msgb *msg) u_int8_t mi_type; char mi_string[MI_SIZE]; + struct gsm_bts *bts = msg->lchan->ts->trx->bts; struct gsm_subscriber *subscr; struct gsm48_hdr *gh = msgb_l3(msg); struct gsm48_service_request *req = @@ -1457,7 +1461,7 @@ static int gsm48_rx_mm_serv_req(struct msgb *msg) DEBUGPC(DMM, "serv_type=0x%02x mi_type=0x%02x M(%s)\n", req->cm_service_type, mi_type, mi_string); - subscr = subscr_get_by_tmsi(mi_string); + subscr = subscr_get_by_tmsi(bts->network, mi_string); /* FIXME: if we don't know the TMSI, inquire abit IMSI and allocate new TMSI */ if (!subscr) @@ -1480,6 +1484,7 @@ static int gsm48_rx_mm_serv_req(struct msgb *msg) static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg) { + struct gsm_bts *bts = msg->lchan->ts->trx->bts; struct gsm48_hdr *gh = msgb_l3(msg); struct gsm48_imsi_detach_ind *idi = (struct gsm48_imsi_detach_ind *) gh->data; @@ -1493,10 +1498,10 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg) switch (mi_type) { case GSM_MI_TYPE_TMSI: - subscr = subscr_get_by_tmsi(mi_string); + subscr = subscr_get_by_tmsi(bts->network, mi_string); break; case GSM_MI_TYPE_IMSI: - subscr = subscr_get_by_imsi(mi_string); + subscr = subscr_get_by_imsi(bts->network, mi_string); break; case GSM_MI_TYPE_IMEI: case GSM_MI_TYPE_IMEISV: @@ -1576,6 +1581,7 @@ static int gsm0408_rcv_mm(struct msgb *msg) /* Receive a PAGING RESPONSE message from the MS */ static int gsm48_rr_rx_pag_resp(struct msgb *msg) { + struct gsm_bts *bts = msg->lchan->ts->trx->bts; struct gsm48_hdr *gh = msgb_l3(msg); u_int8_t *classmark2_lv = gh->data + 1; u_int8_t *mi_lv = gh->data + 2 + *classmark2_lv; @@ -1590,10 +1596,10 @@ static int gsm48_rr_rx_pag_resp(struct msgb *msg) mi_type, mi_string); switch (mi_type) { case GSM_MI_TYPE_TMSI: - subscr = subscr_get_by_tmsi(mi_string); + subscr = subscr_get_by_tmsi(bts->network, mi_string); break; case GSM_MI_TYPE_IMSI: - subscr = subscr_get_by_imsi(mi_string); + subscr = subscr_get_by_imsi(bts->network, mi_string); break; } @@ -3381,9 +3387,10 @@ int mncc_send(struct gsm_network *net, int msg_type, void *arg) } /* New transaction due to setup, find subscriber */ if (data->called.number[0]) - subscr = subscr_get_by_extension(data->called.number); + subscr = subscr_get_by_extension(net, + data->called.number); else - subscr = subscr_get_by_imsi(data->imsi); + subscr = subscr_get_by_imsi(net, data->imsi); /* If subscriber is not found */ if (!subscr) { DEBUGP(DCC, "(bts - trx - ts - ti -- sub %s) " |