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/libosmocore/+/23017 ) Change subject: CBSP: fix encoding/decoding of keep-alive repetition period ...................................................................... CBSP: fix encoding/decoding of keep-alive repetition period Even though the value is only between 0..120s, they didn't encode it 1:1 in the uint8_t, but 3GPP chose to use the same encoding as for the warning period (which has a much larger range). Let's fix this in our implementation. Before this patch, osmo-cbc wanted to send 30s keep-alive repetition period, but a spec-compliant receiver actually decoded this as 80s. Change-Id: I04baa6b6b99b092fa0512b3b6138a363c7f3a13d --- M src/gsm/cbsp.c 1 file changed, 9 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c index 2c7a7b7..fa599c5 100644 --- a/src/gsm/cbsp.c +++ b/src/gsm/cbsp.c @@ -352,7 +352,12 @@ /* 8.1.3.18a KEEP ALIVE */ static int cbsp_enc_keep_alive(struct msgb *msg, const struct osmo_cbsp_keep_alive *in) { - msgb_tv_put(msg, CBSP_IEI_KEEP_ALIVE_REP_PERIOD, in->repetition_period); + int rperiod = encode_wperiod(in->repetition_period); + if (in->repetition_period > 120) + return -EINVAL; + if (rperiod < 0) + return -EINVAL; + msgb_tv_put(msg, CBSP_IEI_KEEP_ALIVE_REP_PERIOD, rperiod); return 0; } @@ -1083,12 +1088,14 @@ static int cbsp_dec_keep_alive(struct osmo_cbsp_keep_alive *out, const struct tlv_parsed *tp, struct msgb *in, void *ctx) { + uint8_t rperiod; if (!TLVP_PRES_LEN(tp, CBSP_IEI_KEEP_ALIVE_REP_PERIOD, 1)) { osmo_cbsp_errstr = "missing/short mandatory IE"; return -EINVAL; } - out->repetition_period = *TLVP_VAL(tp, CBSP_IEI_KEEP_ALIVE_REP_PERIOD); + rperiod = *TLVP_VAL(tp, CBSP_IEI_KEEP_ALIVE_REP_PERIOD); + out->repetition_period = decode_wperiod(rperiod); return 0; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23017 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I04baa6b6b99b092fa0512b3b6138a363c7f3a13d Gerrit-Change-Number: 23017 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder 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/20210222/6097abf8/attachment.htm>