diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-05 22:56:49 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-05 22:56:49 +0200 |
commit | 238d15648142a68b26b57678576b2b047945b011 (patch) | |
tree | 15d4c40bec11327465a2a22067e69e2ec8628a61 /openbsc/src | |
parent | 516c4f073a4fe98c4d02fd883fd2626fa09339d2 (diff) |
nat: Remember a pending delete on an endpoint and carry it out later
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/nat/bsc_mgcp_utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |