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
diff --git a/src/libosmo-mgcp/mgcp_trunk.c b/src/libosmo-mgcp/mgcp_trunk.c
index e41ed0e..f3785cd 100644
--- a/src/libosmo-mgcp/mgcp_trunk.c
+++ b/src/libosmo-mgcp/mgcp_trunk.c
@@ -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