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

September 2026

  • 1 participants
  • 1894 discussions
[M] Change in osmo-ttcn3-hacks[master]: smf,pgw: Fix missing s6b STR handling during release of s2b sessions
by fixeria 30 Sep '26

30 Sep '26
Attention is currently required from: pespin. fixeria has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43740?usp=email ) Change subject: smf,pgw: Fix missing s6b STR handling during release of s2b sessions ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43740?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I9bc54205eaa3b26a5ec9a3666172ee35d3b98b0e Gerrit-Change-Number: 43740 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 30 Sep 2026 10:11:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-remsim[master]: Add maintenance flag to slot_mapping structure
by Jenkins Builder 30 Sep '26

30 Sep '26
Jenkins Builder has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43743?usp=email ) Change subject: Add maintenance flag to slot_mapping structure ...................................................................... Patch Set 1: (2 comments) File src/slotmap.h: Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43743/comment/6b956805_02bf10f7?… : PS1, Line 86: bool maintenance); code indent should use tabs where possible Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43743/comment/bb0715e6_26d53fa3?… : PS1, Line 86: bool maintenance); please, no spaces at the start of a line -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43743?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Ibc9f771cda5d3ba94934cb04e00e60acd466e8bf Gerrit-Change-Number: 43743 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Wed, 30 Sep 2026 09:52:35 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-remsim[master]: Introduce osmo-remsim-client-socket
by Jenkins Builder 30 Sep '26

30 Sep '26
Jenkins Builder has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43742?usp=email ) Change subject: Introduce osmo-remsim-client-socket ...................................................................... Patch Set 1: (5 comments) File src/client/user_socket.c: Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43742/comment/47f71c96_34c8b636?… : PS1, Line 15: socklen_t addr_len; code indent should use tabs where possible Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43742/comment/e1f8bf31_2912e776?… : PS1, Line 15: socklen_t addr_len; please, no spaces at the start of a line Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43742/comment/be30840c_7d1024c7?… : PS1, Line 114: ss->addr_len = sizeof(ss->addr); code indent should use tabs where possible Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43742/comment/86f21428_13d14c19?… : PS1, Line 114: ss->addr_len = sizeof(ss->addr); please, no spaces at the start of a line Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43742/comment/7e6747e9_a382e3e2?… : PS1, Line 160: while (1) { braces {} are not necessary for single statement blocks -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43742?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I9eddb60e4e7c3191ca2b340690416b53005f714f Gerrit-Change-Number: 43742 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Wed, 30 Sep 2026 09:52:30 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-remsim[master]: Add maintenance mapping support to osmo-remsim-server
by Jenkins Builder 30 Sep '26

30 Sep '26
Jenkins Builder has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43745?usp=email ) Change subject: Add maintenance mapping support to osmo-remsim-server ...................................................................... Patch Set 1: (2 comments) File src/server/rest_api.c: Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43745/comment/b7bcb06b_6000e043?… : PS1, Line 373: /* If we are suspended an exisisting maping, we stay inactive until the mapping was removed. */ 'maping' may be misspelled - perhaps 'mapping'? File src/server/rspro_server.c: Robot Comment from checkpatch (run ID ): https://gerrit.osmocom.org/c/osmo-remsim/+/43745/comment/4fd73659_ff726552?… : PS1, Line 434: * while it is beeing activated. */ 'beeing' may be misspelled - perhaps 'being'? -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43745?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I885b3b529276f46fbbe6d86be2170b0bffbb8434 Gerrit-Change-Number: 43745 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Wed, 30 Sep 2026 09:52:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[S] Change in osmo-remsim[master]: libifd_remsim_client supports multiple slots
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43741?usp=email ) Change subject: libifd_remsim_client supports multiple slots ...................................................................... libifd_remsim_client supports multiple slots Proof of concept. DEVICENAME <C>:<n>:<ip osmo-remsim-server>:<port> - First part is the Client ID (default: 0) - Second part is the number of slots (default: 1) Change-Id: Ia8baa2fbe112c2ee6de94a8d706900b09fe548aa --- M src/client/user_ifdhandler.c 1 file changed, 13 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/41/43741/1 diff --git a/src/client/user_ifdhandler.c b/src/client/user_ifdhandler.c index 7435832..bd58c6f 100644 --- a/src/client/user_ifdhandler.c +++ b/src/client/user_ifdhandler.c @@ -549,6 +549,7 @@ } #define MAX_SLOTS 256 +static int num_slots = 1; static struct ifd_client *ifd_client[MAX_SLOTS]; #define LUN2SLOT(lun) ((lun) & 0xffff) @@ -569,7 +570,8 @@ .client_id = 0, .client_slot = 0, }; - char *r, *client_id, *slot_nr, *host, *port; + char device_name[strlen(DeviceName) + 1]; + char *r, *client_id, *slots, *host, *port; if (LUN2RDR(Lun) != 0) return IFD_NO_SUCH_DEVICE; @@ -579,15 +581,20 @@ ensure_osmo_ctx(); - client_id = strtok_r(DeviceName, ":", &r); + strcpy(device_name, DeviceName); + + client_id = strtok_r(device_name, ":", &r); if (!client_id) goto end_parse; cfg.client_id = atoi(client_id); + cfg.client_slot = LUN2SLOT(Lun); - slot_nr = strtok_r(NULL, ":", &r); - if (!slot_nr) + slots = strtok_r(NULL, ":", &r); + if (!slots) goto end_parse; - cfg.client_slot = atoi(slot_nr); + num_slots = atoi(slots); + if (num_slots < 1 || num_slots > MAX_SLOTS) + return IFD_NO_SUCH_DEVICE; host = strtok_r(NULL, ":", &r); if (!host) @@ -718,7 +725,7 @@ /* Return the number of slots in this reader in Value[0] */ if (*Length < 1) goto err; - *Value = 1; + *Value = num_slots; *Length = 1; break; case TAG_IFD_THREAD_SAFE: -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43741?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Ia8baa2fbe112c2ee6de94a8d706900b09fe548aa Gerrit-Change-Number: 43741 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-remsim[master]: Add maintenance flag to slot_mapping structure
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43743?usp=email ) Change subject: Add maintenance flag to slot_mapping structure ...................................................................... Add maintenance flag to slot_mapping structure In order to store two mappings to the same bank/slot, a boolean flag is introduced. One mapping can have the flag cleared and the other can have it set. This will be used in later patches to have a mapping to a maintenance client, while having an inactive mapping to the regular client. Related: SYS#8159 Change-Id: Ibc9f771cda5d3ba94934cb04e00e60acd466e8bf --- M src/bankd/bankd_main.c M src/server/rest_api.c M src/slotmap.c M src/slotmap.h 4 files changed, 37 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/43/43743/1 diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index f924cfb..0dbb0b0 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -229,7 +229,7 @@ } /* Add a new mapping */ - map = slotmap_add(g_bankd->slotmaps, &bs, &cs); + map = slotmap_add(g_bankd->slotmaps, &bs, &cs, false); if (!map) { LOGPFSML(srvc->fi, LOGL_ERROR, "could not create slotmap\n"); resp = rspro_gen_CreateMappingRes(ResultCode_illegalSlotId); diff --git a/src/server/rest_api.c b/src/server/rest_api.c index 6e025ad..d8c5155 100644 --- a/src/server/rest_api.c +++ b/src/server/rest_api.c @@ -325,7 +325,7 @@ rc = json2slotmap(&slotmap, json_req); if (rc < 0) goto err; - map = slotmap_add(g_rps->slotmaps, &slotmap.bank, &slotmap.client); + map = slotmap_add(g_rps->slotmaps, &slotmap.bank, &slotmap.client, false); if (!map) { LOGP(DREST, LOGL_NOTICE, "REST: Cannot add slotmap\n"); goto err; diff --git a/src/slotmap.c b/src/slotmap.c index 1883cf5..8f2fc8e 100644 --- a/src/slotmap.c +++ b/src/slotmap.c @@ -92,9 +92,30 @@ return NULL; } +/* thread-safe lookup of map by bank:slot with specific maintenance flag */ +struct slot_mapping *slotmap_by_bank_and_maintenance(struct slotmaps *maps, const struct bank_slot *bank, + bool maintenance) +{ + struct slot_mapping *map; + + slotmaps_rdlock(maps); + llist_for_each_entry(map, &maps->mappings, list) { +#ifdef REMSIM_SERVER + if (map->maintenance != maintenance) + continue; +#endif + if (bank_slot_equals(&map->bank, bank)) { + slotmaps_unlock(maps); + return map; + } + } + slotmaps_unlock(maps); + return NULL; +} + /* thread-safe creating of a new bank<->client map */ -struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, - const struct client_slot *client) +struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client, + bool maintenance) { struct slot_mapping *map; char mapname[64]; @@ -103,10 +124,10 @@ * and hence we don't have any races by first grabbing + releasing the read * lock twice before grabbing the writelock below */ - map = slotmap_by_bank(maps, bank); + map = slotmap_by_bank_and_maintenance(maps, bank, maintenance); if (map) { - LOGP(DSLOTMAP, LOGL_ERROR, "BANKD %u:%u already in use, cannot add new map\n", - bank->bank_id, bank->slot_nr); + LOGP(DSLOTMAP, LOGL_ERROR, "BANKD %u:%u (maintenance %d) already in use, cannot add new map\n", + bank->bank_id, bank->slot_nr, maintenance); return NULL; } @@ -131,6 +152,7 @@ #ifdef REMSIM_SERVER map->state = SLMAP_S_NEW; INIT_LLIST_HEAD(&map->bank_list); /* to ensure llist_del() always succeeds */ + map->maintenance = maintenance; #endif slotmaps_unlock(maps); diff --git a/src/slotmap.h b/src/slotmap.h index a14e1cf..1967a61 100644 --- a/src/slotmap.h +++ b/src/slotmap.h @@ -59,6 +59,8 @@ #ifdef REMSIM_SERVER struct llist_head bank_list; enum slot_mapping_state state; + /* this mapping is for maintenenance */ + bool maintenance; #endif }; @@ -79,8 +81,13 @@ /* thread-safe lookup of map by bank:slot */ struct slot_mapping *slotmap_by_bank(struct slotmaps *maps, const struct bank_slot *bank); +/* thread-safe lookup of map by bank:slot and maintenance flag */ +struct slot_mapping *slotmap_by_bank_and_maintenance(struct slotmaps *maps, const struct bank_slot *bank, + bool maintenance); + /* thread-safe creating of a new bank<->client map */ -struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client); +struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client, + bool maintenance); /* thread-safe removal of a bank<->client map */ void slotmap_del(struct slotmaps *maps, struct slot_mapping *map); -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43743?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Ibc9f771cda5d3ba94934cb04e00e60acd466e8bf Gerrit-Change-Number: 43743 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[XS] Change in osmo-remsim[master]: Add INACTIVE state to slot mapping
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43744?usp=email ) Change subject: Add INACTIVE state to slot mapping ...................................................................... Add INACTIVE state to slot mapping If two mapping (maintenance and normal mapping) exist for the same bank/slot, only one client/slot can be connected to the bank/slot at the same time. The other mapping will be in INACTIVE state. Related: SYS#8159 Change-Id: I95dff90deb965f8198effdd355d45419bb4c2b02 --- M src/server/rest_api.c M src/slotmap.c M src/slotmap.h 3 files changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/44/43744/1 diff --git a/src/server/rest_api.c b/src/server/rest_api.c index d8c5155..27391f5 100644 --- a/src/server/rest_api.c +++ b/src/server/rest_api.c @@ -368,7 +368,8 @@ switch (map->state) { case SLMAP_S_NEW: - /* new map, not yet sent to bank: we can remove it immediately */ + case SLMAP_S_INACTIVE: + /* new or inactive map, not yet sent to bank: we can remove it immediately */ /* delete from bank list (if any) */ llist_del(&map->bank_list); /* safely initialize list head to avoid trouble when del_slotmap() does another llist_del() */ diff --git a/src/slotmap.c b/src/slotmap.c index 8f2fc8e..84bebea 100644 --- a/src/slotmap.c +++ b/src/slotmap.c @@ -38,6 +38,7 @@ { SLMAP_S_ACTIVE, "ACTIVE" }, { SLMAP_S_DELETE_REQ, "DELETE_REQ" }, { SLMAP_S_DELETING, "DELETING" }, + { SLMAP_S_INACTIVE, "INACTIVE" }, { 0, NULL } }; diff --git a/src/slotmap.h b/src/slotmap.h index 1967a61..fbcc356 100644 --- a/src/slotmap.h +++ b/src/slotmap.h @@ -38,6 +38,7 @@ SLMAP_S_ACTIVE, /* fully active map; acknowledged by bankd */ SLMAP_S_DELETE_REQ, /* fully active map; REST has requested deletion */ SLMAP_S_DELETING, /* RSPRO has issued Remove to bankd, but bankd hasn't confirmed yet */ + SLMAP_S_INACTIVE, /* suspended mapping is inactive */ }; extern const struct value_string slot_map_state_name[]; static inline const char *slotmap_state_name(enum slot_mapping_state st) -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43744?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I95dff90deb965f8198effdd355d45419bb4c2b02 Gerrit-Change-Number: 43744 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[M] Change in osmo-remsim[master]: Introduce osmo-remsim-client-socket
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43742?usp=email ) Change subject: Introduce osmo-remsim-client-socket ...................................................................... Introduce osmo-remsim-client-socket Add new remsim client with socket interface. It is similar to the osmo-rmsim-client-shell, but it uses a unix socket instead of stdin and stdout to exchange APDUs. The coding is binary instead of hex string. Related: SYS#8159 Change-Id: I9eddb60e4e7c3191ca2b340690416b53005f714f --- M src/client/Makefile.am M src/client/client.h M src/client/remsim_client_main.c A src/client/user_socket.c 4 files changed, 194 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/42/43742/1 diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 6c7abc6..0609e32 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -21,6 +21,18 @@ $(OSMOCORE_LIBS) \ $(NULL) +bin_PROGRAMS += osmo-remsim-client-socket + +osmo_remsim_client_socket_SOURCES = user_socket.c remsim_client_main.c \ + remsim_client.c main_fsm.c ../rspro_client_fsm.c ../debug.c +osmo_remsim_client_socket_CPPFLAGS = -DSOCKET_SUPPORT +osmo_remsim_client_socket_CFLAGS = $(AM_CFLAGS) +osmo_remsim_client_socket_LDADD = $(top_builddir)/src/libosmo-rspro.la \ + $(OSMONETIF_LIBS) \ + $(OSMOGSM_LIBS) \ + $(OSMOCORE_LIBS) \ + $(NULL) + if BUILD_CLIENT_IFDHANDLER EXTRA_DIST=PkgInfo osmo-remsim-client-reader_conf.in serialconf_DATA=osmo-remsim-client-reader_conf diff --git a/src/client/client.h b/src/client/client.h index 6ec94b7..1d9431e 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -92,6 +92,11 @@ bool presence_valid; bool presence_pol; } simtrace; + + /* only valid for socket client */ + struct { + char *name; + } socket; }; struct bankd_client { diff --git a/src/client/remsim_client_main.c b/src/client/remsim_client_main.c index c3f36d6..935e25e 100644 --- a/src/client/remsim_client_main.c +++ b/src/client/remsim_client_main.c @@ -39,6 +39,9 @@ #ifdef SIMTRACE_SUPPORT " -Z --set-sim-presence <0-1> Define the presence pin behaviour (only supported on some boards)\n" #endif +#ifdef SOCKET_SUPPORT + " -S --socket-name PATH Unix socket name\n" +#endif #ifdef USB_SUPPORT " -V --usb-vendor VENDOR_ID\n" " -P --usb-product PRODUCT_ID\n" @@ -69,6 +72,9 @@ { "atr-ignore-rspro", 0, 0, 'r' }, { "event-script", 1, 0, 'e' }, {" disable-color", 0, 0, 'L' }, +#ifdef SOCKET_SUPPORT + { "socket-name", 1, 0, 'S' }, +#endif #ifdef USB_SUPPORT { "usb-vendor", 1, 0, 'V' }, { "usb-product", 1, 0, 'P' }, @@ -85,6 +91,9 @@ #ifdef SIMTRACE_SUPPORT "Z:" #endif +#ifdef SOCKET_SUPPORT + "S:" +#endif #ifdef USB_SUPPORT "V:P:C:I:S:A:H:" #endif @@ -140,6 +149,11 @@ cfg->simtrace.presence_pol = atoi(optarg); break; #endif +#ifdef SOCKET_SUPPORT + case 'S': + osmo_talloc_replace_string(cfg, &cfg->socket.name, optarg); + break; +#endif #ifdef USB_SUPPORT case 'V': cfg->usb.vendor_id = strtol(optarg, NULL, 16); diff --git a/src/client/user_socket.c b/src/client/user_socket.c new file mode 100644 index 0000000..af3e050 --- /dev/null +++ b/src/client/user_socket.c @@ -0,0 +1,163 @@ +#include <errno.h> +#include <unistd.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <osmocom/core/select.h> +#include <osmocom/core/socket.h> + +#include "client.h" + +/* This is a remsim-client with a unix socket to exchange APDUs. */ + +struct socket_state { + struct osmo_fd ofd; + struct sockaddr_un addr; + socklen_t addr_len; + struct bankd_client *bc; +}; + +/*********************************************************************** + * stdin frontend code to remsim-client + ***********************************************************************/ + +int frontend_request_card_insert(struct bankd_client *bc) +{ + LOGP(DMAIN, LOGL_INFO, "SIM inseterd\n"); + return 0; +} + +int frontend_request_card_remove(struct bankd_client *bc) +{ + LOGP(DMAIN, LOGL_INFO, "SIM removed\n"); + return 0; +} + +int frontend_request_sim_remote(struct bankd_client *bc) +{ + return 0; +} + +int frontend_request_sim_local(struct bankd_client *bc) +{ + return 0; +} + +int frontend_request_modem_reset(struct bankd_client *bc) +{ + return 0; +} + +int frontend_handle_card2modem(struct bankd_client *bc, const uint8_t *data, size_t len) +{ + struct socket_state *ss = bc->data; + int rc; + + OSMO_ASSERT(data); + + LOGP(DMAIN, LOGL_INFO, "APDU response %s\n", osmo_hexdump(data, len)); + + rc = sendto(ss->ofd.fd, data, len, 0, (struct sockaddr *)&ss->addr, ss->addr_len); + if (rc < 0) { + LOGP(DMAIN, LOGL_ERROR, "Failed to write to socket (errno = %d).\n", errno); + return rc; + } + + return 0; +} + +int frontend_handle_set_atr(struct bankd_client *bc, const uint8_t *data, size_t len) +{ + struct socket_state *ss = bc->data; + int rc; + + OSMO_ASSERT(data); + + /* FIXME: Why do we get this "short" ATR before the actual one? */ + if (len <= 2) + return -EINVAL; + + LOGP(DMAIN, LOGL_INFO, "SET_ATR %s\n", osmo_hexdump(data, len)); + + rc = sendto(ss->ofd.fd, data, len, 0, (struct sockaddr *)&ss->addr, ss->addr_len); + if (rc < 0) { + LOGP(DMAIN, LOGL_ERROR, "Failed to write to socket (errno = %d).\n", errno); + return rc; + } + return 0; +} + +int frontend_handle_slot_status(struct bankd_client *bc, const SlotPhysStatus_t *sts) +{ + return 0; +} + +int frontend_append_script_env(struct bankd_client *bc, char **env, int idx, size_t max_env) +{ + return idx; +} + + +/*********************************************************************** + * Incoming command from the user application (stdin shell in our case) + ***********************************************************************/ + +/* call-back function for socket read. */ +static int socket_fd_cb(struct osmo_fd *ofd, unsigned int what) +{ + struct socket_state *ss = ofd->data; + struct frontend_tpdu ftpdu; + uint8_t buf[1024]; + int rc; + + OSMO_ASSERT(what & OSMO_FD_READ); + + ss->addr_len = sizeof(ss->addr); + rc = recvfrom(ss->ofd.fd, buf, sizeof(buf), 0, (struct sockaddr *)&ss->addr, &ss->addr_len); + if (rc < 0) { + LOGP(DMAIN, LOGL_ERROR, "Failed to read from socket (errno = %d).\n", errno); + return rc; + } + if (rc == 0) { + /* Ignore empty frame. */ + return 0; + } + + LOGP(DMAIN, LOGL_DEBUG, "APDU request %s\n", osmo_hexdump(buf, rc)); + ftpdu.buf = buf; + ftpdu.len = rc; + osmo_fsm_inst_dispatch(ss->bc->main_fi, MF_E_MDM_TPDU, &ftpdu); + + return 0; +} + +/* main function */ +int client_user_main(struct bankd_client *bc) +{ + struct client_config *cfg = bc->cfg; + struct socket_state ss; + int rc; + + memset(&ss, 0, sizeof(ss)); + ss.bc = bc; + bc->data = &ss; + + if (!cfg->socket.name) { + LOGP(DMAIN, LOGL_ERROR, "No socket name specified.\n"); + return -1; + } + rc = osmo_sock_unix_init(SOCK_DGRAM, 0, cfg->socket.name, OSMO_SOCK_F_BIND); + if (rc < 0) { + LOGP(DMAIN, LOGL_ERROR, "Failed to create socket with name '%s' (errno = %d).\n", + cfg->socket.name, errno); + return -1; + } + osmo_fd_setup(&ss.ofd, rc, OSMO_FD_READ, &socket_fd_cb, &ss, 0); + + rc = osmo_fd_register(&ss.ofd); + if (rc < 0) + return rc; + + while (1) { + osmo_select_main(0); + } +} -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43742?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I9eddb60e4e7c3191ca2b340690416b53005f714f Gerrit-Change-Number: 43742 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[M] Change in osmo-remsim[master]: Add maintenance mapping support to osmo-remsim-server
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43745?usp=email ) Change subject: Add maintenance mapping support to osmo-remsim-server ...................................................................... Add maintenance mapping support to osmo-remsim-server A normal mapping and a maintenance mapping may share the same bank/slot. In this case the normal mapping will be inactive until the maintenance mapping has been deleted. The maintenance mapping has priority over the normal mapping. If a maintenance mapping share the same bank/slot of an existing normal mapping, the normal mapping is suspended. The maintenance mapping hat priority over the mapping. The following steps are performed: * The maintenance mapping is put into INACTIVE state. * The normal mapping is deleted and put into INACTIVE state. * The maintenance mapping is created. Once the maintenance mapping is removed, the normal mapping is restored. The following steps are performed: * The maintenance mapping is deleted and then removed. * The normal mapping in INACTIVE state is created again. To control the maintenance flag, the rest API is expanded. An optional 'maintenance' tag is added to the URL. Related: SYS#8159 Change-Id: I885b3b529276f46fbbe6d86be2170b0bffbb8434 --- M src/server/rest_api.c M src/server/rspro_server.c M src/slotmap.h 3 files changed, 103 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/45/43745/1 diff --git a/src/server/rest_api.c b/src/server/rest_api.c index 27391f5..62e4c45 100644 --- a/src/server/rest_api.c +++ b/src/server/rest_api.c @@ -278,12 +278,18 @@ static int api_cb_slotmaps_get(const struct _u_request *req, struct _u_response *resp, void *user_data) { + const char *maintenance_str = u_map_get(req->map_url, "maintenance"); struct slot_mapping *map; json_t *json_body = json_object(); json_t *json_maps = json_array(); + bool maintenance; + + maintenance = (maintenance_str && !strcmp(maintenance_str, "true")); slotmaps_rdlock(g_rps->slotmaps); llist_for_each_entry(map, &g_rps->slotmaps->mappings, list) { + if (map->maintenance != maintenance) + continue; json_array_append_new(json_maps, slotmap2json(map)); } slotmaps_unlock(g_rps->slotmaps); @@ -309,13 +315,18 @@ static int api_cb_slotmaps_post(const struct _u_request *req, struct _u_response *resp, void *user_data) { + const char *maintenance_str = u_map_get(req->map_url, "maintenance"); struct rspro_server *srv = g_rps; - struct slot_mapping slotmap, *map; + struct slot_mapping slotmap, *map, *other_map; struct rspro_client_conn *conn; json_error_t json_err; json_t *json_req = NULL; + bool suspending_map = false; + bool maintenance; int rc; + maintenance = (maintenance_str && !strcmp(maintenance_str, "true")); + json_req = ulfius_get_json_body_request(req, &json_err); if (!json_req) { LOGP(DREST, LOGL_NOTICE, "REST: No JSON Body\n"); @@ -325,13 +336,46 @@ rc = json2slotmap(&slotmap, json_req); if (rc < 0) goto err; - map = slotmap_add(g_rps->slotmaps, &slotmap.bank, &slotmap.client, false); + + /* Suspend existing normal mapping. */ + if (maintenance) { + other_map = slotmap_by_bank_and_maintenance(g_rps->slotmaps, &slotmap.bank, false); + if (other_map && !other_map->suspend) { + suspending_map = true; + other_map->suspend = true; + /* If the normal mapping is already active, trigger suspension. */ + if (other_map->state == SLMAP_S_ACTIVE) { + conn = bankd_conn_by_id(g_rps, other_map->bank.bank_id); + slotmap_state_change(other_map, SLMAP_S_DELETE_REQ, &conn->bank.maps_delreq); + /* Notify the conn FSM about delete request. */ + trigger_main_thread_via_eventfd(); + } + } + } + + map = slotmap_add(g_rps->slotmaps, &slotmap.bank, &slotmap.client, maintenance); if (!map) { LOGP(DREST, LOGL_NOTICE, "REST: Cannot add slotmap\n"); goto err; } slotmap_state_change(map, SLMAP_S_NEW, NULL); + if (!map->maintenance) { + /* If there is already a maintenance mapping. */ + other_map = slotmap_by_bank_and_maintenance(g_rps->slotmaps, &map->bank, true); + if (other_map) { + /* Put our map (not other map) into inactive state. */ + slotmap_state_change(map, SLMAP_S_INACTIVE, NULL); + goto done; + } + } + + /* If we are suspended an exisisting maping, we stay inactive until the mapping was removed. */ + if (suspending_map) { + slotmap_state_change(map, SLMAP_S_INACTIVE, NULL); + goto done; + } + /* check if any already-connected bankd matches this new map. If yes, associate it */ pthread_rwlock_rdlock(&srv->rwlock); llist_for_each_entry(conn, &srv->banks, list) { @@ -344,7 +388,7 @@ } pthread_rwlock_unlock(&srv->rwlock); - +done: json_decref(json_req); ulfius_set_empty_body_response(resp, 201); @@ -402,9 +446,11 @@ static int api_cb_slotmaps_del(const struct _u_request *req, struct _u_response *resp, void *user_data) { const char *slotmap_id_str = u_map_get(req->map_url, "slotmap_id"); + const char *maintenance_str = u_map_get(req->map_url, "maintenance"); struct slot_mapping *map; int status = 404; unsigned long map_id; + bool maintenance; if (!slotmap_id_str) { status = 400; @@ -416,16 +462,17 @@ goto err; } + maintenance = (maintenance_str && !strcmp(maintenance_str, "true")); + slotmaps_wrlock(g_rps->slotmaps); llist_for_each_entry(map, &g_rps->slotmaps->mappings, list) { - if (slotmap_get_id(map) == map_id) { - _slotmap_mark_deleted(map); - status = 200; - break; - } + if (slotmap_get_id(map) != map_id || map->maintenance != maintenance) + continue; + _slotmap_mark_deleted(map); + status = 200; + break; } slotmaps_unlock(g_rps->slotmaps); - trigger_main_thread_via_eventfd(); ulfius_set_empty_body_response(resp, status); diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c index 10c74e5..9fbdaa9 100644 --- a/src/server/rspro_server.c +++ b/src/server/rspro_server.c @@ -21,6 +21,8 @@ #define S(x) (1 << (x)) +extern struct rspro_server *g_rps; + static RsproPDU_t *slotmap2CreateMappingReq(const struct slot_mapping *slotmap) { ClientSlot_t clslot; @@ -410,7 +412,7 @@ struct rspro_client_conn *conn = fi->priv; struct slotmaps *slotmaps = conn->srv->slotmaps; const __attribute__((unused)) RsproPDU_t *rx = NULL; - struct slot_mapping *map, *map2; + struct slot_mapping *map, *map2, *other_map; switch (event) { case CLNTC_E_CREATE_MAP_RES: /* Bankd acknowledges mapping was created */ @@ -427,6 +429,14 @@ _slotmap_state_change(map, SLMAP_S_ACTIVE, &conn->bank.maps_active); slotmaps_unlock(slotmaps); _update_client_for_slotmap(map, conn->srv, conn); + /* If mapping needs to be suspended while it was created, suspend it now. + * This solves the race condition, where the mapping needs to be suspended + * while it is beeing activated. */ + if (map->suspend) { + RsproPDU_t *pdu = slotmap2RemoveMappingReq(map); + client_conn_send(conn, pdu); + slotmap_state_change(map, SLMAP_S_DELETING, &conn->bank.maps_deleting); + } break; case CLNTC_E_REMOVE_MAP_RES: /* Bankd acknowledges mapping was removed */ rx = data; @@ -443,6 +453,40 @@ /* update client! */ OSMO_ASSERT(map->state == SLMAP_S_DELETING); _update_client_for_slotmap(map, conn->srv, conn); + /* If mapping has been suspended, put it into INACTIVE state. */ + if (map->suspend) { + slotmap_state_change(map, SLMAP_S_INACTIVE, NULL); + /* Search for maintenance mapping, so it can be created. */ + other_map = slotmap_by_bank_and_maintenance(slotmaps, &map->bank, true); + if (!other_map) { + LOGPFSML(fi, LOGL_NOTICE, "no maintenance mapping found, resuming clinet=%d:%d\n", + map->client.client_id, map->client.slot_nr); + /* If not found, resume suspended mapping by sending a create request. + * This solves the race condition, where the maintenance mapping gets removed, + * while the normal mapping is beein suspended. */ + RsproPDU_t *pdu = slotmap2CreateMappingReq(map); + client_conn_send(conn, pdu); + slotmap_state_change(map, SLMAP_S_UNACKNOWLEDGED, &conn->bank.maps_unack); + map->suspend = false; + break; + } + /* Send create request for maintenance mapping. */ + RsproPDU_t *pdu = slotmap2CreateMappingReq(other_map); + client_conn_send(conn, pdu); + slotmap_state_change(other_map, SLMAP_S_UNACKNOWLEDGED, &conn->bank.maps_unack); + break; + } + /* If maintenance mapping is to be deleted, reactivate inactive mapping. */ + if (map->maintenance) { + /* Search for non maintenance mapping. */ + other_map = slotmap_by_bank_and_maintenance(slotmaps, &map->bank, false); + if (other_map) { + /* Send create request for maintenance mapping. */ + RsproPDU_t *pdu = slotmap2CreateMappingReq(other_map); + client_conn_send(conn, pdu); + slotmap_state_change(other_map, SLMAP_S_UNACKNOWLEDGED, &conn->bank.maps_unack); + } + } /* slotmap_del() will remove it from both global and bank list */ slotmap_del(map->maps, map); break; diff --git a/src/slotmap.h b/src/slotmap.h index fbcc356..225d453 100644 --- a/src/slotmap.h +++ b/src/slotmap.h @@ -62,6 +62,8 @@ enum slot_mapping_state state; /* this mapping is for maintenenance */ bool maintenance; + /* this mapping is (to be) suspended */ + bool suspend; #endif }; -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43745?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I885b3b529276f46fbbe6d86be2170b0bffbb8434 Gerrit-Change-Number: 43745 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-remsim[master]: Update osmo-remsim-apitool to support maintenance flag
by jolly 30 Sep '26

30 Sep '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43747?usp=email ) Change subject: Update osmo-remsim-apitool to support maintenance flag ...................................................................... Update osmo-remsim-apitool to support maintenance flag In order to create, delete or show maintenance mappings, a command line option '--maintenance' is introduced. Without this flag, all operations relate to non-maintenance mappings. Optionally a timeout can be set via '--timeout <seconds>'. This sets the maximum time before the maintenance mapping ist automatically deleted. The argument of option '--show-slotmaps' is removed, because the rest API does not allow an argument, except the maintenance flag. Related: SYS#8159 Change-Id: Iaac6423b3a2f7209d0c26e9624d90b21b7c39f89 --- M contrib/osmo-remsim-apitool 1 file changed, 29 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/47/43747/1 diff --git a/contrib/osmo-remsim-apitool b/contrib/osmo-remsim-apitool index 50f0e72..b9b8904 100755 --- a/contrib/osmo-remsim-apitool +++ b/contrib/osmo-remsim-apitool @@ -43,16 +43,30 @@ print("delete failed") #rest calls -def slotmap_create(bank_id, bank_slot, client_id, client_slot): +def slotmap_create(bank_id, bank_slot, client_id, client_slot, maintenance, timeout): js = { 'bank': {'bankId': int(bank_id), 'slotNr': int(bank_slot)}, 'client': {'clientId': int(client_id), 'slotNr': int(client_slot)}, } - return rest_post('/slotmaps', js) + url = "/slotmaps" + if maintenance: + url += "?maintenance=true" + if timeout > 0: + url += f"&timeout={timeout}" + return rest_post(url, js) -def slotmap_delete(bank_id, bank_slot): +def slotmap_delete(bank_id, bank_slot, maintenance): slotmap_id = bank_id * 65536 + bank_slot - return rest_delete("/slotmaps/%u"%slotmap_id) + url = "/slotmaps/%u" % slotmap_id + if maintenance: + url += "?maintenance=true" + return rest_delete(url) + +def slotmap_show(maintenance): + url = "/slotmaps/" + if maintenance: + url += "?maintenance=true" + return rest_get(url) def reset_global(): return rest_post('/global-reset') @@ -61,14 +75,16 @@ global server_port, server_host, verbose parser = argparse.ArgumentParser() - parser.add_argument("-H", "--host", help="host to connect to", default="127.0.0.1") - parser.add_argument("-p", "--port", help="port to connect to", default="9997") - parser.add_argument("-v", "--verbose", help="increase output verbosity", action="count", default=0) + parser.add_argument("-H", "--host", help="host to connect to", default="127.0.0.1") + parser.add_argument("-p", "--port", help="port to connect to", default="9997") + parser.add_argument("-v", "--verbose", help="increase output verbosity", action="count", default=0) + parser.add_argument("--maintenance", help="create/delete/show slotmaps in maintenance mode", action="store_true", default=False) + parser.add_argument("--timeout", help="timeout (in seconds) for maintenance mapping", default=0) group = parser.add_mutually_exclusive_group() group.add_argument("-r", "--reset", help="remove all mappings (POST /global-reset)", action="store_true") group.add_argument("-c", "--show-clients", help="show clients (GET /clients)",nargs='?',const="all",default=None) group.add_argument("-b", "--show-banks", help="show banks (GET /banks)",nargs='?',const="all",default=None) - group.add_argument("-s", "--show-slotmaps", help="show slotmaps (GET /slotmaps)",nargs='?',const="all",default=None) + group.add_argument("-s", "--show-slotmaps", help="show slotmaps (GET /slotmaps)", action="store_true") group.add_argument("-m", "--create-slotmap", help="create new slotmap (POST /slotmaps)", type=int, nargs=4,metavar=('bank_id', 'bank_slot','client_id','client_slot')) group.add_argument("-d", "--delete-slotmap", help="delete slotmapping (DELETE /slotmaps/<id>)", type=int, nargs=2, metavar=('bank_id','bank_slot')) group.add_argument("-a", "--show-all", help="show all (default if no argument given)", action="store_true") @@ -97,20 +113,18 @@ rest_get("/banks/" + str(args.show_banks)) return if args.show_slotmaps: - if args.show_slotmaps == "all": - rest_get("/slotmaps") - else: - rest_get("/slotmaps/" + str(args.show_slotmaps)) + slotmap_show(args.maintenance) return if args.create_slotmap: - slotmap_create(args.create_slotmap[0],args.create_slotmap[1],args.create_slotmap[2],args.create_slotmap[3]) + slotmap_create(args.create_slotmap[0],args.create_slotmap[1],args.create_slotmap[2],args.create_slotmap[3], + args.maintenance, int(args.timeout)) return if args.delete_slotmap: - slotmap_delete(args.delete_slotmap[0],args.delete_slotmap[1]) + slotmap_delete(args.delete_slotmap[0],args.delete_slotmap[1],args.maintenance) return rest_get("/clients") rest_get("/banks") - rest_get("/slotmaps") + slotmap_show(args.maintenance) if __name__ == "__main__": main(sys.argv) -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43747?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Iaac6423b3a2f7209d0c26e9624d90b21b7c39f89 Gerrit-Change-Number: 43747 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.