Commit Graph

29 Commits

Author SHA1 Message Date
Harald Welte 542301b067 RSL/LAPDm: Not all RLL message are "transparent"
3GPP TS 48.058 has a very clear definition of which messages are
"transparent" and hence have the T-bit == 1.  This is *not* just
all RLL messages, but basically only RLL_DATA.{ind,req} and
RLL_UNITDATA.{ind,req}.  All other messages are non-transparent.

Change-Id: I9f83654af189d818563d799bf623325b7fee8e70
Closes: OS#3188
2018-04-19 15:09:32 +00:00
Neels Hofmeyr a829b45c85 use osmo_init_logging2() with proper talloc ctx
Ironically, when deprecating osmo_init_logging() in
I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers
within libosmocore itself, i.e. in the various regression tests.

Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
2018-04-06 04:37:50 +02:00
Pau Espin 9dd3bf0cb4 Fix malformed Abis/RSL messages with extra L3 Information field
Some Abis/RSL messages such as "Release Indication" contained 3 extra
bytes from an L3 Information header which should not be there according
to specs in GSM 08.58 (section 8.3 "Radio link layer management
messages"). Other RSL messages were affected by the same issue, except
for "Establish Indication", which had already a workaround in
send_rslms_dlsap.

This commit fixes the issue in a generic way, removes the "Establish
Indication" and fixes the test accounting for the bug, as it otherwise
fails after applying the changes.

Fixes: OS#1635, OS#2336

Change-Id: Ibb116214e8b1798d65a8b0917150496a3c14f344
2017-12-10 14:44:19 +00:00
Neels Hofmeyr dd24560433 lapd_test: sanitize: fix msgb memleaks
Helps fix sanitizer build on debian 9.

Change-Id: I0add9eac7225db23bc02fc2aaee5f42258d34e25
2017-11-18 10:30:58 +00:00
Harald Welte e08da97570 Fix/Update copyright notices; Add SPDX annotation
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.

Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-11-13 01:35:12 +09:00
Pau Espin 35c6fb3723 lapd_test.c: Convert compilation warning to level message
This way we clean the build of warnings completely and we can enable
-Werror but we still see this FIXME message while compiling.

Change-Id: I24c11226cd5bb5b6032f4ece7d1a0695dc82f0dd
2017-06-21 13:56:37 +00:00
Harald Welte 53e2672e11 lapd_test: avoid calling memcpy with NULL source
fixes
lapd/lapd_test.c:54:2: runtime error: null pointer passed as argument 2, which is declared to never be null

Change-Id: I7030729f4f4c867adecc7afc15bb5ca9beff0030
2017-01-06 10:03:30 +00:00
Daniel Willmann 3dc4e16786 gsm/lapdm: Prevent LAPD tx_queue from filling up in polling mode
If LAPDm receives an I-Frame while there already is an I-Frame in the
tx_queue the code generates an additional RR (to acknowledge the
received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should
be updated to ACK the data.
2014-03-26 18:11:07 +01:00
Daniel Willmann 09129352f9 tests/lapd: Add a testcase to check for LAPDm sync issues
Regression test for LAPDm recording the current state
2014-03-26 14:53:29 +01:00
Jacob Erlbeck 8dac4159ad ladpm: Fix msgb handling and SAPI=3 establishment delay
Currently it takes 3s to establish a SAPI 3 SACCH connection with
osmo-bts. This is due to the fact, that a broken SABME request is
sent first and and is ignored by the MS. Then, after a T200 timeout
(2s) the SABME command is sent again (this time correctly) and
answered by the MS.

The first SABME message is broken (it has a length field of 3 and
ends with 3 bytes from the tail of the original RSL message),
because of it is expected throughout lapdm.c that msg buffers
containing RSL have msg->l2h == msg->data. Some abis input drivers
fulfill this but IPA doesn't, thus the 3 bytes of the IPA header
are still part of the msg and confuse length computation.

Since internal fields of the msg are modified directly, this is
difficult to see.

This patch adds a new function msgb_pull_to_l3() that explicitely
skips over all headers prepending L3 and therefore resets l1h and
l2h. This function is then used instead of msgb_pull_l2h() which
only worked correctly when msg->l2h == msg->data. In addition,
code manipulating msg->tail and msg->len directly has been replaced
by calls to msgb_trim().

Note that this patch does not fix all issues of this case in the LADP
related code.

Ticket: SYS#192
Sponsored-by: On-Waves ehf
2014-03-10 14:57:26 +01:00
Jacob Erlbeck 7d5f17aa21 lapd/test: Check for empty ACCH queue, too
This just adds a single test to verify that the ACCH queue is
actually empty.

Sponsored-by: On-Waves ehf
2014-03-04 13:34:38 +01:00
Jacob Erlbeck c893c2233a lapd/test: Extend test case to test msgs having data before l2h
Since e.g. the IPA input driver leaves it's specific header in front
of msg->l2h, so that msg->l2h != msg->data. The lapdm code does not expect this at least in
rslms_rx_rll_est_req().

This patch modifies the test program to add a dummy L1 header to
generated messages (unless the test would abort when doing so).

Note that the ok file reflects the current state which is not
correct.

Sponsored-by: On-Waves ehf
2014-03-04 13:34:38 +01:00
Jacob Erlbeck 2462cf6ee1 lapd/test: Show dequeued messages
This adds and uses a wrapper for lapdm_phsap_dequeue_prim() that
prints information about the message that has been taken from the
queue.
2014-03-04 13:34:38 +01:00
Jacob Erlbeck 90937fe2c5 lapd/test: Add test case for RSL EST REQ -> LAPD
This test case processes RSL establish requests for SMS (SAPI 3)
on the SDCCH and the SACCH channels. The TX queues are checked
after processing each message.

Ticket: SYS#192
Sponsored-by: On-Waves ehf
2014-01-26 08:39:20 +01:00
Holger Hans Peter Freyther ce397dee70 lapd: Extend the test to check if lapdm_channel_exit is idempotent
I have a crash with an older libosmocore and the sysmobts. I
am not sure how we can have a release for a channel where the
lapdm_channel has not gone through lapdm_channel_init. But to
prevent the crash we can promise lapdm_channel_exit to be idempotent.

It has been idempotent since f5a079f739
2013-10-26 13:35:15 +02:00
Harald Welte 98de27a187 make lapd_test compile again.
For whatever reason two functions were present twice in the code,
probably some git merge/rebase artefact?
2013-07-06 23:54:09 +02:00
Andreas Eversberg a3de4dfb5c Add LAPDm collision test (contention resolution on network side) 2013-07-06 23:36:15 +02:00
Holger Hans Peter Freyther 3cc268c8da lapd: Upate the assert to OSMO_ASSERT and describe what we would like to have
Update the OSMO_ASSERT to what it should be like but can't due a
known issue in the LAPDm code.
2013-06-19 08:30:59 +02:00
Holger Hans Peter Freyther dd34ed5b90 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 15f740caa3 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.
2013-06-19 08:27:18 +02:00
Andreas Eversberg 6e182087f4 Fix: LAPDm contention resoltion must acknowledge subsequent SABM
After reception of SABM, the network responds with UA and enters the
establised multiframe state. If UA is not received by mobile, the SABM
is transmitted again, and the network must respond with UA again, unless
it is from a different mobile.

Add LAPDm collision test (contention resolution on network side).
2013-04-06 23:23:52 +02:00
Katerina Barone-Adesi 008e53baae utils: Introduce OSMO_ASSERT in the utils and use it in the unit tests
The tests should unconditionally assert, regardless of debug settings.
This uses the OSMO_ prefix as it's in the global namespace.
2013-03-09 23:52:29 +01:00
Holger Hans Peter Freyther af723a4ed4 lapd: Fix compiler warnings in the lapd code
lapd_test.c: In function ‘ms_to_bts_l1_cb’:
lapd_test.c:192:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
lapd_test.c:199:1: warning: no return statement in function returning non-void [-Wreturn-type]
lapd_test.c: In function ‘main’:
lapd_test.c:355:2: warning: implicit declaration of function ‘osmo_init_logging’ [-Wimplicit-function-declaration]
2012-12-26 10:51:00 +01:00
Daniel Willmann e523392c2c lapd: Check in rslms_rx_rll() if lapdm context was initialized earlier
This was found while implementing handover on a sysmobts. When we
receive a channel release request for a channel that was never really
activated (set_lapdm_context() was not called) we segfault in
lapd_recv_dlsap().

We now return early with -EINVAL in rslms_rx_rll() if we receive a
message that assumes set_lapdm_context() was already called.

These are:
* RSL_MT_UNIT_DATA_REQ
* RSL_MT_DATA_REQ
* RSL_MT_SUSP_REQ
* RSL_MT_REL_REQ

A test case was added to trigger the issue.
2012-12-26 10:48:01 +01:00
Diego Elio Pettenò ea0e1eca2b build: simplify test handling and speed up build.
Instead of using a ./configure parameter to decide whehter to build
tests or not, use the check_PROGRAMS variable so that the tests are
only built when running `make check`.

To avoid slowing down the test phase itself, collapse the declaration
of the test targets in the tests/Makefile.am file, this way they can
be built and linked in parallel before the testsuite is executed.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:42 +02:00
Holger Hans Peter Freyther 3a5f08c221 lapdm: Make sure that the msgb_l3len(msg) == length...
This code should not play with the internals of the msgb like this,
this code got introduced in af48bed556 and is breaking the
osmo-bts usecase of forwarding an RSL message.

Add a test case that fails without the new code. I would prefer if
we could get rid of the manipulating the msgb like this, it is prone
to errors like this one.
2012-01-12 23:23:19 +01:00
Holger Hans Peter Freyther 90656dbd00 lapd: Warn if someone attempts to send an empty message
DATA REQ with a msgb_l3len(msg) == 0 message does not make any
sense, log an error and return immediately before attempting to
send an empty I frame in lapd_send_i.
2012-01-12 23:23:10 +01:00
Holger Hans Peter Freyther 4a075f82f0 lapd: Disable one part of the test as it fails on FreeBSD
I thought this number would be wrong in the same way but it depends
on OS/ARCH. Disable this part of the test for now.
2011-12-12 00:41:25 +01:00
Holger Hans Peter Freyther 15f740caa3 lapd_test: Look at the content of LAPD messages and compare them
Verify the output, accept two known errors in the generation of it.
2011-12-12 00:34:06 +01:00
Holger Hans Peter Freyther 72bd4eb3b9 lapdm: Create a simple test case to transmit data between both ends
This is testing the establishment of two ends (BTS, MS) one is in
the polling mode as used by osmo-bts. Transfer data between the two
ends. The sent data is not verified though. This should be followed
up soon.
2011-12-11 21:35:06 +01:00