lists.osmocom.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
Download
gerrit-log
May 2023
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
gerrit-log@lists.osmocom.org
1 participants
2583 discussions
Start a n
N
ew thread
[S] Change in libosmo-gprs[master]: gmm: Allow passing old RAI during attach
by pespin
Attention is currently required from: dexter. pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmo-gprs/+/32735
) Change subject: gmm: Allow passing old RAI during attach ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/32735
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I22ffa8a169c09445e7126892616f61b8d01cbfe7 Gerrit-Change-Number: 32735 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: dexter <pmaier(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 22 May 2023 08:42:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
[S] Change in libosmocore[master]: coding: declare gsm0503_tch_f96_[de]interleave()
by pespin
Attention is currently required from: fixeria. pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmocore/+/32807
) Change subject: coding: declare gsm0503_tch_f96_[de]interleave() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/32807
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9a631db088a4e279668beb962c98cc1a0929f44d Gerrit-Change-Number: 32807 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 22 May 2023 08:38:00 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
[S] Change in libosmocore[master]: coding: gsm0503_tch_f96_[de]interleave() not applicable to TCH/F2.4
by pespin
Attention is currently required from: fixeria. pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmocore/+/32806
) Change subject: coding: gsm0503_tch_f96_[de]interleave() not applicable to TCH/F2.4 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/32806
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I52078263cd593503a9e8f024e51e18d7b0906131 Gerrit-Change-Number: 32806 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 22 May 2023 08:37:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
[S] Change in libosmocore[master]: coding: use GSM_MACBLOCK_LEN gsm0503_tch_fr_decode()
by pespin
Attention is currently required from: fixeria. pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmocore/+/32805
) Change subject: coding: use GSM_MACBLOCK_LEN gsm0503_tch_fr_decode() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/32805
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I488ca3db1ca093d19abcfba78c1516509870715d Gerrit-Change-Number: 32805 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 22 May 2023 08:37:14 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
2 years, 1 month
1
0
0
0
[S] Change in osmocom-bb[master]: layer23: Move SAP init/close to be done during MS allocation/destruction
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32750
) Change subject: layer23: Move SAP init/close to be done during MS allocation/destruction ...................................................................... layer23: Move SAP init/close to be done during MS allocation/destruction Change-Id: Ic20760228668db4cb2fc6cdea4fd0470c211ce0a --- M src/host/layer23/src/common/ms.c M src/host/layer23/src/mobile/app_mobile.c 2 files changed, 19 insertions(+), 12 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/host/layer23/src/common/ms.c b/src/host/layer23/src/common/ms.c index f123b1e..a14cb1e 100644 --- a/src/host/layer23/src/common/ms.c +++ b/src/host/layer23/src/common/ms.c @@ -27,6 +27,12 @@ static int osmocom_ms_talloc_destructor(struct osmocom_ms *ms) { + + if (ms->sap_wq.bfd.fd > -1) { + sap_close(ms); + ms->sap_wq.bfd.fd = -1; + } + gprs_settings_fi(ms); gsm_subscr_exit(ms); gsm_sim_exit(ms); @@ -63,6 +69,10 @@ gsm_support_init(ms); gsm_settings_init(ms); gprs_settings_init(ms); + /* init SAP client before SIM card starts up */ + sap_init(ms); + /* SAP response call-back */ + ms->sap_entity.sap_rsp_cb = &gsm_subscr_sap_rsp_cb; gsm_sim_init(ms); gsm_subscr_init(ms); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index b314c29..76f11f3 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -260,12 +260,6 @@ GSM_LCHAN_SDCCH, NULL); lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms); - /* init SAP client before SIM card starts up */ - sap_init(ms); - - /* SAP response call-back */ - ms->sap_entity.sap_rsp_cb = &gsm_subscr_sap_rsp_cb; - gsm_sim_init(ms); gsm48_cc_init(ms); gsm480_ss_init(ms); @@ -448,12 +442,6 @@ layer2_close(ms); ms->l2_wq.bfd.fd = -1; } - - if (ms->sap_wq.bfd.fd > -1) { - sap_close(ms); - ms->sap_wq.bfd.fd = -1; - } - if (ms->deleting) { gsm_settings_exit(ms); script_lua_close(ms); -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32750
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ic20760228668db4cb2fc6cdea4fd0470c211ce0a Gerrit-Change-Number: 32750 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
[M] Change in osmocom-bb[master]: layer23: Generalize subscriber SIM insert API
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32751
) Change subject: layer23: Generalize subscriber SIM insert API ...................................................................... layer23: Generalize subscriber SIM insert API With this patch, during VTY config the SIM type is selected, and the app calls a generic gsm_subscriber_insert() API which will take of internally initializing and starting whatever specific-backend setup is needed. Change-Id: I5aa34ae297ec0114e1d2355d59fdd77b43b35464 --- M src/host/layer23/include/osmocom/bb/common/settings.h M src/host/layer23/include/osmocom/bb/common/subscriber.h M src/host/layer23/src/common/subscriber.c M src/host/layer23/src/common/vty.c M src/host/layer23/src/mobile/app_mobile.c M src/host/layer23/src/modem/app_modem.c 6 files changed, 87 insertions(+), 77 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/common/settings.h b/src/host/layer23/include/osmocom/bb/common/settings.h index 01db2a7..e312a1c 100644 --- a/src/host/layer23/include/osmocom/bb/common/settings.h +++ b/src/host/layer23/include/osmocom/bb/common/settings.h @@ -90,7 +90,8 @@ int plmn_mode; /* PLMN_MODE_* */ /* SIM */ - int sim_type; /* selects card on power on */ + int sim_type; /* enum gsm_subscriber_sim_type, + * selects card on power on */ char emergency_imsi[OSMO_IMSI_BUF_SIZE]; /* SMS */ diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h index 8f0966e..8119103 100644 --- a/src/host/layer23/include/osmocom/bb/common/subscriber.h +++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h @@ -32,7 +32,7 @@ #define GSM_SIM_IS_READER(type) \ (type == GSM_SIM_TYPE_L1PHY || type == GSM_SIM_TYPE_SAP) -enum { +enum gsm_subscriber_sim_type { GSM_SIM_TYPE_NONE = 0, GSM_SIM_TYPE_L1PHY, GSM_SIM_TYPE_TEST, @@ -43,8 +43,8 @@ struct osmocom_ms *ms; /* status */ - uint8_t sim_type; /* type of sim */ - uint8_t sim_valid; /* sim inserted and valid */ + enum gsm_subscriber_sim_type sim_type; /* type of sim */ + bool sim_valid; /* sim inserted and valid */ enum gsm_sub_sim_ustate ustate; /* update status */ uint8_t imsi_attached; /* attached state */ @@ -98,17 +98,16 @@ int gsm_subscr_init(struct osmocom_ms *ms); int gsm_subscr_exit(struct osmocom_ms *ms); -int gsm_subscr_testcard(struct osmocom_ms *ms); +int gsm_subscr_insert(struct osmocom_ms *ms); +int gsm_subscr_remove(struct osmocom_ms *ms); + int gsm_subscr_sap_rsp_cb(struct osmocom_ms *ms, int res_code, uint8_t res_type, uint16_t param_len, const uint8_t *param_val); -int gsm_subscr_sapcard(struct osmocom_ms *ms); -int gsm_subscr_simcard(struct osmocom_ms *ms); void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2, int8_t mode); int gsm_subscr_write_loci(struct osmocom_ms *ms); int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, uint8_t *rand, uint8_t no_sim); -int gsm_subscr_remove(struct osmocom_ms *ms); void new_sim_ustate(struct gsm_subscriber *subscr, int state); int gsm_subscr_del_forbidden_plmn(struct gsm_subscriber *subscr, uint16_t mcc, uint16_t mnc); diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index e284c9c..b623742 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -45,6 +45,10 @@ { 0, NULL } }; +static int gsm_subscr_insert_simcard(struct osmocom_ms *ms); +static int gsm_subscr_insert_testcard(struct osmocom_ms *ms); +static int gsm_subscr_insert_sapcard(struct osmocom_ms *ms); + static int gsm_subscr_remove_sapcard(struct osmocom_ms *ms); static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -141,6 +145,46 @@ return 0; } +/* Insert card */ +int gsm_subscr_insert(struct osmocom_ms *ms) +{ + struct gsm_settings *set = &ms->settings; + struct gsm_subscriber *subscr = &ms->subscr; + int rc; + + if (subscr->sim_valid) { + LOGP(DMM, LOGL_ERROR, "Cannot insert card, until current card is removed.\n"); + return -EBUSY; + } + + /* reset subscriber */ + gsm_subscr_exit(ms); + gsm_subscr_init(ms); + + subscr->sim_valid = true; + + switch (set->sim_type) { + case GSM_SIM_TYPE_L1PHY: + /* trigger sim card reader process */ + rc = gsm_subscr_insert_simcard(ms); + break; + case GSM_SIM_TYPE_TEST: + rc = gsm_subscr_insert_testcard(ms); + break; + case GSM_SIM_TYPE_SAP: + rc = gsm_subscr_insert_sapcard(ms); + break; + default: + return -EINVAL; + } + + if (rc < 0) { + subscr->sim_valid = false; + return rc; + } + return rc; +} + /* Detach card */ int gsm_subscr_remove(struct osmocom_ms *ms) { @@ -175,29 +219,18 @@ */ /* Attach test card, no SIM must be currently attached */ -int gsm_subscr_testcard(struct osmocom_ms *ms) +int gsm_subscr_insert_testcard(struct osmocom_ms *ms) { struct gsm_settings *set = &ms->settings; struct gsm_subscriber *subscr = &ms->subscr; - if (subscr->sim_valid) { - LOGP(DMM, LOGL_ERROR, "Cannot insert card, until current card " - "is detached.\n"); - return -EBUSY; - } - if (!osmo_imsi_str_valid(set->test_sim.imsi)) { LOGP(DMM, LOGL_ERROR, "Wrong IMSI format\n"); return -EINVAL; } - /* reset subscriber */ - gsm_subscr_exit(ms); - gsm_subscr_init(ms); - subscr->sim_type = GSM_SIM_TYPE_TEST; sprintf(subscr->sim_name, "test"); - subscr->sim_valid = 1; subscr->imsi_attached = set->test_sim.imsi_attached; subscr->acc_barr = set->test_sim.barr; /* we may access barred cell */ subscr->acc_class = 0xffff; /* we have any access class */ @@ -762,23 +795,12 @@ } /* Attach SIM reader, no SIM must be currently attached */ -int gsm_subscr_simcard(struct osmocom_ms *ms) +int gsm_subscr_insert_simcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; - if (subscr->sim_valid) { - LOGP(DMM, LOGL_ERROR, "Cannot attach card, until current card " - "is detached.\n"); - return -EBUSY; - } - - /* reset subscriber */ - gsm_subscr_exit(ms); - gsm_subscr_init(ms); - subscr->sim_type = GSM_SIM_TYPE_L1PHY; sprintf(subscr->sim_name, "sim"); - subscr->sim_valid = 1; subscr->ustate = GSM_SIM_U2_NOT_UPDATED; /* start with first index */ @@ -1215,24 +1237,13 @@ */ /* Attach SIM card over SAP */ -int gsm_subscr_sapcard(struct osmocom_ms *ms) +int gsm_subscr_insert_sapcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; int rc; - if (subscr->sim_valid) { - LOGP(DMM, LOGL_ERROR, "Cannot insert card, until current card " - "is detached.\n"); - return -EBUSY; - } - - /* reset subscriber */ - gsm_subscr_exit(ms); - gsm_subscr_init(ms); - subscr->sim_type = GSM_SIM_TYPE_SAP; sprintf(subscr->sim_name, "sap"); - subscr->sim_valid = 1; /* Try to connect to the SAP interface */ l23_vty_ms_notify(ms, NULL); diff --git a/src/host/layer23/src/common/vty.c b/src/host/layer23/src/common/vty.c index 56ff6bc..427c8aa 100644 --- a/src/host/layer23/src/common/vty.c +++ b/src/host/layer23/src/common/vty.c @@ -496,6 +496,7 @@ } set = &ms->settings; + set->sim_type = GSM_SIM_TYPE_TEST; if (argc == 2) { vty_out(vty, "Give MNC together with MCC%s", VTY_NEWLINE); @@ -527,7 +528,7 @@ set->test_sim.imsi_attached = attached; - rc = gsm_subscr_testcard(ms); + rc = gsm_subscr_insert(ms); if (rc < 0) { vty_out(vty, "Attach test SIM card failed: %d%s", rc, VTY_NEWLINE); return CMD_WARNING; @@ -562,6 +563,7 @@ "Name of MS (see \"show ms\")\n") { struct osmocom_ms *ms; + struct gsm_settings *set; ms = l23_vty_get_ms(argv[0], vty); if (!ms) @@ -573,7 +575,9 @@ return CMD_WARNING; } - if (gsm_subscr_sapcard(ms) != 0) + set = &ms->settings; + set->sim_type = GSM_SIM_TYPE_SAP; + if (gsm_subscr_insert(ms) != 0) return CMD_WARNING; return CMD_SUCCESS; @@ -583,6 +587,7 @@ "SIM actions\nAttach SIM from reader\nName of MS (see \"show ms\")") { struct osmocom_ms *ms; + struct gsm_settings *set; ms = l23_vty_get_ms(argv[0], vty); if (!ms) @@ -594,7 +599,9 @@ return CMD_WARNING; } - gsm_subscr_simcard(ms); + set = &ms->settings; + set->sim_type = GSM_SIM_TYPE_L1PHY; + gsm_subscr_insert(ms); return CMD_SUCCESS; } diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 76f11f3..9ce1ad2 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -139,7 +139,6 @@ void *handler_data, void *signal_data) { struct osmocom_ms *ms; - struct gsm_settings *set; struct msgb *nmsg; if (subsys != SS_L1CTL) @@ -148,7 +147,6 @@ switch (signal) { case S_L1CTL_RESET: ms = signal_data; - set = &ms->settings; /* waiting for reset after shutdown */ if (ms->shutdown == MS_SHUTDOWN_WAIT_RESET) { @@ -160,19 +158,10 @@ if (ms->started) break; - /* insert test card, if enabled */ - switch (set->sim_type) { - case GSM_SIM_TYPE_L1PHY: - /* trigger sim card reader process */ - gsm_subscr_simcard(ms); - break; - case GSM_SIM_TYPE_TEST: - gsm_subscr_testcard(ms); - break; - case GSM_SIM_TYPE_SAP: - gsm_subscr_sapcard(ms); - break; - default: + if (ms->settings.sim_type != GSM_SIM_TYPE_NONE) { + /* insert sim card */ + gsm_subscr_insert(ms); + } else { /* no SIM, trigger PLMN selection process */ nmsg = gsm322_msgb_alloc(GSM322_EVENT_SWITCH_ON); if (!nmsg) diff --git a/src/host/layer23/src/modem/app_modem.c b/src/host/layer23/src/modem/app_modem.c index 211a008..fdb3821 100644 --- a/src/host/layer23/src/modem/app_modem.c +++ b/src/host/layer23/src/modem/app_modem.c @@ -194,7 +194,6 @@ void *handler_data, void *signal_data) { struct osmocom_ms *ms; - struct gsm_settings *set; if (subsys != SS_L1CTL) return 0; @@ -206,24 +205,14 @@ app_data.ms = ms; /* insert test card, if enabled */ - set = &ms->settings; - switch (set->sim_type) { - case GSM_SIM_TYPE_L1PHY: - /* trigger sim card reader process */ - gsm_subscr_simcard(ms); - break; - case GSM_SIM_TYPE_TEST: - gsm_subscr_testcard(ms); - break; - case GSM_SIM_TYPE_SAP: - gsm_subscr_sapcard(ms); - break; - default: + if (ms->settings.sim_type != GSM_SIM_TYPE_NONE) { + /* insert sim card */ + gsm_subscr_insert(ms); + } else { /* No SIM, trigger PLMN selection process. * FIXME: not implemented. Code in mobile needs to be * moved to common/ and reuse it here. */ - break; } ms->started = true; -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32751
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I5aa34ae297ec0114e1d2355d59fdd77b43b35464 Gerrit-Change-Number: 32751 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
[M] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_generate_kc() internally per-ba...
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32754
) Change subject: layer23: subscriber: Split gsm_subscr_generate_kc() internally per-backend ...................................................................... layer23: subscriber: Split gsm_subscr_generate_kc() internally per-backend Change-Id: I88365d23773a4bdc50a51807c775b3caff0bd425 --- M src/host/layer23/include/osmocom/bb/common/subscriber.h M src/host/layer23/src/common/subscriber.c 2 files changed, 85 insertions(+), 45 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h index 8119103..ac894e5 100644 --- a/src/host/layer23/include/osmocom/bb/common/subscriber.h +++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h @@ -1,6 +1,8 @@ #ifndef _SUBSCRIBER_H #define _SUBSCRIBER_H +#include <stdbool.h> + #include <osmocom/core/utils.h> #include <osmocom/gsm/protocol/gsm_23_003.h> @@ -106,8 +108,8 @@ void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2, int8_t mode); int gsm_subscr_write_loci(struct osmocom_ms *ms); -int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, - uint8_t *rand, uint8_t no_sim); +int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, + bool no_sim); void new_sim_ustate(struct gsm_subscriber *subscr, int state); int gsm_subscr_del_forbidden_plmn(struct gsm_subscriber *subscr, uint16_t mcc, uint16_t mnc); diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index b623742..08559aa 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -51,6 +51,11 @@ static int gsm_subscr_remove_sapcard(struct osmocom_ms *ms); +static int gsm_subscr_generate_kc_simcard(struct osmocom_ms *ms, uint8_t key_seq, + const uint8_t *rand, uint8_t no_sim); +static int gsm_subscr_generate_kc_testcard(struct osmocom_ms *ms, uint8_t key_seq, + const uint8_t *rand, uint8_t no_sim); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -214,6 +219,40 @@ subscr->ustate = state; } +int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, + bool no_sim) +{ + struct gsm_subscriber *subscr = &ms->subscr; + struct osmobb_l23_subscr_sim_auth_resp_sig_data sd; + int rc; + + if (no_sim || subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) { + LOGP(DMM, LOGL_INFO, "Sending dummy authentication response\n"); + sd.ms = ms; + sd.sres[0] = 0x12; + sd.sres[1] = 0x34; + sd.sres[2] = 0x56; + sd.sres[3] = 0x78; + osmo_signal_dispatch(SS_L23_SUBSCR, S_L23_SUBSCR_SIM_AUTH_RESP, &sd); + return 0; + } + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_TEST: + rc = gsm_subscr_generate_kc_testcard(ms, key_seq, rand, no_sim); + break; + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + /* trigger sim card reader process */ + rc = gsm_subscr_generate_kc_simcard(ms, key_seq, rand, no_sim); + break; + default: + OSMO_ASSERT(0); + } + + return rc; +} + /* * test card */ @@ -270,6 +309,37 @@ return 0; } +static int gsm_subscr_generate_kc_testcard(struct osmocom_ms *ms, uint8_t key_seq, + const uint8_t *rand, uint8_t no_sim) +{ + struct gsm_subscriber *subscr = &ms->subscr; + struct osmobb_l23_subscr_sim_auth_resp_sig_data sd; + + struct gsm_settings *set = &ms->settings; + static struct osmo_sub_auth_data auth = { + .type = OSMO_AUTH_TYPE_GSM + }; + struct osmo_auth_vector _vec; + struct osmo_auth_vector *vec = &_vec; + + auth.algo = set->test_sim.ki_type; + memcpy(auth.u.gsm.ki, set->test_sim.ki, sizeof(auth.u.gsm.ki)); + int ret = osmo_auth_gen_vec(vec, &auth, rand); + if (ret < 0) + return ret; + + /* store sequence */ + subscr->key_seq = key_seq; + memcpy(subscr->key, vec->kc, 8); + + LOGP(DMM, LOGL_INFO, "Sending authentication response\n"); + sd.ms = ms; + memcpy(sd.sres, vec->sres, 4); + osmo_signal_dispatch(SS_L23_SUBSCR, S_L23_SUBSCR_SIM_AUTH_RESP, &sd); + + return 0; +} + /* * sim card */ @@ -933,53 +1003,12 @@ msgb_free(msg); } -int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, - uint8_t *rand, uint8_t no_sim) +static int gsm_subscr_generate_kc_simcard(struct osmocom_ms *ms, uint8_t key_seq, + const uint8_t *rand, uint8_t no_sim) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; struct sim_hdr *nsh; - struct osmobb_l23_subscr_sim_auth_resp_sig_data sd; - - /* not a SIM */ - if ((subscr->sim_type != GSM_SIM_TYPE_TEST && !GSM_SIM_IS_READER(subscr->sim_type)) - || !subscr->sim_valid || no_sim) { - LOGP(DMM, LOGL_INFO, "Sending dummy authentication response\n"); - sd.ms = ms; - sd.sres[0] = 0x12; - sd.sres[1] = 0x34; - sd.sres[2] = 0x56; - sd.sres[3] = 0x78; - osmo_signal_dispatch(SS_L23_SUBSCR, S_L23_SUBSCR_SIM_AUTH_RESP, &sd); - return 0; - } - - /* test SIM */ - if (subscr->sim_type == GSM_SIM_TYPE_TEST) { - struct gsm_settings *set = &ms->settings; - static struct osmo_sub_auth_data auth = { - .type = OSMO_AUTH_TYPE_GSM - }; - struct osmo_auth_vector _vec; - struct osmo_auth_vector *vec = &_vec; - - auth.algo = set->test_sim.ki_type; - memcpy(auth.u.gsm.ki, set->test_sim.ki, sizeof(auth.u.gsm.ki)); - int ret = osmo_auth_gen_vec(vec, &auth, rand); - if (ret < 0) - return ret; - - /* store sequence */ - subscr->key_seq = key_seq; - memcpy(subscr->key, vec->kc, 8); - - LOGP(DMM, LOGL_INFO, "Sending authentication response\n"); - sd.ms = ms; - memcpy(sd.sres, vec->sres, 4); - osmo_signal_dispatch(SS_L23_SUBSCR, S_L23_SUBSCR_SIM_AUTH_RESP, &sd); - - return 0; - } LOGP(DMM, LOGL_INFO, "Generating KEY at SIM\n"); -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32754
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I88365d23773a4bdc50a51807c775b3caff0bd425 Gerrit-Change-Number: 32754 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
[M] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_sim_pin() internally per-backend
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32756
) Change subject: layer23: subscriber: Split gsm_subscr_sim_pin() internally per-backend ...................................................................... layer23: subscriber: Split gsm_subscr_sim_pin() internally per-backend Change-Id: I10968c5a43632e0e3054c2d6934cae0052c2daae --- M src/host/layer23/include/osmocom/bb/common/subscriber.h M src/host/layer23/src/common/subscriber.c 2 files changed, 41 insertions(+), 10 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h index ac894e5..972f613 100644 --- a/src/host/layer23/include/osmocom/bb/common/subscriber.h +++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h @@ -105,8 +105,8 @@ int gsm_subscr_sap_rsp_cb(struct osmocom_ms *ms, int res_code, uint8_t res_type, uint16_t param_len, const uint8_t *param_val); -void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2, - int8_t mode); +int gsm_subscr_sim_pin(struct osmocom_ms *ms, const char *pin1, const char *pin2, + int8_t mode); int gsm_subscr_write_loci(struct osmocom_ms *ms); int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, bool no_sim); diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index 16d985f..f3e6f20 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -58,6 +58,9 @@ static int gsm_subscr_write_loci_simcard(struct osmocom_ms *ms); +static int gsm_subscr_sim_pin_simcard(struct osmocom_ms *ms, const char *pin1, const char *pin2, + int8_t mode); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -221,6 +224,28 @@ subscr->ustate = state; } +/* enter PIN */ +int gsm_subscr_sim_pin(struct osmocom_ms *ms, const char *pin1, const char *pin2, + int8_t mode) +{ + struct gsm_subscriber *subscr = &ms->subscr; + + /* skip, if no real valid SIM */ + if (subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) + return 0; + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + return gsm_subscr_sim_pin_simcard(ms, pin1, pin2, mode); + case GSM_SIM_TYPE_TEST: + LOGP(DMM, LOGL_NOTICE, "PIN on test SIM: not implemented!\n"); + return 0; /* TODO */ + default: + OSMO_ASSERT(0); + } +} + int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, bool no_sim) { @@ -843,17 +868,13 @@ } /* enter PIN */ -void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2, - int8_t mode) +static int gsm_subscr_sim_pin_simcard(struct osmocom_ms *ms, const char *pin1, const char *pin2, + int8_t mode) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; uint8_t job; - /* skip, if no real valid SIM */ - if (!GSM_SIM_IS_READER(subscr->sim_type)) - return; - switch (mode) { case -1: job = SIM_JOB_PIN1_DISABLE; @@ -875,7 +896,7 @@ default: if (!subscr->sim_pin_required) { LOGP(DMM, LOGL_ERROR, "No PIN required now\n"); - return; + return 0; } LOGP(DMM, LOGL_INFO, "entering PIN %s\n", pin1); job = SIM_JOB_PIN1_UNLOCK; @@ -883,10 +904,11 @@ nmsg = gsm_sim_msgb_alloc(subscr->sim_handle_query, job); if (!nmsg) - return; + return -ENOMEM; memcpy(msgb_put(nmsg, strlen(pin1) + 1), pin1, strlen(pin1) + 1); memcpy(msgb_put(nmsg, strlen(pin2) + 1), pin2, strlen(pin2) + 1); sim_job(ms, nmsg); + return 0; } /* Attach SIM reader, no SIM must be currently attached */ -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32756
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I10968c5a43632e0e3054c2d6934cae0052c2daae Gerrit-Change-Number: 32756 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
[S] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_write_loci() internally per-bac...
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32755
) Change subject: layer23: subscriber: Split gsm_subscr_write_loci() internally per-backend ...................................................................... layer23: subscriber: Split gsm_subscr_write_loci() internally per-backend Change-Id: I5f024972016afe0e161b745236c84b00ee44ad5e --- M src/host/layer23/src/common/subscriber.c 1 file changed, 35 insertions(+), 7 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index 08559aa..16d985f 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -56,6 +56,8 @@ static int gsm_subscr_generate_kc_testcard(struct osmocom_ms *ms, uint8_t key_seq, const uint8_t *rand, uint8_t no_sim); +static int gsm_subscr_write_loci_simcard(struct osmocom_ms *ms); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -253,6 +255,29 @@ return rc; } +/* update LOCI on SIM */ +int gsm_subscr_write_loci(struct osmocom_ms *ms) +{ + struct gsm_subscriber *subscr = &ms->subscr; + + /* skip, if no real valid SIM */ + if (subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) + return 0; + + LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n"); + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + return gsm_subscr_write_loci_simcard(ms); + case GSM_SIM_TYPE_TEST: + LOGP(DMM, LOGL_NOTICE, "Updating LOCI on test SIM: not implemented!\n"); + return 0; /* TODO */ + default: + OSMO_ASSERT(0); + } +} + /* * test card */ @@ -940,19 +965,13 @@ } /* update LOCI on SIM */ -int gsm_subscr_write_loci(struct osmocom_ms *ms) +static int gsm_subscr_write_loci_simcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; struct sim_hdr *nsh; struct gsm1111_ef_loci *loci; - /* skip, if no real valid SIM */ - if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) - return 0; - - LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n"); - /* write to SIM */ nmsg = gsm_sim_msgb_alloc(subscr->sim_handle_update, SIM_JOB_UPDATE_BINARY); -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32755
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I5f024972016afe0e161b745236c84b00ee44ad5e Gerrit-Change-Number: 32755 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
[S] Change in osmocom-bb[master]: layer23: split subscr_write_plmn_na() internally per-backend
by pespin
pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32757
) Change subject: layer23: split subscr_write_plmn_na() internally per-backend ...................................................................... layer23: split subscr_write_plmn_na() internally per-backend Change-Id: I5e3a4996bbb5cbfbe81342eadb46aa10a2033fd9 --- M src/host/layer23/src/common/subscriber.c 1 file changed, 35 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index f3e6f20..bdd6b62 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -61,6 +61,8 @@ static int gsm_subscr_sim_pin_simcard(struct osmocom_ms *ms, const char *pin1, const char *pin2, int8_t mode); +static int subscr_write_plmn_na_simcard(struct osmocom_ms *ms); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -303,6 +305,29 @@ } } +/* update plmn not allowed list on SIM */ +static int subscr_write_plmn_na(struct osmocom_ms *ms) +{ + struct gsm_subscriber *subscr = &ms->subscr; + + /* skip, if no real valid SIM */ + if (subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) + return 0; + + LOGP(DMM, LOGL_INFO, "Updating FPLMN on SIM\n"); + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + return subscr_write_plmn_na_simcard(ms); + case GSM_SIM_TYPE_TEST: + LOGP(DMM, LOGL_NOTICE, "Updating FPLMN on test SIM: not implemented!\n"); + return 0; /* TODO */ + default: + OSMO_ASSERT(0); + } +} + /* * test card */ @@ -926,7 +951,7 @@ } /* update plmn not allowed list on SIM */ -static int subscr_write_plmn_na(struct osmocom_ms *ms) +static int subscr_write_plmn_na_simcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; @@ -940,10 +965,6 @@ return 0; #endif - /* skip, if no real valid SIM */ - if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) - return 0; - /* get tail list from "PLMN not allowed" */ llist_for_each_entry(na, &subscr->plmn_na, entry) { if (count < 4) -- To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32757
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I5e3a4996bbb5cbfbe81342eadb46aa10a2033fd9 Gerrit-Change-Number: 32757 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
2 years, 1 month
1
0
0
0
← Newer
1
...
117
118
119
120
121
122
123
...
259
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Results per page:
10
25
50
100
200