Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11307 ) Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. gsm_04_08_cc: Add global guard timer for MNCC The external MNCC handler may hang indefinitely in cases where the remote end of the MNCC ceases to work properly. Add a global guard timer to make sure the call reaches ACTIVE state. Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Related: OS#3599 --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/transaction.h M src/libmsc/gsm_04_08_cc.c M src/libmsc/msc_vty.c M src/libmsc/osmo_msc.c M tests/msc_vlr/msc_vlr_test_call.err 6 files changed, 94 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 54026f6..579697e 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -332,6 +332,9 @@ /* Periodic location update default value */ uint8_t t3212; + /* Global MNCC guard timer value */ + int mncc_guard_timeout; + struct { struct mgcp_client_conf conf; struct mgcp_client *client; diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h index 4ffb468..b7d7971 100644 --- a/include/osmocom/msc/transaction.h +++ b/include/osmocom/msc/transaction.h @@ -69,6 +69,7 @@ int Tcurrent; /* current CC timer */ int T308_second;/* used to send release again */ struct osmo_timer_list timer; + struct osmo_timer_list timer_guard; struct gsm_mncc msg;/* stores setup/disconnect/release message */ } cc; struct { diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 19e6cba..f9888d7 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -73,6 +73,43 @@ static uint32_t new_callref = 0x8001; +static void gsm48_cc_guard_timeout(void *arg) +{ + struct gsm_trans *trans = arg; + DEBUGP(DCC, "(sub %s) guard timeout expired\n", + vlr_subscr_msisdn_or_name(trans->vsub)); + trans_free(trans); + return; +} + +static void gsm48_stop_guard_timer(struct gsm_trans *trans) +{ + if (osmo_timer_pending(>cc.timer_guard)) { + DEBUGP(DCC, "(sub %s) stopping pending guard timer\n", + vlr_subscr_msisdn_or_name(trans->vsub)); + osmo_timer_del(>cc.timer_guard); + } +} + +static void gsm48_start_guard_timer(struct gsm_trans *trans) +{ + /* NOTE: The purpose of this timer is to prevent the cc state machine +* from hanging in cases where mncc, gsm48 or both become unresponsive +* for some reason. The timer is started initially with the setup from +* the gsm48 side and then re-started with every incoming mncc message. +* Once the mncc state reaches its active state the timer is stopped. +* So if the cc state machine does not show any activity for an +* extended amount of time during call setup or teardown the guard +* timer will time out and hard-clear the connection. */ + if (osmo_timer_pending(>cc.timer_guard)) + gsm48_stop_guard_timer(trans); + DEBUGP(DCC, "(sub %s) starting guard timer with %d seconds\n", + vlr_subscr_msisdn_or_name(trans->vsub), + trans->net->mncc_guard_timeout); + osmo_timer_setup(>cc.timer_guard, gsm48_cc_guard_timeout, trans); + osmo_timer_schedule(>cc.timer_guard, + trans->net->mncc_guard_timeout, 0); +} /* Call Control */ @@ -149,6 +186,10 @@ count_statistics(trans, state); trans->cc.state = state; + + /* Stop the guard timer when a call reaches the active state */ + if (state == GSM_CSTATE_ACTIVE) + gsm48_stop_guard_timer(trans); } static int gsm48_cc_tx_status(struct gsm_trans *trans, void *arg) @@ -259,6 +300,8 @@ } if (trans->cc.state != GSM_CSTATE_NULL) new_cc_state(trans, GSM_CSTATE_NULL); + + gsm48_stop_guard_timer(trans); } static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg); @@ -474,6 +517,8 @@ struct tlv_parsed tp; struct gsm_mncc setup; + gsm48_start_guard_timer(trans); + memset(, 0, sizeof(struct gsm_mncc)); setup.callref = trans->callref; @@ -1970,6 +2015,8 @@ log_set_context(LOG_CTX_VLR_SUBSCR, trans->vsub); } + gsm48_start_guard_timer(trans); + if (trans->conn) conn = trans->conn; diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index fe6ae88..a16cec8 100644 --- a/src/libmsc/msc_vty.c +++
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/11307 ) Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 5 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr Gerrit-Comment-Date: Wed, 24 Oct 2018 09:04:10 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/11307 to look at the new patch set (#5). Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. gsm_04_08_cc: Add global guard timer for MNCC The external MNCC handler may hang indefinitely in cases where the remote end of the MNCC ceases to work properly. Add a global guard timer to make sure the call reaches ACTIVE state. Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Related: OS#3599 --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/transaction.h M src/libmsc/gsm_04_08_cc.c M src/libmsc/msc_vty.c M src/libmsc/osmo_msc.c M tests/msc_vlr/msc_vlr_test_call.err 6 files changed, 94 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/07/11307/5 -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 5 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/11307 to look at the new patch set (#4). Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. gsm_04_08_cc: Add global guard timer for MNCC The external MNCC handler may hang indefinitely in cases where the remote end of the MNCC ceases to work properly. Add a global guard timer to make sure the call reaches ACTIVE state. Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Related: OS#3599 --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/transaction.h M src/libmsc/gsm_04_08_cc.c M src/libmsc/msc_vty.c M src/libmsc/osmo_msc.c M tests/msc_vlr/msc_vlr_test_call.err 6 files changed, 94 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/07/11307/4 -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 4 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/11307 ) Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. Patch Set 3: Code-Review+1 (3 comments) https://gerrit.osmocom.org/#/c/11307/3/src/libmsc/gsm_04_08_cc.c File src/libmsc/gsm_04_08_cc.c: https://gerrit.osmocom.org/#/c/11307/3/src/libmsc/gsm_04_08_cc.c@80 PS3, Line 80: vlr_subscr_msisdn_or_name(trans->vsub)); (best use same formatting as other logging in this file, e.g. line 2025) https://gerrit.osmocom.org/#/c/11307/3/src/libmsc/gsm_04_08_cc.c@89 PS3, Line 89: vlr_subscr_msisdn_or_name(trans->vsub)); re https://gerrit.osmocom.org/#/c/11307/3/src/libmsc/osmo_msc.c File src/libmsc/osmo_msc.c: https://gerrit.osmocom.org/#/c/11307/3/src/libmsc/osmo_msc.c@57 PS3, Line 57: /* If the mncc interface remains silent for more then 3 minutes, ("than" .. "during setup" ... or maybe just drop the comment anyway, it's obvious enough) -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 3 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr Gerrit-Comment-Date: Wed, 17 Oct 2018 14:10:18 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/11307 to look at the new patch set (#2). Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. gsm_04_08_cc: Add global guard timer for MNCC The external MNCC handler may hang indefinitely in cases where the remote end of the MNCC ceases to work properly. Add a global guard timer to make sure the call reaches ACTIVE state. Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Related: OS#3599 --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/transaction.h M src/libmsc/gsm_04_08_cc.c M src/libmsc/msc_vty.c M src/libmsc/osmo_msc.c M tests/msc_vlr/msc_vlr_test_call.err 6 files changed, 95 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/07/11307/2 -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 2 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/11307 ) Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. Patch Set 1: Code-Review-1 (1 comment) looks good, but the actual timeout value should receive some more consideration. https://gerrit.osmocom.org/#/c/11307/1/src/libmsc/gsm_04_08_cc.c File src/libmsc/gsm_04_08_cc.c: https://gerrit.osmocom.org/#/c/11307/1/src/libmsc/gsm_04_08_cc.c@76 PS1, Line 76: #define GUARD_TIMEOUT 65 > should this be configurable? it should be configurable, and I am afraid 65 seconds is way too little. According to TS 04.07, we have something like 180 seconds of default timeout when alerting the remote end alone. This means that the phone of the called subscriber could be ringing for 3 minutes before an answer. And if the called party picks up after 2:50 minutes after starting to alert (which is probably easily more than 3 minutes after attempting the call), it is still a successful call. With 65 seconds global guard timer, we would kill the call too early. -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 1 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr Gerrit-Comment-Date: Fri, 12 Oct 2018 06:29:45 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/11307 ) Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. Patch Set 1: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/11307/1/src/libmsc/gsm_04_08_cc.c File src/libmsc/gsm_04_08_cc.c: https://gerrit.osmocom.org/#/c/11307/1/src/libmsc/gsm_04_08_cc.c@76 PS1, Line 76: #define GUARD_TIMEOUT 65 should this be configurable? https://gerrit.osmocom.org/#/c/11307/1/src/libmsc/gsm_04_08_cc.c@90 PS1, Line 90: DEBUGP(DCC, "stopping pending guard timer for subscr %s\n", place the context information first, like below in line 173. I'd also prefer to use vlr_subscr_name() to match most other logging. -- To view, visit https://gerrit.osmocom.org/11307 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Gerrit-Change-Number: 11307 Gerrit-PatchSet: 1 Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Neels Hofmeyr Gerrit-Comment-Date: Thu, 11 Oct 2018 13:15:38 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-msc[master]: gsm_04_08_cc: Add global guard timer for MNCC
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/11307 Change subject: gsm_04_08_cc: Add global guard timer for MNCC .. gsm_04_08_cc: Add global guard timer for MNCC The external MNCC handler may hang indefinitely in cases where the remote end of the MNCC ceases to work properly. Add a global guard timer to make sure the call reaches ACTIVE state. Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d Related: OS#3599 --- M include/osmocom/msc/transaction.h M src/libmsc/gsm_04_08_cc.c M tests/msc_vlr/msc_vlr_test_call.err 3 files changed, 60 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/07/11307/1 diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h index 4ffb468..b7d7971 100644 --- a/include/osmocom/msc/transaction.h +++ b/include/osmocom/msc/transaction.h @@ -69,6 +69,7 @@ int Tcurrent; /* current CC timer */ int T308_second;/* used to send release again */ struct osmo_timer_list timer; + struct osmo_timer_list timer_guard; struct gsm_mncc msg;/* stores setup/disconnect/release message */ } cc; struct { diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 19e6cba..7410947 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -73,6 +73,35 @@ static uint32_t new_callref = 0x8001; +#define GUARD_TIMEOUT 65 + +static void gsm48_cc_guard_timeout(void *arg) +{ + struct gsm_trans *trans = arg; + DEBUGP(DCC, "guard timeout for subscr %s\n", + vlr_subscr_msisdn_or_name(trans->vsub)); + trans_free(trans); + return; +} + +static void gsm48_stop_guard_timer(struct gsm_trans *trans) +{ + if (osmo_timer_pending(>cc.timer_guard)) { + DEBUGP(DCC, "stopping pending guard timer for subscr %s\n", + vlr_subscr_msisdn_or_name(trans->vsub)); + osmo_timer_del(>cc.timer_guard); + } +} + +static void gsm48_start_guard_timer(struct gsm_trans *trans) +{ + if (osmo_timer_pending(>cc.timer_guard)) + gsm48_stop_guard_timer(trans); + DEBUGP(DCC, "starting guard timer with %d seconds for subscr %s\n", + GUARD_TIMEOUT, vlr_subscr_msisdn_or_name(trans->vsub)); + osmo_timer_setup(>cc.timer_guard, gsm48_cc_guard_timeout, trans); + osmo_timer_schedule(>cc.timer_guard, GUARD_TIMEOUT, 0); +} /* Call Control */ @@ -149,6 +178,10 @@ count_statistics(trans, state); trans->cc.state = state; + + /* Stop the guard timer when a call reaches the active state */ + if (state == GSM_CSTATE_ACTIVE) + gsm48_stop_guard_timer(trans); } static int gsm48_cc_tx_status(struct gsm_trans *trans, void *arg) @@ -259,6 +292,8 @@ } if (trans->cc.state != GSM_CSTATE_NULL) new_cc_state(trans, GSM_CSTATE_NULL); + + gsm48_stop_guard_timer(trans); } static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg); @@ -1970,6 +2005,8 @@ log_set_context(LOG_CTX_VLR_SUBSCR, trans->vsub); } + gsm48_start_guard_timer(trans); + if (trans->conn) conn = trans->conn; diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err index 19cb25d..9c68ea5 100644 --- a/tests/msc_vlr/msc_vlr_test_call.err +++ b/tests/msc_vlr/msc_vlr_test_call.err @@ -287,6 +287,7 @@ DREF MSISDN:42342: MSC conn use - dtap == 1 (0x10: trans_cc) - MNCC says that's fine DMNCC receive message MNCC_CALL_PROC_REQ +DCC starting guard timer with 65 seconds for subscr 42342 DCC (ti 08 sub 42342) Received 'MNCC_CALL_PROC_REQ' from MNCC in state 1 (INITIATED) DCC (ti 08 sub MSISDN:42342) new state INITIATED -> MO_CALL_PROC DMSC msc_tx 2 bytes to MSISDN:42342 via RAN_UTRAN_IU @@ -296,12 +297,16 @@ - Total time passed: 1.23 s - The other call leg got established (not shown here), MNCC tells us so DMNCC receive message MNCC_ALERT_REQ +DCC stopping pending guard timer for subscr 42342 +DCC starting guard timer with 65 seconds for subscr 42342 DCC (ti 08 sub 42342) Received 'MNCC_ALERT_REQ' from MNCC in state 3 (MO_CALL_PROC) DCC (ti 08 sub MSISDN:42342) new state MO_CALL_PROC -> CALL_DELIVERED DMSC msc_tx 2 bytes to MSISDN:42342 via RAN_UTRAN_IU - DTAP --RAN_UTRAN_IU--> MS: GSM48_MT_CC_ALERTING: 8301 - DTAP matches expected message DMNCC receive message MNCC_SETUP_RSP +DCC stopping pending guard timer for subscr 42342 +DCC starting guard timer with 65 seconds for subscr 42342 DCC (ti 08 sub 42342) Received 'MNCC_SETUP_RSP' from MNCC in state 4 (CALL_DELIVERED) DCC starting timer T313 with 30 seconds DCC (ti 08 sub MSISDN:42342) new state CALL_DELIVERED -> CONNECT_IND @@ -314,6 +319,7 @@