Commit 8e368396 authored by aligungr's avatar aligungr

Global gNodeB ID bug fix

parent b0aef086
......@@ -122,7 +122,8 @@ void NgapTask::sendNgSetupRequest(int amfId)
auto *globalGnbId = asn::New<ASN_NGAP_GlobalGNB_ID>();
globalGnbId->gNB_ID.present = ASN_NGAP_GNB_ID_PR_gNB_ID;
asn::SetBitString(globalGnbId->gNB_ID.choice.gNB_ID, octet4{m_base->config->getGnbId()});
asn::SetBitString(globalGnbId->gNB_ID.choice.gNB_ID, octet4{m_base->config->getGnbId()},
static_cast<size_t>(m_base->config->gnbIdLength));
asn::SetOctetString3(globalGnbId->pLMNIdentity, ngap_utils::PlmnToOctet3(m_base->config->plmn));
auto *ieGlobalGnbId = asn::New<ASN_NGAP_NGSetupRequestIEs>();
......
......@@ -60,7 +60,7 @@ void SetOctetString(OCTET_STRING_t &target, const OctetString &value)
throw std::runtime_error("OCTET_STRING_fromBuf failed");
}
void SetBitString(BIT_STRING_t &target, octet4 value)
void SetBitString(BIT_STRING_t &target, octet4 value, size_t bitCount)
{
if (target.buf)
free(target.buf);
......@@ -70,8 +70,8 @@ void SetBitString(BIT_STRING_t &target, octet4 value)
target.buf[1] = value[1];
target.buf[2] = value[2];
target.buf[3] = value[3];
target.size = 4;
target.bits_unused = 0;
target.size = static_cast<size_t>(bits::NearDiv(static_cast<int>(bitCount), 8) / 8);
target.bits_unused = static_cast<int>(target.size * 8 - bitCount);
}
void SetBitString(BIT_STRING_t &target, const OctetString &value)
......
......@@ -78,7 +78,7 @@ void SetOctetString(OCTET_STRING_t &target, const OctetString &value);
OctetString GetOctetString(const OCTET_STRING_t &source);
OctetString GetOctetString(const BIT_STRING_t &source);
void SetBitString(BIT_STRING_t &target, octet4 value);
void SetBitString(BIT_STRING_t &target, octet4 value, size_t bitCount = 32);
void SetBitString(BIT_STRING_t &target, const OctetString &value);
template <size_t BitCount>
......
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