Hello Vadim Yanitskiy, Jenkins Builder, I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/6667 to look at the new patch set (#2). abis_nm / ipa_nanobts_omlattr: use gsm48_ra_id instead of buf Move from using deprecated gsm48_construct_ra(), which uses a buf, to gsm48_encode_ra(), which uses a gsm48_ra_id argument. Pass struct gsm48_ra_id around instead of a buf. struct gsm48_ra_id is the "encoded" representation of the bytes in a typical MCC-MNC-LAC-RAC (04.08 Routing Area Id IE, 3GPP TS 24.008 ยง 10.5.5.15). Using the struct spares using magic numbers for byte offsets. Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06 --- M include/osmocom/bsc/abis_nm.h M include/osmocom/bsc/gsm_data.h M src/libbsc/abis_nm.c M src/libbsc/bts_ipaccess_nanobts_omlattr.c M src/libbsc/gsm_data.c 5 files changed, 9 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/67/6667/2 diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index 18f87cd..d6b7084 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -157,7 +157,7 @@ uint8_t *attr, uint8_t attr_len); int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, uint32_t ip, uint16_t port, uint8_t stream); -void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts); +void abis_nm_ipaccess_cgi(struct gsm48_ra_id *buf, struct gsm_bts *bts); int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf); const char *ipacc_testres_name(uint8_t res); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 07e5478..a8d7a0b 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1348,7 +1348,7 @@ const char *bts_gprs_mode_name(enum bts_gprs_mode mode); int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode); -int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts); +void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts); void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c index 671c874..393fb7a 100644 --- a/src/libbsc/abis_nm.c +++ b/src/libbsc/abis_nm.c @@ -2848,12 +2848,12 @@ attr, attr_len); } -void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts) +void abis_nm_ipaccess_cgi(struct gsm48_ra_id *buf, struct gsm_bts *bts) { - /* we simply reuse the GSM48 function and overwrite the RAC - * with the Cell ID */ + /* 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); - *((uint16_t *)(buf + 5)) = htons(bts->cell_identity); + *((uint16_t*)&buf->rac) = htons(bts->cell_identity); } void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason) diff --git a/src/libbsc/bts_ipaccess_nanobts_omlattr.c b/src/libbsc/bts_ipaccess_nanobts_omlattr.c index 926322c..4347132 100644 --- a/src/libbsc/bts_ipaccess_nanobts_omlattr.c +++ b/src/libbsc/bts_ipaccess_nanobts_omlattr.c @@ -101,7 +101,7 @@ msgb_tv_put(msgb, NM_ATT_BSIC, bts->bsic); - abis_nm_ipaccess_cgi(buf, bts); + abis_nm_ipaccess_cgi((struct gsm48_ra_id*)buf, bts); msgb_tl16v_put(msgb, NM_ATT_IPACC_CGI, 7, buf); return msgb; diff --git a/src/libbsc/gsm_data.c b/src/libbsc/gsm_data.c index a504252..e18c528 100644 --- a/src/libbsc/gsm_data.c +++ b/src/libbsc/gsm_data.c @@ -277,13 +277,12 @@ raid->rac = bts->gprs.rac; } -int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts) +void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts) { struct gprs_ra_id raid; gprs_ra_id_by_bts(&raid, bts); - - return gsm48_construct_ra(buf, &raid); + gsm48_encode_ra(buf, &raid); } int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char **argv) -- To view, visit https://gerrit.osmocom.org/6667 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>