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
This commit is contained in:
Harald Welte 2017-12-17 20:50:34 +01:00
parent 84ea2e0374
commit 62e40855c2
2 changed files with 3 additions and 2 deletions

View File

@ -240,7 +240,8 @@ struct msgb *gsm0808_create_cipher_reject(uint8_t cause)
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));

View File

@ -233,7 +233,7 @@ static void test_create_cipher_complete()
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");