aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/gsup_client.h7
-rw-r--r--openbsc/include/openbsc/vlr.h5
-rw-r--r--openbsc/src/gprs/gprs_subscriber.c1
-rw-r--r--openbsc/src/libcommon/gsup_client.c16
-rw-r--r--openbsc/src/libcommon/gsup_test_client.c4
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c2
-rw-r--r--openbsc/src/libvlr/vlr.c7
-rw-r--r--openbsc/tests/vlr/vlr_test.c2
8 files changed, 29 insertions, 15 deletions
diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h
index a113225e1..4a25490f6 100644
--- a/openbsc/include/openbsc/gsup_client.h
+++ b/openbsc/include/openbsc/gsup_client.h
@@ -37,6 +37,8 @@ typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc,
struct msgb *msg);
struct gsup_client {
+ const char *unit_name;
+
struct ipa_client_conn *link;
gsup_client_read_cb_t read_cb;
void *data;
@@ -49,10 +51,11 @@ struct gsup_client {
int got_ipa_pong;
};
-struct gsup_client *gsup_client_create(const char *ip_addr,
+struct gsup_client *gsup_client_create(const char *unit_name,
+ const char *ip_addr,
unsigned int tcp_port,
gsup_client_read_cb_t read_cb,
- struct oap_client_config *oap_config);
+ struct oap_client_config *oapc_config);
void gsup_client_destroy(struct gsup_client *gsupc);
int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg);
diff --git a/openbsc/include/openbsc/vlr.h b/openbsc/include/openbsc/vlr.h
index 9c469cec9..a72970848 100644
--- a/openbsc/include/openbsc/vlr.h
+++ b/openbsc/include/openbsc/vlr.h
@@ -259,9 +259,8 @@ int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub);
void vlr_subscr_conn_timeout(struct vlr_subscr *vsub);
struct vlr_instance *vlr_alloc(void *ctx, const struct vlr_ops *ops);
-int vlr_start(struct vlr_instance *vlr, const char *gsup_server_addr_str,
- uint16_t gsup_server_port);
-
+int vlr_start(const char *gsup_unit_name, struct vlr_instance *vlr,
+ const char *gsup_server_addr_str, uint16_t gsup_server_port);
/* internal use only */
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 2042ec6eb..460cc277a 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -69,6 +69,7 @@ int gprs_subscr_init(struct sgsn_instance *sgi)
addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr);
sgi->gsup_client = gsup_client_create(
+ "SGSN",
addr_str, sgi->cfg.gsup_server_port,
&gsup_read_cb,
&sgi->cfg.oap);
diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c
index 4ed5c27ed..d3fd736ef 100644
--- a/openbsc/src/libcommon/gsup_client.c
+++ b/openbsc/src/libcommon/gsup_client.c
@@ -173,10 +173,13 @@ static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg)
struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg);
struct gsup_client *gsupc = (struct gsup_client *)link->data;
int rc;
- static struct ipaccess_unit ipa_dev = {
- .unit_name = "SGSN"
+ struct ipaccess_unit ipa_dev = {
+ /* see gsup_client_create() on const vs non-const */
+ .unit_name = (char*)gsupc->unit_name,
};
+ OSMO_ASSERT(ipa_dev.unit_name);
+
msg->l2h = &hh->data[0];
rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg);
@@ -263,7 +266,8 @@ static void start_test_procedure(struct gsup_client *gsupc)
gsup_client_send_ping(gsupc);
}
-struct gsup_client *gsup_client_create(const char *ip_addr,
+struct gsup_client *gsup_client_create(const char *unit_name,
+ const char *ip_addr,
unsigned int tcp_port,
gsup_client_read_cb_t read_cb,
struct oap_client_config *oapc_config)
@@ -274,6 +278,12 @@ struct gsup_client *gsup_client_create(const char *ip_addr,
gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client);
OSMO_ASSERT(gsupc);
+ /* struct ipaccess_unit has a non-const unit_name, so let's copy to be
+ * able to have a non-const unit_name here as well. To not taint the
+ * public gsup_client API, let's store it in a const char* anyway. */
+ gsupc->unit_name = talloc_strdup(gsupc, unit_name);
+ OSMO_ASSERT(gsupc->unit_name);
+
/* a NULL oapc_config will mark oap_state disabled. */
rc = oap_client_init(oapc_config, &gsupc->oap_state);
if (rc != 0)
diff --git a/openbsc/src/libcommon/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c
index 8be4e7aea..ce302353c 100644
--- a/openbsc/src/libcommon/gsup_test_client.c
+++ b/openbsc/src/libcommon/gsup_test_client.c
@@ -276,8 +276,8 @@ int main(int argc, char **argv)
osmo_init_logging(&gsup_test_client_log_info);
- g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb,
- NULL);
+ g_gc = gsup_client_create("GSUPTEST",server_host, server_port,
+ gsupc_read_cb, NULL);
signal(SIGINT, sig_cb);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 8c2e835ce..92760cdef 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -3880,7 +3880,7 @@ int msc_vlr_alloc(struct gsm_network *net)
int msc_vlr_start(struct gsm_network *net)
{
OSMO_ASSERT(net->vlr);
- return vlr_start(net->vlr, net->gsup_server_addr_str,
+ return vlr_start("MSC", net->vlr, net->gsup_server_addr_str,
net->gsup_server_port);
}
diff --git a/openbsc/src/libvlr/vlr.c b/openbsc/src/libvlr/vlr.c
index bc8d43d92..db874f298 100644
--- a/openbsc/src/libvlr/vlr.c
+++ b/openbsc/src/libvlr/vlr.c
@@ -959,12 +959,13 @@ struct vlr_instance *vlr_alloc(void *ctx, const struct vlr_ops *ops)
return vlr;
}
-int vlr_start(struct vlr_instance *vlr, const char *gsup_server_addr_str,
- uint16_t gsup_server_port)
+int vlr_start(const char *gsup_unit_name, struct vlr_instance *vlr,
+ const char *gsup_server_addr_str, uint16_t gsup_server_port)
{
OSMO_ASSERT(vlr);
- vlr->gsup_client = gsup_client_create(gsup_server_addr_str,
+ vlr->gsup_client = gsup_client_create(gsup_unit_name,
+ gsup_server_addr_str,
gsup_server_port,
&vlr_gsupc_read_cb, NULL);
if (!vlr->gsup_client)
diff --git a/openbsc/tests/vlr/vlr_test.c b/openbsc/tests/vlr/vlr_test.c
index 5433e3e41..055b0432f 100644
--- a/openbsc/tests/vlr/vlr_test.c
+++ b/openbsc/tests/vlr/vlr_test.c
@@ -671,7 +671,7 @@ int main(int argc, char **argv)
osmo_init_logging(&log_info);
g_vlr = vlr_alloc(NULL, &test_vlr_ops);
- vlr_start(g_vlr, "localhost", 2222);
+ vlr_start("VLRTEST", g_vlr, "localhost", 2222);
OSMO_ASSERT(g_vlr);
osmo_fsm_register(&vlr_test_fsm);
osmo_fsm_register(&test_sub_pres_vlr_fsm);