fix build: gprs_ra_id_by_bts(): ensure to init all values

After recent libosmocore commit "implement support for 3-digit MNC with leading
zeros" c4fce1425e19d604c199c895e227dc2519110456
Id2240f7f518494c9df6c8bda52c0d5092f90f221, struct gprs_ra_id has a new member,
namely mnc_3_digits. In gprs_ra_id_by_bts(), this new member is now not
initialized and may end up having an arbitrary value, which then may amount to
mnc_3_digits == true. Hence the resulting BCD representation of the MCC-MNC may
inadvertently and randomly indicate a leading zero on the MNC.

Use a struct assignment so that all members are guaranteed to be set, and so
that mnc_3_digits will be zero in all cases.

Since above libosmocore commit, nanobts_omlattr_test fails "randomly", fixed by
this patch.

Change-Id: I872ae3b2b0a0cd8f932f3a5fbc77c0dbfcb28bbf
This commit is contained in:
Neels Hofmeyr 2018-03-01 19:48:54 +01:00
parent faf0982ae2
commit 0a5a47addf
1 changed files with 6 additions and 4 deletions

View File

@ -271,10 +271,12 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts)
{
raid->mcc = bts->network->country_code;
raid->mnc = bts->network->network_code;
raid->lac = bts->location_area_code;
raid->rac = bts->gprs.rac;
*raid = (struct gprs_ra_id){
.mcc = bts->network->country_code,
.mnc = bts->network->network_code,
.lac = bts->location_area_code,
.rac = bts->gprs.rac,
};
}
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts)