aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-04-23 23:31:31 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-04-26 09:36:19 +0200
commite188010512388acdb1408f3d1a0749c25c2c99e3 (patch)
tree5df9a436d79f1bf3674a0316474af66aa9a26d9c /openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
parent2a9eeaa588a2a3b63fadd94d6760879b44b14af5 (diff)
bsc: Allow to have a list of MSCs/MUXs to connect to
Be able to configure a list of destinations (duplicates allowed) that will be tried in a round robin fashion. The change is in the bsc_msc_connection to operate on a list. We achieve the round robin nature with the same trick used in the paging code to delete and append the current entry. The nat code was updated to compile but one can only configure one destination.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_utils.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c20
1 files changed, 15 insertions, 5 deletions
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)