Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/9776


Change subject: bsc-nat: forward paging to all BSC when CELL_IDENT_BSS is 
received
......................................................................

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
---
M openbsc/src/osmo-bsc_nat/bsc_nat.c
M openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
2 files changed, 34 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/76/9776/1

diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c 
b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index ba7f542..2c6c644 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -611,11 +611,21 @@
 {
        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 85fc7ed..223ef34 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 @@
        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 @@
        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)

--
To view, visit https://gerrit.osmocom.org/9776
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3125ba0e67d2965c0be3089748dd113b1bf615af
Gerrit-Change-Number: 9776
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <[email protected]>

Reply via email to