This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19847 ) Change subject: lapd_test: add a test checking SAPI0/SAPI3 prioritization ...................................................................... lapd_test: add a test checking SAPI0/SAPI3 prioritization Recently we've encountered a situation where during MT SMS delivery, the func=SABM for SAPI=3 was sent on Downlink *before* the BTS replied with the func=UA for SAPI=0 (contetion resolution procedure, where we echo the (RR) Paging Response back to the MS). This change adds a unit test reprodicing the problem. Change-Id: Ied0f8bb683de8e37bcfa984c2877aa1cec1c0b4b Related: SYS#5047, OS#4731 --- M tests/lapd/lapd_test.c M tests/lapd/lapd_test.ok 2 files changed, 84 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/19847/1 diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c index 3ea2706..ccc84e6 100644 --- a/tests/lapd/lapd_test.c +++ b/tests/lapd/lapd_test.c @@ -73,6 +73,19 @@ 0x00, 0x00, 0x80, 0x2b, 0x2b, 0x2b, 0x2b }; +static const uint8_t pr[] = { + 0x06, 0x27, 0x07, 0x03, 0x50, 0x58, 0x92, 0x05, + 0xf4, 0x44, 0x59, 0xba, 0x63, +}; + +#if 0 +static const uint8_t ua_pr[] = { + 0x01, 0x73, 0x35, 0x06, 0x27, 0x07, 0x03, 0x50, + 0x58, 0x92, 0x05, 0xf4, 0x44, 0x59, 0xba, 0x63, + 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, +}; +#endif + static const uint8_t mm[] = { 0x00, 0x0c, 0x00, 0x03, 0x01, 0x01, 0x20, 0x02, 0x00, 0x0b, 0x00, 0x03, 0x05, 0x04, 0x0d @@ -757,6 +770,61 @@ lapdm_channel_exit(&bts_to_ms_channel); } +static void test_lapdm_sapi_prio(void) +{ + struct osmo_phsap_prim pp1, pp2; + struct lapdm_channel lc = { }; + struct msgb *msg; + int rc; + + printf("\n=== I test SAPI0/SAPI3 prioritization ===\n\n"); + + /* BTS to MS in polling mode */ + lapdm_channel_init(&lc, LAPDM_MODE_BTS); + lapdm_channel_set_flags(&lc, LAPDM_ENT_F_POLLING_ONLY); + lapdm_channel_set_l1(&lc, NULL, NULL); + lapdm_channel_set_l3(&lc, bts_to_ms_dummy_tx_cb, NULL); + + /* MS establishes a SAPI=0 link by sending func=SABM on SDCCH */ + printf("MS is establishing a SAPI=0 link\n"); + send_sabm(&lc, 0, pr, sizeof(pr)); + + /* BTS establishes a SAPI=3 link by sending func=SABM on SDCCH */ + msg = create_est_req(est_req_sdcch_sapi3, sizeof(est_req_sdcch_sapi3)); + printf("BTS is establishing a SAPI=3 link\n"); + rc = lapdm_rslms_recvmsg(msg, &lc); + OSMO_ASSERT(rc == 0); + + /* Make sure that we get func=UA on SDCCH from the BTS first */ + rc = dequeue_prim(&lc.lapdm_dcch, &pp1, "DCCH"); + CHECK_RC(rc); + + /* Contention resolution is completed, we should get func=SAMB now */ + rc = dequeue_prim(&lc.lapdm_dcch, &pp2, "DCCH"); + CHECK_RC(rc); + +#if 0 + /* OS#4731: currently these checks would fail, uncomment when the bug is fixed */ + OSMO_ASSERT(memcmp(pp1.oph.msg->l2h, ua_pr, sizeof(ua_pr)) == 0); + OSMO_ASSERT(memcmp(pp2.oph.msg->l2h, est_req_sdcch_sapi3, + sizeof(est_req_sdcch_sapi3)) == 0); +#endif + + msgb_free(pp1.oph.msg); + msgb_free(pp2.oph.msg); + + /* Make sure that the queue is empty now */ + printf("\nChecking whether the DL/DCCH queue is empty\n"); + rc = dequeue_prim(&lc.lapdm_dcch, &pp1, "DCCH"); + OSMO_ASSERT(rc < 0); + + /* Clean up */ + lapdm_channel_exit(&lc); + + /* Check if exit is idempotent */ + lapdm_channel_exit(&lc); +} + int main(int argc, char **argv) { void *ctx = talloc_named_const(NULL, 0, "lapd_test"); @@ -773,6 +841,7 @@ test_lapdm_contention_resolution(); test_lapdm_establishment(); test_lapdm_desync(); + test_lapdm_sapi_prio(); printf("Success.\n"); diff --git a/tests/lapd/lapd_test.ok b/tests/lapd/lapd_test.ok index 16f6fc3..5796582 100644 --- a/tests/lapd/lapd_test.ok +++ b/tests/lapd/lapd_test.ok @@ -124,4 +124,19 @@ MSGB: L3 is undefined Took message from DCCH queue: L2 header size 23, L3 size 0, SAP 0x1000000, 0/0, Link 0x03 Message: [L2]> 0d 21 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b + +=== I test SAPI0/SAPI3 prioritization === + +MS is establishing a SAPI=0 link +bts_to_ms_dummy_tx_cb: MS->BTS(us) message 22 +BTS is establishing a SAPI=3 link +lapdm_phsap_dequeue_prim(): got rc 0: Success +Took message from DCCH queue: L2 header size 3, L3 size 20, SAP 0x1000000, 0/0, Link 0x03 +Message: [L2]> 0f 3f 01 [L3]> 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +lapdm_phsap_dequeue_prim(): got rc 0: Success +Took message from DCCH queue: L2 header size 3, L3 size 20, SAP 0x1000000, 0/0, Link 0x00 +Message: [L2]> 01 73 35 [L3]> 06 27 07 03 50 58 92 05 f4 44 59 ba 63 2b 2b 2b 2b 2b 2b 2b + +Checking whether the DL/DCCH queue is empty +lapdm_phsap_dequeue_prim(): got rc -19: No such device Success. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19847 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ied0f8bb683de8e37bcfa984c2877aa1cec1c0b4b Gerrit-Change-Number: 19847 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200827/9ec2c6f3/attachment.htm>