jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/34840?usp=email )


Change subject: LAPDm: Correctly count expiry of T200 during 
estabishment/release
......................................................................

LAPDm: Correctly count expiry of T200 during estabishment/release

After T200 expires N200+1 times, the link establishment or relase
fails. The counting must be performed prior check.

Related: OS#5970
Change-Id: Icf44e26420fc91312e7c8972a2f3ed475e42fc48
---
M src/isdn/lapd_core.c
1 file changed, 17 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/34840/1

diff --git a/src/isdn/lapd_core.c b/src/isdn/lapd_core.c
index 6475cb0..5674c66 100644
--- a/src/isdn/lapd_core.c
+++ b/src/isdn/lapd_core.c
@@ -593,6 +593,8 @@
        switch (dl->state) {
        case LAPD_STATE_SABM_SENT:
                /* 5.4.1.3 */
+               /* increment re-transmission counter */
+               dl->retrans_ctr++;
                if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
                        /* flush tx and send buffers */
                        lapd_dl_flush_tx(dl);
@@ -611,13 +613,13 @@
                }
                /* retransmit SABM command */
                lapd_send_resend(dl);
-               /* increment re-transmission counter */
-               dl->retrans_ctr++;
                /* restart T200 (PH-READY-TO-SEND) */
                lapd_start_t200(dl);
                break;
        case LAPD_STATE_DISC_SENT:
                /* 5.4.4.3 */
+               /* increment re-transmission counter */
+               dl->retrans_ctr++;
                if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
                        /* send MDL ERROR INIDCATION to L3 */
                        mdl_error(MDL_CAUSE_T200_EXPIRED, &dl->lctx);
@@ -635,8 +637,6 @@
                }
                /* retransmit DISC command */
                lapd_send_resend(dl);
-               /* increment re-transmission counter */
-               dl->retrans_ctr++;
                /* restart T200 (PH-READY-TO-SEND) */
                lapd_start_t200(dl);
                break;

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34840?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icf44e26420fc91312e7c8972a2f3ed475e42fc48
Gerrit-Change-Number: 34840
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andr...@eversberg.eu>
Gerrit-MessageType: newchange

Reply via email to