diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2023-11-15 14:33:53 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2023-11-27 16:25:53 +0000 |
commit | bd2b897b72209ab17a54c329be9a1cdc6508eb25 (patch) | |
tree | 2d199d7f85a442bd0210acc24dae4e236b010972 | |
parent | LAPDm: Add an extra queue for UI frames (diff) | |
download | libosmocore-bd2b897b72209ab17a54c329be9a1cdc6508eb25.tar.xz libosmocore-bd2b897b72209ab17a54c329be9a1cdc6508eb25.zip |
LAPDm: Add a flag to enable suppression of subsequent REJ frame
This behaviour was default in earlier versions of LAPDm/LAPD. Because it
is only required for osmocom-bb, a flag is added to enable it there.
Related: OS#5969
Change-Id: I93994dbbd1fc2c9edb8f3015c6b18ecd0fce0565
-rw-r--r-- | include/osmocom/gsm/lapdm.h | 1 | ||||
-rw-r--r-- | include/osmocom/isdn/lapd_core.h | 1 | ||||
-rw-r--r-- | src/gsm/lapdm.c | 2 | ||||
-rw-r--r-- | src/isdn/lapd_core.c | 5 |
4 files changed, 6 insertions, 3 deletions
diff --git a/include/osmocom/gsm/lapdm.h b/include/osmocom/gsm/lapdm.h index 08b808c0..42ebbcec 100644 --- a/include/osmocom/gsm/lapdm.h +++ b/include/osmocom/gsm/lapdm.h @@ -50,6 +50,7 @@ typedef int (*lapdm_cb_t)(struct msgb *msg, struct lapdm_entity *le, void *ctx); #define LAPDM_ENT_F_EMPTY_FRAME 0x0001 #define LAPDM_ENT_F_POLLING_ONLY 0x0002 +#define LAPDM_ENT_F_DROP_2ND_REJ 0x0004 /*! a LAPDm Entity */ struct lapdm_entity { diff --git a/include/osmocom/isdn/lapd_core.h b/include/osmocom/isdn/lapd_core.h index 776d4f41..1e010afe 100644 --- a/include/osmocom/isdn/lapd_core.h +++ b/include/osmocom/isdn/lapd_core.h @@ -86,6 +86,7 @@ enum lapd_state { /*! lapd_flags */ #define LAPD_F_RTS 0x0001 +#define LAPD_F_DROP_2ND_REJ 0x0002 /*! LAPD T200 state in RTS mode */ enum lapd_t200_rts { diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index 28644c28..fb892d2d 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -1637,6 +1637,8 @@ void lapdm_entity_set_flags(struct lapdm_entity *le, unsigned int flags) /* Set flags at LAPD. */ if (le->flags & LAPDM_ENT_F_POLLING_ONLY) dl_flags |= LAPD_F_RTS; + if (le->flags & LAPDM_ENT_F_DROP_2ND_REJ) + dl_flags |= LAPD_F_DROP_2ND_REJ; for (i = 0; i < ARRAY_SIZE(le->datalink); i++) { dl = &le->datalink[i]; diff --git a/src/isdn/lapd_core.c b/src/isdn/lapd_core.c index 34748a49..d98edae2 100644 --- a/src/isdn/lapd_core.c +++ b/src/isdn/lapd_core.c @@ -1633,9 +1633,8 @@ static int lapd_rx_i(struct msgb *msg, struct lapd_msg_ctx *lctx) ns, dl->v_recv, lapd_state_name(dl->state)); /* discard data */ msgb_free(msg); - if (dl->seq_err_cond != 1) { - /* FIXME: help me understand what exactly todo here - */ + /* Send reject, but suppress second reject if LAPD_F_DROP_2ND_REJ flag is set. */ + if (dl->seq_err_cond != 1 || !(dl->lapd_flags & LAPD_F_DROP_2ND_REJ)) { dl->seq_err_cond = 1; lapd_send_rej(lctx, lctx->p_f); } else { |