aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-17 09:07:24 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-17 09:07:24 +0200
commitc24632930a9207dec8b76946bce6dac76cafe00b (patch)
tree8e8db0ca0dbfee0652ad38125bb47830e29ab130
parentf140348eff37a08ec40c6156941de2611673fb17 (diff)
bsc_msc_ip: Allow to put the MSC address into the network config
-rw-r--r--openbsc/include/openbsc/gsm_data.h2
-rw-r--r--openbsc/src/bsc_msc_ip.c37
-rw-r--r--openbsc/src/gsm_data.c3
-rw-r--r--openbsc/src/vty_interface.c25
4 files changed, 51 insertions, 16 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 50a172042..8b00d1f05 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -661,6 +661,8 @@ struct gsm_network {
/* a simple token for this network... */
char *bsc_token;
+ char *msc_ip;
+ int msc_port;
};
#define SMS_HDR_SIZE 128
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index deba7d3ba..9b43d7cea 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -59,7 +59,7 @@
static struct log_target *stderr_target;
struct gsm_network *bsc_gsmnet = 0;
static const char *config_file = "openbsc.cfg";
-static char *msc_address = "127.0.0.1";
+static char *msc_address = NULL;
static struct bsc_msc_connection *msc_con;
static struct in_addr local_addr;
static LLIST_HEAD(active_connections);
@@ -938,7 +938,7 @@ static void handle_options(int argc, char** argv)
ipacc_rtp_direct = 0;
break;
case 'm':
- msc_address = strdup(optarg);
+ msc_address = optarg;
break;
case 'l':
inet_aton(optarg, &local_addr);
@@ -1030,6 +1030,7 @@ extern int bts_model_nanobts_init(void);
int main(int argc, char **argv)
{
+ char *msc;
int rc;
log_init(&log_info);
@@ -1070,20 +1071,6 @@ int main(int argc, char **argv)
/* initialize ipaccess handling */
register_signal_handler(SS_ABISIP, handle_abisip_signal, NULL);
-
- /* setup MSC Connection handling */
- msc_con = bsc_msc_create(msc_address, 5000);
- if (!msc_con) {
- fprintf(stderr, "Creating a bsc_msc_connection failed.\n");
- exit(1);
- }
-
- msc_con->connection_loss = msc_connection_was_lost;
- msc_con->write_queue.read_cb = ipaccess_a_fd_cb;
- msc_con->write_queue.write_cb = msc_sccp_do_write;
- bsc_msc_connect(msc_con);
-
-
fprintf(stderr, "Bootstraping the network. Sending GSM08.08 reset.\n");
rc = bsc_bootstrap_network(NULL, config_file);
if (rc < 0) {
@@ -1100,6 +1087,24 @@ int main(int argc, char **argv)
}
}
+ /* setup MSC Connection handling */
+ msc = bsc_gsmnet->msc_ip;
+ if (msc_address)
+ msc = msc_address;
+
+ msc_con = bsc_msc_create(msc, bsc_gsmnet->msc_port);
+ if (!msc_con) {
+ fprintf(stderr, "Creating a bsc_msc_connection failed.\n");
+ exit(1);
+ }
+
+ msc_con->connection_loss = msc_connection_was_lost;
+ msc_con->write_queue.read_cb = ipaccess_a_fd_cb;
+ msc_con->write_queue.write_cb = msc_sccp_do_write;
+ bsc_msc_connect(msc_con);
+
+
+
while (1) {
bsc_select_main(0);
}
diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c
index e817a5dd7..5db1ff239 100644
--- a/openbsc/src/gsm_data.c
+++ b/openbsc/src/gsm_data.c
@@ -294,6 +294,9 @@ struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_c
net->core_network_code = -1;
net->rtp_base_port = 4000;
+ net->msc_ip = talloc_strdup(net, "127.0.0.1");
+ net->msc_port = 5000;
+
return net;
}
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index 729545a95..05a1d6803 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -433,6 +433,8 @@ static int config_write_net(struct vty *vty)
if (gsmnet->bsc_token)
vty_out(vty, " bsc_token %s%s", gsmnet->bsc_token, VTY_NEWLINE);
+ vty_out(vty, " msc ip %s%s", gsmnet->msc_ip, VTY_NEWLINE);
+ vty_out(vty, " msc port %d%s", gsmnet->msc_port, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -1272,6 +1274,27 @@ DEFUN(cfg_net_pag_any_tch,
return CMD_SUCCESS;
}
+DEFUN(cfg_net_msc_ip,
+ cfg_net_msc_ip_cmd,
+ "msc ip IP",
+ "Set the MSC/MUX IP address.")
+{
+ if (gsmnet->msc_ip)
+ talloc_free(gsmnet->msc_ip);
+ gsmnet->msc_ip = talloc_strdup(gsmnet, argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_msc_port,
+ cfg_net_msc_port_cmd,
+ "msc port <1-65000>",
+ "Set the MSC/MUX port.")
+{
+ gsmnet->msc_port = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+
#define DECLARE_TIMER(number, doc) \
DEFUN(cfg_net_T##number, \
cfg_net_T##number##_cmd, \
@@ -1971,6 +1994,8 @@ int bsc_vty_init(struct gsm_network *net)
install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
install_element(GSMNET_NODE, &cfg_net_bsc_token_cmd);
install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
+ install_element(GSMNET_NODE, &cfg_net_msc_ip_cmd);
+ install_element(GSMNET_NODE, &cfg_net_msc_port_cmd);
install_element(GSMNET_NODE, &cfg_bts_cmd);
install_node(&bts_node, config_write_bts);