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

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue May 7 18:14:08 UTC 2019


Harald Welte has submitted this change and it was merged. ( 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(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/oml.c b/src/common/oml.c
index d1db8f4..260dfc4 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -145,11 +145,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;
+	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_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;
 
-	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 = 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 */
+	osmo_store16be(total_len, len);
 }
 
 /* Handle a list of attributes requested by the BSC, compose

-- 
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: merged
Gerrit-Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5
Gerrit-Change-Number: 13709
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190507/f072a027/attachment.htm>


More information about the gerrit-log mailing list