Review at  https://gerrit.osmocom.org/7883

RSL/LAPDm: Not all RLL message are "transparent"

3GPP TS 48.058 has a very clear definition of which messages are
"transparent" and hence have the T-bit == 1.  This is *not* just
all RLL messages, but basically only RLL_DATA.{ind,req} and
RLL_UNITDATA.{ind,req}.  All other messages are non-transparent.

Change-Id: I9f83654af189d818563d799bf623325b7fee8e70
Closes: OS#3188
---
M src/gsm/lapdm.c
M tests/lapd/lapd_test.c
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/7883/1

diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c
index 80c0d17..6a16012 100644
--- a/src/gsm/lapdm.c
+++ b/src/gsm/lapdm.c
@@ -349,12 +349,29 @@
        return le->l1_prim_cb(&pp.oph, le->l1_ctx);
 }
 
+/* Is a given msg_type "transparent" as per TS 48.058 Section 8.1 */
+static int rsl_is_transparent(uint8_t msg_type)
+{
+       switch (msg_type) {
+       case RSL_MT_DATA_IND:
+       case RSL_MT_UNIT_DATA_IND:
+               return 1;
+       case RSL_MT_DATA_REQ:
+       case RSL_MT_UNIT_DATA_REQ:
+               return 1;
+       default:
+               return 0;
+       }
+}
+
 /* Create RSLms various RSLms messages */
 static int send_rslms_rll_l3(uint8_t msg_type, struct lapdm_msg_ctx *mctx,
                             struct msgb *msg)
 {
+       int transparent = rsl_is_transparent(msg_type);
+
        /* Add the RSL + RLL header */
-       rsl_rll_push_l3(msg, msg_type, mctx->chan_nr, mctx->link_id, 1);
+       rsl_rll_push_l3(msg, msg_type, mctx->chan_nr, mctx->link_id, 
transparent);
 
        /* send off the RSLms message to L3 */
        return rslms_sendmsg(msg, mctx->dl->entity);
@@ -385,8 +402,9 @@
 static int send_rll_simple(uint8_t msg_type, struct lapdm_msg_ctx *mctx)
 {
        struct msgb *msg;
+       int transparent = rsl_is_transparent(msg_type);
 
-       msg = rsl_rll_simple(msg_type, mctx->chan_nr, mctx->link_id, 1);
+       msg = rsl_rll_simple(msg_type, mctx->chan_nr, mctx->link_id, 
transparent);
 
        /* send off the RSLms message to L3 */
        return rslms_sendmsg(msg, mctx->dl->entity);
@@ -397,7 +415,7 @@
        struct msgb *msg;
 
        LOGP(DLLAPD, LOGL_NOTICE, "sending MDL-ERROR-IND %d\n", cause);
-       msg = rsl_rll_simple(RSL_MT_ERROR_IND, mctx->chan_nr, mctx->link_id, 1);
+       msg = rsl_rll_simple(RSL_MT_ERROR_IND, mctx->chan_nr, mctx->link_id, 0);
        msgb_tlv_put(msg, RSL_IE_RLM_CAUSE, 1, &cause);
        return rslms_sendmsg(msg, mctx->dl->entity);
 }
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 3f15afe..8a4e931 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -356,7 +356,6 @@
                /* verify the header */
                memset(&hdr, 0, sizeof(hdr));
                rsl_init_rll_hdr(&hdr, RSL_MT_EST_CONF);
-               hdr.c.msg_discr |= ABIS_RSL_MDISC_TRANSP;
                OSMO_ASSERT(memcmp(msg->data, &hdr, sizeof(hdr)) == 0);
        } else if (state->ms_read == 1) {
                printf("MS: Verifying incoming MM message: %d\n", 
msgb_l3len(msg));

-- 
To view, visit https://gerrit.osmocom.org/7883
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f83654af189d818563d799bf623325b7fee8e70
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to