diff options
Diffstat (limited to 'openbsc/src/libbsc/abis_nm.c')
-rw-r--r-- | openbsc/src/libbsc/abis_nm.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index f24f6bf91..8eadfa8d7 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -2785,10 +2785,12 @@ int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class, void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts) { - /* we simply reuse the GSM48 function and overwrite the RAC - * with the Cell ID */ - gsm48_ra_id_by_bts(buf, bts); - *((uint16_t *)(buf + 5)) = htons(bts->cell_identity); + struct gsm48_ra_id *_buf = (struct gsm48_ra_id*)buf; + uint16_t ci = htons(bts->cell_identity); + /* we simply reuse the GSM48 function and write the Cell ID over the position where the RAC + * starts */ + gsm48_ra_id_by_bts(_buf, bts); + memcpy(&_buf->rac, &ci, sizeof(ci)); } void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason) @@ -2822,23 +2824,11 @@ const char *ipacc_testres_name(uint8_t res) return get_value_string(ipacc_testres_names, res); } -void ipac_parse_cgi(struct cell_global_id *cid, const uint8_t *buf) +void ipac_parse_cgi(struct osmo_cell_global_id *cid, const uint8_t *buf) { - cid->mcc = (buf[0] & 0xf) * 100; - cid->mcc += (buf[0] >> 4) * 10; - cid->mcc += (buf[1] & 0xf) * 1; - - if (buf[1] >> 4 == 0xf) { - cid->mnc = (buf[2] & 0xf) * 10; - cid->mnc += (buf[2] >> 4) * 1; - } else { - cid->mnc = (buf[2] & 0xf) * 100; - cid->mnc += (buf[2] >> 4) * 10; - cid->mnc += (buf[1] >> 4) * 1; - } - - cid->lac = ntohs(*((uint16_t *)&buf[3])); - cid->ci = ntohs(*((uint16_t *)&buf[5])); + osmo_plmn_from_bcd(buf, &cid->lai.plmn); + cid->lai.lac = ntohs(*((uint16_t *)&buf[3])); + cid->cell_identity = ntohs(*((uint16_t *)&buf[5])); } /* parse BCCH information IEI from wire format to struct ipac_bcch_info */ |