Commit e6bf9698 authored by Cedric Roux's avatar Cedric Roux

bugfix: fix do_MIB

- carrier->MIB will be reused, so "spare" has to be allocated
- wrong parameters sent to uper_encode_to_buffer
parent 293bcf13
...@@ -196,7 +196,8 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich ...@@ -196,7 +196,8 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
BCCH_BCH_Message_t *mib=&carrier->mib ; BCCH_BCH_Message_t *mib=&carrier->mib ;
uint8_t sfn = (uint8_t)((frame>>2)&0xff); uint8_t sfn = (uint8_t)((frame>>2)&0xff);
uint16_t spare=0; uint16_t *spare= calloc(1, sizeof(uint16_t));
if (spare == NULL) abort();
switch (N_RB_DL) { switch (N_RB_DL) {
...@@ -240,7 +241,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich ...@@ -240,7 +241,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
mib->message.systemFrameNumber.buf = &sfn; mib->message.systemFrameNumber.buf = &sfn;
mib->message.systemFrameNumber.size = 1; mib->message.systemFrameNumber.size = 1;
mib->message.systemFrameNumber.bits_unused=0; mib->message.systemFrameNumber.bits_unused=0;
mib->message.spare.buf = (uint8_t *)&spare; mib->message.spare.buf = (uint8_t *)spare;
#ifndef Rel14 #ifndef Rel14
mib->message.spare.size = 2; mib->message.spare.size = 2;
mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits
...@@ -252,8 +253,8 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich ...@@ -252,8 +253,8 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
(void*)mib, (void*)mib,
&carrier->MIB, carrier->MIB,
100); 24);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment