Harald Welte has submitted this change and it was merged.

Change subject: BSSMAP: Fix L3 sequence number for ComplL3(Paging Response)
......................................................................


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
---
M library/BSSMAP_Emulation.ttcn
M library/BSSMAP_Templates.ttcn
2 files changed, 42 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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;
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index d4e278b..cd94ad1 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -921,6 +921,32 @@
        }
 }
 
+/* return Layer3 octetstring inside BSSAP PDU */
+function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
+       if (ischosen(bssap.pdu.bssmap)) {
+               var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
+               if (ischosen(bssmap.completeLayer3Information)) {
+                       return 
bssmap.completeLayer3Information.layer3Information.layer3info;
+               } else if (ischosen(bssmap.handoverRequestAck)) {
+                       return 
bssmap.handoverRequestAck.layer3Information.layer3info;
+               } else if (ischosen(bssmap.handoverCommand)) {
+                       return 
bssmap.handoverCommand.layer3Information.layer3info;
+               } else if (ischosen(bssmap.uplinkRequest)) {
+                       return 
bssmap.uplinkRequest.layer3Information.layer3info;
+               } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
+                       return 
bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
+               } else if (ischosen(bssmap.uplinkApplicationData)) {
+                       return 
bssmap.uplinkApplicationData.layer3Information.layer3info;
+               } else if (ischosen(bssmap.rerouteCommand)) {
+                       return 
bssmap.rerouteCommand.initialLayer3Information.layer3info;
+               } else {
+                       return omit;
+               }
+       } else {
+               return bssap.pdu.dtap;
+       }
+}
+
 
 
 

-- 
To view, visit https://gerrit.osmocom.org/6372
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I25a5dd0c180c9acfa870984c6b122ac0c46383b3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to