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
[S] Change in libosmocore[master]: [WIP] osmo_io: Support detecting connect
by daniel 17 May '23

17 May '23
daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32759 ) Change subject: [WIP] osmo_io: Support detecting connect ...................................................................... [WIP] osmo_io: Support detecting connect libosmo-netif does a non blocking connect() which is signalled by marking the fd writable. Therefore osmo_io should signal this somehow. This patch modifies osmo_iofd_write_enable() so that if called and the write queue is empty then the write callback will then be called once with msg == NULL and rc == 0. Change-Id: I893cbc3becd5e125f2f06b3654578aed0aacadf3 --- M src/core/osmo_io.c M src/core/osmo_io_poll.c 2 files changed, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/32759/1 diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index b52b838..e783de8 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -392,8 +392,7 @@ void osmo_iofd_write_enable(struct osmo_io_fd *iofd) { iofd->write_enabled = true; - if (iofd->tx_queue.current_length > 0) - osmo_iofd_ops.write_enable(iofd); + osmo_iofd_ops.write_enable(iofd); } /*! Disable writing to this iofd diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index bc203c0..b368c7a 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -110,7 +110,13 @@ talloc_free(msghdr); msgb_free(msg); + } else { + if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE) + iofd->io_ops.write_cb(iofd, 0, NULL); + if (osmo_iofd_txqueue_len(iofd) == 0) + iofd_poll_ops.write_disable(iofd); } + } } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32759 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I893cbc3becd5e125f2f06b3654578aed0aacadf3 Gerrit-Change-Number: 32759 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Improve handling of segmentation_cb
by daniel 17 May '23

17 May '23
daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32758 ) Change subject: osmo_io: Improve handling of segmentation_cb ...................................................................... osmo_io: Improve handling of segmentation_cb The read length is not needed int the segmentation callback, msgb already has all the necessary information, the parameter previously was just msgb_length(msg). Also handle negative return values (except -EAGAIN) of the callback as errors which cause the msg to be dropped. -EAGAIN will defer the msg. Change-Id: I6a0eebb8d4490f09a3cc6eb97d4ff47b4a8fd377 --- M include/osmocom/core/osmo_io.h M src/core/osmo_io.c 2 files changed, 29 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/32758/1 diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index ffc8cfa..db9805b 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -43,7 +43,7 @@ void (*write_cb)(struct osmo_io_fd *iofd, int res, const struct msgb *msg); /*! call-back function to segment the data returned by read_cb */ - int (*segmentation_cb)(struct msgb *msg, int data_len); + int (*segmentation_cb)(struct msgb *msg); }; /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */ diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index cfb6d68..b52b838 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -229,7 +229,18 @@ return IOFD_SEG_ACT_HANDLE_ONE; } - int len = iofd->io_ops.segmentation_cb(msg, msg_len); + int len = iofd->io_ops.segmentation_cb(msg); + if (len == -EAGAIN) { + LOGPIO(iofd, LOGL_DEBUG, "segmentation_cb returned EAGAIN\n"); + *pending_out = msg; + return IOFD_SEG_ACT_DEFER; + } else if (len < 0) { + /* Something is wrong, skip this msgb */ + LOGPIO(iofd, LOGL_ERROR, "segmentation_cb returned error (%i), skipping msg of size %i\n", len, msg_len); + *pending_out = NULL; + msgb_free(msg); + return IOFD_SEG_ACT_DEFER; + } pending_len = msg_len - len; /* No segmentation needed, return */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32758 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I6a0eebb8d4490f09a3cc6eb97d4ff47b4a8fd377 Gerrit-Change-Number: 32758 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp_codec: fix codec decision
by dexter 17 May '23

17 May '23
Attention is currently required from: neels, fixeria, pespin. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/32218 ) Change subject: mgcp_codec: fix codec decision ...................................................................... Patch Set 12: (7 comments) Patchset: PS11: > Somehow `tests/mgcp/mgcp_test.ok` is seen by Gerrit as a binary file? […] This might be due to the MCGP/SDP we dump in the ok.file Maybe the line breaks at the end confuse gerrit? My editor at least does not complain. Especially in #define CRCX_ZYN we use sometimes \r and \n or both. File src/libosmo-mgcp/mgcp_codec.c: https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/41faa488_963689ad PS11, Line 362: found_same_codec = &rtp_end->codecs[i]; > just do: […] Done https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/c244192c_8dcacc7d PS11, Line 367: return found_same_codec; > ``` […] Done https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/6d2cf65b_ea0b9f47 PS11, Line 408: struct mgcp_rtp_codec *codec_conn_dst = NULL; > cosmetic: can be moved inside the loop bodies Done https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/164f53c0_c6f0dd89 PS11, Line 423: if (conn_dst->end.codecs_assigned == 0) { > In order to avoid code duplication, I would merge this block into the previous one: […] Done File tests/mgcp/mgcp_test.c: https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/0814b158_3b0a68f3 PS11, Line 1808: > ws Done https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/6a30d4cd_484278a4 PS11, Line 1976: > ws Done -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/32218 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5 Gerrit-Change-Number: 32218 Gerrit-PatchSet: 12 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 17 May 2023 15:26:25 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp_codec: fix codec decision
by dexter 17 May '23

17 May '23
Attention is currently required from: neels, fixeria, pespin. Hello Jenkins Builder, neels, laforge, fixeria, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-mgw/+/32218 to look at the new patch set (#12). Change subject: mgcp_codec: fix codec decision ...................................................................... mgcp_codec: fix codec decision Unfortunately OsmoMGW was never really tested with multiple different codecs on either side of the connection. While OsmoMSC and OsmoBSC only assign exactly one codec on each side this has never been a problem, however it might become a problem when a call agent assigns multiple codecs on one side. This has been observed in a setup where OsmoMGW had one leg towards an external call agent. Also due to recent upgrades to the TTCN3 tests we are now able to simulate different codecs on both sides to pinpoint issues. Testing has shown that OsmoMGW has difficulties with multiple codecs. The reason for this is that the function that makes the codec decision was not fully finished. So let's finish the codec decision function and let's also use that decision when patching the payload type of outgoing RTP packets. Related: OS#5461 Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5 --- M include/osmocom/mgcp/mgcp_codec.h M include/osmocom/mgcp/mgcp_trunk.h M src/libosmo-mgcp/mgcp_codec.c M src/libosmo-mgcp/mgcp_network.c M src/libosmo-mgcp/mgcp_protocol.c M src/libosmo-mgcp/mgcp_vty.c M tests/mgcp/mgcp_test.c M tests/mgcp/mgcp_test.ok 8 files changed, 256 insertions(+), 232 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/18/32218/12 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/32218 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5 Gerrit-Change-Number: 32218 Gerrit-PatchSet: 12 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: split subscr_write_plmn_na() internally per-backend
by pespin 17 May '23

17 May '23
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/57/32757/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_sim_pin() internally per-backend
by pespin 17 May '23

17 May '23
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/32756/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_write_loci() internally per-bac...
by pespin 17 May '23

17 May '23
pespin has uploaded a new patch set (#2). ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/55/32755/2 -- 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: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_write_loci() internally per-bac...
by pespin 17 May '23

17 May '23
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/55/32755/1 diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index 08559aa..066f9e4 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_INFO, "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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: layer23: subscriber: Split gsm_subscr_generate_kc() internally per-ba...
by pespin 17 May '23

17 May '23
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/54/32754/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bts[master]: l1sap: Accept RFC5993 and TS 101.318 HR GSM payload
by pespin 17 May '23

17 May '23
Attention is currently required from: dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32630 ) Change subject: l1sap: Accept RFC5993 and TS 101.318 HR GSM payload ...................................................................... Patch Set 4: (1 comment) File src/common/l1sap.c: https://gerrit.osmocom.org/c/osmo-bts/+/32630/comment/18e89d11_debaf3f0 PS4, Line 1955: /* Since we already verified the payload in rtppayload_validate_hr(), we may trust that the payload length is I meant something like this (assuming no weird lengths like len=0 are to be received here): ``` switch (rtp_pl_len) { case GSM_HR_BYTES_RTP_TS101318: /* Convert from TS 101 318 to RFC 5993 */ if (OSMO_UNLIKELY(!ts101318 && rfc5993)) { msg = l1sap_msgb_alloc(rtp_pl_len + 1); if (!msg) return NULL; msgb_put_u8(msg, 0x00); memcpy(msgb_put(msg, rtp_pl_len), rtp_pl, rtp_pl_len); return msg; } break; case GSM_HR_BYTES_RTP_RFC5993: /* Convert from RFC 5993 TS 101 318 */ if (OSMO_UNLIKELY(!rfc5993 && ts101318)) { msg = l1sap_msgb_alloc(rtp_pl_len - 1); if (!msg) return NULL; memcpy(msgb_put(msg, rtp_pl_len - 1), rtp_pl + 1, rtp_pl_len - 1); return msg; } break; default: OSMO_ASSERT(0); } /* No conversion needed since the RTP payload is already in a supported format */ msg = l1sap_msgb_alloc(rtp_pl_len); if (!msg) return NULL; memcpy(msgb_put(msg, rtp_pl_len), rtp_pl, rtp_pl_len); ``` -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32630 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I9419b40c1171876879d41aba4f51c93e8ef5673c Gerrit-Change-Number: 32630 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 17 May 2023 14:52:37 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.