summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-09-15 13:52:04 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2017-09-15 13:52:04 +0200
commit11c316f5dd081d3a695812da2ab1e553ebb3be1b (patch)
tree83d3dc19e5079bde6791e7c6daba8cc80c64077b
parentdb3f545da1f48e3cf37de4309cc290e4790c8884 (diff)
libmgcp: Pass the pointer to the mgcp list on init, don't copy itusers/daniel/ow-nat-msc-conns
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/include/openbsc/mgcp.h2
-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, 13 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 0531d6e..3d240c1 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -260,7 +260,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 cdc6f03..dbb9ff1 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -243,7 +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, int index);
-int mgcp_parse_config(const char *config_file, struct llist_head *cfg,
+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);
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index e860468..99d0b9a 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -1681,7 +1681,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;
@@ -1722,7 +1722,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 87154c2..08a6751 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;
@@ -224,10 +224,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);
rc = telnet_init(tall_bsc_ctx, &dummy_network, OSMO_VTY_PORT_BSC_MGCP);
if (rc < 0)
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 c383854..ca2d425 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;
@@ -1651,7 +1651,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;
nat->ctrl = bsc_nat_controlif_setup(nat, 4250);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 634f579..0997aa6 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");