aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-05 11:31:08 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:48 +0100
commitd65305f5b45780dbcc1bb7dda9161a1995d98125 (patch)
treebd100f92116f1c8156befb8004a9ba827ca1d8a8 /openbsc
parent5bb874d2f5c7bc87121d74437cc6d1fe0e6cda1c (diff)
bsc: Look for location updating requests in messages
Introduce the SCCP connection data and remember that we were seeing a location updating request from a different LAC.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/osmo_bsc.h4
-rw-r--r--openbsc/src/bsc/osmo_bsc_filter.c37
2 files changed, 41 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h
index 43182ad3e..30e643919 100644
--- a/openbsc/include/openbsc/osmo_bsc.h
+++ b/openbsc/include/openbsc/osmo_bsc.h
@@ -5,6 +5,10 @@
#include "bsc_api.h"
+struct osmo_bsc_sccp_con {
+ uint8_t new_subscriber;
+};
+
struct bsc_api *osmo_bsc_api();
int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg);
diff --git a/openbsc/src/bsc/osmo_bsc_filter.c b/openbsc/src/bsc/osmo_bsc_filter.c
index 1aeaa951e..7052cfea1 100644
--- a/openbsc/src/bsc/osmo_bsc_filter.c
+++ b/openbsc/src/bsc/osmo_bsc_filter.c
@@ -19,6 +19,34 @@
*/
#include <openbsc/osmo_bsc.h>
+#include <openbsc/debug.h>
+
+static void handle_lu_request(struct gsm_subscriber_connection *conn,
+ struct msgb *msg)
+{
+ struct gsm48_hdr *gh;
+ struct gsm48_loc_upd_req *lu;
+ struct gsm48_loc_area_id lai;
+ struct gsm_network *net;
+
+ if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*lu)) {
+ LOGP(DMSC, LOGL_ERROR, "LU too small to look at: %u\n", msgb_l3len(msg));
+ return;
+ }
+
+ net = conn->bts->network;
+
+ gh = msgb_l3(msg);
+ lu = (struct gsm48_loc_upd_req *) gh->data;
+
+ gsm48_generate_lai(&lai, net->country_code, net->network_code,
+ conn->bts->location_area_code);
+
+ if (memcmp(&lai, &lu->lai, sizeof(lai)) != 0) {
+ LOGP(DMSC, LOGL_DEBUG, "Marking con for welcome USSD.\n");
+ conn->sccp_con->new_subscriber = 1;
+ }
+}
/**
* This is used to scan a message for extra functionality of the BSC. This
@@ -27,5 +55,14 @@
*/
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
+ struct gsm48_hdr *gh = msgb_l3(msg);
+ uint8_t pdisc = gh->proto_discr & 0x0f;
+ uint8_t mtype = gh->msg_type & 0xbf;
+
+ if (pdisc == GSM48_PDISC_MM) {
+ if (mtype == GSM48_MT_MM_LOC_UPD_REQUEST)
+ handle_lu_request(conn, msg);
+ }
+
return 0;
}