aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_mgcp_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-18 02:14:45 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:14 +0800
commiteb52e89c3adad6b01cbbbc139f804a66f161ca43 (patch)
tree41051d76e7f131303fdfb17a9e266428723a8bfb /openbsc/src/nat/bsc_mgcp_utils.c
parent3d0049f4a032c9e2fadb03d6d3e230427474c10f (diff)
nat: Return the newest SCCP connection...
In case we have a stale SCCP connection with an Endpoint that we want to reassign...use the newest (last) occurence of that as it is most likely the one we want to handle.
Diffstat (limited to 'openbsc/src/nat/bsc_mgcp_utils.c')
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index 30a5a30f7..ab830e6e5 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -94,6 +94,7 @@ void bsc_mgcp_free_endpoints(struct bsc_nat *nat)
struct bsc_connection *bsc_mgcp_find_con(struct bsc_nat *nat, int endpoint)
{
+ struct bsc_connection *bsc = NULL;
struct sccp_connections *sccp;
llist_for_each_entry(sccp, &nat->sccp_connections, list_entry) {
@@ -102,9 +103,12 @@ struct bsc_connection *bsc_mgcp_find_con(struct bsc_nat *nat, int endpoint)
if (mgcp_timeslot_to_endpoint(0, sccp->msc_timeslot) != endpoint)
continue;
- return sccp->bsc;
+ bsc = sccp->bsc;
}
+ if (bsc)
+ return bsc;
+
LOGP(DMGCP, LOGL_ERROR, "Failed to find the connection.\n");
return NULL;
}