Change in osmo-bts[master]: common/oml.c: fix: properly encode NM_ATT_SW_CONFIG

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Fri Apr 19 14:36:39 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/13709


Change subject: common/oml.c: fix: properly encode NM_ATT_SW_CONFIG
......................................................................

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
---
M src/common/oml.c
1 file changed, 33 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/09/13709/1

diff --git a/src/common/oml.c b/src/common/oml.c
index caff595..d8859db 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -142,11 +142,26 @@
 
 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;
+	uint16_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 = (uint16_t *) 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 */
+	*len = htons(total_len);
 }
 
 /* Add BTS features as 3GPP TS 52.021 §9.4.30 Manufacturer Id */
@@ -158,9 +173,21 @@
 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;
+	uint16_t *len;
 
-	abis_nm_put_sw_file(msg, btsatttr2str(TRX_PHY_VERSION), pinst && strlen(pinst->version) ? pinst->version : "Unknown",
-			    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 = (uint16_t *) 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);
+
+	/* Finally, update the length */
+	*len = htons(total_len);
 }
 
 /* The number of attributes in §9.4.26 List of Required Attributes is 2 bytes,

-- 
To view, visit https://gerrit.osmocom.org/13709
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5
Gerrit-Change-Number: 13709
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190419/1bc57074/attachment.html>


More information about the gerrit-log mailing list