aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-23 17:36:01 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-12 23:42:47 +0200
commit90ac6b068413d9dbb5804a0f846175677552e040 (patch)
treea21b7a32a3481a861256a3968b9da82d2abecd5c
parent425cb6ddaa1649b0dc23dfab83745a23075a3164 (diff)
AoIP+3G: use one common SCCP client for A and IuCS
Move osmo_sccp_simple_client() setup out of iu_init() and a_init(). In msc_main.c and sgsn_main.c, initialize the STP connection first and then pass to iu_init() and a_init(). This allows serving 3G (IuCS) and 2G (A) from one and the same MSC instance. Since both OsmoHNBGW and OsmoBSC are using PC 23 by default now, move BSC to PC 42 (because OsmoBSC typically has vty port 4242, bla). Also: a_iface.c: remove now unused defines a_init(): remove osmo_ss7_init() call that duplicated msc_main.c Change-Id: I963a94e1a0bfc455992d22940dcc9c67c44570b9
-rw-r--r--include/openbsc/a_iface.h3
-rw-r--r--include/openbsc/gsm_data.h2
-rw-r--r--include/openbsc/iu.h3
-rw-r--r--src/gprs/sgsn_main.c16
-rw-r--r--src/libiu/iu.c8
-rw-r--r--src/libmsc/a_iface.c14
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c2
-rw-r--r--src/osmo-msc/msc_main.c16
8 files changed, 37 insertions, 27 deletions
diff --git a/include/openbsc/a_iface.h b/include/openbsc/a_iface.h
index 483ffa47..b27c3db8 100644
--- a/include/openbsc/a_iface.h
+++ b/include/openbsc/a_iface.h
@@ -19,8 +19,7 @@
*/
/* Initalize A interface connection between to MSC and BSC */
-int a_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port, struct gsm_network *network);
+int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network);
/* Send DTAP message via A-interface */
int a_iface_tx_dtap(struct msgb *msg);
diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
index b07cac4a..39e2227e 100644
--- a/include/openbsc/gsm_data.h
+++ b/include/openbsc/gsm_data.h
@@ -478,6 +478,8 @@ struct gsm_network {
struct {
enum nsap_addr_enc rab_assign_addr_enc;
} iu;
+
+ struct osmo_sccp_instance *sccp;
};
struct osmo_esme;
diff --git a/include/openbsc/iu.h b/include/openbsc/iu.h
index a0c481aa..65d41ad7 100644
--- a/include/openbsc/iu.h
+++ b/include/openbsc/iu.h
@@ -62,8 +62,7 @@ typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx,
typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id,
struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
-int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port,
+int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
int iu_tx(struct msgb *msg, uint8_t sapi);
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 200e803f..52c300ce 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -61,6 +61,8 @@
#include <osmocom/ctrl/control_if.h>
#include <osmocom/ctrl/ports.h>
+#include <osmocom/sigtran/protocol/m3ua.h>
+
#include <gtp.h>
#include "../../bscconfig.h"
@@ -322,6 +324,7 @@ int main(int argc, char **argv)
{
struct ctrl_handle *ctrl;
struct gsm_network dummy_network;
+ struct osmo_sccp_instance *sccp;
int rc;
srand(time(NULL));
@@ -432,7 +435,18 @@ int main(int argc, char **argv)
}
#ifdef BUILD_IU
- iu_init(tall_bsc_ctx, "OsmoSGSN", 2, "127.0.0.4", "127.0.0.1", 0, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
+ sccp = osmo_sccp_simple_client(tall_bsc_ctx, "OsmoSGSN",
+ 2 /* FIXME: configurable */,
+ OSMO_SS7_ASP_PROT_M3UA, 0,
+ "127.0.0.4" /* FIXME: configurable */,
+ M3UA_PORT,
+ "127.0.0.1" /* FIXME: configurable */);
+ if (!sccp) {
+ printf("Setting up SCCP client failed.\n");
+ return 8;
+ }
+
+ iu_init(tall_bsc_ctx, sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
#endif
if (daemonize) {
diff --git a/src/libiu/iu.c b/src/libiu/iu.c
index 32891f9e..1bb53058 100644
--- a/src/libiu/iu.c
+++ b/src/libiu/iu.c
@@ -752,8 +752,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
return rc;
}
-int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port,
+int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb)
{
talloc_iu_ctx = talloc_named_const(ctx, 1, "iu");
@@ -761,9 +760,8 @@ int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_a
global_iu_recv_cb = iu_recv_cb;
global_iu_event_cb = iu_event_cb;
- g_sccp = osmo_sccp_simple_client(talloc_iu_ctx, name, local_pc, OSMO_SS7_ASP_PROT_M3UA,
- local_port, listen_addr, M3UA_PORT, remote_addr);
- g_scu = osmo_sccp_user_bind(g_sccp, name, sccp_sap_up, OSMO_SCCP_SSN_RANAP);
+ g_sccp = sccp;
+ g_scu = osmo_sccp_user_bind(g_sccp, "OsmoMSC-Iu", sccp_sap_up, OSMO_SCCP_SSN_RANAP);
return 0;
}
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index c6b446b1..ce38e20d 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -38,9 +38,6 @@
#include <osmocom/core/byteswap.h>
#include <osmocom/sccp/sccp_types.h>
-#define SSN_BSSAP 254 /* SCCP_SSN_BSSAP */
-#define SENDER_PC 1 /* Our local point code */
-
/* A pointer to the GSM network we work with. By the current paradigm,
* there can only be one gsm_network per MSC. The pointer is set once
* when calling a_init() */
@@ -383,22 +380,15 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
}
/* Initalize A interface connection between to MSC and BSC */
-int a_init(void *ctx, const char *name, uint32_t local_pc,
- const char *listen_addr, const char *remote_addr, uint16_t local_port, struct gsm_network *network)
+int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network)
{
/* FIXME: Remove hardcoded parameters, use parameters in parameter list */
- struct osmo_sccp_instance *sccp;
-
LOGP(DMSC, LOGL_NOTICE, "Initalizing SCCP connection to stp...\n");
gsm_network = network;
- osmo_ss7_init();
/* SCCP Protocol stack */
- sccp =
- osmo_sccp_simple_client(NULL, name, SENDER_PC, OSMO_SS7_ASP_PROT_M3UA, 0, NULL, M3UA_PORT,
- "127.0.0.1");
- osmo_sccp_user_bind(sccp, name, sccp_sap_up, SSN_BSSAP);
+ osmo_sccp_user_bind(sccp, "OsmoMSC-A", sccp_sap_up, SCCP_SSN_BSSAP);
return 0;
}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 1f8f645a..47113da7 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
msc->msc_con->g_calling_addr.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC;
msc->msc_con->g_calling_addr.ssn = SCCP_SSN_BSSAP;
msc->msc_con->g_calling_addr.ri = OSMO_SCCP_RI_SSN_PC;
- msc->msc_con->g_calling_addr.pc = 23;
+ msc->msc_con->g_calling_addr.pc = 42;
msc->msc_con->g_called_addr.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC;
msc->msc_con->g_called_addr.ssn = SCCP_SSN_BSSAP;
msc->msc_con->g_called_addr.ri = OSMO_SCCP_RI_SSN_PC;
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 3a8e3172..5b4acd2b 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -496,14 +496,22 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
return 7;
}
- /* Set up A-Interface */
- /* TODO: implement A-Interface and remove above legacy stuff. */
+ /* 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) {
+ printf("Setting up SCCP client failed.\n");
+ return 8;
+ }
/* Set up IuCS */
- iu_init(tall_msc_ctx, "OsmoMSC_Iu", 1, "127.0.0.3", "127.0.0.1", 0, rcvmsg_iu_cs, rx_iu_event);
+ iu_init(tall_msc_ctx, msc_network->sccp, rcvmsg_iu_cs, rx_iu_event);
/* Set up A interface */
- a_init(tall_msc_ctx, "OsmoMSC_A", 254, "127.0.0.3", "127.0.0.1", 0, msc_network);
+ a_init(tall_msc_ctx, msc_network->sccp, msc_network);
if (msc_cmdline_config.daemonize) {
rc = osmo_daemonize();