Change in osmo-bts[master]: OML: Work around OsmoBSC but sending "GET ATTRIBUTES" with short length

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 Feb 12 18:55:24 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/12891


Change subject: OML: Work around OsmoBSC but sending "GET ATTRIBUTES" with short length
......................................................................

OML: Work around OsmoBSC but sending "GET ATTRIBUTES" with short length

OsmoBSC used to have a bug in encoding the "GET ATTRIBUTES" OML message,
resulting in the actual message length being three bytes longer than the
encoded length value.

As in Ib98f0d7c2cff9172714ed18667c02564540d65d7 we have introduced
proper consistency checks on length values, all "GET ATTRIBUTES" from
OsmoBSC version suntil today will fail.  This patch introduces a
work-around to remain compatible with old OsmoBSC while still keeping
the consistency checks for all other messages.

Change-Id: Ifa24e9e2c71feb2c597557807d675438c2825b2d
Related: OS#3799
---
M src/common/oml.c
1 file changed, 11 insertions(+), 4 deletions(-)



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

diff --git a/src/common/oml.c b/src/common/oml.c
index 1de8054..30449a9 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1447,10 +1447,17 @@
 	}
 
 	if (msgb_l3len(msg) > oh->length) {
-		LOGP(DOML, LOGL_NOTICE, "OML message with %u extraneous bytes at end: %s\n",
-			msgb_l3len(msg) - oh->length, msgb_hexdump(msg));
-		/* remove extra bytes at end */
-		msgb_l3trim(msg, oh->length);
+		if (oh->mdisc == ABIS_OM_MDISC_FOM && oh->data[0] == NM_MT_GET_ATTR &&
+		    msgb_l3len(msg) == oh->length + 3) {
+			/* work-around a bug present in OsmoBSC before February 2019 */
+			DEBUGP(DOML, "GET ATTR with off-by-3 length: Fixing up for OS#3799\n");
+			oh->length += 3;
+		} else {
+			LOGP(DOML, LOGL_NOTICE, "OML message with %u extraneous bytes at end: %s\n",
+				msgb_l3len(msg) - oh->length, msgb_hexdump(msg));
+			/* remove extra bytes at end */
+			msgb_l3trim(msg, oh->length);
+		}
 	}
 
 	switch (oh->mdisc) {

-- 
To view, visit https://gerrit.osmocom.org/12891
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: Ifa24e9e2c71feb2c597557807d675438c2825b2d
Gerrit-Change-Number: 12891
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190212/d9b21fa5/attachment.htm>


More information about the gerrit-log mailing list