[MERGED] libosmocore[master]: gsm0808_create_cipher_reject: Fix encoding of Cause IE

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Dec 17 19:58:52 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: gsm0808_create_cipher_reject: Fix encoding of Cause IE
......................................................................


gsm0808_create_cipher_reject: Fix encoding of Cause IE

The Cause IE in the 08.08 CIPHER MODE REJECT is a normal TLV IE,
and not just a value.  Let's make sure we encode the cause value
properly.

Change-Id: I4f5b231edf6dcb0a9c2bbafb2a59f301f3b2402b
Closes: OS#2766
---
M src/gsm/gsm0808.c
M tests/gsm0808/gsm0808_test.c
2 files changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 2396a10..abf3d25 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -240,7 +240,8 @@
 	if (!msg)
 		return NULL;
 
-	msgb_tv_put(msg, BSS_MAP_MSG_CIPHER_MODE_REJECT, cause);
+	msgb_v_put(msg, BSS_MAP_MSG_CIPHER_MODE_REJECT);
+	msgb_tlv_put(msg, GSM0808_IE_CAUSE, 1, &cause);
 
 	msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
 
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 28bd7f7..189d548 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -233,7 +233,7 @@
 
 static void test_create_cipher_reject()
 {
-	static const uint8_t res[] = { 0x00, 0x02, 0x59, 0x23 };
+	static const uint8_t res[] = { 0x00, 0x04, 0x59, 0x04, 0x01, 0x23 };
 	struct msgb *msg;
 
 	printf("Testing creating Cipher Reject\n");

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f5b231edf6dcb0a9c2bbafb2a59f301f3b2402b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list