diff options
Diffstat (limited to 'openbsc/src/osmo-bsc_nat')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat.c | 6 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 20 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 9 |
3 files changed, 22 insertions, 13 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index bbb2ae35c..2146da1c4 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -1,8 +1,8 @@ /* BSC Multiplexer/NAT */ /* - * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> - * (C) 2010 by On-Waves + * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org> + * (C) 2010-2011 by On-Waves * (C) 2009 by Harald Welte <laforge@gnumonks.org> * All Rights Reserved * @@ -1432,7 +1432,7 @@ int main(int argc, char **argv) return -4; /* connect to the MSC */ - nat->msc_con = bsc_msc_create(nat->msc_ip, nat->msc_port, 0); + nat->msc_con = bsc_msc_create(nat, &nat->dests); if (!nat->msc_con) { fprintf(stderr, "Creating a bsc_msc_connection failed.\n"); exit(1); diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 4e7286e6f..4d1afe2df 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -2,8 +2,8 @@ /* BSC Multiplexer/NAT Utilities */ /* - * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> - * (C) 2010 by On-Waves + * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org> + * (C) 2010-2011 by On-Waves * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -82,10 +82,17 @@ struct bsc_nat *bsc_nat_alloc(void) if (!nat) return NULL; + nat->main_dest = talloc_zero(nat, struct bsc_msc_dest); + if (!nat->main_dest) { + talloc_free(nat); + return NULL; + } + INIT_LLIST_HEAD(&nat->sccp_connections); INIT_LLIST_HEAD(&nat->bsc_connections); INIT_LLIST_HEAD(&nat->bsc_configs); INIT_LLIST_HEAD(&nat->access_lists); + INIT_LLIST_HEAD(&nat->dests); nat->stats.sccp.conn = counter_alloc("nat.sccp.conn"); nat->stats.sccp.calls = counter_alloc("nat.sccp.calls"); @@ -93,17 +100,20 @@ struct bsc_nat *bsc_nat_alloc(void) nat->stats.bsc.auth_fail = counter_alloc("nat.bsc.auth_fail"); nat->stats.msc.reconn = counter_alloc("nat.msc.conn"); nat->stats.ussd.reconn = counter_alloc("nat.ussd.conn"); - nat->msc_ip = talloc_strdup(nat, "127.0.0.1"); - nat->msc_port = 5000; nat->auth_timeout = 2; nat->ping_timeout = 20; nat->pong_timeout = 5; + + llist_add(&nat->main_dest->list, &nat->dests); + nat->main_dest->ip = talloc_strdup(nat, "127.0.0.1"); + nat->main_dest->port = 5000; + return nat; } void bsc_nat_set_msc_ip(struct bsc_nat *nat, const char *ip) { - bsc_replace_string(nat, &nat->msc_ip, ip); + bsc_replace_string(nat, &nat->main_dest->ip, ip); } struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index ef433caed..ffbfe9b3a 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -69,8 +69,8 @@ static int config_write_nat(struct vty *vty) struct bsc_nat_acc_lst *lst; vty_out(vty, "nat%s", VTY_NEWLINE); - vty_out(vty, " msc ip %s%s", _nat->msc_ip, VTY_NEWLINE); - vty_out(vty, " msc port %d%s", _nat->msc_port, VTY_NEWLINE); + vty_out(vty, " msc ip %s%s", _nat->main_dest->ip, VTY_NEWLINE); + vty_out(vty, " msc port %d%s", _nat->main_dest->port, VTY_NEWLINE); vty_out(vty, " timeout auth %d%s", _nat->auth_timeout, VTY_NEWLINE); vty_out(vty, " timeout ping %d%s", _nat->ping_timeout, VTY_NEWLINE); vty_out(vty, " timeout pong %d%s", _nat->pong_timeout, VTY_NEWLINE); @@ -311,8 +311,7 @@ DEFUN(show_msc, return CMD_WARNING; } - vty_out(vty, "MSC on %s:%d is connected: %d%s\n", - _nat->msc_con->ip, _nat->msc_con->port, + vty_out(vty, "MSC is connected: %d%s\n", _nat->msc_con->is_connected, VTY_NEWLINE); return CMD_SUCCESS; } @@ -357,7 +356,7 @@ DEFUN(cfg_nat_msc_port, "msc port <1-65500>", "Set the port of the MSC.") { - _nat->msc_port = atoi(argv[0]); + _nat->main_dest->port = atoi(argv[0]); return CMD_SUCCESS; } |