From 73f99bc4424d8b72b88f7f58f418c698a5c29ffc Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 19 Apr 2019 10:22:57 +0200 Subject: [PATCH] MNCC: Do not continue with B leg if A leg is cancelled. In case we receive MNCC_RTP_CREATE after MNCC_DISC_IND, check if the call is already marked in_release and if so, send MNCC_REJ_REQ and do not proceed with the B leg. Related: OS#3518 Change-Id: I0eca9a741f7924c2fc32c503dd1a0fc083f94f37 --- src/mncc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mncc.c b/src/mncc.c index b7977c4..ab2bed6 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -104,6 +104,17 @@ static struct mncc_call_leg *mncc_find_leg(uint32_t callref) return NULL; } +/* Find a MNCC Call leg (by callref) which is not yet in release */ +static struct mncc_call_leg *mncc_find_leg_not_released(uint32_t callref) +{ + struct mncc_call_leg *leg = mncc_find_leg(callref); + if (!leg) + return NULL; + if (leg->base.in_release) + return NULL; + return leg; +} + static void mncc_fill_header(struct gsm_mncc *mncc, uint32_t msg_type, uint32_t callref) { struct mncc_call_leg *mncc_leg; @@ -343,7 +354,7 @@ static void check_rtp_connect(struct mncc_connection *conn, const char *buf, int } rtp = (const struct gsm_mncc_rtp *) buf; - leg = mncc_find_leg(rtp->callref); + leg = mncc_find_leg_not_released(rtp->callref); if (!leg) { LOGP(DMNCC, LOGL_ERROR, "leg(%u) can not be found\n", rtp->callref); return mncc_send(conn, MNCC_REJ_REQ, rtp->callref); @@ -373,7 +384,7 @@ static void check_rtp_create(struct mncc_connection *conn, const char *buf, int } rtp = (const struct gsm_mncc_rtp *) buf; - leg = mncc_find_leg(rtp->callref); + leg = mncc_find_leg_not_released(rtp->callref); if (!leg) { LOGP(DMNCC, LOGL_ERROR, "call(%u) can not be found\n", rtp->callref); return mncc_send(conn, MNCC_REJ_REQ, rtp->callref);