aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/gsm_data.h2
-rw-r--r--src/libbsc/abis_nm.c10
-rw-r--r--src/libbsc/gsm_data.c5
-rw-r--r--tests/gsm0408/gsm0408_test.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 3c65c9c3f..8692469b4 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1353,7 +1353,7 @@ enum bts_gprs_mode bts_gprs_mode_parse(const char *arg, int *valid);
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 671c87419..435d00453 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2850,10 +2850,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)
diff --git a/src/libbsc/gsm_data.c b/src/libbsc/gsm_data.c
index 15945228a..d4a6a70f9 100644
--- a/src/libbsc/gsm_data.c
+++ b/src/libbsc/gsm_data.c
@@ -279,13 +279,12 @@ void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts)
};
}
-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)
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index d1d50f135..aeec56f4c 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -801,7 +801,7 @@ static void test_gsm48_ra_id_by_bts()
bts.location_area_code = t->lac;
bts.gprs.rac = t->rac;
- gsm48_ra_id_by_bts((uint8_t*)&result, &bts);
+ gsm48_ra_id_by_bts(&result, &bts);
ok = (t->expect.digits[0] == result.digits[0])
&& (t->expect.digits[1] == result.digits[1])