aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-02-28 18:23:31 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2018-01-25 16:48:23 +0100
commit68785e6a52cdb313200bf690b3974b018b4fed0d (patch)
treedbf2e286927b139c4ea25371d4261150e1e85377 /openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
parent0167c96cc5d4f51e7b34d92fdb5c226287b77c94 (diff)
osmo-bsc_nat: Support multiple MSCs in VTY/config
Change-Id: I2e9009b52c6ecc17fc2da8402736412b9093ce19 Ticket: SYS#3208 Sponsored-by: On-Waves ehf.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_utils.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 6746518e3..d13749912 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -75,18 +75,12 @@ 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->msc_configs);
INIT_LLIST_HEAD(&nat->sccp_connections);
INIT_LLIST_HEAD(&nat->bsc_connections);
INIT_LLIST_HEAD(&nat->paging_groups);
INIT_LLIST_HEAD(&nat->bsc_configs);
INIT_LLIST_HEAD(&nat->access_lists);
- INIT_LLIST_HEAD(&nat->dests);
INIT_LLIST_HEAD(&nat->num_rewr);
INIT_LLIST_HEAD(&nat->num_rewr_post);
INIT_LLIST_HEAD(&nat->smsc_rewr);
@@ -104,20 +98,19 @@ struct bsc_nat *bsc_nat_alloc(void)
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_free(struct bsc_nat *nat)
{
- struct bsc_config *cfg, *tmp;
+ struct bsc_config *bcfg, *btmp;
+ struct msc_config *mcfg, *mtmp;
struct bsc_msg_acc_lst *lst, *tmp_lst;
- llist_for_each_entry_safe(cfg, tmp, &nat->bsc_configs, entry)
- bsc_config_free(cfg);
+ llist_for_each_entry_safe(mcfg, mtmp, &nat->msc_configs, entry)
+ msc_config_free(mcfg);
+ llist_for_each_entry_safe(bcfg, btmp, &nat->bsc_configs, entry)
+ bsc_config_free(bcfg);
llist_for_each_entry_safe(lst, tmp_lst, &nat->access_lists, list)
bsc_msg_acc_lst_delete(lst);
@@ -137,9 +130,9 @@ void bsc_nat_free(struct bsc_nat *nat)
talloc_free(nat);
}
-void bsc_nat_set_msc_ip(struct bsc_nat *nat, const char *ip)
+void bsc_nat_set_msc_ip(struct msc_config *cfg, const char *ip)
{
- osmo_talloc_replace_string(nat, &nat->main_dest->ip, ip);
+ osmo_talloc_replace_string(cfg, &cfg->main_dest->ip, ip);
}
struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat)