aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-04-19 20:32:43 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-05-07 00:40:14 +0700
commit27ee75e4c0c82a17d213e5ca1091b8c3f5766a69 (patch)
treee5758109062cafce49873676636674c6fea0559a
parent038a1fa04763ae8fc9279a69bc0d3c8acefc834c (diff)
common/oml.c: fix: properly encode NM_ATT_SW_CONFIG
According to 3GPP TS 52.021, sections 9.4.61-62, 'SW Configuration' shall contain a list of 'SW Descriptions' related to the MO. In other words, all 'NM_ATT_SW_DESCR' blobs shall be encapsulated into a single NM_ATT_SW_CONFIG attribute. For some reason, they were not encapsulated properly, so OsmoBSC were unable to parse the 'SW Descriptions'. However, unlike OsmoBSC the old OpenBSC does not expect this encapsulation, thus after this change it will be unable to parse the 'SW Descriptions'. Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5 Related: OS#3938
-rw-r--r--src/common/oml.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/common/oml.c b/src/common/oml.c
index d1db8f43..260dfc4d 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -145,11 +145,26 @@ char *gsm_abis_mo_name(const struct gsm_abis_mo *mo)
static inline void add_bts_attrs(struct msgb *msg, const struct gsm_bts *bts)
{
- abis_nm_put_sw_file(msg, "osmobts", PACKAGE_VERSION, true);
- abis_nm_put_sw_file(msg, btsatttr2str(BTS_TYPE_VARIANT), btsvariant2str(bts->variant), true);
+ uint16_t total_len = 0;
+ uint8_t *len;
- if (strlen(bts->sub_model))
- abis_nm_put_sw_file(msg, btsatttr2str(BTS_SUB_MODEL), bts->sub_model, true);
+ /* Put NM_ATT_SW_CONFIG as per 9.4.61 "SW Configuration". */
+ msgb_v_put(msg, NM_ATT_SW_CONFIG);
+
+ /* We don't know the length yet, so we update it later. */
+ len = msgb_put(msg, 2);
+
+ total_len += abis_nm_put_sw_file(msg, "osmobts", PACKAGE_VERSION, true);
+ total_len += abis_nm_put_sw_file(msg, btsatttr2str(BTS_TYPE_VARIANT),
+ btsvariant2str(bts->variant), true);
+
+ if (strlen(bts->sub_model)) {
+ total_len += abis_nm_put_sw_file(msg, btsatttr2str(BTS_SUB_MODEL),
+ bts->sub_model, true);
+ }
+
+ /* Finally, update the length */
+ osmo_store16be(total_len, len);
}
/* Add BTS features as 3GPP TS 52.021 ยง9.4.30 Manufacturer Id */
@@ -161,9 +176,21 @@ static inline void add_bts_feat(struct msgb *msg, const struct gsm_bts *bts)
static inline void add_trx_attr(struct msgb *msg, const struct gsm_bts_trx *trx)
{
const struct phy_instance *pinst = trx_phy_instance(trx);
+ const char *phy_version;
+ uint16_t total_len;
+ uint8_t *len;
+
+ /* Put NM_ATT_SW_CONFIG as per 9.4.61 "SW Configuration". */
+ msgb_v_put(msg, NM_ATT_SW_CONFIG);
+
+ /* We don't know the length yet, so we update it later. */
+ len = msgb_put(msg, 2);
+
+ phy_version = pinst && strlen(pinst->version) ? pinst->version : "Unknown";
+ total_len = abis_nm_put_sw_file(msg, btsatttr2str(TRX_PHY_VERSION), phy_version, true);
- abis_nm_put_sw_file(msg, btsatttr2str(TRX_PHY_VERSION), pinst && strlen(pinst->version) ? pinst->version : "Unknown",
- true);
+ /* Finally, update the length */
+ osmo_store16be(total_len, len);
}
/* Handle a list of attributes requested by the BSC, compose