summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-31 00:48:07 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-31 00:48:07 +0200
commitd6a4ebc6462a1cf7e1e12587967363441dc7dc7b (patch)
tree04c5f56f51185e23ed80dd7d65db5952e7e4583c
parentefe9ab1921f9fb8927c142ddd4403233ed72cd85 (diff)
nat: Check if compression is enabled on the trunk
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index a80ac83..b2d83f5 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -306,6 +306,8 @@ int bsc_mgcp_policy_cb(struct mgcp_trunk_config *tcfg, int endpoint, int state,
bsc_endp = &nat->bsc_endpoints[endpoint];
mgcp_endp = &nat->mgcp_cfg->trunk.endpoints[endpoint];
+ int compr = 0;
+
if (bsc_endp->transaction_id) {
LOGP(DMGCP, LOGL_ERROR, "Endpoint 0x%x had pending transaction: '%s'\n",
endpoint, bsc_endp->transaction_id);
@@ -337,10 +339,14 @@ int bsc_mgcp_policy_cb(struct mgcp_trunk_config *tcfg, int endpoint, int state,
}
}
+ if (nat->mgcp_cfg->trunk.compress_dir == COMPR_BTS
+ && sccp->bsc->cfg->allow_compr)
+ compr = 1;
+
/* we need to generate a new and patched message */
bsc_msg = bsc_mgcp_rewrite((char *) nat->mgcp_msg, nat->mgcp_length, sccp->bsc_endp,
nat->mgcp_cfg->source_addr, mgcp_endp->bts_end.local_port,
- sccp->bsc->cfg->allow_compr);
+ compr);
if (!bsc_msg) {
LOGP(DMGCP, LOGL_ERROR, "Failed to patch the msg.\n");
return MGCP_POLICY_CONT;
@@ -363,7 +369,7 @@ int bsc_mgcp_policy_cb(struct mgcp_trunk_config *tcfg, int endpoint, int state,
}
/* enable the compression on this endpoint */
- if (sccp->bsc->cfg->allow_compr)
+ if (compr)
mgcp_endp->compr_enabled = 1;
/* send the message and a fake MDCX to force sending of a dummy packet */