<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/12891">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">OML: Work around OsmoBSC but sending "GET ATTRIBUTES" with short length<br><br>OsmoBSC used to have a bug in encoding the "GET ATTRIBUTES" OML message,<br>resulting in the actual message length being three bytes longer than the<br>encoded length value.<br><br>As in Ib98f0d7c2cff9172714ed18667c02564540d65d7 we have introduced<br>proper consistency checks on length values, all "GET ATTRIBUTES" from<br>OsmoBSC version suntil today will fail.  This patch introduces a<br>work-around to remain compatible with old OsmoBSC while still keeping<br>the consistency checks for all other messages.<br><br>Change-Id: Ifa24e9e2c71feb2c597557807d675438c2825b2d<br>Related: OS#3799<br>---<br>M src/common/oml.c<br>1 file changed, 11 insertions(+), 4 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/91/12891/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 1de8054..30449a9 100644</span><br><span>--- a/src/common/oml.c</span><br><span>+++ b/src/common/oml.c</span><br><span>@@ -1447,10 +1447,17 @@</span><br><span>      }</span><br><span> </span><br><span>        if (msgb_l3len(msg) > oh->length) {</span><br><span style="color: hsl(0, 100%, 40%);">-               LOGP(DOML, LOGL_NOTICE, "OML message with %u extraneous bytes at end: %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                  msgb_l3len(msg) - oh->length, msgb_hexdump(msg));</span><br><span style="color: hsl(0, 100%, 40%);">-            /* remove extra bytes at end */</span><br><span style="color: hsl(0, 100%, 40%);">-         msgb_l3trim(msg, oh->length);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (oh->mdisc == ABIS_OM_MDISC_FOM && oh->data[0] == NM_MT_GET_ATTR &&</span><br><span style="color: hsl(120, 100%, 40%);">+              msgb_l3len(msg) == oh->length + 3) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   /* work-around a bug present in OsmoBSC before February 2019 */</span><br><span style="color: hsl(120, 100%, 40%);">+                       DEBUGP(DOML, "GET ATTR with off-by-3 length: Fixing up for OS#3799\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                     oh->length += 3;</span><br><span style="color: hsl(120, 100%, 40%);">+           } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      LOGP(DOML, LOGL_NOTICE, "OML message with %u extraneous bytes at end: %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                msgb_l3len(msg) - oh->length, msgb_hexdump(msg));</span><br><span style="color: hsl(120, 100%, 40%);">+                  /* remove extra bytes at end */</span><br><span style="color: hsl(120, 100%, 40%);">+                       msgb_l3trim(msg, oh->length);</span><br><span style="color: hsl(120, 100%, 40%);">+              }</span><br><span>    }</span><br><span> </span><br><span>        switch (oh->mdisc) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12891">change 12891</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/12891"/><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: Ifa24e9e2c71feb2c597557807d675438c2825b2d </div>
<div style="display:none"> Gerrit-Change-Number: 12891 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>