aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-06-28 16:38:05 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-06-28 17:07:58 +0200
commit5f267a64b985341306385936bc576a9303d05560 (patch)
treeca4a65061f4528907338287d308b28839a73386c /openbsc/src
parenta02b71f65ad7829bba0b63c00e8e031119a628d7 (diff)
bsc-nat: forward paging to all BSC when CELL_IDENT_BSS is received
Previous to this commit, an error message was printed and the paging message was dropped: openbsc/openbsc/src/osmo-bsc_nat/bsc_nat.c:618 Could not parse paging message: -3 Related: OS#3325 Change-Id: I3125ba0e67d2965c0be3089748dd113b1bf615af
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c18
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c30
2 files changed, 34 insertions, 14 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index ba7f5425e..2c6c6443d 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -611,11 +611,21 @@ static void bsc_nat_handle_paging(struct bsc_nat *nat, struct msgb *msg)
{
struct bsc_connection *bsc;
const uint8_t *paging_start;
- int paging_length, i, ret;
+ int paging_length, i, discrim;
- ret = bsc_nat_find_paging(msg, &paging_start, &paging_length);
- if (ret != 0) {
- LOGP(DNAT, LOGL_ERROR, "Could not parse paging message: %d\n", ret);
+ discrim = bsc_nat_find_paging(msg, &paging_start, &paging_length);
+ if (discrim < 0) {
+ LOGP(DNAT, LOGL_ERROR, "Could not parse paging message: %d\n", discrim);
+ return;
+ }
+
+ if (discrim == CELL_IDENT_BSS) {
+ /* All cells on the BSS are identified. */
+ llist_for_each_entry(bsc, &nat->bsc_connections, list_entry) {
+ if (!bsc->authenticated)
+ continue;
+ bsc_nat_send_paging(bsc, msg);
+ }
return;
}
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 85fc7edea..223ef349e 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -324,7 +324,16 @@ void sccp_connection_destroy(struct nat_sccp_connection *conn)
talloc_free(conn);
}
-
+/*! Parse paging message and provide pointer to first Cell identification item
+ * in Cell Identifier List IE.
+ * See e.g. GSM 08.08 Section 3.2.2.27 for Cell Identifier List.
+ * For multiple occurences, use tlv_parse2().
+ * \param[in] msg msgbcontaining the paging cmd message to be decoded
+ * \param[out] out_data pointer to first Cell identification item in Cell Identifier List IE.
+ * \param[out] out_leng length of \ref out_data in bytes (the size of the array of items)
+ * \returns Field "Cell identification discriminator" of the "Cell Identifier
+ * List" IE (>=0) on success. Negative value on error.
+ */
int bsc_nat_find_paging(struct msgb *msg,
const uint8_t **out_data, int *out_leng)
{
@@ -352,17 +361,18 @@ int bsc_nat_find_paging(struct msgb *msg,
data_length = TLVP_LEN(&tp, GSM0808_IE_CELL_IDENTIFIER_LIST);
data = TLVP_VAL(&tp, GSM0808_IE_CELL_IDENTIFIER_LIST);
- /* No need to try a different BSS */
- if (data[0] == CELL_IDENT_BSS) {
- return -3;
- } else if (data[0] != CELL_IDENT_LAC) {
- LOGP(DNAT, LOGL_ERROR, "Unhandled cell ident discrminator: %d\n", data[0]);
+ switch (data[0]) {
+ case CELL_IDENT_LAC:
+ *out_data = &data[1];
+ *out_leng = data_length - 1;
+ /* fall through */
+ case CELL_IDENT_BSS:
+ return data[0];
+ default:
+ LOGP(DNAT, LOGL_ERROR, "Unhandled cell ident discrminator: %s\n",
+ gsm0808_cell_id_discr_name(data[0]));
return -4;
}
-
- *out_data = &data[1];
- *out_leng = data_length - 1;
- return 0;
}
int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length)