[PATCH] Fix issue in encoding CSN_RECURSIVE_ARRAY

Saurabh Sharan saurabh.sharan at radisys.com
Wed Mar 16 13:47:32 UTC 2016


The remaining_bits_len is correctly decremented while encoding
CSN_RECURSIVE_ARRAY for fixing the bug.
Details of the bug is in https://projects.osmocom.org/issues/1641

During introduction of basic EGPRS feature new hex dump message
PUASS, from a different working network log was used in Unit test.
It exposed the issue of incorrect handling of recursive array
encoding in osmo-pcu.
---
 src/csn1.cpp                |    1 +
 tests/rlcmac/RLCMACTest.cpp |    1 +
 tests/rlcmac/RLCMACTest.ok  |    8 ++++++++
 3 files changed, 10 insertions(+)

diff --git a/src/csn1.cpp b/src/csn1.cpp
index 82bf17f..d51fe83 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -2504,6 +2504,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector
         bitvec_write_field(vector, writeIndex, !Tag, 1);
         LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(!Tag));
         bit_offset++;
+        remaining_bits_len--;
 
         pDescr++;
         break;
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index 26d35ec..466b89e 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -93,6 +93,7 @@ void testRlcMacDownlink()
 	"47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack
 	"47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
 	"400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment (EGPRS)
+	"40284f0000001009810c826f4406809dcecb2b2b2b2b2b", // Packet Uplink Assignment (EGPRS)
 	"4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b"  // Packet Uplink Ack Nack (EGPRS)
 	"4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b"
 	"412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b"
diff --git a/tests/rlcmac/RLCMACTest.ok b/tests/rlcmac/RLCMACTest.ok
index 4deced7..896982d 100644
--- a/tests/rlcmac/RLCMACTest.ok
+++ b/tests/rlcmac/RLCMACTest.ok
@@ -39,6 +39,14 @@ vector1 = 4082001a394df680efb330b2b2b2b2b2b2b2b2b2b
 vector1 = 4082001a394df680efb330b2b2b2b2b2b2b2b2b2b
 vector2 = 4082001a394df680efb330b2b2b2b2b2b2b2b2b2b
 vector1 == vector2 : TRUE
+vector1 = 40284f00010981c826f446809dcecb2b2b2b2b2b
+=========Start DECODE===========
++++++++++Finish DECODE++++++++++
+=========Start ENCODE=============
++++++++++Finish ENCODE+++++++++++
+vector1 = 40284f00010981c826f446809dcecb2b2b2b2b2b
+vector2 = 40284f00010981c826f446809dcecb2b2b2b2b2b
+vector1 == vector2 : TRUE
 vector1 = 40243f2f000087b042b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
 +++++++++Finish DECODE++++++++++
-- 
1.7.9.5



More information about the osmocom-net-gprs mailing list