Change in osmo-bsc[master]: bssap: Avoid logging error if no optional Global Call Ref IE received

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

pespin gerrit-no-reply at lists.osmocom.org
Mon Feb 17 09:46:50 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/17138 )

Change subject: bssap: Avoid logging error if no optional Global Call Ref IE received
......................................................................

bssap: Avoid logging error if no optional Global Call Ref IE received

Also take the chance to simplify related code and print erroneous IE
data.

Change-Id: I27ee9c6112f96d6839b8b6141888ac8fe377db65
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 14 insertions(+), 10 deletions(-)

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



diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 74faae1..1ba490f 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -568,20 +568,24 @@
 static void bssmap_handle_ass_req_lcls(struct gsm_subscriber_connection *conn,
 					const struct tlv_parsed *tp)
 {
-	const uint8_t *config, *control, *gcr, gcr_len = TLVP_LEN(tp, GSM0808_IE_GLOBAL_CALL_REF);
+	const uint8_t *config, *control, *gcr;
+	uint8_t gcr_len;
 
-	if (gcr_len > sizeof(conn->lcls.global_call_ref))
-		LOGPFSML(conn->fi, LOGL_ERROR, "Global Call Ref IE of %u bytes is too long\n",
-			 gcr_len);
-	else {
-		gcr = TLVP_VAL_MINLEN(tp, GSM0808_IE_GLOBAL_CALL_REF, 13);
-		if (gcr) {
+	/* TS 48.008 sec 3.2.2.115 Global Call Reference */
+	if (TLVP_PRESENT(tp, GSM0808_IE_GLOBAL_CALL_REF)) {
+		gcr = TLVP_VAL(tp, GSM0808_IE_GLOBAL_CALL_REF);
+		gcr_len = TLVP_LEN(tp, GSM0808_IE_GLOBAL_CALL_REF);
+		if (gcr_len > sizeof(conn->lcls.global_call_ref)) {
+			LOGPFSML(conn->fi, LOGL_ERROR, "Global Call Ref IE of %u bytes is too long: %s\n",
+				 gcr_len, osmo_hexdump_nospc(gcr, gcr_len));
+		} else if (gcr_len < 13) { /* FIXME: document this magic value 13 */
+			LOGPFSML(conn->fi, LOGL_ERROR, "Global Call Ref IE of %u bytes is too short: %s\n",
+				 gcr_len, osmo_hexdump_nospc(gcr, gcr_len));
+		} else {
 			LOGPFSM(conn->fi, "Setting GCR to %s\n", osmo_hexdump_nospc(gcr, gcr_len));
 			memcpy(&conn->lcls.global_call_ref, gcr, gcr_len);
 			conn->lcls.global_call_ref_len = gcr_len;
-		} else
-			LOGPFSML(conn->fi, LOGL_ERROR, "Global Call Ref IE of %u bytes is too short\n",
-				 gcr_len);
+		}
 	}
 
 	config = TLVP_VAL_MINLEN(tp, GSM0808_IE_LCLS_CONFIG, 1);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I27ee9c6112f96d6839b8b6141888ac8fe377db65
Gerrit-Change-Number: 17138
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
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/20200217/38ac04eb/attachment.htm>


More information about the gerrit-log mailing list