aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-07 11:20:36 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:13 +0800
commitb752761a3df0de97e1104c9227e9c3bc4f45a6d5 (patch)
tree82796d7b94b1a9983f41ad1b5eba1d88a78a485a /openbsc/src/nat/bsc_nat.c
parent7cab16619eb3935c5e36abb753e505ff1fc83653 (diff)
nat: Send the reset after we have received the init ack
Sending the reset right away will upset the MSC and we need to wait for the first contact.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r--openbsc/src/nat/bsc_nat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 75c8935d8..2e2235d21 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -60,6 +60,7 @@ static struct bsc_fd bsc_listen;
static struct bsc_nat *nat;
static void bsc_write(struct bsc_connection *bsc, const u_int8_t *data, unsigned int length);
static void remove_bsc_connection(struct bsc_connection *connection);
+static void msc_send_reset(struct bsc_msc_connection *con);
struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num)
{
@@ -169,10 +170,11 @@ static void send_mgcp_reset(struct bsc_connection *bsc)
*/
static void initialize_msc_if_needed()
{
- static int init = 0;
- init = 1;
+ if (nat->first_contact)
+ return;
- /* do we need to send a GSM 08.08 message here? */
+ nat->first_contact = 1;
+ msc_send_reset(msc_con);
}
/*
@@ -303,11 +305,12 @@ static void msc_connection_was_lost(struct bsc_msc_connection *con)
llist_for_each_entry_safe(bsc, tmp, &nat->bsc_connections, list_entry)
remove_bsc_connection(bsc);
+ nat->first_contact = 0;
bsc_mgcp_free_endpoints(nat);
bsc_msc_schedule_connect(con);
}
-static void msc_connected(struct bsc_msc_connection *con)
+static void msc_send_reset(struct bsc_msc_connection *con)
{
static const u_int8_t reset[] = {
0x00, 0x12, 0xfd,
@@ -810,7 +813,6 @@ int main(int argc, char** argv)
}
msc_con->connection_loss = msc_connection_was_lost;
- msc_con->connected = msc_connected;
msc_con->write_queue.read_cb = ipaccess_msc_read_cb;
msc_con->write_queue.write_cb = ipaccess_msc_write_cb;;
bsc_msc_connect(msc_con);