aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-09-08 04:00:08 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2017-09-08 04:00:08 +0200
commit986e54a1982dd1bab71dc843ff0c4ae014f83965 (patch)
tree0b87c702e6ddd72a848e7f342421ae1867af01f2
parentb27944450392d5d3dda548a585406224acdf58d6 (diff)
osmo-bsc_nat: Handle multiple mgcp configs in SCCP conn
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/include/openbsc/bsc_nat_sccp.h2
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c4
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c4
4 files changed, 9 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 42af7e912..0531d6e0c 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -394,7 +394,7 @@ void bsc_mgcp_dlcx(struct nat_sccp_connection *);
void bsc_mgcp_free_endpoints(struct bsc_nat *nat);
int bsc_mgcp_nat_init(struct bsc_nat *nat, struct llist_head* cfgs);
-struct nat_sccp_connection *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number);
+struct nat_sccp_connection *bsc_mgcp_find_con(struct bsc_nat *, struct mgcp_config *, int endpoint_number);
struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip,
int port, int osmux, int *first_payload_type, int mode_set);
void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
diff --git a/openbsc/include/openbsc/bsc_nat_sccp.h b/openbsc/include/openbsc/bsc_nat_sccp.h
index 082466408..750db78d6 100644
--- a/openbsc/include/openbsc/bsc_nat_sccp.h
+++ b/openbsc/include/openbsc/bsc_nat_sccp.h
@@ -72,6 +72,8 @@ struct nat_sccp_connection {
struct bsc_connection *bsc;
struct bsc_msc_connection *msc_con;
+ struct msc_config *msc_conf;
+ struct mgcp_config *mgcp_conf;
struct sccp_source_reference real_ref;
struct sccp_source_reference patched_ref;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index ac1a14bc0..79e44a377 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -204,7 +204,7 @@ int bsc_mgcp_assign_patch(struct nat_sccp_connection *con, struct msgb *msg)
endp = mgcp_timeslot_to_endpoint(multiplex, timeslot);
- if (endp >= con->bsc->nat->mgcp_cfg->trunk.number_endpoints) {
+ if (endp >= con->mgcp_conf->trunk.number_endpoints) {
LOGP(DNAT, LOGL_ERROR,
"MSC attempted to assign bad endpoint 0x%x\n",
endp);
@@ -336,7 +336,7 @@ static void remember_pending_dlcx(struct nat_sccp_connection *con, uint32_t tran
}
/* take the endpoint here */
- endp = &bsc->nat->mgcp_cfg->trunk.endpoints[con->msc_endp];
+ endp = &con->mgcp_conf->trunk.endpoints[con->msc_endp];
stats->remote_ref = con->remote_ref;
stats->src_ref = con->patched_ref;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index d59275319..c3838542a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1165,6 +1165,10 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
con->msc_con = msc_conn_by_num(bsc->nat, bsc->nat->default_msc);
}
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->filter_state.con_type = con_type;
con->filter_state.imsi_checked = filter;
bsc_nat_extract_lac(bsc, con, parsed, msg);