<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13709">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">common/oml.c: fix: properly encode NM_ATT_SW_CONFIG<br><br>According to 3GPP TS 52.021, sections 9.4.61-62, 'SW Configuration'<br>shall contain a list of 'SW Descriptions' related to the MO. In<br>other words, all 'NM_ATT_SW_DESCR' blobs shall be encapsulated<br>into a single NM_ATT_SW_CONFIG attribute.<br><br>For some reason, they were not encapsulated properly, so<br>OsmoBSC were unable to parse the 'SW Descriptions'.<br><br>However, unlike OsmoBSC the old OpenBSC does not expect this<br>encapsulation, thus after this change it will be unable to<br>parse the 'SW Descriptions'.<br><br>Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5<br>Related: OS#3938<br>---<br>M src/common/oml.c<br>1 file changed, 33 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/09/13709/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/oml.c b/src/common/oml.c</span><br><span>index caff595..d8859db 100644</span><br><span>--- a/src/common/oml.c</span><br><span>+++ b/src/common/oml.c</span><br><span>@@ -142,11 +142,26 @@</span><br><span> </span><br><span> static inline void add_bts_attrs(struct msgb *msg, const struct gsm_bts *bts)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-     abis_nm_put_sw_file(msg, "osmobts", PACKAGE_VERSION, true);</span><br><span style="color: hsl(0, 100%, 40%);">-   abis_nm_put_sw_file(msg, btsatttr2str(BTS_TYPE_VARIANT), btsvariant2str(bts->variant), true);</span><br><span style="color: hsl(120, 100%, 40%);">+      uint16_t total_len = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       uint16_t *len;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (strlen(bts->sub_model))</span><br><span style="color: hsl(0, 100%, 40%);">-          abis_nm_put_sw_file(msg, btsatttr2str(BTS_SUB_MODEL), bts->sub_model, true);</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Put NM_ATT_SW_CONFIG as per 9.4.61 "SW Configuration". */</span><br><span style="color: hsl(120, 100%, 40%);">+        msgb_v_put(msg, NM_ATT_SW_CONFIG);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* We don't know the length yet, so we update it later. */</span><br><span style="color: hsl(120, 100%, 40%);">+        len = (uint16_t *) msgb_put(msg, 2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        total_len += abis_nm_put_sw_file(msg, "osmobts", PACKAGE_VERSION, true);</span><br><span style="color: hsl(120, 100%, 40%);">+    total_len += abis_nm_put_sw_file(msg, btsatttr2str(BTS_TYPE_VARIANT),</span><br><span style="color: hsl(120, 100%, 40%);">+                                  btsvariant2str(bts->variant), true);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    if (strlen(bts->sub_model)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              total_len += abis_nm_put_sw_file(msg, btsatttr2str(BTS_SUB_MODEL),</span><br><span style="color: hsl(120, 100%, 40%);">+                                             bts->sub_model, true);</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Finally, update the length */</span><br><span style="color: hsl(120, 100%, 40%);">+      *len = htons(total_len);</span><br><span> }</span><br><span> </span><br><span> /* Add BTS features as 3GPP TS 52.021 §9.4.30 Manufacturer Id */</span><br><span>@@ -158,9 +173,21 @@</span><br><span> static inline void add_trx_attr(struct msgb *msg, const struct gsm_bts_trx *trx)</span><br><span> {</span><br><span>       const struct phy_instance *pinst = trx_phy_instance(trx);</span><br><span style="color: hsl(120, 100%, 40%);">+     const char *phy_version;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint16_t total_len;</span><br><span style="color: hsl(120, 100%, 40%);">+   uint16_t *len;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      abis_nm_put_sw_file(msg, btsatttr2str(TRX_PHY_VERSION), pinst && strlen(pinst->version) ? pinst->version : "Unknown",</span><br><span style="color: hsl(0, 100%, 40%);">-                       true);</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Put NM_ATT_SW_CONFIG as per 9.4.61 "SW Configuration". */</span><br><span style="color: hsl(120, 100%, 40%);">+        msgb_v_put(msg, NM_ATT_SW_CONFIG);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* We don't know the length yet, so we update it later. */</span><br><span style="color: hsl(120, 100%, 40%);">+        len = (uint16_t *) msgb_put(msg, 2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        phy_version = pinst && strlen(pinst->version) ? pinst->version : "Unknown";</span><br><span style="color: hsl(120, 100%, 40%);">+   total_len = abis_nm_put_sw_file(msg, btsatttr2str(TRX_PHY_VERSION), phy_version, true);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Finally, update the length */</span><br><span style="color: hsl(120, 100%, 40%);">+      *len = htons(total_len);</span><br><span> }</span><br><span> </span><br><span> /* The number of attributes in §9.4.26 List of Required Attributes is 2 bytes,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13709">change 13709</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13709"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5 </div>
<div style="display:none"> Gerrit-Change-Number: 13709 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>