summaryrefslogtreecommitdiff
path: root/srsue/src/stack/rrc_nr/rrc_nr.cc
diff options
context:
space:
mode:
authorCodebot <codebot@softwareradiosystems.com>2024-01-31 15:19:46 +0000
committersrs-codebot <codebot@softwareradiosystems.com>2024-01-31 15:19:46 +0000
commitec29b0c1ff79cebcbe66caa6d6b90778261c42b8 (patch)
tree4f8d74c1e6658ef1600c6641cccf4c3d87852259 /srsue/src/stack/rrc_nr/rrc_nr.cc
parenteea87b1d893ae58e0b08bc381730c502024ae71f (diff)
parentf8978a6978226c958295adf9235dea255194c7e3 (diff)
Merge branch 'next' into agpl_nextmaster
Diffstat (limited to 'srsue/src/stack/rrc_nr/rrc_nr.cc')
-rw-r--r--srsue/src/stack/rrc_nr/rrc_nr.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc
index 325ee70ad..f1cc38629 100644
--- a/srsue/src/stack/rrc_nr/rrc_nr.cc
+++ b/srsue/src/stack/rrc_nr/rrc_nr.cc
@@ -45,10 +45,16 @@ rrc_nr::rrc_nr(srsran::task_sched_handle task_sched_) :
cell_selector(*this),
meas_cells(task_sched_)
{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ random_gen = srsran_random_init(tv.tv_usec);
set_phy_default_config();
}
-rrc_nr::~rrc_nr() = default;
+rrc_nr::~rrc_nr()
+{
+ srsran_random_free(random_gen);
+}
int rrc_nr::init(phy_interface_rrc_nr* phy_,
mac_interface_rrc_nr* mac_,
@@ -610,8 +616,7 @@ void rrc_nr::send_setup_request(srsran::nr_establishment_cause_t cause)
// TODO: implement ng_minus5_g_s_tmsi_part1
rrc_setup_req->ue_id.set_random_value();
- // TODO use proper RNG
- uint64_t random_id = 0;
+ uint64_t random_id = srsran_random_uniform_int_dist(random_gen, 0, 12345);
for (uint i = 0; i < 5; i++) { // fill random ID bytewise, 40 bits = 5 bytes
random_id |= ((uint64_t)rand() & 0xFF) << i * 8;
}