aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-05 22:56:49 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-05 22:56:49 +0200
commit238d15648142a68b26b57678576b2b047945b011 (patch)
tree15d4c40bec11327465a2a22067e69e2ec8628a61 /openbsc
parent516c4f073a4fe98c4d02fd883fd2626fa09339d2 (diff)
nat: Remember a pending delete on an endpoint and carry it out later
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index e27234911..13bdc7184 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -134,6 +134,8 @@ struct bsc_endpoint {
char *transaction_id;
/* the bsc we are talking to */
struct bsc_connection *bsc;
+ /* pending delete */
+ int pending_delete;
};
/**
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index 1ccb1364e..49c44668e 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -150,6 +150,7 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c
bsc_endp->transaction_id = talloc_strdup(nat, transaction_id);
bsc_endp->bsc = bsc_con;
+ bsc_endp->pending_delete = state == MGCP_ENDP_DLCX;
/* we need to update some bits */
if (state == MGCP_ENDP_CRCX) {
@@ -232,6 +233,13 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
endp->bts_rtcp = htons(port + 1);
output = bsc_mgcp_rewrite((char * ) msg->l2h, msgb_l2len(msg),
bsc->nat->mgcp_cfg->source_addr, endp->rtp_port);
+
+ if (bsc_endp->pending_delete) {
+ mgcp_free_endp(endp);
+ bsc_endp->bsc = NULL;
+ bsc_endp->pending_delete = 0;
+ }
+
if (!output) {
LOGP(DMGCP, LOGL_ERROR, "Failed to rewrite MGCP msg.\n");
return;