From 7638cb7e7b1a5bdbf76c1162146054cb73b97618 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 25 May 2023 17:47:59 +0200 Subject: [PATCH] gmm: Stop READY timer upon receiving force_stdby IE Change-Id: I44d0f69571f6425fef74a10602001aca4ecb5716 --- src/gmm/gmm.c | 19 +++++++++++++++++-- tests/gmm/gmm_prim_test.err | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 1944b86..ade4059 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -779,6 +779,8 @@ static int gprs_gmm_rx_att_ack(struct gprs_gmm_entity *gmme, struct gsm48_hdr *g gmme->t3312_assigned_sec = periodic_rau_sec >= 0 ? periodic_rau_sec : 0; if (gmme->t3312_assigned_sec == 0) gprs_gmm_gmme_t3312_stop(gmme); + if (aa->force_stby) + gprs_gmm_gmme_ready_timer_stop(gmme); gsm48_parse_ra(&gmme->ra, (const uint8_t *)&aa->ra_id); if (len > sizeof(*gh) + sizeof(*aa)) { @@ -906,6 +908,9 @@ static int gprs_gmm_rx_detach_accept(struct gprs_gmm_entity *gmme, struct gsm48_ LOGGMME(gmme, LOGL_INFO, "Rx GMM DETACH ACCEPT (MO) force_standby_indicated=%s\n", force_standby_indicated ? "true" : "false"); + if (force_standby_indicated) + gprs_gmm_gmme_ready_timer_stop(gmme); + /* TODO: submit GMMSM-RELEASE-IND */ /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.3 */ @@ -949,6 +954,8 @@ static int gprs_gmm_rx_rau_acc(struct gprs_gmm_entity *gmme, struct gsm48_hdr *g gmme->t3312_assigned_sec = periodic_rau_sec >= 0 ? periodic_rau_sec : 0; if (gmme->t3312_assigned_sec == 0) gprs_gmm_gmme_t3312_stop(gmme); + if (raack->force_stby) + gprs_gmm_gmme_ready_timer_stop(gmme); gsm48_parse_ra(&gmme->ra, (const uint8_t *)&raack->ra_id); if (len > sizeof(*gh) + sizeof(*raack)) { @@ -1053,6 +1060,7 @@ static int gprs_gmm_rx_id_req(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh * The IDENTITY RESPONSE message shall contain the identification parameters as requested by the network" */ uint8_t id_type; + bool force_standby_indicated; if (len < sizeof(struct gsm48_hdr) + 1) { LOGGMME(gmme, LOGL_ERROR, "Rx GMM IDENTITY REQUEST with wrong size %u\n", len); @@ -1060,8 +1068,12 @@ static int gprs_gmm_rx_id_req(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh } id_type = gh->data[0] & 0xf; - LOGGMME(gmme, LOGL_INFO, "Rx GMM IDENTITY REQUEST mi_type=%s\n", - gsm48_mi_type_name(id_type)); + force_standby_indicated = (gh->data[0] >> 4) == 0x01; + LOGGMME(gmme, LOGL_INFO, "Rx GMM IDENTITY REQUEST mi_type=%s force_stdby=%u\n", + gsm48_mi_type_name(id_type), force_standby_indicated); + + if (force_standby_indicated) + gprs_gmm_gmme_ready_timer_stop(gmme); return gprs_gmm_tx_id_resp(gmme, id_type); } @@ -1173,6 +1185,9 @@ static int gprs_gmm_rx_auth_ciph_req(struct gprs_gmm_entity *gmme, struct gsm48_ /* TODO: 9.4.9.7 Replayed MS Radio Access Capability */ } + if (acreq->force_stby) + gprs_gmm_gmme_ready_timer_stop(gmme); + gmme->auth_ciph.gea = acreq->ciph_alg; gmme->auth_ciph.req.ac_ref_nr = acreq->ac_ref_nr; gmme->auth_ciph.req.imeisv_requested = acreq->imeisv_req; diff --git a/tests/gmm/gmm_prim_test.err b/tests/gmm/gmm_prim_test.err index dea0ca7..64af93b 100644 --- a/tests/gmm/gmm_prim_test.err +++ b/tests/gmm/gmm_prim_test.err @@ -7,7 +7,7 @@ DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM ATTACH R DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO GMM_MS{Deregistered}: state_chg to RegisteredInitiated DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication -DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM IDENTITY REQUEST mi_type=IMEI +DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM IDENTITY REQUEST mi_type=IMEI force_stdby=0 DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM IDENTITY RESPONSE DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication @@ -60,7 +60,7 @@ DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM ATTACH R DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO GMM_MS{Deregistered}: state_chg to RegisteredInitiated DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication -DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM IDENTITY REQUEST mi_type=IMEI +DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM IDENTITY REQUEST mi_type=IMEI force_stdby=0 DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM IDENTITY RESPONSE DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication