path: root/openbsc/tests/bsc-nat/bsc_nat_test.c
diff options
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-22 12:08:17 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:16 +0800
commit7b7eef62c195c1d99e959fab432cb147c0961ad7 (patch)
tree1ad7f6bdd515b241cb676187de15e95a70b42bcd /openbsc/tests/bsc-nat/bsc_nat_test.c
parent8151973c73e87751ddb7963d8d882a9c3c63c312 (diff)
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.
Diffstat (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c')
1 files changed, 13 insertions, 1 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index e046e776..24b96012 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)
- 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");
+ talloc_free(nat);
/* test the code to find a given connection */