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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18565 ) Change subject: abis_nm: fix ARFCN list encoding in Set Channel Attributes ...................................................................... abis_nm: fix ARFCN list encoding in Set Channel Attributes 3GPP TS 12.21 defines coding of 'ARFCN List' attribute as follows: +---------------------------+--------------------+ | Attribute Identifier | 1st octet | +---------------------------+--------------------+ | Length | 2-3 octets | +---------------------------+--------------------+ | ARFCN1 | 4-5 octets | +---------------------------+--------------------+ | ... | ... | +---------------------------+--------------------+ | ARFCNn | (n * 2 - 3) octets | +---------------------------+--------------------+ so this is basically TL16V, where L16 is the length of V. In the Siemens dialect of OML coding rules are different though: +---------------------------+--------------------+ | Attribute Identifier | 1st octet | +---------------------------+--------------------+ | ARFCN count | 2nd octet | +---------------------------+--------------------+ | ARFCN1 | 4-5 octets | +---------------------------+--------------------+ | ... | ... | +---------------------------+--------------------+ | ARFCNn | (n * 2 - 2) octets | +---------------------------+--------------------+ so this is TCV, where C is the amount of ARFCNs in V. This change fixes encoding of 'ARFCN List' for other dialects, in particular encoding of the 'Length' field (1 vs 2 octets). I verified the results in Wireshark (generic 3GPP TS 12.21 and ip.access dialect), everything looks good. Change-Id: Iec1826f55459ac8e9355328a1a6bb0949874db60 Related: OS#4545 --- M src/osmo-bsc/abis_nm.c 1 file changed, 28 insertions(+), 11 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index db2879f..d503f2a 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -2019,26 +2019,43 @@ msgb_tv_put(msg, NM_ATT_CHAN_COMB, chan_comb); if (ts->hopping.enabled) { - unsigned int i; - uint8_t *len; + unsigned int i, n; + uint16_t *u16 = NULL; + uint8_t *u8 = NULL; msgb_tv_put(msg, NM_ATT_HSN, ts->hopping.hsn); msgb_tv_put(msg, NM_ATT_MAIO, ts->hopping.maio); - /* build the ARFCN list */ msgb_put_u8(msg, NM_ATT_ARFCN_LIST); - len = msgb_put(msg, 1); - *len = 0; - for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { + + /* 3GPP TS 12.21 defines this IE as TL16V */ + if (bts->type != GSM_BTS_TYPE_BS11) + u16 = (uint16_t *) msgb_put(msg, 2); + else /* ... but BS-11 wants TLV instead */ + u8 = (uint8_t *) msgb_put(msg, 1); + + /* build the ARFCN list from pre-computed bitmap */ + for (i = 0, n = 0; i < ts->hopping.arfcns.data_len*8; i++) { if (bitvec_get_bit_pos(&ts->hopping.arfcns, i)) { msgb_put_u16(msg, i); - /* At least BS-11 wants a TLV16 here */ - if (bts->type == GSM_BTS_TYPE_BS11) - *len += 1; - else - *len += sizeof(uint16_t); + n += 1; } } + + /* BS-11 cannot handle more than 255 ARFCNs, because L is 8 bit. + * This is unlikely to happen, but better check than sorry... */ + if (bts->type == GSM_BTS_TYPE_BS11 && n > 0xff) { + LOGPFOH(DNM, LOGL_ERROR, foh, "%s cannot handle %u (more than 255) " + "hopping channels\n", gsm_bts_name(bts), n); + msgb_free(msg); + return -EINVAL; + } + + /* 3GPP TS 12.21 defines L as length of the V part (in octets) */ + if (bts->type != GSM_BTS_TYPE_BS11) + *u16 = htons(n * sizeof(*u16)); + else /* ... BS-11 wants the number of channels instead */ + *u8 = n; } msgb_tv_put(msg, NM_ATT_TSC, gsm_ts_tsc(ts)); /* training sequence */ if (bts->type == GSM_BTS_TYPE_BS11) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18565 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iec1826f55459ac8e9355328a1a6bb0949874db60 Gerrit-Change-Number: 18565 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200618/ec26253a/attachment.htm>