Change in osmo-bts[master]: osmo-bts-trx: discard TRXD PDUs with unexpected version

laforge gerrit-no-reply at lists.osmocom.org
Sat Apr 24 08:47:03 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/23829 )

Change subject: osmo-bts-trx: discard TRXD PDUs with unexpected version
......................................................................

osmo-bts-trx: discard TRXD PDUs with unexpected version

Change-Id: Icdc3d12a7686428046113f9fa8f21a99569e651a
Related: SYS#4895, OS#4941, OS#4006
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 13 insertions(+), 4 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 912ab42..5ce1889 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -945,8 +945,18 @@
 	/* Pre-clean (initialize) the flags */
 	bi.flags = 0x00;
 
-	/* Parse header depending on the PDU version */
+	/* Parse PDU version first */
 	pdu_ver = buf[0] >> 4;
+
+	/* Make sure that PDU version matches our expectations */
+	if (pdu_ver != l1h->config.trxd_pdu_ver_use) {
+		LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+			"Rx TRXD PDU with unexpected version %u (expected %u)\n",
+			pdu_ver, l1h->config.trxd_pdu_ver_use);
+		return -EIO;
+	}
+
+	/* Parse header depending on the PDU version */
 	switch (pdu_ver) {
 	case 0:
 		/* Legacy protocol has no version indicator */
@@ -956,9 +966,8 @@
 		hdr_len = trx_data_handle_hdr_v1(l1h, &bi, buf, buf_len);
 		break;
 	default:
-		LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
-			"TRXD PDU version %u is not supported\n", pdu_ver);
-		return -ENOTSUP;
+		/* Shall not happen */
+		OSMO_ASSERT(0);
 	}
 
 	/* Header parsing error */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23829
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Icdc3d12a7686428046113f9fa8f21a99569e651a
Gerrit-Change-Number: 23829
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210424/b1149180/attachment.htm>


More information about the gerrit-log mailing list