Change in osmo-bts[master]: fix handling of odd pchans in bts_supports_cm()

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

Keith Whyte gerrit-no-reply at lists.osmocom.org
Tue Sep 11 12:32:14 UTC 2018


Keith Whyte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10870 )

Change subject: fix handling of odd pchans in bts_supports_cm()
......................................................................

fix handling of odd pchans in bts_supports_cm()

Convert the if-cascade to a switch().

For any unexpected pchan kind, reject the chan mode immediately instead of
going on to invoke gsm_bts_has_feature on feature = _NUM_BTS_FEAT, and log the
error.

Tweaked-by: neels
Change-Id: Ieaded9258554b15fcc4b7f05d5a8847175b7962f
---
M src/common/bts.c
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/common/bts.c b/src/common/bts.c
index bec611c..c251fdd 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -704,7 +704,8 @@
 
 	/* Before the requested pchan/cm combination can be checked, we need to
 	 * convert it to a feature identifier we can check */
-	if (pchan == GSM_PCHAN_TCH_F) {
+	switch (pchan) {
+	case GSM_PCHAN_TCH_F:
 		switch(cm) {
 		case GSM48_CMODE_SPEECH_V1:
 			feature	= BTS_FEAT_SPEECH_F_V1;
@@ -719,7 +720,9 @@
 			/* Invalid speech codec type => Not supported! */
 			return 0;
 		}
-	} else if (pchan == GSM_PCHAN_TCH_H) {
+		break;
+
+	case GSM_PCHAN_TCH_H:
 		switch(cm) {
 		case GSM48_CMODE_SPEECH_V1:
 			feature	= BTS_FEAT_SPEECH_H_V1;
@@ -731,6 +734,12 @@
 			/* Invalid speech codec type => Not supported! */
 			return 0;
 		}
+		break;
+
+	default:
+		LOGP(DRSL, LOGL_ERROR, "BTS %u: unhandled pchan %s when checking mode %s\n",
+		     bts->nr, gsm_pchan_name(pchan), gsm48_chan_mode_name(cm));
+		return 0;
 	}
 
 	/* Check if the feature is supported by this BTS */

-- 
To view, visit https://gerrit.osmocom.org/10870
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ieaded9258554b15fcc4b7f05d5a8847175b7962f
Gerrit-Change-Number: 10870
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180911/957e063e/attachment.htm>


More information about the gerrit-log mailing list