pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32495 )
Change subject: gmm: Provide allocated P-TMSI in GMMREG-ATTACH.cnf ......................................................................
gmm: Provide allocated P-TMSI in GMMREG-ATTACH.cnf
This allows the upper layers to find out the P-TMSI allocated by the network.
Change-Id: I95000ccfb9b4d24804ce916976d26aec8e51c749 --- M include/osmocom/gprs/gmm/gmm_prim.h M src/gmm/gmm.c M tests/gmm/gmm_prim_test.c M tests/gmm/gmm_prim_test.ok 4 files changed, 28 insertions(+), 6 deletions(-)
Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/include/osmocom/gprs/gmm/gmm_prim.h b/include/osmocom/gprs/gmm/gmm_prim.h index 78c8dfb..1f277d5 100644 --- a/include/osmocom/gprs/gmm/gmm_prim.h +++ b/include/osmocom/gprs/gmm/gmm_prim.h @@ -115,9 +115,10 @@ union { struct { /* PLMNs MT-caps, attach-type. */ + uint32_t allocated_ptmsi; } acc; struct { - uint8_t cause; + uint8_t cause; /* See enum gsm48_gsm_cause */ } rej; }; } attach_cnf; diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index fbe7d40..5174a5e 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -188,8 +188,11 @@
gmm_prim_tx = gprs_gmm_prim_alloc_gmmreg_attach_cnf(); gmm_prim_tx->gmmreg.attach_cnf.accepted = accepted; - if (!accepted) + if (accepted) { + gmm_prim_tx->gmmreg.attach_cnf.acc.allocated_ptmsi = gmme->ptmsi; + } else { gmm_prim_tx->gmmreg.attach_cnf.rej.cause = cause; + }
rc = gprs_gmm_prim_call_up_cb(gmm_prim_tx); return rc; diff --git a/tests/gmm/gmm_prim_test.c b/tests/gmm/gmm_prim_test.c index fa300d4..1b91640 100644 --- a/tests/gmm/gmm_prim_test.c +++ b/tests/gmm/gmm_prim_test.c @@ -145,9 +145,15 @@ case OSMO_GPRS_GMM_SAP_GMMREG: switch (OSMO_PRIM_HDR(&gmm_prim->oph)) { case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_ATTACH, PRIM_OP_CONFIRM): - printf("%s(): Rx %s accepted=%u rej_cause=%u\n", __func__, pdu_name, - gmm_prim->gmmreg.attach_cnf.accepted, - gmm_prim->gmmreg.attach_cnf.rej.cause); + if (gmm_prim->gmmreg.attach_cnf.accepted) { + printf("%s(): Rx %s accepted=%u allocated_ptmsi=0x%08x\n", __func__, pdu_name, + gmm_prim->gmmreg.attach_cnf.accepted, + gmm_prim->gmmreg.attach_cnf.acc.allocated_ptmsi); + } else { + printf("%s(): Rx %s accepted=%u rej_cause=%u\n", __func__, pdu_name, + gmm_prim->gmmreg.attach_cnf.accepted, + gmm_prim->gmmreg.attach_cnf.rej.cause); + } break; case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_CONFIRM): printf("%s(): Rx %s detach_type='%s'\n", __func__, pdu_name, diff --git a/tests/gmm/gmm_prim_test.ok b/tests/gmm/gmm_prim_test.ok index 5f4a723..f003efc 100644 --- a/tests/gmm/gmm_prim_test.ok +++ b/tests/gmm/gmm_prim_test.ok @@ -6,7 +6,7 @@ test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request TLLI=0x00000000 test_gmm_prim_down_cb(): Rx GMRR-ASSIGN.request new_tlli=0xea711b41 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 03 ] -test_gmm_prim_up_cb(): Rx GMMREG-ATTACH.confirm accepted=1 rej_cause=0 +test_gmm_prim_up_cb(): Rx GMMREG-ATTACH.confirm accepted=1 allocated_ptmsi=0xea711b41 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 05 20 0a 00 05 f4 ea 71 1b 41 ] test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request TLLI=0x00000000 test_gmm_prim_up_cb(): Rx GMMREG-DETACH.confirm detach_type='GPRS detach'