Merge pull request #138 from mrlnc/ue_random_id

Fix bug in random UE ID generation
This commit is contained in:
Andre Puschmann 2018-01-24 12:56:12 +01:00 committed by GitHub
commit 636c8b711b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -837,7 +837,12 @@ void rrc::send_con_request() {
ul_ccch_msg.msg.rrc_con_req.ue_id.s_tmsi = s_tmsi;
} else {
ul_ccch_msg.msg.rrc_con_req.ue_id_type = LIBLTE_RRC_CON_REQ_UE_ID_TYPE_RANDOM_VALUE;
ul_ccch_msg.msg.rrc_con_req.ue_id.random = rand() % 2^40;
// TODO use proper RNG
uint64_t random_id = 0;
for (uint i = 0; i < 5; i++) { // fill random ID bytewise, 40 bits = 5 bytes
random_id |= ( (uint64_t)rand() & 0xFF ) << i*8;
}
ul_ccch_msg.msg.rrc_con_req.ue_id.random = random_id;
}
ul_ccch_msg.msg.rrc_con_req.cause = LIBLTE_RRC_CON_REQ_EST_CAUSE_MO_SIGNALLING;