[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_prim.c: fix: correct the first padding byte

2018-03-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: trxcon/sched_prim.c: fix: correct the first padding byte
..


trxcon/sched_prim.c: fix: correct the first padding byte

According to TS 144.006, section 5.2, the first octet containing
fill bits shall be set to the binary value "00101011" == 0x2b.

Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
---
M src/host/trxcon/sched_prim.c
1 file changed, 10 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index c17fb2a..e1c87bb 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -251,7 +251,7 @@
 * and with an information field of 0 octet length.
 */
static const uint8_t lapdm_fill_frame[] = {
-   0x01, 0x03, 0x01,
+   0x01, 0x03, 0x01, 0x2b,
/* Pending part is to be randomized */
};
 
@@ -275,15 +275,16 @@
/* FIXME: should we do anything for CSD? */
return 0;
} else {
-   /**
-* TS 144.006, section 8.1.2.3 "Fill frames"
-* A fill frame is a UI command frame for SAPI 0, P=0
-* and with an information field of 0 octet length.
-*/
-   memcpy(prim_buffer, lapdm_fill_frame, 3);
+   /* Copy a fill frame payload */
+   memcpy(prim_buffer, lapdm_fill_frame, sizeof(lapdm_fill_frame));
 
-   /* Randomize pending unused bytes */
-   for (i = 3; i < GSM_MACBLOCK_LEN; i++)
+   /**
+* TS 144.006, section 5.2 "Frame delimitation and fill bits"
+* Except for the first octet containing fill bits which shall
+* be set to the binary value "00101011", each fill bit should
+* be set to a random value when sent by the network.
+*/
+   for (i = sizeof(lapdm_fill_frame); i < GSM_MACBLOCK_LEN; i++)
prim_buffer[i] = (uint8_t) rand();
 
/* Define a prim length */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmocom-bb[fixeria/trx]: trxcon/sched_prim.c: fix: correct the first padding byte

2018-03-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmocom-bb[fixeria/trx]: trxcon/sched_prim.c: fix: correct the first padding byte

2018-03-22 Thread Vadim Yanitskiy

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

trxcon/sched_prim.c: fix: correct the first padding byte

According to TS 144.006, section 5.2, the first octet containing
fill bits shall be set to the binary value "00101011" == 0x2b.

Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
---
M src/host/trxcon/sched_prim.c
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/67/7467/1

diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index c17fb2a..e1c87bb 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -251,7 +251,7 @@
 * and with an information field of 0 octet length.
 */
static const uint8_t lapdm_fill_frame[] = {
-   0x01, 0x03, 0x01,
+   0x01, 0x03, 0x01, 0x2b,
/* Pending part is to be randomized */
};
 
@@ -275,15 +275,16 @@
/* FIXME: should we do anything for CSD? */
return 0;
} else {
-   /**
-* TS 144.006, section 8.1.2.3 "Fill frames"
-* A fill frame is a UI command frame for SAPI 0, P=0
-* and with an information field of 0 octet length.
-*/
-   memcpy(prim_buffer, lapdm_fill_frame, 3);
+   /* Copy a fill frame payload */
+   memcpy(prim_buffer, lapdm_fill_frame, sizeof(lapdm_fill_frame));
 
-   /* Randomize pending unused bytes */
-   for (i = 3; i < GSM_MACBLOCK_LEN; i++)
+   /**
+* TS 144.006, section 5.2 "Frame delimitation and fill bits"
+* Except for the first octet containing fill bits which shall
+* be set to the binary value "00101011", each fill bit should
+* be set to a random value when sent by the network.
+*/
+   for (i = sizeof(lapdm_fill_frame); i < GSM_MACBLOCK_LEN; i++)
prim_buffer[i] = (uint8_t) rand();
 
/* Define a prim length */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy