BSSMAP: Fix L3 sequence number for ComplL3(Paging Response)
The existing code generating L3 sequence numbers in MO direction
made the assumption that the L3 message inside ComplL3 would always
be MM/CM, and increment the sequence number.
However, in case of a paging response, it is actually RR, which
does *not* have L3 sequence counters. So we must make the sequence
counter increment dependant on the L3 protocol discriminator.
Change-Id: I25a5dd0c180c9acfa870984c6b122ac0c46383b3
diff --git a/library/BSSMAP_Emulation.ttcn b/library/BSSMAP_Emulation.ttcn
index b1567f3..4aacdf2 100644
--- a/library/BSSMAP_Emulation.ttcn
+++ b/library/BSSMAP_Emulation.ttcn
@@ -446,6 +446,19 @@
log("patched enc_l3: ", enc_l3);
}
+private function f_bssap_l3_is_rr(PDU_BSSAP bssap) return boolean {
+ var template octetstring l3 := f_bssap_extract_l3(bssap);
+ if (not isvalue(l3)) {
+ return false;
+ }
+ var octetstring l3v := valueof(l3);
+ /* lower 4 bits of first octet are protocol discriminator */
+ if ((oct2bit(l3v[0]) and4b '00001111'B) == '00000110'B) {
+ return true;
+ }
+ return false;
+}
+
function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
g_bssmap_id := id;
@@ -553,7 +566,9 @@
BSSAP.send(ts_BSSAP_DATA_req(conn_id, creq.bssap));
}
- if (g_bssmap_ops.role_ms) {
+ /* InitialL3 contains RR (PAG RESP) or MM (CM SRV REQ), we must increment
+ * counter only on MM/CC/SS, but not on RR */
+ if (g_bssmap_ops.role_ms and not f_bssap_l3_is_rr(creq.bssap)) {
/* we have just sent the first MM message, increment the counter */
var integer idx := f_idx_by_comp(vc_conn);
ConnectionTable[idx].n_sd[0] := 1;