summaryrefslogtreecommitdiffstats
path: root/tests/lapd
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-01-13 05:49:29 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-01-12 23:23:10 +0100
commit90656dbd00c32b56a6082d7baf4fc752adcf85dd (patch)
tree669b78384b829817dcb960695872d11ba5cd793d /tests/lapd
parent6ecafef28f74ddae6c6db3458ca3d84179cdf953 (diff)
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.
Diffstat (limited to 'tests/lapd')
-rw-r--r--tests/lapd/lapd_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 8c6b0df2..c924dbf9 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -99,6 +99,16 @@ static struct msgb *create_mm_id_req(void)
return msg;
}
+static struct msgb *create_empty_msg(void)
+{
+ struct msgb *msg;
+
+ msg = msgb_from_array(NULL, 0);
+ ASSERT(msgb_l3len(msg) == 0);
+ rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1);
+ return msg;
+}
+
static struct msgb *create_dummy_data_req(void)
{
struct msgb *msg;
@@ -284,6 +294,11 @@ static void test_lapdm_polling()
rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
ASSERT(rc < 0);
+ /* check sending an empty L3 message fails */
+ rc = lapdm_rslms_recvmsg(create_empty_msg(), &bts_to_ms_channel);
+ ASSERT(rc == -1);
+ ASSERT(test_state.ms_read == 2);
+
/* clean up */
lapdm_channel_exit(&bts_to_ms_channel);
lapdm_channel_exit(&ms_to_bts_channel);