aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-06-15 00:58:11 +0700
committerlaforge <laforge@osmocom.org>2020-06-18 11:54:24 +0000
commit2190ac9ce51319f40cc8fce2729c2d2de2b0dcf2 (patch)
tree8951a47a3917d7897d04b151d970af5068e6a095
parent83e6e613a7180b7969ddde04e3c52d15f624310b (diff)
abis_nm: fix length indicator in Set Channel Attributes
This message may contain optional IEs (HSN, MAIO, ARFCN list), so we cannot know the final length in advance. Let's set both msg->{l2h,l3h} pointers and use msgb_l3len() to get the length. Change-Id: I948ad4b847921324794a6eabd95d5583324da6e4 Related: OS#4545
-rw-r--r--src/osmo-bsc/abis_nm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index d503f2a21..b6d1ec5c2 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -1998,14 +1998,11 @@ int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb)
struct abis_om_fom_hdr *foh;
uint8_t zero = 0x00;
struct msgb *msg = nm_msgb_alloc();
- uint8_t len = 2 + 2;
const char *reason = NULL;
- if (bts->type == GSM_BTS_TYPE_BS11)
- len += 4 + 2 + 2 + 3;
-
+ /* NOTE: message length will be set later, see down below */
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
- foh = fill_om_fom_hdr(oh, len, NM_MT_SET_CHAN_ATTR, NM_OC_CHANNEL, bts->bts_nr,
+ foh = fill_om_fom_hdr(oh, 0, NM_MT_SET_CHAN_ATTR, NM_OC_CHANNEL, bts->bts_nr,
ts->trx->nr, ts->nr);
DEBUGPFOH(DNM, foh, "Set Chan Attr %s\n", gsm_ts_name(ts));
@@ -2061,6 +2058,10 @@ int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb)
if (bts->type == GSM_BTS_TYPE_BS11)
msgb_tlv_put(msg, 0x59, 1, &zero);
+ msg->l2h = (uint8_t *) oh;
+ msg->l3h = (uint8_t *) foh;
+ oh->length = msgb_l3len(msg);
+
DEBUGPFOH(DNM, foh, "%s(): sending %s\n", __func__, msgb_hexdump(msg));
return abis_nm_sendmsg(bts, msg);
}