diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-07 03:38:28 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-07 04:08:44 +0100 |
commit | 9eb208fcfb75eedd2b1a45a2aa67893ce4726404 (patch) | |
tree | cc4f18405c3c191630c7d018e93a849c618f7d02 /src/osmo-bsc/osmo_bsc_bssap.c | |
parent | 36bf7974ab85f81623fa15f6bf1250997341af7f (diff) |
bssap: paging: page entire BSS for unimplemented cell id list
3GPP TS § 08.08 defines various types of Cell Identifier List IEs, but we only
implement "entire BSS" and "one LAC". If the MSC sends a Cell Identifier List
that we don't implement, it is best for interoperability to page the entire BSS
and post a log message instead of rejecting the paging altogether. Apart from
resource management, it is not harmful to page more than the MSC requested; if
use of resources becomes an issue, the log message will guide towards the
solution of providing an actually implemented Cell Identifier List IE.
Upon IE length that is other than we expect, log the error, but also fall back
to paging the entire BSS. Overall message length correctness has been checked
earlier.
The particular case observed is that a Huwaei MSC sends a LAI for Cell
Identifier List (MCC+MNC in bcd, followed by a LAC), parsing of which we may
want to add later.
Improve logging: identify the subscriber that is being paged.
Coding style: use a switch() statement to clarify flow and provide a place to
add more implementations later.
Add regression test bssap_test.c: fabricates BSSAP Paging messages with the two
implemented Cell Identifier List IEs as well as the unimplemented LAI
identifier, verify the resulting paging LAC in wrapped function and stderr.
Change-Id: Ie934c5d229140a89763bf2efff86d6a3766cd351
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_bssap.c')
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 431125024..93e9274a0 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -233,10 +233,11 @@ static int bssmap_handle_paging(struct bsc_msc_data *msc, struct tlv_parsed tp; char mi_string[GSM48_MI_SIZE]; uint32_t tmsi = GSM_RESERVED_TMSI; - unsigned int lac = GSM_LAC_RESERVED_ALL_BTS; + unsigned int lac; uint8_t data_length; const uint8_t *data; uint8_t chan_needed = RSL_CHANNEED_ANY; + uint8_t cell_ident; tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l4h + 1, payload_length - 1, 0, 0); @@ -265,21 +266,50 @@ static int bssmap_handle_paging(struct bsc_msc_data *msc, TLVP_VAL(&tp, GSM0808_IE_IMSI), TLVP_LEN(&tp, GSM0808_IE_IMSI)); /* - * parse the cell identifier list + * There are various cell identifier list types defined at 3GPP TS § 08.08, we don't support all + * of them yet. To not disrupt paging operation just because we're lacking some implementation, + * interpret any unknown cell identifier type as "page the entire BSS". */ data_length = TLVP_LEN(&tp, GSM0808_IE_CELL_IDENTIFIER_LIST); data = TLVP_VAL(&tp, GSM0808_IE_CELL_IDENTIFIER_LIST); - /* - * Support paging to all network or one BTS at one LAC - */ - if (data_length == 3 && data[0] == CELL_IDENT_LAC) { - lac = osmo_load16be(&data[1]); - } else if (data_length > 1 || (data[0] & 0x0f) != CELL_IDENT_BSS) { - LOGP(DMSC, LOGL_ERROR, "Unsupported Cell Identifier List: %s\n", osmo_hexdump(data, data_length)); + if (data_length < 1) { + LOGP(DMSC, LOGL_ERROR, "Paging IMSI %s: Zero length Cell Identifier List\n", + mi_string); return -1; } + cell_ident = data[0] & 0xf; + + /* Default fallback: page entire BSS */ + lac = GSM_LAC_RESERVED_ALL_BTS; + + switch (cell_ident) { + case CELL_IDENT_LAC: + if (data_length != 3) { + LOGP(DMSC, LOGL_ERROR, "Paging IMSI %s: Cell Identifier List for LAC (0x%x)" + " has invalid length: %u, paging entire BSS instead (%s)\n", + mi_string, CELL_IDENT_LAC, data_length, osmo_hexdump(data, data_length)); + break; + } + lac = osmo_load16be(&data[1]); + break; + + case CELL_IDENT_BSS: + if (data_length != 1) { + LOGP(DMSC, LOGL_ERROR, "Paging IMSI %s: Cell Identifier List for BSS (0x%x)" + " has invalid length: %u, paging entire BSS anyway (%s)\n", + mi_string, CELL_IDENT_BSS, data_length, osmo_hexdump(data, data_length)); + } + break; + + default: + LOGP(DMSC, LOGL_NOTICE, "Paging IMSI %s: unimplemented Cell Identifier List (0x%x)," + " paging entire BSS instead (%s)\n", + mi_string, cell_ident, osmo_hexdump(data, data_length)); + break; + } + if (TLVP_PRESENT(&tp, GSM0808_IE_CHANNEL_NEEDED) && TLVP_LEN(&tp, GSM0808_IE_CHANNEL_NEEDED) == 1) chan_needed = TLVP_VAL(&tp, GSM0808_IE_CHANNEL_NEEDED)[0] & 0x03; |