aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_filter.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 02:09:40 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-03-07 15:34:48 +0000
commitf93970b167aba2805cc67e1326591f31fbe93ada (patch)
treefefb1abf602475204e443563b634596df9ff5444 /src/osmo-bsc/osmo_bsc_filter.c
parent56dec0c75358fe42954f9e7949ebd0c163377b10 (diff)
implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). The changes to abis_test and gsm0408_test show that this code now handles 3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded PLMN. Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the presence of the third digit of the MNC. Always reply with all leading zeros. Adjust the expected results in ctrl_test_runner.py, to show that it works. In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters and detect errno returned by strtol() (in contrast to atoi()). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore), I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore) Change-Id: I8e722103344186fde118b26d8353db95a4581daa
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_filter.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_filter.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/osmo-bsc/osmo_bsc_filter.c b/src/osmo-bsc/osmo_bsc_filter.c
index c1f3e80a6..5f60989a7 100644
--- a/src/osmo-bsc/osmo_bsc_filter.c
+++ b/src/osmo-bsc/osmo_bsc_filter.c
@@ -36,21 +36,16 @@ static void handle_lu_request(struct gsm_subscriber_connection *conn,
struct gsm48_hdr *gh;
struct gsm48_loc_upd_req *lu;
struct gsm48_loc_area_id lai;
- struct gsm_network *net;
- struct gsm_bts *bts = conn_get_bts(conn);
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 = bts->network;
-
gh = msgb_l3(msg);
lu = (struct gsm48_loc_upd_req *) gh->data;
- gsm48_generate_lai(&lai, net->country_code, net->network_code,
- bts->location_area_code);
+ gsm48_generate_lai2(&lai, bts_lai(conn_get_bts(conn)));
if (memcmp(&lai, &lu->lai, sizeof(lai)) != 0) {
LOGP(DMSC, LOGL_DEBUG, "Marking con for welcome USSD.\n");
@@ -315,9 +310,9 @@ static int bsc_patch_mm_info(struct gsm_subscriber_connection *conn,
static int has_core_identity(struct bsc_msc_data *msc)
{
- if (msc->core_mnc != -1)
+ if (msc->core_plmn.mnc != GSM_MCC_MNC_INVALID)
return 1;
- if (msc->core_mcc != -1)
+ if (msc->core_plmn.mcc != GSM_MCC_MNC_INVALID)
return 1;
if (msc->core_lac != -1)
return 1;
@@ -332,8 +327,6 @@ static int has_core_identity(struct bsc_msc_data *msc)
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct bsc_msc_data *msc;
- struct gsm_bts *bts = conn_get_bts(conn);
- struct gsm_network *net;
struct gsm48_loc_area_id *lai;
struct gsm48_hdr *gh;
uint8_t pdisc;
@@ -353,7 +346,6 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
return 0;
mtype = gsm48_hdr_msg_type(gh);
- net = bts->network;
msc = conn->sccp.msc;
if (mtype == GSM48_MT_MM_LOC_UPD_ACCEPT) {
@@ -361,9 +353,7 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
if (msgb_l3len(msg) >= sizeof(*gh) + sizeof(*lai)) {
/* overwrite LAI in the message */
lai = (struct gsm48_loc_area_id *) &gh->data[0];
- gsm48_generate_lai(lai, net->country_code,
- net->network_code,
- bts->location_area_code);
+ gsm48_generate_lai2(lai, bts_lai(conn_get_bts(conn)));
}
}