Commit 428c2212 authored by Cédric Roux's avatar Cédric Roux
Browse files

fix: better creation of RNTI

The previous version was calling taus(), which
may return any value in [0..65535].

The new version restricts it to [1024..59999]
(arbitrary values, big enough, and in the valid range).

It also checks that the new RNTI is not already present
in the MAC.

I think we should also check that it's not used by a RA

The "loop" thing may not be the best solution either.

To be refined.
parent c1fee624
......@@ -749,13 +749,24 @@ void initiate_ra_proc(module_id_t module_idP, int CC_id,frame_t frameP, uint16_t
for (i=0; i<NB_RA_PROC_MAX; i++) {
if (RA_template[i].RA_active==FALSE &&
RA_template[i].wait_ack_Msg4 == 0) {
int loop = 0;
// Put in random rnti (to be replaced with proper procedure!!)
RA_template[i].rnti = taus();
/* TODO: find better procedure to allocate RNTI */
do {
RA_template[i].rnti = taus();
} while (loop != 100 &&
/* TODO: this is not correct, the rnti may be in use without
* being in the MAC yet. To be refined.
!(find_UE_id(module_idP, RA_template[i].rnti) == -1 &&
/* 1024 and 60000 arbirarily chosen, not coming from standard */
RA_template[i].rnti >= 1024 && RA_template[i].rnti < 60000));
if (loop == 100) { printf("%s:%d:%s: FATAL ERROR! contact the authors\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
RA_template[i].RA_rnti = 1+subframeP+(10*f_id);
RA_template[i].preamble_index = preamble_index;
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation for process %d, rnti %x, RA_active %d\n",
Supports Markdown
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