gprs_bssgp: abuse gsm48_encode_ra() to encode TAC

Both LAC and TAC take 2 octets and follow MCC/MNC fields on the wire.
We abuse gsm48_encode_ra() for encoding of MCC/MNC, but it can also
be abused to encode TAC in bssgp_create_rim_ri().  There is no need
to encode '0000'O and then override it with osmo_store16be().

Change-Id: I986552aa52cf38b1c5290d2e5cd3ff2d1c36a4e5
This commit is contained in:
Vadim Yanitskiy 2021-01-05 14:55:38 +01:00 committed by laforge
parent 5d797c4264
commit e2ad6ebb7a
1 changed files with 2 additions and 1 deletions

View File

@ -402,10 +402,11 @@ int bssgp_create_rim_ri(uint8_t *buf, const struct bssgp_rim_routing_info *ri)
.mcc = ri->eutran.tai.mcc,
.mnc = ri->eutran.tai.mnc,
.mnc_3_digits = ri->eutran.tai.mnc_3_digits,
/* TAC is encoded in the same way as LAC */
.lac = ri->eutran.tai.tac,
};
gsm48_encode_ra((struct gsm48_ra_id *)buf, &raid_temp);
osmo_store16be(ri->eutran.tai.tac, buf + 3);
OSMO_ASSERT(ri->eutran.global_enb_id_len <=
sizeof(ri->eutran.global_enb_id));
memcpy(buf + 5, ri->eutran.global_enb_id,