This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged.
Change subject: fix gsm0808_enc_cell_id_list2 for leading-zero MNC
......................................................................
fix gsm0808_enc_cell_id_list2 for leading-zero MNC
Use non-deprecated API to decode encode in gsm0808_enc_cell_id_list2().
Adjust gsm0808_test.c to now expect the correct results instead of previous
failure.
Change-Id: I1ce78883995e0d484368046b69db5afb2b4adc97
---
M src/gsm/gsm0808_utils.c
M tests/gsm0808/gsm0808_test.c
2 files changed, 3 insertions(+), 6 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 776f091..e4872b8 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -595,7 +595,7 @@
for (i = 0; i < cil->id_list_len; i++) {
const struct osmo_cell_global_id *id = &cil->id_list[i].global;
struct gsm48_loc_area_id lai;
- gsm48_generate_lai(&lai, id->lai.plmn.mcc, id->lai.plmn.mnc, id->lai.lac);
+ gsm48_generate_lai2(&lai, &id->lai);
memcpy(msgb_put(msg, sizeof(lai)), &lai, sizeof(lai));
msgb_put_u16(msg, id->cell_identity);
}
@@ -615,7 +615,7 @@
for (i = 0; i < cil->id_list_len; i++) {
const struct osmo_location_area_id *id = &cil->id_list[i].lai_and_lac;
struct gsm48_loc_area_id lai;
- gsm48_generate_lai(&lai, id->plmn.mcc, id->plmn.mnc, id->lac);
+ gsm48_generate_lai2(&lai, id);
memcpy(msgb_put(msg, sizeof(lai)), &lai, sizeof(lai));
}
break;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index f6a7bc4..4bf61e7 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -1003,8 +1003,7 @@
uint8_t cil_enc_expected[] = { GSM0808_IE_CELL_IDENTIFIER_LIST, 0x16, 0x00,
0x21, 0x63, 0x54, 0x23, 0x42, 0x00, 0x1,
0x21, 0xf4, 0x75, 0x24, 0x43, 0x00, 0x2,
- 0x21, 0xf5, 0x70, 0x25, 0x44, 0x00, 0x77
- /* ERROR! This ^^^^^^^^ should be 0x75, 0x00, i.e. a 3-digit MNC with leading zeros! */
+ 0x21, 0x75, 0x00, 0x25, 0x44, 0x00, 0x77
};
uint8_t rc_enc;
int rc_dec, i;
@@ -1057,9 +1056,7 @@
struct osmo_cell_global_id *dec_id;
enc_id = &enc_cil.id_list[i].global;
dec_id = &dec_cil.id_list[i].global;
- /* ERROR: the decoded PLMN will mismatch, because the leading zero was not preserved:
OSMO_ASSERT(osmo_plmn_cmp(&enc_id->lai.plmn, &dec_id->lai.plmn) == 0);
- */
OSMO_ASSERT(enc_id->lai.lac == dec_id->lai.lac);
OSMO_ASSERT(enc_id->cell_identity == dec_id->cell_identity);
}
--
To view, visit https://gerrit.osmocom.org/7475
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1ce78883995e0d484368046b69db5afb2b4adc97
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>