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
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 1842ab7..e3d4e80 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -36,6 +36,7 @@
 	}
 
 static struct log_info info = {};
+static int dummy_l1_header_len = 0;
 
 struct lapdm_polling_state {
 	struct lapdm_channel *bts;
@@ -94,6 +95,7 @@
 
 	msg = msgb_from_array(cm, sizeof(cm));
 	rsl_rll_push_l3(msg, RSL_MT_EST_REQ, 0, 0, 1);
+	msgb_push(msg, dummy_l1_header_len);
 	return msg;
 }
 
@@ -106,6 +108,7 @@
 	OSMO_ASSERT(msgb_l2len(msg) == 12);
 	msg->l3h = msg->l2h + 6;
 	OSMO_ASSERT(msgb_l3len(msg) == 6);
+	msgb_push(msg, dummy_l1_header_len);
 
 	return msg;
 }
@@ -117,6 +120,7 @@
 	msg = msgb_from_array(NULL, 0);
 	OSMO_ASSERT(msgb_l3len(msg) == 0);
 	rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1);
+	msgb_push(msg, dummy_l1_header_len);
 	return msg;
 }
 
@@ -126,6 +130,7 @@
 
 	msg = msgb_from_array(dummy1, sizeof(dummy1));
 	rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1);
+	msgb_push(msg, dummy_l1_header_len);
 	return msg;
 }
 
@@ -135,6 +140,7 @@
 
 	msg = msgb_from_array(rel_req, sizeof(rel_req));
 	msg->l2h = msg->data;
+	msgb_push(msg, dummy_l1_header_len);
 	msg->l3h = msg->l2h + sizeof(struct abis_rsl_rll_hdr);
 	return msg;
 }
@@ -145,6 +151,7 @@
 
 	msg = msgb_from_array(est_req, est_req_size);
 	msg->l2h = msg->data;
+	msgb_push(msg, dummy_l1_header_len);
 	msg->l3h = msg->l2h + sizeof(struct abis_rsl_rll_hdr);
 	return msg;
 }
@@ -550,10 +557,15 @@
 {
 	osmo_init_logging(&info);
 
+	/* Prevent the test from segfaulting */
+	dummy_l1_header_len = 0;
 	test_lapdm_polling();
+
+	dummy_l1_header_len = 3;
 	test_lapdm_early_release();
 	test_lapdm_contention_resolution();
 	test_lapdm_establishment();
+
 	printf("Success.\n");
 
 	return 0;