lapdm: Append RSL_IE_OSMO_ABS_FRAME_NUMBER to RSLms msgs towards upper layers

This makes it possible to track GSM time in the upper layers.
The existing RSL_IE_FRAME_NUMBER and RSL_IE_STARTNG_TIME cannot be used
there, since those are 16bit fields containing Relative FN values.

The IE needs to be added before the L3_INFO one, because user code
usually assumes the msgb->l3 pointing to L3_INFO value extends until the
end of the message, using msgb3_len(msg). Regarding having an extra IE
at the middle, it's not a big problem since the libosmocore version
submitting this commit to the upper layers is the same which will also
be parsing it through rsl_tlv_parse() later on by the app.

Related: OS#3626
Change-Id: Id62c18f49f270449067b25b7104eb8b47f1955ec
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 2f2a7f4..bae73c2 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -359,7 +359,7 @@
 		struct abis_rsl_rll_hdr hdr;
 
 		printf("MS: Verifying incoming primitive.\n");
-		OSMO_ASSERT(msg->len == sizeof(struct abis_rsl_rll_hdr));
+		OSMO_ASSERT(msg->len >= sizeof(struct abis_rsl_rll_hdr));
 
 		/* verify the header */
 		memset(&hdr, 0, sizeof(hdr));
diff --git a/tests/lapd/lapd_test.ok b/tests/lapd/lapd_test.ok
index 065886c..ff9df5b 100644
--- a/tests/lapd/lapd_test.ok
+++ b/tests/lapd/lapd_test.ok
@@ -1,28 +1,28 @@
 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 25
+bts_to_ms_tx_cb: MS->BTS(us) message 31
 BTS: Verifying CM request.
 
 Confirming
 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 41 [L3]> 05 24 31 03 50 18 93 08 29 47 80 00 00 00 00 80 2b 2b 2b 2b 
-ms_to_bts_tx_cb: BTS->MS(us) message 6
+ms_to_bts_tx_cb: BTS->MS(us) message 12
 MS: Verifying incoming primitive.
 
 Sending back to MS
 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]> 03 00 0d [L3]> 05 04 0d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
-ms_to_bts_tx_cb: BTS->MS(us) message 12
+ms_to_bts_tx_cb: BTS->MS(us) message 18
 MS: Verifying incoming MM message: 3
 ms_to_bts_l1_cb: MS(us) -> BTS prim message
 lapdm_phsap_dequeue_prim(): got rc -19: No such device
 
 Sending back to BTS
 ms_to_bts_l1_cb: MS(us) -> BTS prim message
-bts_to_ms_tx_cb: MS->BTS(us) message 14
+bts_to_ms_tx_cb: MS->BTS(us) message 20
 BTS: Verifying dummy message.
 lapdm_phsap_dequeue_prim(): got rc 0: Success
 MSGB: L3 is undefined
@@ -32,7 +32,7 @@
 lapdm_phsap_dequeue_prim(): got rc -19: No such device
 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 25
+bts_to_ms_tx_cb: MS->BTS(us) message 31
 BTS: Verifying CM request.
 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
@@ -60,7 +60,7 @@
 I test if desync problems exist in LAPDm
 
 Establishing SAPI=0
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 25
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 31
 
 Dumping queue:
 00 00 17 [L2]> 01 73 41 [L3]> 05 24 31 03 50 18 93 08 29 47 80 00 00 00 00 80 
@@ -70,7 +70,7 @@
 Message: [L2]> 01 73 41 [L3]> 05 24 31 03 50 18 93 08 29 47 80 00 00 00 00 80 2b 2b 2b 2b 
 
 Sending Classmark Change
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 27
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 33
 
 Dumping queue:
 00 00 17 [L2]> 01 21 01 
@@ -87,7 +87,7 @@
 
 
 Sending GPRS Suspend Request
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 22
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 28
 
 Dumping queue:
 00 00 17 [L2]> 03 40 0d [L3]> 06 35 01 
@@ -97,7 +97,7 @@
 Message: [L2]> 03 40 0d [L3]> 06 35 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 
 Sending Cipher Mode Complete
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 11
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 17
 
 Dumping queue:
 00 00 17 [L2]> 01 61 01 
@@ -108,7 +108,7 @@
 Message: [L2]> 01 61 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 
 Establishing SAPI=3
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 6
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 12
 
 Dumping queue:
 
@@ -128,7 +128,7 @@
 === I test SAPI0/SAPI3 prioritization ===
 
 MS is establishing a SAPI=0 link
-bts_to_ms_dummy_tx_cb: MS->BTS(us) message 22
+bts_to_ms_dummy_tx_cb: MS->BTS(us) message 28
 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 0x00