aboutsummaryrefslogtreecommitdiffstats
path: root/src/bsc_hack.c
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2008-12-29 17:44:08 +0000
committerHolger Freyther <zecke@selfish.org>2008-12-29 17:44:08 +0000
commitb7193e4e9498fbc51a985a24e374832976997355 (patch)
tree520f9d4e02a9bdc00477300e54871cc22a9116b4 /src/bsc_hack.c
parentfad5d0db83c9ba458c865cfc1a645b83e98ddf19 (diff)
Introduce new callbacks, remember that we have LOC UPD REQ, reject things only once
gsm_data.h add new callbacks, add some parameters, update bsc_hack and other call sites. Remember that we need to ACCEPT/REJECT the LOCATION UPDATE REQUEST and then send the ACCEPT or schedule the sending of the reject. Currently it is possible that for a new subscriber that we do not have a !subscbr yet, we will trigger an IDENTITY REQUEST and schedule the reject timer. This may lead to rejecting AND accepting (a new subscriber). This issue is triggered when allowing everyone to connect to the network.
Diffstat (limited to 'src/bsc_hack.c')
-rw-r--r--src/bsc_hack.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index 94bc3461e..03dd5e4a0 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -49,11 +49,13 @@ static int MNC = 1;
static const char *database_name = "hlr.sqlite3";
/* forward declarations */
-static void bsc_hack_update_request_accepted(struct gsm_bts *bts, u_int32_t assigned_tmi);
+static void bsc_hack_update_request(struct gsm_bts *bts,
+ u_int32_t assigned_tmi, int accepted);
static void bsc_hack_channel_allocated(struct gsm_lchan *chan,
enum gsm_chreq_reason_t reason);
static void bsc_hack_channel_response(struct gsm_lchan *chan, int acked);
-static void bsc_hack_call_released(struct gsm_lchan *chan);
+static void bsc_hack_call_state_changed(struct gsm_lchan *chan,
+ enum gsm_call_state new_state);
/* The following definitions are for OM and NM packets that we cannot yet
@@ -643,10 +645,10 @@ static int bootstrap_network(void)
bts = &gsmnet->bts[0];
bts->location_area_code = 1;
bts->trx[0].arfcn = HARDCODED_ARFCN;
- gsmnet->update_request_accepted = bsc_hack_update_request_accepted;
+ gsmnet->update_request = bsc_hack_update_request;
gsmnet->channel_allocated = bsc_hack_channel_allocated;
gsmnet->channel_response = bsc_hack_channel_response;
- gsmnet->call_released = bsc_hack_call_released;
+ gsmnet->call_state_changed = bsc_hack_call_state_changed;
if (mi_setup(bts, 0, mi_cb) < 0)
return -EIO;
@@ -807,10 +809,19 @@ static struct timer_list station_timer = {
/*
* schedule work
*/
-static void bsc_hack_update_request_accepted(struct gsm_bts *bts, u_int32_t tmsi)
+static void bsc_hack_update_request(struct gsm_bts *bts, u_int32_t tmsi, int accepted)
{
struct pending_registered_station *station =
(struct pending_registered_station*)malloc(sizeof(*station));
+
+ /*
+ * Only deal with LOCATION UPDATE REQUEST we have
+ * accepted.
+ */
+ if (!accepted)
+ return;
+
+
station->tmsi = tmsi;
station->last_page_group = 0;
llist_add_tail(&station->entry, &pending_stations);
@@ -877,9 +888,15 @@ static void bsc_hack_channel_response(struct gsm_lchan *lchan, int ack)
}
}
-static void bsc_hack_call_released(struct gsm_lchan *lchan)
+static void bsc_hack_call_state_changed(struct gsm_lchan *lchan,
+ enum gsm_call_state new_state)
{
DEBUGP(DPAG, "Call released jumping to the next...\n");
+
+ /* only handle the transition back to the NULL state */
+ if (new_state != GSM_CSTATE_NULL)
+ return;
+
rsl_chan_release(lchan);
/* next!!! */