aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-09-08 04:00:08 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2018-01-30 18:59:28 +0100
commit7414b37ce62b7839c20e84661a39ccb8feba039f (patch)
tree2dae9e8dbfb0740c4a9ff0ef7087c3c07e2cdc58
parentdaf3885b1a848a1a9896cc70a18bbcf5f380f468 (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 687511f01..14a41925e 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -405,7 +405,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 1a97537fc..32e3f4f8e 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 89f99064d..faa65257a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1167,6 +1167,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);