Attention is currently required from: fixeria, laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/43637?usp=email )
Change subject: pySim-shell: use verify_adm command for commandline ADM auth
......................................................................
Patch Set 4:
(2 comments)
File pySim-shell.py:
https://gerrit.osmocom.org/c/pysim/+/43637/comment/75fa7b7f_554f6653?usp=em… :
PS2, Line 1132: PIN_ADM1
> also remove `1` here?
Done
https://gerrit.osmocom.org/c/pysim/+/43637/comment/b6f95712_c1a20548?usp=em… :
PS2, Line 1188: pin_adm_type = ""
: if opts.pin_adm_type:
: pin_adm_type = "--adm-type %s" % opts.pin_adm_type
: if opts.pin_adm:
: app.onecmd_plus_hooks("verify_adm %s %s" %
: (opts.pin_adm, pin_adm_type), add_to_history = False)
: elif opts.pin_adm_hex:
: app.onecmd_plus_hooks("verify_adm %s --pin-is-hex %s" %
:
> Why don't you just call `app. […]
This was my first approach, it even worked, but the linter complained I guess that was why the method is actually in PySimCommands and not in PysimApp.
Then I saw that we use app.onecmd_plus_hooks for running commands and scripts. I think this is the cleaner method since it does a real execution on the CMD2 shell. Its also more uniform with the existing code in the vicinity.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43637?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7164fad757048774aa7186a84041febde75c351c
Gerrit-Change-Number: 43637
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 21 Sep 2026 12:56:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/43637?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Verified+1 by Jenkins Builder
Change subject: pySim-shell: use verify_adm command for commandline ADM auth
......................................................................
pySim-shell: use verify_adm command for commandline ADM auth
since the very early days, pySim-shell.py has a commandline option
where the user may supply an ADM pin as commandline parameter.
(-a / --pin-adm and -A --pin-adm-hex) This was introduced to simplify
the usage of pySim-shell.py with shellscripts.
Unfortunately the code that handles those commandline options
duplicates the code of the verify_adm commmand. Fortunately it is
very easy to call pySim-shell commands directly using the CMD2
onecmd_plus_hooks method, so we can just call the verify_adm and
replace the duplicated code with that.
So far we are only able to use ADM1 pins from the commandline, since
we now practically use the verify_adm commnad, we can add another
parameter to allow the verification of ADM as well.
Related: SYS#8239
Change-Id: I7164fad757048774aa7186a84041febde75c351c
---
M pySim-shell.py
1 file changed, 14 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/37/43637/4
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43637?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7164fad757048774aa7186a84041febde75c351c
Gerrit-Change-Number: 43637
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: jolly.
pespin has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/43667?usp=email )
Change subject: Add Cisco like DSCP configuration support
......................................................................
Patch Set 5: Code-Review+1
(2 comments)
File src/ss7_vty.h:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/43667/comment/2f60da3c_2419f… :
PS5, Line 51: "Default QoS Class (0)\n"
According to this line there seems to be a "default qos class", but we are not really supporting that afaiu?
File src/ss7_xua_srv_vty.c:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/43667/comment/0ef2c8fc_951f0… :
PS5, Line 160: vty_out(vty, "%%'init-ip-dscp' command is deprecated, use 'qos-class' instead%s", VTY_NEWLINE);
Missing space between %% and '.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/43667?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ic346698fc63771d95e474aec53ffb6c776636b3b
Gerrit-Change-Number: 43667
Gerrit-PatchSet: 5
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Comment-Date: Mon, 21 Sep 2026 12:38:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria, pespin.
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ci/+/43687?usp=email )
Change subject: ansible: jenkins: allow rtprio up to 32
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> I wonder why is 32 needed now? Isn't using rtprio 30 just fine?
@vyanitskiy@sysmocom.de: what was the reason for using 32?
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43687?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I8a66ae833d65c1ddfcc52d14483c1f32323a7640
Gerrit-Change-Number: 43687
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 21 Sep 2026 12:32:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
jolly has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43653?usp=email )
Change subject: Add support for polling multiple eIMs
......................................................................
Add support for polling multiple eIMs
If the eUICC stores multiple eIM configurations, poll all eIMs rather
than only the first one found.
The poll loop is moved from main.c to ipad.c. This poll loop is then
called for all eIMs found in the EimConfigurationData list.
To abort execution, the global "running" flag is mode from main.c to
context structure. A new function is used to clear the flag and cause
the poll loop to terminate.
Related: SYS#8101
Change-Id: Ifcad584dd04dc83c59124ce32e60254a72537d02
---
M include/onomondo/ipa/ipad.h
M src/ipa/libipa/context.h
M src/ipa/libipa/ipad.c
M src/ipa/main.c
4 files changed, 146 insertions(+), 95 deletions(-)
Approvals:
dexter: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/onomondo/ipa/ipad.h b/include/onomondo/ipa/ipad.h
index 77a66df..af8de91 100644
--- a/include/onomondo/ipa/ipad.h
+++ b/include/onomondo/ipa/ipad.h
@@ -45,6 +45,9 @@
* used.) */
char *preferred_eim_id;
+ /*! force the IPAd to process only one eUICC package (debug, use with caution) */
+ bool one_euicc_pkg_only;
+
/*! current TAC (This struct member may be updated at any time after context creation.) */
uint8_t tac[IPA_LEN_TAC];
@@ -87,7 +90,6 @@
struct ipa_context *ipa_new_ctx(struct ipa_config *cfg, struct ipa_buf *nvstate);
int ipa_init(struct ipa_context *ctx);
-int eim_init(struct ipa_context *ctx);
int ipa_add_init_eim_cfg(struct ipa_context *ctx, struct ipa_buf *cfg);
int ipa_euicc_mem_rst(struct ipa_context *ctx, bool operatnl_profiles, bool field_test_profiles, bool default_smdp_addr,
bool pre_test_profiles, bool provisioning_profiles, bool eim_cfg_data, bool immediate_enable_cfg);
@@ -97,5 +99,6 @@
int ipa_disable_emerg_prfle(struct ipa_context *ctx);
int ipa_get_connnectivity_parameters(struct ipa_context *ctx, struct ipa_buf **http_params);
int ipa_poll(struct ipa_context *ctx);
+void ipa_abort(struct ipa_context *ctx);
void ipa_close(struct ipa_context *ctx);
struct ipa_buf *ipa_free_ctx(struct ipa_context *ctx);
diff --git a/src/ipa/libipa/context.h b/src/ipa/libipa/context.h
index 2100cc2..d9c8324 100644
--- a/src/ipa/libipa/context.h
+++ b/src/ipa/libipa/context.h
@@ -67,10 +67,10 @@
} immediate_enable;
} iot_euicc_emu;
- /*! cached eimId (read from eUICC when ipa_init is called) */
+ /*! cached eimId (read from eUICC when eim_init is called) */
char *eim_id;
- /*! cached eIM address (read from eUICC when ipa_init is called) */
+ /*! cached eIM address (read from eUICC when eim_init is called) */
char *eim_fqdn;
/*! cached state of generic eUICC package download and execute procedure
@@ -86,4 +86,7 @@
/*! A canary to detect HTTP communication errors */
bool check_http;
+
+ /*! Flag to keep polling eIM(s) or terminate the loop */
+ bool poll_running;
};
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 8838f91..fa91961 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -138,45 +138,6 @@
nvstate_deserialize_ipa_buf(&nvstate_data, &nvstate_data_len);
}
-/*! Read eIM configuration from eUICC and pick a suitable eIM.
- * \param[inout] ctx pointer to ipa_context.
- * \returns 0 success, -EINVAL on failure. */
-int eim_init(struct ipa_context *ctx)
-{
- struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
- struct EimConfigurationData *eim_cfg_data_item = NULL;
- int rc;
-
- eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
- if (!eim_cfg_data) {
- IPA_LOGP(SIPA, LERROR, "cannot read EimConfigurationData from eUICC\n");
- goto error;
- }
-
- /* In case no preferred_eim_id is set, the first eIM configuration item will be pulled from the list */
- rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, 0);
- if (rc < 0) {
- IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
- goto error;
- }
-
- ctx->eim_id = IPA_STR_FROM_ASN(&eim_cfg_data_item->eimId);
- if (!ctx->eim_id)
- goto error;
-
- if (eim_cfg_data_item->eimFqdn)
- ctx->eim_fqdn = IPA_STR_FROM_ASN(eim_cfg_data_item->eimFqdn);
- else
- goto error;
-
- ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
- return 0;
-error:
- IPA_LOGP(SIPA, LERROR, "unable to retrieve EimConfigurationData\n");
- ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
- return -EINVAL;
-}
-
/*! Create a new ipa_context.
* \param[in] cfg IPAd configuration.
* \returns ipa_context on success, NULL on failure. */
@@ -393,13 +354,53 @@
return -EINVAL;
}
-/*! poll the IPAd (may be called in regular intervals or on purpose).
- * \param[inout] ctx pointer to ipa_context.
- * \returns positive on success, negative on error (see also enum ipa_poll_rc). */
-int ipa_poll(struct ipa_context *ctx)
+static int eim_init(struct ipa_context *ctx, int index)
+{
+ struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
+ struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc = -EINVAL;
+
+ eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
+ if (!eim_cfg_data) {
+ IPA_LOGP(SIPA, LERROR, "cannot read EimConfigurationData from eUICC\n");
+ goto error;
+ }
+
+ /* In case no preferred_eim_id is set, the eIM configuration item of the given index will be pulled from the list */
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, index);
+ if (rc) {
+ if (rc != -ENOENT)
+ IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
+ goto error;
+ }
+
+ IPA_FREE(ctx->eim_id);
+ ctx->eim_id = IPA_STR_FROM_ASN(&eim_cfg_data_item->eimId);
+ if (!ctx->eim_id) {
+ IPA_LOGP(SIPA, LERROR, "unable to allocate memory\n");
+ goto error;
+ }
+
+ IPA_FREE(ctx->eim_fqdn);
+ if (eim_cfg_data_item->eimFqdn) {
+ ctx->eim_fqdn = IPA_STR_FROM_ASN(eim_cfg_data_item->eimFqdn);
+ } else {
+ IPA_LOGP(SIPA, LERROR, "unable to allocate memory\n");
+ goto error;
+ }
+
+ rc = 0;
+error:
+ ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
+ return rc;
+}
+
+static int ipa_poll_eim_package(struct ipa_context *ctx)
{
int rc;
+ IPA_LOGP(SIPA, LINFO, "Polling eIM \"%s\"\n", ctx->eim_id);
+
/* Reset canaries */
ctx->check_scard = false;
ctx->check_http = false;
@@ -448,6 +449,94 @@
}
}
+static int ipa_poll_eim(struct ipa_context *ctx, int index)
+{
+ int rc = 0;
+
+ while (ctx->poll_running) {
+ IPA_LOGP(SIPA, LINFO, "-----------------------------8<-----------------------------\n");
+ rc = ipa_poll_eim_package(ctx);
+
+ switch (rc) {
+ case IPA_POLL_AGAIN_WHEN_ONLINE:
+ /* ipa_poll asks us to wait with the next poll cycle until we have a stable IP
+ * connection. In this example we assume that IP connectivity is always available. */
+ IPA_LOGP(SIPA, LINFO, "poll cycle continues normally (profile change)\n");
+ rc = 0;
+ break;
+ case IPA_POLL_AGAIN:
+ /* ipa_poll asks us to continue polling normally */
+ rc = 0;
+ if (ctx->cfg->one_euicc_pkg_only) {
+ IPA_LOGP(SIPA, LINFO, "forcefully stopping poll cycle upon user decision!\n");
+ goto leave;
+ } else {
+ IPA_LOGP(SIPA, LINFO, "poll cycle continues normally\n");
+ break;
+ }
+ case IPA_POLL_AGAIN_LATER:
+ /* ipa_poll tells us that we may poll less frequently, so just exit. */
+ IPA_LOGP(SIPA, LINFO, "poll cycle ends normally\n");
+ rc = 0;
+ goto leave;
+ default:
+ /* We got a negative return code from ipa_poll. This means something does not work
+ * normally. In a productive setup we would continue calling ipa_poll a few more times
+ * to see if the cause is a temporary problem. After that we would free the context
+ * using ipa_free_ctx and start over. */
+ IPA_LOGP(SIPA, LERROR, "poll cycle ends due to error (%d)\n", rc);
+ rc = -EINVAL;
+ goto leave;
+ }
+ }
+
+leave:
+ return rc;
+}
+
+/*! run the poll loop of the IPAd.
+ * \param[inout] ctx pointer to ipa_context.
+ * \returns positive on success or when polling all eIMs, negative on error (see also enum ipa_poll_rc). */
+int ipa_poll(struct ipa_context *ctx)
+{
+ int rc, index;
+
+ ctx->poll_running = true;
+
+ /* Loop through all eIM, if no preferred eIM ID is specified. */
+ for (index = 0; ; index++) {
+ IPA_LOGP(SIPA, LINFO, "-----------------------------8<-----------------------------\n");
+ rc = eim_init(ctx, index);
+ if (rc < 0) {
+ if (rc == -ENOENT) {
+ IPA_LOGP(SIPA, LINFO, "all eIMs polled!\n");
+ break;
+ }
+ IPA_LOGP(SIPA, LERROR, "eIM initialization failed!\n");
+ return rc;
+ }
+
+ rc = ipa_poll_eim(ctx, index);
+
+ if (!ctx->poll_running) {
+ IPA_LOGP(SIPA, LINFO, "polling aborted by user!\n");
+ break;
+ }
+
+ if (ctx->cfg->preferred_eim_id)
+ return rc;
+ }
+
+ return 0;
+}
+
+/*! abort IPAd polling (may be called from signal handler). */
+void ipa_abort(struct ipa_context *ctx)
+{
+ ctx->poll_running = false;
+}
+
+
/*! close connection towards the eIM.
* \param[inout] ctx pointer to ipa_context. */
void ipa_close(struct ipa_context *ctx)
diff --git a/src/ipa/main.c b/src/ipa/main.c
index 2b15d9b..183a584 100644
--- a/src/ipa/main.c
+++ b/src/ipa/main.c
@@ -35,7 +35,8 @@
OPER_GET_CONN_PARAMS,
};
-bool running = true;
+/* IPA context, used in main() and signal handler */
+static struct ipa_context *ctx = NULL;
static void print_help(const char *prog_name)
{
@@ -138,13 +139,12 @@
static void sig_usr1(int signum)
{
- running = false;
+ ipa_abort(ctx);
}
int main(int argc, char **argv)
{
struct ipa_config cfg = { 0 };
- struct ipa_context *ctx = NULL;
int opt;
int rc;
enum operation operation = OPER_GET_EIM_PACKAGE;
@@ -152,7 +152,6 @@
char *getopt_nvstate_path = DEFAULT_NVSTATE_PATH;
struct ipa_buf *nvstate_load = NULL;
struct ipa_buf *nvstate_save = NULL;
- bool getopt_one_euicc_pkg_only = false;
signal(SIGUSR1, sig_usr1);
@@ -209,7 +208,7 @@
cfg.esipa_req_retries = atoi(optarg);
break;
case '1':
- getopt_one_euicc_pkg_only = true;
+ cfg.one_euicc_pkg_only = true;
break;
case 'D':
cfg.device_capabilities = strtoul(optarg, NULL, 0);
@@ -300,50 +299,7 @@
switch (operation) {
case OPER_GET_EIM_PACKAGE:
- IPA_LOGP(SMAIN, LINFO, "-----------------------------8<-----------------------------\n");
- rc = eim_init(ctx);
- if (rc < 0) {
- IPA_LOGP(SMAIN, LERROR, "eIM initialization failed!\n");
- rc = -EINVAL;
- goto leave;
- }
-
- while (running) {
- IPA_LOGP(SMAIN, LINFO, "-----------------------------8<-----------------------------\n");
- rc = ipa_poll(ctx);
-
- switch (rc) {
- case IPA_POLL_AGAIN_WHEN_ONLINE:
- /* ipa_poll asks us to wait with the next poll cycle until we have a stable IP
- * connection. In this example we assume that IP connectivity is always available. */
- IPA_LOGP(SMAIN, LINFO, "poll cycle continues normally (profile change)\n");
- rc = 0;
- break;
- case IPA_POLL_AGAIN:
- /* ipa_poll asks us to continue polling normally */
- rc = 0;
- if (getopt_one_euicc_pkg_only) {
- IPA_LOGP(SMAIN, LINFO, "forcefully stopping poll cycle upon user decision!\n");
- goto leave;
- } else {
- IPA_LOGP(SMAIN, LINFO, "poll cycle continues normally\n");
- break;
- }
- case IPA_POLL_AGAIN_LATER:
- /* ipa_poll tells us that we may poll less frequently, so just exit. */
- IPA_LOGP(SMAIN, LERROR, "poll cycle ends normally\n");
- rc = 0;
- goto leave;
- default:
- /* We got a negative return code from ipa_poll. This means something does not work
- * normally. In a productive setup we would continue calling ipa_poll a few more times
- * to see if the cause is a temporary problem. After that we would free the context
- * using ipa_free_ctx and start over. */
- IPA_LOGP(SMAIN, LERROR, "poll cycle ends due to error (%d)\n", rc);
- rc = -EINVAL;
- goto leave;
- }
- }
+ rc = ipa_poll(ctx);
break;
case OPER_ADD_INITIAL_EIM:
/* Load initial eIM configuration */
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43653?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: Ifcad584dd04dc83c59124ce32e60254a72537d02
Gerrit-Change-Number: 43653
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
jolly has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email )
Change subject: Add index to ipa_es10b_get_eim_cfg_data_filter
......................................................................
Add index to ipa_es10b_get_eim_cfg_data_filter
In order to select a specific item from EimConfigurationData list, an
index may be given. This is needed to select list items, if no specific
eIM ID is given. Later patch use this filter to loop through all
available eIM configurations.
Related: SYS#8101
Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
---
M src/ipa/libipa/es10b_get_eim_cfg_data.c
M src/ipa/libipa/es10b_get_eim_cfg_data.h
M src/ipa/libipa/ipad.c
M src/ipa/libipa/proc_eim_pkg_retr.c
M src/ipa/libipa/proc_euicc_data_req.c
5 files changed, 31 insertions(+), 15 deletions(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, approved
diff --git a/src/ipa/libipa/es10b_get_eim_cfg_data.c b/src/ipa/libipa/es10b_get_eim_cfg_data.c
index 9a34392..d8a6b62 100644
--- a/src/ipa/libipa/es10b_get_eim_cfg_data.c
+++ b/src/ipa/libipa/es10b_get_eim_cfg_data.c
@@ -285,37 +285,48 @@
}
/*! Filter one EimConfigurationData list item from GetEimConfigurationDataResponse.
+ * \param[out] eim_cfg_data_ite pointer to EimConfigurationData item pointer.
* \param[in] res pointer to function result that contains the GetEimConfigurationDataResponse.
* \param[in] eim_id eimId to look for. When set to NULL, the first item of the EimConfigurationData list is returned.
- * \returns pointer to EimConfigurationData item, NULL on error. */
-struct EimConfigurationData *ipa_es10b_get_eim_cfg_data_filter(struct ipa_es10b_eim_cfg_data *res, char *eim_id)
+ * \param[in] index the item of the EimConfigurationData list to be returned. (If eim_id is set, this has no effect.)
+ * \returns 0 on success, negative on failure. (-ENOENT is returned if index not 0 and out of range.) */
+int ipa_es10b_get_eim_cfg_data_filter(struct EimConfigurationData **eim_cfg_data_item,
+ struct ipa_es10b_eim_cfg_data *res, char *eim_id, int index)
{
long i;
+ *eim_cfg_data_item = NULL;
+
if (!res || !res->res) {
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR,
"cannot filter non existent EimConfigurationData list\n");
- return NULL;
+ return -EINVAL;
}
if (res->res->eimConfigurationDataList.list.count < 1) {
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR, "cannot filter empty EimConfigurationData list\n");
- return NULL;
+ return -EINVAL;
}
- /* In case no eim_id is specified, just pick the first item from the list */
+ /* In case no eim_id is specified, pick the eim_cfg_data_item by its index and exit. */
if (!eim_id || eim_id[0] == '\0') {
- return res->res->eimConfigurationDataList.list.array[0];
+ /* If the index is out of range, return -ENOENT. */
+ if (index >= res->res->eimConfigurationDataList.list.count)
+ return -ENOENT;
+ *eim_cfg_data_item = res->res->eimConfigurationDataList.list.array[index];
+ return 0;
}
+ /* Otherwise find the eim_cfg_data_item by the specified eim_id and exit. */
for (i = 0; i < res->res->eimConfigurationDataList.list.count; i++) {
if (IPA_ASN_STR_CMP_BUF
(&res->res->eimConfigurationDataList.list.array[i]->eimId, eim_id, strlen(eim_id))) {
- return res->res->eimConfigurationDataList.list.array[i];
+ *eim_cfg_data_item = res->res->eimConfigurationDataList.list.array[i];
+ return 0;
}
}
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR, "cannot find eimId %s in EimConfigurationData list\n",
eim_id);
- return NULL;
+ return -EINVAL;
}
diff --git a/src/ipa/libipa/es10b_get_eim_cfg_data.h b/src/ipa/libipa/es10b_get_eim_cfg_data.h
index 5c3c3c5..0bfb776 100644
--- a/src/ipa/libipa/es10b_get_eim_cfg_data.h
+++ b/src/ipa/libipa/es10b_get_eim_cfg_data.h
@@ -43,4 +43,5 @@
struct ipa_es10b_eim_cfg_data *ipa_es10b_get_eim_cfg_data(struct ipa_context *ctx);
void ipa_es10b_get_eim_cfg_data_free(struct ipa_es10b_eim_cfg_data *res);
-struct EimConfigurationData *ipa_es10b_get_eim_cfg_data_filter(struct ipa_es10b_eim_cfg_data *res, char *eim_id);
+int ipa_es10b_get_eim_cfg_data_filter(struct EimConfigurationData **eim_cfg_data_item,
+ struct ipa_es10b_eim_cfg_data *res, char *eim_id, int index);
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 1b15e56..8838f91 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -145,6 +145,7 @@
{
struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc;
eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
if (!eim_cfg_data) {
@@ -153,8 +154,8 @@
}
/* In case no preferred_eim_id is set, the first eIM configuration item will be pulled from the list */
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->cfg->preferred_eim_id);
- if (!eim_cfg_data_item) {
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, 0);
+ if (rc < 0) {
IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
goto error;
}
diff --git a/src/ipa/libipa/proc_eim_pkg_retr.c b/src/ipa/libipa/proc_eim_pkg_retr.c
index e5b3422..2028605 100644
--- a/src/ipa/libipa/proc_eim_pkg_retr.c
+++ b/src/ipa/libipa/proc_eim_pkg_retr.c
@@ -32,6 +32,7 @@
{
struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc;
*pkid = NULL;
@@ -41,8 +42,8 @@
goto error;
}
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->eim_id);
- if (!eim_cfg_data_item) {
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->eim_id, 0);
+ if (rc < 0) {
IPA_LOGP(SIPA, LERROR, "no EimConfigurationData item for eimId %s present!\n", ctx->eim_id);
goto error;
}
diff --git a/src/ipa/libipa/proc_euicc_data_req.c b/src/ipa/libipa/proc_euicc_data_req.c
index b867828..28174f9 100644
--- a/src/ipa/libipa/proc_euicc_data_req.c
+++ b/src/ipa/libipa/proc_euicc_data_req.c
@@ -153,8 +153,10 @@
IPA_LOGP(SIPA, LINFO, "eIM asks for Association token\n");
eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
if (eim_cfg_data && eim_cfg_data->res) {
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->eim_id);
- if (eim_cfg_data_item)
+ int rc;
+
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->eim_id, 0);
+ if (rc >= 0)
ipa_euicc_data_response.choice.ipaEuiccData.associationToken = eim_cfg_data_item->associationToken;
}
}
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
Gerrit-Change-Number: 43652
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
jolly has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43624?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: Prevent compiler warning after calling realloc()
......................................................................
Prevent compiler warning after calling realloc()
After calling realloc(), the old pointer may get freed, so it must not
be used afterwards. If memory leak debugging is enabled (see
-DMEM_EMIT_DEBUG=ON), the old pointer value is printed but there is no
access to any memory location.
Prevent the compiler warning by making a copy of the old pointer and
call realloc() with that copy. Print the value of the original pointer.
Related: SYS#8199
Change-Id: I97360285ec5077d668dd23a158475496c9c47890
---
M include/onomondo/ipa/mem.h
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
dexter: Looks good to me, approved
diff --git a/include/onomondo/ipa/mem.h b/include/onomondo/ipa/mem.h
index 88349b1..cc9d43e 100644
--- a/include/onomondo/ipa/mem.h
+++ b/include/onomondo/ipa/mem.h
@@ -47,8 +47,9 @@
#ifdef MEM_EMIT_DEBUG
#define IPA_REALLOC(obj, n) ({ \
void *___ptr; \
+ void *___old_ptr = (obj); \
___mem_counter -= malloc_usable_size(obj); \
- ___ptr = realloc(obj, n); \
+ ___ptr = realloc(___old_ptr, n); \
___mem_counter += malloc_usable_size(___ptr); \
if (___mem_counter > ___mem_peak) ___mem_peak = ___mem_counter; \
printf("====> %p=realloc(%p, %ld): %li bytes total, %li bytes peak\n", \
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43624?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I97360285ec5077d668dd23a158475496c9c47890
Gerrit-Change-Number: 43624
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>