Change in osmo-mgw[master]: mgcp_trunk: remove double check

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

dexter gerrit-no-reply at lists.osmocom.org
Fri Jul 3 14:10:52 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/19119 )


Change subject: mgcp_trunk: remove double check
......................................................................

mgcp_trunk: remove double check

At the moment, the trunk prefix is checked twice. Lets re-arange the
code a bit so that the check only happens once.

Change-Id: I91fb8cf6e3b077ba8f18fdbcd071275c6fd7cacd
Related: OS#2547
---
M src/libosmo-mgcp/mgcp_trunk.c
1 file changed, 3 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/19/19119/1

diff --git a/src/libosmo-mgcp/mgcp_trunk.c b/src/libosmo-mgcp/mgcp_trunk.c
index 185f0ee..43abe45 100644
--- a/src/libosmo-mgcp/mgcp_trunk.c
+++ b/src/libosmo-mgcp/mgcp_trunk.c
@@ -149,7 +149,7 @@
 {
 	size_t prefix_len;
 	char epname_lc[MGCP_ENDPOINT_MAXLEN];
-	unsigned long int trunk_nr;
+        int trunk_nr;
 
 	osmo_str_tolower_buf(epname_lc, sizeof(epname_lc), epname);
 	epname = epname_lc;
@@ -159,13 +159,9 @@
 		return mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 	}
 
-	prefix_len = sizeof(MGCP_ENDPOINT_PREFIX_E1_TRUNK) - 1;
-	if (strncmp(epname, MGCP_ENDPOINT_PREFIX_E1_TRUNK, prefix_len) == 0) {
-		trunk_nr = e1_trunk_nr_from_epname(epname);
-		if (trunk_nr < 0)
-			return NULL;
+	trunk_nr = e1_trunk_nr_from_epname(epname);
+	if (trunk_nr > 0)
 		return mgcp_trunk_by_num(cfg, MGCP_TRUNK_E1, trunk_nr);
-	}
 
 	/* Earlier versions of osmo-mgw were accepting endpoint names
 	 * without trunk prefix. This is normally not allowed, each MGCP

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I91fb8cf6e3b077ba8f18fdbcd071275c6fd7cacd
Gerrit-Change-Number: 19119
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200703/33987e1a/attachment.htm>


More information about the gerrit-log mailing list