jolly has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35130?usp=email )
Change subject: LAPDm: Enable flag to prevent sending two subsequent REJ frame ......................................................................
LAPDm: Enable flag to prevent sending two subsequent REJ frame
Setting the flag was not required in earlier versions of libosmogsm, because this feature was enabled by default.
The roundtrip delay for a LAPD link must be less than T200.
Osmocom-bb runs LAPDm on the host machine via serial interface and USB interface that may cause a roundtrip delay that exceeds T200. Also osmo-bts may have that problem, due to latency between physical interface and osmo-bts software.
What may happen:
An I frame gets lost.
The sending side transmits the next I frame. The receiving side detects the send-sequence error and responds with a REJ frame.
Due to the round trip delay, the T200 expires on the sending side and causes the I frame to be retransmitted with the P bit set, it enters the timer recovery state. The receiving side detects the send-sequence error and responds with a REJ frame with the F bit set.
The sending side will then receive two REJ frames. The first REJ frame will clear the timer recovery state. The second REJ frame (with F bit set) is received when not in timer recovery state, causing an MDL-ERROR-INDICATION.
The layer 2 connection is broken.
Early tests with osmocom-bb in a real network showed exactly this problem.
The solution is to suppress every second REJ frame at the receiving side, until the sequence error condition is cleared. If the first REJ frame gets lost, the sending side would retransmit the I frame again after another expiry of T200. Then the receiving side would respond with a REJ frame again.
Relates: OS#5969 Depends: libosmocore.git I93994dbbd1fc2c9edb8f3015c6b18ecd0fce0565 Change-Id: Iaa1645fb1970fe513d71bc1b03f7c5eac62f35d7 --- M src/host/layer23/src/mobile/app_mobile.c 1 file changed, 50 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index cada8fc..e2ef56a 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -249,6 +249,7 @@ lapdm_channel_init3(&ms->lapdm_channel, LAPDM_MODE_MS, t200_ms_dcch, t200_ms_acch, GSM_LCHAN_SDCCH, NULL); + lapdm_channel_set_flags(&ms->lapdm_channel, LAPDM_ENT_F_DROP_2ND_REJ); lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
gsm_sim_init(ms);