summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-09-19 18:07:41 +0200
committerMax <msuraev@sysmocom.de>2017-09-19 18:27:26 +0200
commit14d90026e733ed11a2022d8e06d13fa19f9ae446 (patch)
tree26b332b536b19514cd802bcf18090342a85f64db
parentc439059783d6237d5599857714ea133214652dbd (diff)
libmgcp: Pass the pointer to the mgcp list on inituser/max/mscsplit
Adjusted by Max <msuraev@sysmocom.de> Ticket: SYS#3208 Sponsored-by: On-Waves ehf. Change-Id: I2d51589670bb602422ec98521eec620948752e36
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/include/openbsc/mgcp.h3
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c5
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_main.c6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c4
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c1
7 files changed, 13 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 8184379..d446aa4 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -265,7 +265,7 @@ struct bsc_nat {
int bsc_ip_dscp;
/* MGCP config */
- struct llist_head mgcp_cfgs;
+ struct llist_head *mgcp_cfgs;
uint8_t mgcp_msg[4096];
int mgcp_length;
int mgcp_ipa;
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 8f5d97b..c3e4f18 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -243,8 +243,7 @@ struct mgcp_config {
/* config management */
struct mgcp_config *mgcp_config_alloc(void);
struct mgcp_config *mgcp_config_by_num(struct llist_head *configs, unsigned index);
-int mgcp_parse_config(const char *config_file, struct llist_head *cfg,
- enum mgcp_role role);
+int mgcp_parse_config(const char *config_file, struct llist_head **cfg, enum mgcp_role role);
int mgcp_vty_init(void);
int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
void mgcp_release_endp(struct mgcp_endpoint *endp);
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 55377a8..b15740b 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -1690,7 +1690,7 @@ static int allocate_trunk(struct mgcp_trunk_config *trunk)
return 0;
}
-int mgcp_parse_config(const char *config_file, struct llist_head *cfgs,
+int mgcp_parse_config(const char *config_file, struct llist_head **cfgs,
enum mgcp_role role)
{
int rc;
@@ -1731,7 +1731,8 @@ int mgcp_parse_config(const char *config_file, struct llist_head *cfgs,
}
cfg->role = role;
}
- memcpy(cfgs, &mgcp_configs, sizeof(struct llist_head));
+
+ *cfgs = &mgcp_configs;
return 0;
}
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 8af7eb9..4b41da4 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -199,7 +199,7 @@ static struct vty_app_info vty_info = {
int main(int argc, char **argv)
{
- struct llist_head mgcp_cfgs;
+ struct llist_head *mgcp_cfgs;
struct gsm_network dummy_network;
struct sockaddr_in addr;
int on = 1, rc;
@@ -225,10 +225,10 @@ int main(int argc, char **argv)
if (rc < 0)
return rc;
- if (llist_empty(&mgcp_cfgs))
+ if (llist_empty(mgcp_cfgs))
return -1;
- cfg = llist_entry(mgcp_cfgs.next, struct mgcp_config, entry);
+ cfg = llist_entry(mgcp_cfgs->next, struct mgcp_config, entry);
#ifdef BUILD_MGCP_TRANSCODING
cfg->setup_rtp_processing_cb = &mgcp_transcoding_setup;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 848fcd1..6b57445 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -258,7 +258,7 @@ void bsc_mgcp_free_endpoints(struct bsc_nat *nat)
int i;
struct mgcp_config *mgcp_cfg;
- llist_for_each_entry(mgcp_cfg, &nat->mgcp_cfgs, entry) {
+ llist_for_each_entry(mgcp_cfg, nat->mgcp_cfgs, entry) {
for (i = 1; i < mgcp_cfg->trunk.number_endpoints; ++i){
bsc_mgcp_free_endpoint(mgcp_cfg, i);
mgcp_release_endp(&mgcp_cfg->trunk.endpoints[i]);
@@ -733,7 +733,7 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
return;
}
- llist_for_each_entry(mgcp_cfg, &bsc->nat->mgcp_cfgs, entry) {
+ llist_for_each_entry(mgcp_cfg, bsc->nat->mgcp_cfgs, entry) {
mgcp_nat = mgcp_cfg->data;
for (i = 1; i < mgcp_cfg->trunk.number_endpoints; ++i) {
if (mgcp_nat->bsc_endpoints[i].bsc != bsc)
@@ -1175,7 +1175,7 @@ void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc)
if (bsc->cfg)
ctr = &bsc->cfg->stats.ctrg->ctr[BCFG_CTR_DROPPED_CALLS];
- llist_for_each_entry(mgcp_cfg, &bsc->nat->mgcp_cfgs, entry) {
+ llist_for_each_entry(mgcp_cfg, bsc->nat->mgcp_cfgs, entry) {
mgcp_nat = mgcp_cfg->data;
for (i = 1; i < mgcp_cfg->trunk.number_endpoints; ++i) {
struct bsc_endpoint *bsc_endp = &mgcp_nat->bsc_endpoints[i];
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 98e002d..1a6ffa2 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1167,7 +1167,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
con_msc = con->msc_con;
/* Shortcuts for handling later */
con->msc_conf = msc_config_by_con(bsc->nat, con_msc);
- con->mgcp_conf = mgcp_config_by_num(&bsc->nat->mgcp_cfgs, con->msc_conf->nr);
+ con->mgcp_conf = mgcp_config_by_num(bsc->nat->mgcp_cfgs, con->msc_conf->nr);
con->filter_state.con_type = con_type;
con->filter_state.imsi_checked = filter;
@@ -1658,7 +1658,7 @@ int main(int argc, char **argv)
/*
* Setup the MGCP code..
*/
- if (bsc_mgcp_nat_init(nat, &nat->mgcp_cfgs) != 0)
+ if (bsc_mgcp_nat_init(nat, nat->mgcp_cfgs) != 0)
return -4;
/* start control interface after reading config for
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 7a43777..5bed6cd 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -87,7 +87,6 @@ struct bsc_nat *bsc_nat_alloc(void)
INIT_LLIST_HEAD(&nat->tpdest_match);
INIT_LLIST_HEAD(&nat->sms_clear_tp_srr);
INIT_LLIST_HEAD(&nat->sms_num_rewr);
- INIT_LLIST_HEAD(&nat->mgcp_cfgs);
nat->stats.sccp.conn = osmo_counter_alloc("nat.sccp.conn");
nat->stats.sccp.calls = osmo_counter_alloc("nat.sccp.calls");