From dd34ed5b904a715a6ed742b635ed44c2b9b0b564 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 19 Jun 2013 08:16:56 +0200 Subject: lapd: The two known LAPDm issues have been addressed, update the test The issue about the wrong padding has been found when creating the testcase in commit 15f740caa3a1ef681b3a5564daf6dfccb7b1e489 but the patch to fix that was never proposed by inclusion by its author. The issue about about the establish confirm carrying data with a wrong size is still present. --- tests/lapd/lapd_test.c | 16 +++++----------- tests/lapd/lapd_test.ok | 4 ++-- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'tests/lapd') diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c index 49b7eefa..4d91fee3 100644 --- a/tests/lapd/lapd_test.c +++ b/tests/lapd/lapd_test.c @@ -61,12 +61,6 @@ static const uint8_t cm[] = { 0x29, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, }; -static const uint8_t cm_padded[] = { - 0x05, 0x24, 0x31, 0x03, 0x50, 0x18, 0x93, 0x08, - 0x29, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x2b, 0x2b, 0x2b, 0x2b -}; - static const uint8_t ua[] = { 0x01, 0x73, 0x41, 0x05, 0x24, 0x31, 0x03, 0x50, 0x18, 0x93, 0x08, 0x29, 0x47, 0x80, 0x00, 0x00, @@ -173,7 +167,7 @@ static int send_sabm(struct lapdm_channel *chan, int second_ms) msg->l2h[0] = 0x01; msg->l2h[1] = 0x3f; msg->l2h[2] = 0x01 | (sizeof(cm) << 2); - memcpy(msg->l2h + 3, cm_padded, sizeof(cm_padded)); + memcpy(msg->l2h + 3, cm, sizeof(cm)); msg->l2h[3] += second_ms; /* alter message, for second mobile */ /* LAPDm requires those... */ @@ -198,9 +192,9 @@ static int bts_to_ms_tx_cb(struct msgb *in_msg, struct lapdm_entity *le, void *_ if (state->bts_read == 0) { printf("BTS: Verifying CM request.\n"); - OSMO_ASSERT(msgb_l3len(in_msg) == ARRAY_SIZE(cm_padded)); - OSMO_ASSERT(memcmp(in_msg->l3h, cm_padded, - ARRAY_SIZE(cm_padded)) == 0); + OSMO_ASSERT(msgb_l3len(in_msg) == ARRAY_SIZE(cm)); + OSMO_ASSERT(memcmp(in_msg->l3h, cm, + ARRAY_SIZE(cm)) == 0); } else if (state->bts_read == 1) { printf("BTS: Verifying dummy message.\n"); OSMO_ASSERT(msgb_l3len(in_msg) == ARRAY_SIZE(dummy1)); @@ -249,7 +243,7 @@ static int ms_to_bts_tx_cb(struct msgb *msg, struct lapdm_entity *le, void *_ctx /* Verify the added RSL_IE_L3_INFO but we have a bug here */ OSMO_ASSERT(msg->data[6] == RSL_IE_L3_INFO); #warning "RSL_IE_L3_INFO 16 bit length is wrong" - /* ASSERT(msg->data[7] == 0x0 && msg->data[8] == 0x9c); */ + /* ASSERT(msg->data[7] == 0x0 && msg->data[8] == 0x0c); */ /* this should be 0x0 and 0x0... but we have a bug */ } else if (state->ms_read == 1) { printf("MS: Verifying incoming MM message: %d\n", msgb_l3len(msg)); diff --git a/tests/lapd/lapd_test.ok b/tests/lapd/lapd_test.ok index aa927088..27389bfd 100644 --- a/tests/lapd/lapd_test.ok +++ b/tests/lapd/lapd_test.ok @@ -1,7 +1,7 @@ I do some very simple LAPDm test. Establishing link. ms_to_bts_l1_cb: MS(us) -> BTS prim message -bts_to_ms_tx_cb: MS->BTS(us) message 29 +bts_to_ms_tx_cb: MS->BTS(us) message 25 BTS: Verifying CM request. Confirming @@ -19,6 +19,6 @@ bts_to_ms_tx_cb: MS->BTS(us) message 14 BTS: Verifying dummy message. I test RF channel release of an unestablished channel. I test contention resultion by having two mobiles collide and first mobile repeating SABM. -bts_to_ms_tx_cb: MS->BTS(us) message 29 +bts_to_ms_tx_cb: MS->BTS(us) message 25 BTS: Verifying CM request. Success. -- cgit v1.2.3