pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/32493 )

Change subject: gmm: Append 'P-TMSI type' IE to GPRS Attach Req when needed
......................................................................

gmm: Append 'P-TMSI type' IE to GPRS Attach Req when needed

Depends: libosmocore.git Change-Id Ief4e03785f01f07c8d97b33bbb55c89a863baccc
Change-Id: I79d8f2dae356fc25467553955f43fffb2661ab47
---
M src/gmm/gmm_pdu.c
M tests/gmm/gmm_prim_test.ok
2 files changed, 21 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved




diff --git a/src/gmm/gmm_pdu.c b/src/gmm/gmm_pdu.c
index 4123e24..efdca48 100644
--- a/src/gmm/gmm_pdu.c
+++ b/src/gmm/gmm_pdu.c
@@ -132,6 +132,7 @@
 const struct tlv_definition gprs_gmm_att_tlvdef = {
        .def = {
                [GSM48_IE_GMM_CIPH_CKSN]        = { TLV_TYPE_SINGLE_TV, 1 },
+               [GSM48_IE_GMM_PTMSI_TYPE]       = { TLV_TYPE_SINGLE_TV, 1 },
                [GSM48_IE_GMM_TIMER_READY]      = { TLV_TYPE_TV, 1 },
                [GSM48_IE_GMM_ALLOC_PTMSI]      = { TLV_TYPE_TLV, 0 },
                [GSM48_IE_GMM_PTMSI_SIG]        = { TLV_TYPE_FIXED, 3 },
@@ -236,6 +237,14 @@
                return -EINVAL;

        /* TODO: optional fields */
+
+       /* 9.4.1.13 P-TMSI type: The MS shall include this IE if the
+        * type of identity in the Mobile identity IE is set to
+        * "TMSI/P-TMSI/M-TMSI". */
+       if (!attach_with_imsi) {
+               uint8_t ptmsi_type_native = 1; /* Table 10.5.5.29.1 */
+               msgb_v_put(msg, (GSM48_IE_GMM_PTMSI_TYPE << 4) | 
(ptmsi_type_native & 0x01));
+       }
        return 0;
 }

diff --git a/tests/gmm/gmm_prim_test.ok b/tests/gmm/gmm_prim_test.ok
index 12afb40..5f4a723 100644
--- a/tests/gmm/gmm_prim_test.ok
+++ b/tests/gmm/gmm_prim_test.ok
@@ -1,5 +1,5 @@
 ==== test_gmm_prim_ms_gmmreg() [start] ====
-test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 00 00 00 f0 00 00 00 00 00 ]
+test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 00 00 00 f0 00 00 00 00 00 e1 ]
 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 16 08 42 32 24 43 32 24 43 f2 ]
 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 13 02 ]
 test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request TLLI=0x00000000
@@ -12,7 +12,7 @@
 test_gmm_prim_up_cb(): Rx GMMREG-DETACH.confirm detach_type='GPRS detach'
 ==== test_gmm_prim_ms_gmmreg() [end] ====
 ==== test_gmm_prim_ms_gmmsm() [start] ====
-test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 00 00 00 f0 00 00 00 00 00 ]
+test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 00 00 00 f0 00 00 00 00 00 e1 ]
 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 16 08 42 32 24 43 32 24 43 f2 ]
 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x00000000 SAPI=GMM 
l3=[08 13 02 ]
 test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request TLLI=0x00000000

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32493
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I79d8f2dae356fc25467553955f43fffb2661ab47
Gerrit-Change-Number: 32493
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to