From 7b7eef62c195c1d99e959fab432cb147c0961ad7 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 22 Apr 2010 12:08:17 +0800 Subject: nat: Change MGCP DLCX handling and send dummy MDCX to the BTS. When setting a new MSC timeslot to a SCCP connection check if any of the existing connections have this timeslot, if so we will send a DLCX down the stream to make sure it is closed there, when we will CRCX this new timeslot we will happily reallocate it. When the SCCP connection goes away, or we get a DLCX from the network, or the BSC is gone we will send a DLCX message down the stream as well. When we receive a CRCX from the network we will forward the CRCX as usual and send a dummy MDCX after it. For the DLCX and the dummy MDCX we send a custom MGCP message that will not provoke an answer. Even if the downstream MGCP GW will answer we will ignore it due the dummy transaction id that is not used anywhere else. This change should make sure that we close the dowstream endpoint all the time, even when the DLCX arrives after the SCCP connection is torndown. --- openbsc/tests/bsc-nat/bsc_nat_test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c') diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index e046e776e..24b96012a 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -395,6 +395,8 @@ static void test_paging(void) static void test_mgcp_ass_tracking(void) { + struct bsc_connection *bsc; + struct bsc_nat *nat; struct sccp_connections con; struct bsc_nat_parsed *parsed; struct msgb *msg; @@ -402,6 +404,14 @@ static void test_mgcp_ass_tracking(void) fprintf(stderr, "Testing MGCP.\n"); memset(&con, 0, sizeof(con)); + nat = bsc_nat_alloc(); + nat->bsc_endpoints = talloc_zero_array(nat, + struct bsc_endpoint, + 33); + bsc = bsc_connection_alloc(nat); + bsc->cfg = bsc_config_alloc(nat, "foo", 2323); + con.bsc = bsc; + msg = msgb_alloc(4096, "foo"); copy_to_msg(msg, ass_cmd, sizeof(ass_cmd)); parsed = bsc_nat_parse(msg); @@ -421,11 +431,13 @@ static void test_mgcp_ass_tracking(void) } talloc_free(parsed); - bsc_mgcp_clear(&con); + bsc_mgcp_dlcx(&con); if (con.bsc_timeslot != -1 || con.msc_timeslot != -1) { fprintf(stderr, "Clearing should remove the mapping.\n"); abort(); } + + talloc_free(nat); } /* test the code to find a given connection */ -- cgit v1.2.3