lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

May 2023

  • 1 participants
  • 2583 discussions
[M] Change in libosmo-gprs[master]: gmm: Initial implementation of T3166, rx Auth & Ciph Reject
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33054 ) Change subject: gmm: Initial implementation of T3166, rx Auth & Ciph Reject ...................................................................... gmm: Initial implementation of T3166, rx Auth & Ciph Reject As specified in 3GPP TS 24.008 Table 11.3/3. Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f --- M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/gmm_ms_fsm.c M src/gmm/gmm_prim.c M tests/gmm/gmm_prim_test.err 5 files changed, 85 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index 0308d1e..5a29600 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -89,6 +89,7 @@ unsigned long t3314_assigned_sec; /* value assigned by the network */ struct osmo_timer_list t3312; /* periodic RAU, in seconds */ unsigned long t3312_assigned_sec; /* value assigned by the network */ + struct osmo_timer_list t3316; /* Delete stored RAND & SRES */ /* network name */ char name_long[32]; @@ -124,6 +125,8 @@ bool gprs_gmm_gmme_ready_timer_running(const struct gprs_gmm_entity *gmme); void gprs_gmm_gmme_t3312_start(struct gprs_gmm_entity *gmme); void gprs_gmm_gmme_t3312_stop(struct gprs_gmm_entity *gmme); +void gprs_gmm_gmme_t3316_start(struct gprs_gmm_entity *gmme); +void gprs_gmm_gmme_t3316_stop(struct gprs_gmm_entity *gmme); int gprs_gmm_rx(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len); int gprs_gmm_tx_att_req(struct gprs_gmm_entity *gmme, enum osmo_gprs_gmm_attach_type attach_type, diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 092a56c..1dcee79 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -88,6 +88,7 @@ static void t3314_ready_timer_cb(void *data); static void t3312_periodic_rau_timer_cb(void *data); +static void t3316_delete_rand_sres_cb(void *data); static void gprs_gmm_ctx_free(void) { @@ -186,6 +187,7 @@ osmo_timer_setup(&gmme->t3314, t3314_ready_timer_cb, gmme); osmo_timer_setup(&gmme->t3312, t3312_periodic_rau_timer_cb, gmme); + osmo_timer_setup(&gmme->t3316, t3316_delete_rand_sres_cb, gmme); llist_add(&gmme->list, &g_gmm_ctx->gmme_list); @@ -202,6 +204,8 @@ osmo_timer_del(&gmme->t3314); if (osmo_timer_pending(&gmme->t3312)) osmo_timer_del(&gmme->t3312); + if (osmo_timer_pending(&gmme->t3316)) + osmo_timer_del(&gmme->t3316); gprs_gmm_ms_fsm_ctx_release(&gmme->ms_fsm); llist_del(&gmme->list); talloc_free(gmme); @@ -389,6 +393,37 @@ } +/* T3316 (Delete stored RAND & SRES) is started: */ +void gprs_gmm_gmme_t3316_start(struct gprs_gmm_entity *gmme) +{ + unsigned long timeout_sec = osmo_tdef_get(g_gmm_ctx->T_defs, 3316, OSMO_TDEF_S, -1); + + if (timeout_sec == 0) + return; + LOGGMME(gmme, LOGL_INFO, "T3316 started (expires in %lu seconds)\n", timeout_sec); + osmo_timer_schedule(&gmme->t3316, timeout_sec, 0); +} + +/* T3316 (Delete stored RAND & SRES) is stopped: */ +void gprs_gmm_gmme_t3316_stop(struct gprs_gmm_entity *gmme) +{ + if (!osmo_timer_pending(&gmme->t3316)) + return; + + LOGGMME(gmme, LOGL_INFO, "T3316 stopped\n"); + osmo_timer_del(&gmme->t3316); +} + +/* T3312 (Delete stored RAND & SRES) timer expiration: */ +static void t3316_delete_rand_sres_cb(void *data) +{ + struct gprs_gmm_entity *gmme = (struct gprs_gmm_entity *)data; + LOGGMME(gmme, LOGL_INFO, "T3316 (Delete stored RAND & SRES timer) expired\n"); + /* invalidate active reference: */ + gmme->auth_ciph.req.ac_ref_nr = 0xff; + /* Nothing more to do yet, since we really never store RAND & SRES so far? */ +} + int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause) { struct osmo_gprs_gmm_prim *gmm_prim_tx; @@ -732,8 +767,14 @@ llc_prim->ll.apply_gia; */ + /* TS 24.008 4.7.7.5.1: "If the MS returns an AUTHENTICATION AND CIPHERING FAILURE + * message to the network, the MS shall delete any previously stored RAND and RES + * and shall stop timer T3316, if running." + */ + gprs_gmm_gmme_t3316_stop(gmme); /* invalidate active reference: */ gmme->auth_ciph.req.ac_ref_nr = 0xff; + rc = gprs_gmm_prim_call_llc_down_cb(llc_prim); if (rc < 0) return rc; @@ -1264,6 +1305,19 @@ return rc; } +/* Rx GMM Authentication and ciphering reject, 9.4.11 */ +static int gprs_gmm_rx_auth_ciph_rej(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) +{ + int rc; + uint8_t cause; + + LOGGMME(gmme, LOGL_NOTICE, "Rx GMM AUTHENTICATION AND CIPHERING REJECT\n"); + + cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + rc = osmo_fsm_inst_dispatch(gmme->ms_fsm.fi, GPRS_GMM_MS_EV_ATTACH_REJECTED, &cause); + return rc; +} + /* Rx GMM Status, 9.4.18 */ static int gprs_gmm_rx_status(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { @@ -1335,6 +1389,9 @@ case GSM48_MT_GMM_AUTH_CIPH_REQ: rc = gprs_gmm_rx_auth_ciph_req(gmme, gh, len); break; + case GSM48_MT_GMM_AUTH_CIPH_REJ: + rc = gprs_gmm_rx_auth_ciph_rej(gmme, gh, len); + break; case GSM48_MT_GMM_STATUS: rc = gprs_gmm_rx_status(gmme, gh, len); break; diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c index a344494..e5a7002 100644 --- a/src/gmm/gmm_ms_fsm.c +++ b/src/gmm/gmm_ms_fsm.c @@ -72,6 +72,12 @@ return gprs_gmm_tx_rau_req(ctx->gmme, ctx->rau.type); } +static void st_gmm_ms_null_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gprs_gmm_ms_fsm_ctx *ctx = (struct gprs_gmm_ms_fsm_ctx *)fi->priv; + gprs_gmm_gmme_t3316_stop(ctx->gmme); +} + static void st_gmm_ms_null(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -89,6 +95,7 @@ memset(&ctx->attach, 0, sizeof(ctx->attach)); gprs_gmm_gmme_t3312_stop(ctx->gmme); + gprs_gmm_gmme_t3316_stop(ctx->gmme); /* TS 24.007 9.5.1.4: informs SM layerthat the MS has been GPRS detached, e.g. by timer expiry */ if (prev_state != GPRS_GMM_MS_ST_NULL) @@ -241,6 +248,7 @@ //mm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED_INITIATED); break; case GPRS_GMM_MS_EV_RAU_ACCEPTED: + gprs_gmm_gmme_t3316_stop(ctx->gmme); /* TS 24.007 C.15: submit LLGM-RESUME-REQ */ llc_prim_tx = osmo_gprs_llc_prim_alloc_llgmm_resume_req(ctx->gmme->tlli); OSMO_ASSERT(llc_prim_tx); @@ -284,6 +292,7 @@ .out_state_mask = X(GPRS_GMM_MS_ST_DEREGISTERED), .name = "Null", + .onenter = st_gmm_ms_null_on_enter, .action = st_gmm_ms_null, }, [GPRS_GMM_MS_ST_DEREGISTERED] = { diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c index 2122d76..5a35ef2 100644 --- a/src/gmm/gmm_prim.c +++ b/src/gmm/gmm_prim.c @@ -445,6 +445,8 @@ /* Copy over Kc: */ memcpy(gmme->auth_ciph.kc, gmm_prim->gmmreg.sim_auth_rsp.kc, sizeof(gmme->auth_ciph.kc)); + gprs_gmm_gmme_t3316_start(gmme); + rc = gprs_gmm_submit_llgmm_assing_req(gmme); if (rc < 0) { /* invalidate active reference: */ diff --git a/tests/gmm/gmm_prim_test.err b/tests/gmm/gmm_prim_test.err index 64af93b..fa670cf 100644 --- a/tests/gmm/gmm_prim_test.err +++ b/tests/gmm/gmm_prim_test.err @@ -13,6 +13,7 @@ DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM AUTHENTICATION AND CIPHERING REQUEST DLGLOBAL INFO Rx from upper layers: GMMREG-SIM_AUTH.response +DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) T3316 started (expires in 30 seconds) DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM GMM AUTHENTICATION AND CIPHERING RESPONSE DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication @@ -24,6 +25,7 @@ DLGLOBAL INFO GMM_MS{RegisteredInitiated}: state_chg to Registered DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-ea711b41:TLLI-ea711b41) READY timer expired DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-ea711b41:TLLI-ea711b41) T3312 started (expires in 600 seconds) +DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-ea711b41:TLLI-ea711b41) T3316 (Delete stored RAND & SRES timer) expired DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-ea711b41:TLLI-ea711b41) T3312 Periodic RAU timer expired DLGLOBAL INFO GMM_MS{Registered}: Received Event RAU_REQUESTED DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-ea711b41:TLLI-ea711b41) Tx GMM RAU REQUEST @@ -66,6 +68,7 @@ DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM AUTHENTICATION AND CIPHERING REQUEST DLGLOBAL INFO Rx from upper layers: GMMREG-SIM_AUTH.response +DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) T3316 started (expires in 30 seconds) DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM GMM AUTHENTICATION AND CIPHERING RESPONSE DLGLOBAL INFO Rx from lower layers: GMRR-LLC_TRANSMITTED.indication DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f Gerrit-Change-Number: 33054 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmo-gprs[master]: gmm: Fix typo checking IE presence in Rx Attach Rej
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33055 ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: gmm: Fix typo checking IE presence in Rx Attach Rej ...................................................................... gmm: Fix typo checking IE presence in Rx Attach Rej Change-Id: Ifaf653d89efd4ff4776e0e9b9e8dff625c4f9ebb --- M src/gmm/gmm.c 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 1dcee79..c96917b 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -968,7 +968,7 @@ if (TLVP_PRES_LEN(&tp, GSM48_IE_GMM_TIMER_T3302, 1)) gmme->t3302 = *TLVP_VAL(&tp, GSM48_IE_GMM_TIMER_T3302); - if (TLVP_PRES_LEN(&tp, GSM48_IE_GMM_TIMER_T3302, 1)) + if (TLVP_PRES_LEN(&tp, GSM48_IE_GMM_TIMER_T3346, 1)) gmme->t3346 = *TLVP_VAL(&tp, GSM48_IE_GMM_TIMER_T3346); } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33055 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ifaf653d89efd4ff4776e0e9b9e8dff625c4f9ebb Gerrit-Change-Number: 33055 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmo-gprs[master]: gmm: Tx Auth & Ciph Failure
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33053 ) Change subject: gmm: Tx Auth & Ciph Failure ...................................................................... gmm: Tx Auth & Ciph Failure Change-Id: I3ebb3dba20010e57f29dd5b8bbec457c2b08a8e1 --- M include/osmocom/gprs/gmm/gmm_pdu.h M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/gmm_pdu.c M src/gmm/gmm_prim.c 5 files changed, 77 insertions(+), 3 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/gprs/gmm/gmm_pdu.h b/include/osmocom/gprs/gmm/gmm_pdu.h index 18a181c..541cb48 100644 --- a/include/osmocom/gprs/gmm/gmm_pdu.h +++ b/include/osmocom/gprs/gmm/gmm_pdu.h @@ -3,6 +3,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> +#include <osmocom/gsm/protocol/gsm_04_08_gprs.h> struct gprs_gmm_entity; enum gprs_gmm_upd_type; @@ -39,6 +40,9 @@ enum osmo_gprs_gmm_detach_poweroff_type poweroff_type, struct msgb *msg); +int gprs_gmm_build_auth_ciph_fail(struct gprs_gmm_entity *gmme, + struct msgb *msg, enum gsm48_gmm_cause cause); + int gprs_gmm_build_rau_req(struct gprs_gmm_entity *gmme, enum gprs_gmm_upd_type rau_type, struct msgb *msg); diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index ac64ea1..0308d1e 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -12,6 +12,7 @@ #include <osmocom/core/endian.h> #include <osmocom/core/tdef.h> #include <osmocom/gsm/protocol/gsm_23_003.h> +#include <osmocom/gsm/protocol/gsm_04_08_gprs.h> #include <osmocom/gprs/llc/llc_prim.h> #include <osmocom/gprs/gmm/gmm.h> @@ -132,6 +133,7 @@ enum osmo_gprs_gmm_detach_poweroff_type poweroff_type); int gprs_gmm_tx_rau_req(struct gprs_gmm_entity *gmme, enum gprs_gmm_upd_type rau_type); int gprs_gmm_tx_auth_ciph_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres); +int gprs_gmm_tx_auth_ciph_fail(struct gprs_gmm_entity *gmme, enum gsm48_gmm_cause cause); int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 55b5d66..092a56c 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -704,6 +704,42 @@ return rc; } +/* Tx GMM Authentication and Ciphering Failure, 9.4.10a */ +int gprs_gmm_tx_auth_ciph_fail(struct gprs_gmm_entity *gmme, enum gsm48_gmm_cause cause) +{ + struct osmo_gprs_llc_prim *llc_prim; + int rc; + struct msgb *msg; + + LOGGMME(gmme, LOGL_INFO, "Tx GMM AUTHENTICATION AND CIPHERING FAILURE cause=0x%02x '%s'\n", + cause, get_value_string(gsm48_gmm_cause_names, cause)); + + llc_prim = osmo_gprs_llc_prim_alloc_ll_unitdata_req( + gmme->tlli, OSMO_GPRS_LLC_SAPI_GMM, NULL, GPRS_GMM_ALLOC_SIZE); + msg = llc_prim->oph.msg; + msg->l3h = msg->tail; + rc = gprs_gmm_build_auth_ciph_fail(gmme, msg, cause); + if (rc < 0) { + msgb_free(msg); + return -EBADMSG; + } + llc_prim->ll.l3_pdu = msg->l3h; + llc_prim->ll.l3_pdu_len = msgb_l3len(msg); + /* TODO: + llc_prim->ll.qos_params.*; + llc_prim->ll.radio_prio; + llc_prim->ll.apply_gea; + llc_prim->ll.apply_gia; + */ + + /* invalidate active reference: */ + gmme->auth_ciph.req.ac_ref_nr = 0xff; + rc = gprs_gmm_prim_call_llc_down_cb(llc_prim); + if (rc < 0) + return rc; + return rc; +} + /* Tx GMM Routing area update request, 9.4.14 */ int gprs_gmm_tx_rau_req(struct gprs_gmm_entity *gmme, enum gprs_gmm_upd_type rau_type) @@ -1166,6 +1202,7 @@ if (len < sizeof(*gh) + sizeof(*acreq)) { LOGGMME(gmme, LOGL_ERROR, "Rx GMM AUTHENTICATION AND CIPHERING REQUEST with wrong size %u\n", len); + gprs_gmm_tx_auth_ciph_fail(gmme, GMM_CAUSE_SEM_INCORR_MSG); return -EINVAL; } @@ -1177,6 +1214,7 @@ len - (sizeof(*gh) + sizeof(*acreq))); if (rc < 0) { LOGGMME(gmme, LOGL_ERROR, "Rx GMM AUTHENTICATION AND CIPHERING REQUEST: failed to parse TLVs %d\n", rc); + gprs_gmm_tx_auth_ciph_fail(gmme, GMM_CAUSE_COND_IE_ERR); return -EINVAL; } if (TLVP_PRESENT(&tp, GSM48_IE_GMM_AUTH_RAND)) { @@ -1206,14 +1244,17 @@ if (rand) { /* SIM AUTH needed. Answer GMM req asynchronously in GMMREG-SIM_AUTH.rsp: */ rc = gprs_gmm_submit_gmmreg_sim_auth_ind(gmme); - /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */ + if (rc < 0) { + gprs_gmm_tx_auth_ciph_fail(gmme, GMM_CAUSE_GSM_AUTH_UNACCEPT); + return rc; + } } else { /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.1 */ rc = gprs_gmm_submit_llgmm_assing_req(gmme); if (rc < 0) { - /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */ /* invalidate active reference: */ gmme->auth_ciph.req.ac_ref_nr = 0xff; + gprs_gmm_tx_auth_ciph_fail(gmme, GMM_CAUSE_MSG_INCOMP_P_STATE); return rc; } rc = gprs_gmm_tx_auth_ciph_resp(gmme, NULL); diff --git a/src/gmm/gmm_pdu.c b/src/gmm/gmm_pdu.c index 5ff7a20..7c83ac5 100644 --- a/src/gmm/gmm_pdu.c +++ b/src/gmm/gmm_pdu.c @@ -295,6 +295,24 @@ return 0; } +/* 9.4.10a Authentication and Ciphering Failure */ +int gprs_gmm_build_auth_ciph_fail(struct gprs_gmm_entity *gmme, struct msgb *msg, + enum gsm48_gmm_cause cause) +{ + struct gsm48_hdr *gh; + + gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); + gh->proto_discr = GSM48_PDISC_MM_GPRS; + gh->msg_type = GSM48_MT_GMM_PTMSI_REALL_COMPL; + + /* 10.5.5.14 Cause */ + msgb_put_u8(msg, (uint8_t)cause); + + /* TODO: 10.5.3.2.2 Authentication Failure parameter */ + return 0; +} + + /* Chapter 9.4.14: Routing area update request */ int gprs_gmm_build_rau_req(struct gprs_gmm_entity *gmme, enum gprs_gmm_upd_type rau_type, diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c index bea8341..2122d76 100644 --- a/src/gmm/gmm_prim.c +++ b/src/gmm/gmm_prim.c @@ -447,9 +447,9 @@ rc = gprs_gmm_submit_llgmm_assing_req(gmme); if (rc < 0) { - /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */ /* invalidate active reference: */ gmme->auth_ciph.req.ac_ref_nr = 0xff; + gprs_gmm_tx_auth_ciph_fail(gmme, GMM_CAUSE_MSG_INCOMP_P_STATE); return rc; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33053 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I3ebb3dba20010e57f29dd5b8bbec457c2b08a8e1 Gerrit-Change-Number: 33053 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmo-gprs[master]: gmm: Implement rx RAU Reject
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33058 ) Change subject: gmm: Implement rx RAU Reject ...................................................................... gmm: Implement rx RAU Reject Change-Id: I0d4d8288b78cfd3140c786a52a3906eaf37ebe6b --- M include/osmocom/gprs/gmm/gmm_ms_fsm.h M src/gmm/gmm.c M src/gmm/gmm_ms_fsm.c 3 files changed, 69 insertions(+), 6 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/gprs/gmm/gmm_ms_fsm.h b/include/osmocom/gprs/gmm/gmm_ms_fsm.h index 1ebc53c..772444f 100644 --- a/include/osmocom/gprs/gmm/gmm_ms_fsm.h +++ b/include/osmocom/gprs/gmm/gmm_ms_fsm.h @@ -51,7 +51,7 @@ GPRS_GMM_MS_EV_SR_REJECTED, /* (Iu only) */ GPRS_GMM_MS_EV_SR_ACCEPTED, /* (Iu only) */ GPRS_GMM_MS_EV_RAU_REQUESTED, - GPRS_GMM_MS_EV_RAU_REJECTED, + GPRS_GMM_MS_EV_RAU_REJECTED, /* data: ptr to "uint8_t cause" */ GPRS_GMM_MS_EV_RAU_ACCEPTED, GPRS_GMM_MS_EV_LOW_LVL_FAIL, }; diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index c96917b..4836d58 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -1137,6 +1137,49 @@ return -EINVAL; /* TODO: what to do on error? */ } +/* Rx GMM Routing area update reject, 9.4.17 */ +static int gprs_gmm_rx_rau_rej(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) +{ + uint8_t *buf = &gh->data[0]; + struct tlv_parsed tp; + uint8_t cause = GMM_CAUSE_SEM_INCORR_MSG; + bool force_standby_indicated; + int rc; + + if (len < sizeof(*gh) + 2) { + LOGGMME(gmme, LOGL_ERROR, "Rx GMM ROUTING AREA UPDATE REJECT with wrong size %u\n", len); + goto rejected; + } + + cause = buf[0]; + force_standby_indicated = (buf[1] >> 4) == 0x01; + buf += 2; + + LOGGMME(gmme, LOGL_NOTICE, "Rx GMM ROUTING AREA UPDATE REJECT cause='%s' (%u) force_stdby=%u\n", + get_value_string(gsm48_gmm_cause_names, cause), cause, force_standby_indicated); + + if (force_standby_indicated) + gprs_gmm_gmme_ready_timer_stop(gmme); + + if (len > (buf - (uint8_t *)gh)) { + rc = gprs_gmm_tlv_parse(&tp, buf, len - (buf - (uint8_t *)gh)); + if (rc < 0) { + LOGGMME(gmme, LOGL_ERROR, "Rx GMM ROUTING AREA UPDATE REJECT: failed to parse TLVs %d\n", rc); + goto rejected; + } + + if (TLVP_PRES_LEN(&tp, GSM48_IE_GMM_TIMER_T3302, 1)) + gmme->t3302 = *TLVP_VAL(&tp, GSM48_IE_GMM_TIMER_T3302); + + if (TLVP_PRES_LEN(&tp, GSM48_IE_GMM_TIMER_T3346, 1)) + gmme->t3346 = *TLVP_VAL(&tp, GSM48_IE_GMM_TIMER_T3346); + } + +rejected: + rc = osmo_fsm_inst_dispatch(gmme->ms_fsm.fi, GPRS_GMM_MS_EV_RAU_REJECTED, &cause); + return -EINVAL; +} + /* Rx GMM Identity Request, 9.2.10 */ static int gprs_gmm_rx_id_req(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { @@ -1380,6 +1423,9 @@ case GSM48_MT_GMM_RA_UPD_ACK: rc = gprs_gmm_rx_rau_acc(gmme, gh, len); break; + case GSM48_MT_GMM_RA_UPD_REJ: + rc = gprs_gmm_rx_rau_rej(gmme, gh, len); + break; case GSM48_MT_GMM_ID_REQ: rc = gprs_gmm_rx_id_req(gmme, gh, len); break; diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c index e5a7002..ff26dfa 100644 --- a/src/gmm/gmm_ms_fsm.c +++ b/src/gmm/gmm_ms_fsm.c @@ -239,13 +239,22 @@ { struct gprs_gmm_ms_fsm_ctx *ctx = (struct gprs_gmm_ms_fsm_ctx *)fi->priv; struct osmo_gprs_llc_prim *llc_prim_tx; + enum gsm48_gmm_cause cause; switch (event) { case GPRS_GMM_MS_EV_RAU_REJECTED: - // causes #13, #15, #25 - gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); - // else - //mm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED_INITIATED); + cause = *(uint8_t *)data; + /* 3GPP TS 24.008 Figure 4.1b */ + switch (cause) { + case GMM_CAUSE_ROAMING_NOTALLOWED: + case GMM_CAUSE_NO_SUIT_CELL_IN_LA: + case GMM_CAUSE_NOT_AUTH_FOR_CSG: + gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); + break; + default: + gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); + break; + } break; case GPRS_GMM_MS_EV_RAU_ACCEPTED: gprs_gmm_gmme_t3316_stop(ctx->gmme); @@ -351,7 +360,6 @@ X(GPRS_GMM_MS_EV_RAU_ACCEPTED), .out_state_mask = X(GPRS_GMM_MS_ST_REGISTERED) | - X(GPRS_GMM_MS_ST_DEREGISTERED_INITIATED) | X(GPRS_GMM_MS_ST_DEREGISTERED), .name = "RAUInitidated", .action = st_gmm_ms_rau_initiated, -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I0d4d8288b78cfd3140c786a52a3906eaf37ebe6b Gerrit-Change-Number: 33058 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmo-gprs[master]: rlcmac: Avoid generating UL data if no data to be sent available
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33075 ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: rlcmac: Avoid generating UL data if no data to be sent available ...................................................................... rlcmac: Avoid generating UL data if no data to be sent available Dummy LLC commands only make sense in the network->MS direction, in order to delay closing the DL TBF (3GPP TS 44.064 6.4.2.2). That code in the MS is a leftover from porting code from osmo-pcu. Change-Id: I062aa9aea4f7d66a70ed53eae1c67780ddc3dca5 --- M src/rlcmac/tbf_ul.c 1 file changed, 13 insertions(+), 7 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c index 40e993c..b38c750 100644 --- a/src/rlcmac/tbf_ul.c +++ b/src/rlcmac/tbf_ul.c @@ -589,13 +589,6 @@ gprs_rlcmac_rlc_ul_window_v_a(ul_tbf->ulw)); if (restart_bsn_cycle(ul_tbf)) return take_next_bsn(ul_tbf, bi, previous_bsn, may_combine); - } else { - /* Nothing left to send, create dummy LLC commands */ - LOGPTBFUL(ul_tbf, LOGL_DEBUG, "Sending new dummy block at BSN %d, CS=%s\n", - gprs_rlcmac_rlc_ul_window_v_s(ul_tbf->ulw), - gprs_rlcmac_mcs_name(tx_cs)); - bsn = create_new_bsn(ul_tbf, bi, tx_cs); - /* Don't send a second block, so don't set cs_current_trans */ } if (bsn < 0) { -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I062aa9aea4f7d66a70ed53eae1c67780ddc3dca5 Gerrit-Change-Number: 33075 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmo-gprs[master]: gmm: Rename s/ciph_auth/auth_ciph/
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33052 ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: gmm: Rename s/ciph_auth/auth_ciph/ ...................................................................... gmm: Rename s/ciph_auth/auth_ciph/ The procedure is called "Authentication and ciphering", not the other way around. Change-Id: I02c7edede8db8dbe94e129529ad8fb03fe1b4089 --- M include/osmocom/gprs/gmm/gmm_pdu.h M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/gmm_pdu.c M src/gmm/gmm_prim.c 5 files changed, 19 insertions(+), 7 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gprs/gmm/gmm_pdu.h b/include/osmocom/gprs/gmm/gmm_pdu.h index 249c94f..18a181c 100644 --- a/include/osmocom/gprs/gmm/gmm_pdu.h +++ b/include/osmocom/gprs/gmm/gmm_pdu.h @@ -31,7 +31,7 @@ uint8_t mi_type, struct msgb *msg); -int gprs_gmm_build_ciph_auth_resp(const struct gprs_gmm_entity *gmme, +int gprs_gmm_build_auth_ciph_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres, struct msgb *msg); int gprs_gmm_build_detach_req(struct gprs_gmm_entity *gmme, diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index 48068d9..ac64ea1 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -131,7 +131,7 @@ enum osmo_gprs_gmm_detach_ms_type detach_type, enum osmo_gprs_gmm_detach_poweroff_type poweroff_type); int gprs_gmm_tx_rau_req(struct gprs_gmm_entity *gmme, enum gprs_gmm_upd_type rau_type); -int gprs_gmm_tx_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres); +int gprs_gmm_tx_auth_ciph_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres); int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index a99fe57..55b5d66 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -537,7 +537,7 @@ /* Tx GMM Authentication and ciphering response, 9.4.10 * sres can be NULL if no authentication was requested. */ -int gprs_gmm_tx_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres) +int gprs_gmm_tx_auth_ciph_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres) { struct osmo_gprs_llc_prim *llc_prim; int rc; @@ -549,7 +549,7 @@ gmme->tlli, OSMO_GPRS_LLC_SAPI_GMM, NULL, GPRS_GMM_ALLOC_SIZE); msg = llc_prim->oph.msg; msg->l3h = msg->tail; - rc = gprs_gmm_build_ciph_auth_resp(gmme, sres, msg); + rc = gprs_gmm_build_auth_ciph_resp(gmme, sres, msg); if (rc < 0) { msgb_free(msg); return -EBADMSG; @@ -1216,7 +1216,7 @@ gmme->auth_ciph.req.ac_ref_nr = 0xff; return rc; } - rc = gprs_gmm_tx_ciph_auth_resp(gmme, NULL); + rc = gprs_gmm_tx_auth_ciph_resp(gmme, NULL); /* invalidate active reference: */ gmme->auth_ciph.req.ac_ref_nr = 0xff; } diff --git a/src/gmm/gmm_pdu.c b/src/gmm/gmm_pdu.c index d213e70..5ff7a20 100644 --- a/src/gmm/gmm_pdu.c +++ b/src/gmm/gmm_pdu.c @@ -413,7 +413,7 @@ } /* Tx GMM Authentication and ciphering response, 9.4.10 */ -int gprs_gmm_build_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres, struct msgb *msg) +int gprs_gmm_build_auth_ciph_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres, struct msgb *msg) { struct gsm48_hdr *gh; struct gsm48_auth_ciph_resp *acr; diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c index b6d8dac..bea8341 100644 --- a/src/gmm/gmm_prim.c +++ b/src/gmm/gmm_prim.c @@ -453,7 +453,7 @@ return rc; } - rc = gprs_gmm_tx_ciph_auth_resp(gmme, gmm_prim->gmmreg.sim_auth_rsp.sres); + rc = gprs_gmm_tx_auth_ciph_resp(gmme, gmm_prim->gmmreg.sim_auth_rsp.sres); /* invalidate active reference: */ gmme->auth_ciph.req.ac_ref_nr = 0xff; return rc; -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33052 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I02c7edede8db8dbe94e129529ad8fb03fe1b4089 Gerrit-Change-Number: 33052 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmo-gprs[master]: gmm: Implement rx GMM STATUS msg
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33001 ) Change subject: gmm: Implement rx GMM STATUS msg ...................................................................... gmm: Implement rx GMM STATUS msg Change-Id: I46719a3bf6d5e93e25f41f01f5c2ab889ff62803 --- M src/gmm/gmm.c 1 file changed, 29 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 2fb341e..f4fdd6c 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -1223,6 +1223,23 @@ return rc; } +/* Rx GMM Status, 9.4.18 */ +static int gprs_gmm_rx_status(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) +{ + enum gsm48_gmm_cause cause; + + if (len < sizeof(struct gsm48_hdr) + 1) { + LOGGMME(gmme, LOGL_ERROR, "Rx GMM STATUS with wrong size %u\n", len); + return -EINVAL; + } + + cause = gh->data[0]; + LOGGMME(gmme, LOGL_INFO, "Rx GMM STATUS cause=0x%02x '%s'\n", + cause, get_value_string(gsm48_gmm_cause_names, cause)); + + return 0; +} + /* Rx GPRS Mobility Management. */ int gprs_gmm_rx(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { @@ -1250,6 +1267,9 @@ case GSM48_MT_GMM_AUTH_CIPH_REQ: rc = gprs_gmm_rx_auth_ciph_req(gmme, gh, len); break; + case GSM48_MT_GMM_STATUS: + rc = gprs_gmm_rx_status(gmme, gh, len); + break; default: LOGGMME(gmme, LOGL_ERROR, "Rx GMM message not implemented! type=%u len=%u\n", -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33001 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I46719a3bf6d5e93e25f41f01f5c2ab889ff62803 Gerrit-Change-Number: 33001 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmo-gprs[master]: gmm: Initial implementation of rx GMM Information msg
by pespin 30 May '23

30 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33002 ) Change subject: gmm: Initial implementation of rx GMM Information msg ...................................................................... gmm: Initial implementation of rx GMM Information msg Basic implementation of gprs_gmm_decode_network_name() was cherry-picked from osmocom-bb 2dfa84e73dca455900e6522f61f5c610077783b7 decode_network_name(). Change-Id: I9b81f8f9113a95cc75666dac5ff9e315d0845fcb --- M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/misc.c 3 files changed, 75 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index df3f496..48068d9 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -88,6 +88,10 @@ unsigned long t3314_assigned_sec; /* value assigned by the network */ struct osmo_timer_list t3312; /* periodic RAU, in seconds */ unsigned long t3312_assigned_sec; /* value assigned by the network */ + + /* network name */ + char name_long[32]; + char name_short[32]; }; /* gmm_prim.c: */ @@ -137,6 +141,7 @@ /* misc.c */ int gprs_gmm_gprs_tmr_to_secs(uint8_t gprs_tmr); uint8_t gprs_gmm_secs_to_gprs_tmr_floor(int secs); +int gprs_gmm_decode_network_name(char *name, int name_len, const uint8_t *lv); #define LOGGMME(gmme, level, fmt, args...) \ LOGGMM(level, "GMME(IMSI-%s:PTMSI-%08x:TLLI-%08x) " fmt, \ diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index f4fdd6c..a99fe57 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -1240,6 +1240,33 @@ return 0; } +/* Rx GMM Information, 9.4.19 */ +static int gprs_gmm_rx_information(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) +{ + struct tlv_parsed tp; + int rc; + + if (len <= sizeof(struct gsm48_hdr)) /* no Optional IEs, empty msg */ + return 0; + + rc = gprs_gmm_tlv_parse(&tp, &gh->data[0], + len - sizeof(*gh)); + if (rc < 0) { + LOGGMME(gmme, LOGL_ERROR, "Rx GMM INFORMATION: failed to parse TLVs %d\n", rc); + return -EINVAL; + } + + if (TLVP_PRESENT(&tp, GSM48_IE_GSM_NAME_FULL)) + gprs_gmm_decode_network_name(gmme->name_long, sizeof(gmme->name_long), + TLVP_VAL(&tp, GSM48_IE_GSM_NAME_FULL)-1); + + if (TLVP_PRESENT(&tp, GSM48_IE_GSM_NAME_SHORT)) + gprs_gmm_decode_network_name(gmme->name_short, sizeof(gmme->name_short), + TLVP_VAL(&tp, GSM48_IE_GSM_NAME_SHORT)-1); + + return 0; +} + /* Rx GPRS Mobility Management. */ int gprs_gmm_rx(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { @@ -1270,6 +1297,9 @@ case GSM48_MT_GMM_STATUS: rc = gprs_gmm_rx_status(gmme, gh, len); break; + case GSM48_MT_GMM_INFO: + rc = gprs_gmm_rx_information(gmme, gh, len); + break; default: LOGGMME(gmme, LOGL_ERROR, "Rx GMM message not implemented! type=%u len=%u\n", diff --git a/src/gmm/misc.c b/src/gmm/misc.c index c54bf3c..18ed8c6 100644 --- a/src/gmm/misc.c +++ b/src/gmm/misc.c @@ -20,6 +20,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/utils.h> +#include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/protocol/gsm_04_08_gprs.h> #include <osmocom/gprs/gmm/gmm.h> @@ -79,3 +80,29 @@ return GPRS_TMR_6MINUTE | GPRS_TMR_FACT_MASK; } + + +/* Decode TS 24.008 10.5.3.5a "Network name". + * FIXME: This should be improved & moved to libosmocore at some point, since it is also used in CS MM. + */ +int gprs_gmm_decode_network_name(char *name, int name_len, const uint8_t *lv) +{ + uint8_t in_len = lv[0]; + int length, padding; + + name[0] = '\0'; + if (in_len < 1) + return -EINVAL; + + /* must be CB encoded */ + if ((lv[1] & 0x70) != 0x00) + return -ENOTSUP; + + padding = lv[1] & 0x03; + length = ((in_len - 1) * 8 - padding) / 7; + if (length <= 0) + return 0; + gsm_7bit_decode_n(name, name_len, lv + 2, length); + + return length; +} -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33002 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I9b81f8f9113a95cc75666dac5ff9e315d0845fcb Gerrit-Change-Number: 33002 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmo-gprs[master]: gmm: Implement rx RAU Reject
by pespin 30 May '23

30 May '23
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33058 ) Change subject: gmm: Implement rx RAU Reject ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I0d4d8288b78cfd3140c786a52a3906eaf37ebe6b Gerrit-Change-Number: 33058 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 30 May 2023 16:30:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmo-gprs[master]: gmm: Initial implementation of T3166, rx Auth & Ciph Reject
by pespin 30 May '23

30 May '23
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33054 ) Change subject: gmm: Initial implementation of T3166, rx Auth & Ciph Reject ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f Gerrit-Change-Number: 33054 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 30 May 2023 16:29:58 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.