summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/gsm_data.h8
-rw-r--r--openbsc/src/libmsc/msc_vty.c28
-rw-r--r--openbsc/src/osmo-msc/msc_main.c62
3 files changed, 87 insertions, 11 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 283b5498c..e3f6fc3ce 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -489,16 +489,20 @@ struct gsm_network {
} mgcpgw;
struct {
+ /* CS7 instance id number (set via VTY) */
+ uint32_t cs7_instance;
enum nsap_addr_enc rab_assign_addr_enc;
+ struct osmo_sccp_instance *sccp;
} iu;
struct {
+ /* CS7 instance id number (set via VTY) */
+ uint32_t cs7_instance;
/* A list with the context information about
* all BSCs we have connections with */
struct llist_head bscs;
+ struct osmo_sccp_instance *sccp;
} a;
-
- struct osmo_sccp_instance *sccp;
};
struct osmo_esme;
diff --git a/openbsc/src/libmsc/msc_vty.c b/openbsc/src/libmsc/msc_vty.c
index b6fff56af..bf664e27a 100644
--- a/openbsc/src/libmsc/msc_vty.c
+++ b/openbsc/src/libmsc/msc_vty.c
@@ -105,6 +105,26 @@ DEFUN(cfg_msc_no_assign_tmsi, cfg_msc_no_assign_tmsi_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_msc_cs7_instance_a,
+ cfg_msc_cs7_instance_a_cmd,
+ "cs7-instance-a <0-15>",
+ "Set SS7 to be used by the A-Interface.\n" "SS7 instance reference number\n")
+{
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ gsmnet->a.cs7_instance = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_msc_cs7_instance_iu,
+ cfg_msc_cs7_instance_iu_cmd,
+ "cs7-instance-iu <0-15>",
+ "Set SS7 to be used by the Iu-Interface.\n" "SS7 instance reference number\n")
+{
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ gsmnet->iu.cs7_instance = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
static int config_write_msc(struct vty *vty)
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
@@ -124,6 +144,11 @@ static int config_write_msc(struct vty *vty)
vty_out(vty, " %sassign-tmsi%s",
gsmnet->vlr->cfg.assign_tmsi? "" : "no ", VTY_NEWLINE);
+ vty_out(vty, " cs7-instance-a %u%s", gsmnet->a.cs7_instance,
+ VTY_NEWLINE);
+ vty_out(vty, " cs7-instance-iu %u%s", gsmnet->iu.cs7_instance,
+ VTY_NEWLINE);
+
mgcpgw_client_config_write(vty, " ");
iu_vty_config_write(vty, " ");
@@ -176,6 +201,9 @@ void msc_vty_init(struct gsm_network *msc_network)
install_element(MSC_NODE, &cfg_msc_no_subscr_create_cmd);
install_element(MSC_NODE, &cfg_msc_assign_tmsi_cmd);
install_element(MSC_NODE, &cfg_msc_no_assign_tmsi_cmd);
+ install_element(MSC_NODE, &cfg_msc_cs7_instance_a_cmd);
+ install_element(MSC_NODE, &cfg_msc_cs7_instance_iu_cmd);
+
mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
}
diff --git a/openbsc/src/osmo-msc/msc_main.c b/openbsc/src/osmo-msc/msc_main.c
index 06e228aa2..adf4752bf 100644
--- a/openbsc/src/osmo-msc/msc_main.c
+++ b/openbsc/src/osmo-msc/msc_main.c
@@ -338,6 +338,55 @@ static int rx_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type,
return iucs_rx_ranap_event(msc_network, ctx, type, data);
}
+#define A_DEFAULT_PC 1
+#define A_DEFAULT_LOCAL_IP "127.0.0.3"
+#define A_DEFAULT_REMOTE_IP "127.0.0.1"
+#define IU_DEFAULT_PC 3
+#define IU_DEFAULT_LOCAL_IP "127.0.0.6"
+#define IU_DEFAULT_REMOTE_IP "127.0.0.1"
+
+/* Setup sigtran connection */
+int ss7_setup(void *ctx)
+{
+ uint32_t cs7_instance_a = msc_network->a.cs7_instance;
+ uint32_t cs7_instance_iu = msc_network->iu.cs7_instance;
+
+ LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifier, A-Interface: %u\n",
+ cs7_instance_a);
+ LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifier, Iu-Interface: %u\n",
+ cs7_instance_iu);
+
+ /* Create first SCCP instance (Iu) */
+ msc_network->iu.sccp =
+ osmo_sccp_simple_client_on_ss7_id(ctx, cs7_instance_iu,
+ "OsmoMSC-Iu", IU_DEFAULT_PC,
+ OSMO_SS7_ASP_PROT_M3UA, 0,
+ IU_DEFAULT_LOCAL_IP, 0,
+ IU_DEFAULT_REMOTE_IP);
+ if (!msc_network->iu.sccp)
+ return -EINVAL;
+
+ /* If the VTY settings indicate, that the user wants to use only a
+ single cs7 instance (A and Iu are running on the same instance,
+ we just copy the pointer and exit early */
+ if (cs7_instance_a == cs7_instance_iu) {
+ msc_network->a.sccp = msc_network->iu.sccp;
+ return 0;
+ }
+
+ /* Create second SCCP instance (A) */
+ msc_network->a.sccp =
+ osmo_sccp_simple_client_on_ss7_id(ctx, cs7_instance_a,
+ "OsmoMSC-A", A_DEFAULT_PC,
+ OSMO_SS7_ASP_PROT_M3UA, 0,
+ A_DEFAULT_LOCAL_IP, 0,
+ A_DEFAULT_REMOTE_IP);
+ if (!msc_network->a.sccp)
+ return -EINVAL;
+
+ return 0;
+}
+
int main(int argc, char **argv)
{
int rc;
@@ -354,6 +403,7 @@ int main(int argc, char **argv)
vty_init(&msc_vty_info);
osmo_ss7_init();
+ osmo_ss7_vty_init_sg();
/* Parse options */
handle_options(argc, argv);
@@ -496,22 +546,16 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
return 7;
}
- /* Set up STP link to receive connections from BSC and HNBGW */
- msc_network->sccp = osmo_sccp_simple_client(tall_msc_ctx, "OsmoMSC",
- 1 /* FIXME: configurable */,
- OSMO_SS7_ASP_PROT_M3UA, 0,
- "127.0.0.3" /* FIXME: configurable */,
- M3UA_PORT, "127.0.0.1" /* FIXME: configurable */);
- if (!msc_network->sccp) {
+ if (ss7_setup(tall_msc_ctx)) {
printf("Setting up SCCP client failed.\n");
return 8;
}
/* Set up IuCS */
- iu_init(tall_msc_ctx, msc_network->sccp, rcvmsg_iu_cs, rx_iu_event);
+ iu_init(tall_msc_ctx, msc_network->iu.sccp, rcvmsg_iu_cs, rx_iu_event);
/* Set up A interface */
- a_init(msc_network->sccp, msc_network);
+ a_init(msc_network->a.sccp, msc_network);
if (msc_cmdline_config.daemonize) {
rc = osmo_daemonize();