jolly has uploaded this change for review.
V1.2: Add function ES10b.ExecuteFallbackMechanism
Add new library function to enable the fallback profile on IoT eUICC.
Also add an option to the command line interface to call the library
function. The optional refresh flag may be set via command line option.
The function cannot be emulated with non-IoT eUICC.
Reference: SGP.32 Section 5.9.20
Related: SYS#8101
Change-Id: Ia751f0888c36f39ddfadf7f8bb923a8ee50178dc
---
M asn1/SGP32Definitions.asn
M include/onomondo/ipa/ipad.h
M src/ipa/libasn/CMakeLists.txt
A src/ipa/libasn/ExecuteFallbackMechanismRequest.c
A src/ipa/libasn/ExecuteFallbackMechanismRequest.h
A src/ipa/libasn/ExecuteFallbackMechanismResponse.c
A src/ipa/libasn/ExecuteFallbackMechanismResponse.h
M src/ipa/libipa/CMakeLists.txt
A src/ipa/libipa/es10b_exec_fallback_mech.c
A src/ipa/libipa/es10b_exec_fallback_mech.h
M src/ipa/libipa/ipad.c
M src/ipa/main.c
12 files changed, 411 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/41/43041/1
diff --git a/asn1/SGP32Definitions.asn b/asn1/SGP32Definitions.asn
index 7c5821c..287d4c3 100644
--- a/asn1/SGP32Definitions.asn
+++ b/asn1/SGP32Definitions.asn
@@ -592,6 +592,26 @@
}
-- ASN1STOP
+-- Section 5.9.20
+-- ASN1START
+ExecuteFallbackMechanismRequest ::= [93] SEQUENCE { -- Tag ' BF5D'
+ refreshFlag BOOLEAN -- indicating whether REFRESH is required
+}
+-- ASN1STOP
+-- ASN1START
+ExecuteFallbackMechanismResponse ::= [93] SEQUENCE { -- Tag ' BF5D'
+ executeFallbackMechanismResult [0] INTEGER {
+ ok(0),
+ profileNotInDisabledState(2),
+ catBusy(5),
+ fallbackNotAvailable(6), -- Fallback Attribute not set
+ commandError(7),
+ ecallActive(104),
+ undefinedError(127)
+ }
+}
+-- ASN1STOP
+
-- Section 5.9.25
-- ASN1START
SGP32-SetDefaultDpAddressRequest ::= [101] SEQUENCE { -- Tag 'BF65'
diff --git a/include/onomondo/ipa/ipad.h b/include/onomondo/ipa/ipad.h
index bb4a05a..2d11d23 100644
--- a/include/onomondo/ipa/ipad.h
+++ b/include/onomondo/ipa/ipad.h
@@ -94,6 +94,7 @@
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 test_profiles, bool default_smdp_addr,
bool eim_cfg_data, bool immediate_enable_cfg);
+int ipa_execute_fallback_mechanism(struct ipa_context *ctx, bool refresh_flag);
int ipa_poll(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/libasn/CMakeLists.txt b/src/ipa/libasn/CMakeLists.txt
index 3c84951..166d7f2 100644
--- a/src/ipa/libasn/CMakeLists.txt
+++ b/src/ipa/libasn/CMakeLists.txt
@@ -347,6 +347,10 @@
EuiccSignPIR.h
EventEntries.c
EventEntries.h
+ExecuteFallbackMechanismRequest.c
+ExecuteFallbackMechanismRequest.h
+ExecuteFallbackMechanismResponse.c
+ExecuteFallbackMechanismResponse.h
ExpirationDate.c
ExpirationDate.h
ExtendedNetworkAddress.c
diff --git a/src/ipa/libasn/ExecuteFallbackMechanismRequest.c b/src/ipa/libasn/ExecuteFallbackMechanismRequest.c
new file mode 100644
index 0000000..2df0b3b
--- /dev/null
+++ b/src/ipa/libasn/ExecuteFallbackMechanismRequest.c
@@ -0,0 +1,51 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "ExecuteFallbackMechanismRequest.h"
+
+static asn_TYPE_member_t asn_MBR_ExecuteFallbackMechanismRequest_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct ExecuteFallbackMechanismRequest, refreshFlag),
+ (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_BOOLEAN,
+ 0,
+ { 0, 0, 0 },
+ 0, 0, /* No default value */
+ "refreshFlag"
+ },
+};
+static const ber_tlv_tag_t asn_DEF_ExecuteFallbackMechanismRequest_tags_1[] = {
+ (ASN_TAG_CLASS_CONTEXT | (93 << 2)),
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_ExecuteFallbackMechanismRequest_tag2el_1[] = {
+ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* refreshFlag */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_ExecuteFallbackMechanismRequest_specs_1 = {
+ sizeof(struct ExecuteFallbackMechanismRequest),
+ offsetof(struct ExecuteFallbackMechanismRequest, _asn_ctx),
+ asn_MAP_ExecuteFallbackMechanismRequest_tag2el_1,
+ 1, /* Count of tags in the map */
+ 0, 0, 0, /* Optional elements (not needed) */
+ 1, /* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_ExecuteFallbackMechanismRequest = {
+ "ExecuteFallbackMechanismRequest",
+ "ExecuteFallbackMechanismRequest",
+ &asn_OP_SEQUENCE,
+ asn_DEF_ExecuteFallbackMechanismRequest_tags_1,
+ sizeof(asn_DEF_ExecuteFallbackMechanismRequest_tags_1)
+ /sizeof(asn_DEF_ExecuteFallbackMechanismRequest_tags_1[0]) - 1, /* 1 */
+ asn_DEF_ExecuteFallbackMechanismRequest_tags_1, /* Same as above */
+ sizeof(asn_DEF_ExecuteFallbackMechanismRequest_tags_1)
+ /sizeof(asn_DEF_ExecuteFallbackMechanismRequest_tags_1[0]), /* 2 */
+ { 0, 0, SEQUENCE_constraint },
+ asn_MBR_ExecuteFallbackMechanismRequest_1,
+ 1, /* Elements count */
+ &asn_SPC_ExecuteFallbackMechanismRequest_specs_1 /* Additional specs */
+};
+
diff --git a/src/ipa/libasn/ExecuteFallbackMechanismRequest.h b/src/ipa/libasn/ExecuteFallbackMechanismRequest.h
new file mode 100644
index 0000000..2f122fe
--- /dev/null
+++ b/src/ipa/libasn/ExecuteFallbackMechanismRequest.h
@@ -0,0 +1,42 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _ExecuteFallbackMechanismRequest_H_
+#define _ExecuteFallbackMechanismRequest_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <BOOLEAN.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ExecuteFallbackMechanismRequest */
+typedef struct ExecuteFallbackMechanismRequest {
+ BOOLEAN_t refreshFlag;
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} ExecuteFallbackMechanismRequest_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ExecuteFallbackMechanismRequest;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ExecuteFallbackMechanismRequest_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libasn/ExecuteFallbackMechanismResponse.c b/src/ipa/libasn/ExecuteFallbackMechanismResponse.c
new file mode 100644
index 0000000..ba2e27e
--- /dev/null
+++ b/src/ipa/libasn/ExecuteFallbackMechanismResponse.c
@@ -0,0 +1,51 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "ExecuteFallbackMechanismResponse.h"
+
+static asn_TYPE_member_t asn_MBR_ExecuteFallbackMechanismResponse_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct ExecuteFallbackMechanismResponse, executeFallbackMechanismResult),
+ (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_NativeInteger,
+ 0,
+ { 0, 0, 0 },
+ 0, 0, /* No default value */
+ "executeFallbackMechanismResult"
+ },
+};
+static const ber_tlv_tag_t asn_DEF_ExecuteFallbackMechanismResponse_tags_1[] = {
+ (ASN_TAG_CLASS_CONTEXT | (93 << 2)),
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_ExecuteFallbackMechanismResponse_tag2el_1[] = {
+ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* executeFallbackMechanismResult */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_ExecuteFallbackMechanismResponse_specs_1 = {
+ sizeof(struct ExecuteFallbackMechanismResponse),
+ offsetof(struct ExecuteFallbackMechanismResponse, _asn_ctx),
+ asn_MAP_ExecuteFallbackMechanismResponse_tag2el_1,
+ 1, /* Count of tags in the map */
+ 0, 0, 0, /* Optional elements (not needed) */
+ 1, /* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_ExecuteFallbackMechanismResponse = {
+ "ExecuteFallbackMechanismResponse",
+ "ExecuteFallbackMechanismResponse",
+ &asn_OP_SEQUENCE,
+ asn_DEF_ExecuteFallbackMechanismResponse_tags_1,
+ sizeof(asn_DEF_ExecuteFallbackMechanismResponse_tags_1)
+ /sizeof(asn_DEF_ExecuteFallbackMechanismResponse_tags_1[0]) - 1, /* 1 */
+ asn_DEF_ExecuteFallbackMechanismResponse_tags_1, /* Same as above */
+ sizeof(asn_DEF_ExecuteFallbackMechanismResponse_tags_1)
+ /sizeof(asn_DEF_ExecuteFallbackMechanismResponse_tags_1[0]), /* 2 */
+ { 0, 0, SEQUENCE_constraint },
+ asn_MBR_ExecuteFallbackMechanismResponse_1,
+ 1, /* Elements count */
+ &asn_SPC_ExecuteFallbackMechanismResponse_specs_1 /* Additional specs */
+};
+
diff --git a/src/ipa/libasn/ExecuteFallbackMechanismResponse.h b/src/ipa/libasn/ExecuteFallbackMechanismResponse.h
new file mode 100644
index 0000000..823708c
--- /dev/null
+++ b/src/ipa/libasn/ExecuteFallbackMechanismResponse.h
@@ -0,0 +1,53 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _ExecuteFallbackMechanismResponse_H_
+#define _ExecuteFallbackMechanismResponse_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <NativeInteger.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum ExecuteFallbackMechanismResponse__executeFallbackMechanismResult {
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ok = 0,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_profileNotInDisabledState = 2,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_catBusy = 5,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_fallbackNotAvailable = 6,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_commandError = 7,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ecallActive = 104,
+ ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_undefinedError = 127
+} e_ExecuteFallbackMechanismResponse__executeFallbackMechanismResult;
+
+/* ExecuteFallbackMechanismResponse */
+typedef struct ExecuteFallbackMechanismResponse {
+ long executeFallbackMechanismResult;
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} ExecuteFallbackMechanismResponse_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ExecuteFallbackMechanismResponse;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ExecuteFallbackMechanismResponse_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libipa/CMakeLists.txt b/src/ipa/libipa/CMakeLists.txt
index 7a6ac28..a46e22b 100644
--- a/src/ipa/libipa/CMakeLists.txt
+++ b/src/ipa/libipa/CMakeLists.txt
@@ -20,6 +20,7 @@
es10b_prfle_rollback.c
es10b_retr_notif_from_lst.c
es10b_rm_notif_from_lst.c
+ es10b_exec_fallback_mech.c
es10c_delete_prfle.c
es10c_disable_prfle.c
es10c_enable_prfle.c
diff --git a/src/ipa/libipa/es10b_exec_fallback_mech.c b/src/ipa/libipa/es10b_exec_fallback_mech.c
new file mode 100644
index 0000000..17609b0
--- /dev/null
+++ b/src/ipa/libipa/es10b_exec_fallback_mech.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2026 sysmocom - s.f.m.c. GmbH. All rights reserved.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ *
+ * Author: Philipp Maier <pmaier@sysmocom.de> / sysmocom - s.f.m.c. GmbH
+ * Andreas Eversberg <pmaier@sysmocom.de> / sysmocom - s.f.m.c. GmbH
+ *
+ * See also: GSMA SGP.22, 5.9.20: Function (ES10b): ExecuteFallbackMechanism
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <onomondo/ipa/utils.h>
+#include "context.h"
+#include "utils.h"
+#include "euicc.h"
+#include "es10x.h"
+#include "es10b_exec_fallback_mech.h"
+
+static const struct num_str_map error_code_strings[] = {
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ok, "ok" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_profileNotInDisabledState, "profileNotInDisabledState" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_catBusy, "catBusy" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_fallbackNotAvailable, "fallbackNotAvailable" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_commandError, "commandError" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ecallActive, "ecallActive" },
+ { ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_undefinedError, "undefinedError" },
+ { 0, NULL }
+};
+
+static int dec_exec_fallback_mech_res(struct ipa_es10b_exec_fallback_mech_res *res, const struct ipa_buf *es10b_res)
+{
+ struct ExecuteFallbackMechanismResponse *asn = NULL;
+
+ asn = ipa_es10x_res_dec(&asn_DEF_ExecuteFallbackMechanismResponse, es10b_res, "ExecuteFallbackMechanism");
+ if (!asn)
+ return -EINVAL;
+
+ if (asn->executeFallbackMechanismResult != ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ok) {
+ IPA_LOGP_ES10X("ExecuteFallbackMechanism", LERROR, "function failed with error code %ld=%s!\n",
+ asn->executeFallbackMechanismResult,
+ ipa_str_from_num(error_code_strings, asn->executeFallbackMechanismResult, "(unknown)"));
+ } else {
+ IPA_LOGP_ES10X("ExecuteFallbackMechanism", LERROR, "function succeeded with status code %ld=%s!\n",
+ asn->executeFallbackMechanismResult,
+ ipa_str_from_num(error_code_strings, asn->executeFallbackMechanismResult, "(unknown)"));
+ }
+
+ res->res = asn;
+ return 0;
+}
+
+/*! Function (Es10b): ExecuteFallbackMechanism.
+ * \param[inout] ctx pointer to ipa_context.
+ * \param[in] req pointer to struct that holds the function parameters.
+ * \returns pointer newly allocated struct with function result, NULL on error. */
+struct ipa_es10b_exec_fallback_mech_res *ipa_es10b_exec_fallback_mech(struct ipa_context *ctx,
+ const struct ipa_es10b_exec_fallback_mech_req *req)
+{
+ struct ipa_buf *es10b_req = NULL;
+ struct ipa_buf *es10b_res = NULL;
+ struct ipa_es10b_exec_fallback_mech_res *res = IPA_ALLOC_ZERO(struct ipa_es10b_exec_fallback_mech_res);
+ int rc;
+
+ es10b_req = ipa_es10x_req_enc(&asn_DEF_ExecuteFallbackMechanismRequest, &req->req, "ExecuteFallbackMechanism");
+ if (!es10b_req) {
+ IPA_LOGP_ES10X("ExecuteFallbackMechanism", LERROR, "unable to encode Es10b request\n");
+ goto error;
+ }
+
+ es10b_res = ipa_euicc_transceive_es10x(ctx, es10b_req);
+ if (!es10b_res) {
+ IPA_LOGP_ES10X("ExecuteFallbackMechanism", LERROR, "no Es10b response\n");
+ goto error;
+ }
+
+ rc = dec_exec_fallback_mech_res(res, es10b_res);
+ if (rc < 0)
+ goto error;
+
+ IPA_FREE(es10b_req);
+ IPA_FREE(es10b_res);
+ return res;
+error:
+ IPA_FREE(es10b_req);
+ IPA_FREE(es10b_res);
+ ipa_es10b_exec_fallback_mech_res_free(res);
+ return NULL;
+}
+
+/*! Free results of function (Es10b): ExecuteFallbackMechanism.
+ * \param[in] res pointer to function result. */
+void ipa_es10b_exec_fallback_mech_res_free(struct ipa_es10b_exec_fallback_mech_res *res)
+{
+ IPA_ES10X_RES_FREE(asn_DEF_ExecuteFallbackMechanismResponse, res);
+}
diff --git a/src/ipa/libipa/es10b_exec_fallback_mech.h b/src/ipa/libipa/es10b_exec_fallback_mech.h
new file mode 100644
index 0000000..6d33788
--- /dev/null
+++ b/src/ipa/libipa/es10b_exec_fallback_mech.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2026 sysmocom - s.f.m.c. GmbH. All rights reserved.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#pragma once
+
+#include <ExecuteFallbackMechanismRequest.h>
+#include <ExecuteFallbackMechanismResponse.h>
+struct ipa_context;
+
+struct ipa_es10b_exec_fallback_mech_req {
+ struct ExecuteFallbackMechanismRequest req;
+};
+
+struct ipa_es10b_exec_fallback_mech_res {
+ struct ExecuteFallbackMechanismResponse *res;
+};
+
+struct ipa_es10b_exec_fallback_mech_res *ipa_es10b_exec_fallback_mech(struct ipa_context *ctx,
+ const struct ipa_es10b_exec_fallback_mech_req *req);
+void ipa_es10b_exec_fallback_mech_res_free(struct ipa_es10b_exec_fallback_mech_res *res);
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 5d4c0a9..ae3ca8e 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -25,6 +25,7 @@
#include "es10b_add_init_eim.h"
#include "es10b_euicc_mem_rst.h"
#include "es10b_load_euicc_pkg.h"
+#include "es10b_exec_fallback_mech.h"
#include "proc_euicc_pkg_dwnld_exec.h"
#include "proc_notif_delivery.h"
@@ -263,6 +264,32 @@
return ipa_es10b_euicc_mem_rst(ctx, &euicc_mem_rst);
}
+/*! Trigger return from fallback profile to previous profile.
+ * \param[inout] ctx pointer to ipa_context.
+ * \param[in] refresh_flag send a CAT refresh after switchting profile.
+ * \returns 0 on success, negative on error. */
+int ipa_execute_fallback_mechanism(struct ipa_context *ctx, bool refresh_flag)
+{
+ struct ipa_es10b_exec_fallback_mech_req exec_fallback_mech = { 0 };
+ struct ipa_es10b_exec_fallback_mech_res *res;
+ int rc = -EINVAL;
+
+ if (ctx->cfg->iot_euicc_emu_enabled) {
+ IPA_LOGP(SIPA, LERROR, "Unable to emulate switching to fallback profile.\n");
+ return -ENOTSUP;
+ }
+
+ exec_fallback_mech.req.refreshFlag = refresh_flag;
+ res = ipa_es10b_exec_fallback_mech(ctx, &exec_fallback_mech);
+ if (!res)
+ return -EIO;
+ if (res->res->executeFallbackMechanismResult == ExecuteFallbackMechanismResponse__executeFallbackMechanismResult_ok)
+ rc = 0;
+ ipa_es10b_exec_fallback_mech_res_free(res);
+
+ return rc;
+}
+
static int check_canaries(struct ipa_context *ctx)
{
if (ctx->check_http)
diff --git a/src/ipa/main.c b/src/ipa/main.c
index d4316f2..5a7c1f5 100644
--- a/src/ipa/main.c
+++ b/src/ipa/main.c
@@ -42,22 +42,24 @@
static void print_help(void)
{
printf("options:\n");
- printf(" -h .................. print this text.\n");
- printf(" -t TAC .............. set TAC (default: %s)\n", DEFAULT_TAC);
- printf(" -e eimId ............ set preferred eIM (in case the eUICC has multiple)\n");
- printf(" -r N ................ set reader number (default: %d)\n", DEFAULT_READER_NUMBER);
- printf(" -c N ................ set logical channel number (default: %d)\n", DEFAULT_CHANNEL_NUMBER);
- printf(" -f PATH ............. set initial eIM configuration\n");
- printf(" -m .................. reset eUICC memory\n");
- printf(" -n PATH ............. path to nvstate file (default: %s)\n", DEFAULT_NVSTATE_PATH);
- printf(" -y NUM .............. number of retries for ESipa requests (default: %u)\n",
+ printf(" -h ......................... print this text.\n");
+ printf(" -t TAC ..................... set TAC (default: %s)\n", DEFAULT_TAC);
+ printf(" -e eimId ................... set preferred eIM (in case the eUICC has multiple)\n");
+ printf(" -r N ....................... set reader number (default: %d)\n", DEFAULT_READER_NUMBER);
+ printf(" -c N ....................... set logical channel number (default: %d)\n", DEFAULT_CHANNEL_NUMBER);
+ printf(" -f PATH .................... set initial eIM configuration\n");
+ printf(" -m ......................... reset eUICC memory\n");
+ printf(" --execute-fallback-mechanism Trigger enabling of fallback profile\n");
+ printf(" --refresh-flag.............. Make eUICC send a CAT refresh after switchting profile with the triggers above.\n");
+ printf(" -n PATH .................... path to nvstate file (default: %s)\n", DEFAULT_NVSTATE_PATH);
+ printf(" -y NUM ..................... number of retries for ESipa requests (default: %u)\n",
DEFAULT_ESIPA_REQ_RETRIES);
- printf(" -a .................. ask end user for consent\n");
- printf(" -C .................. CA (Certificate Authority) Bundle file\n");
- printf(" -S .................. disable HTTPS\n");
- printf(" -I .................. disable SSL certificate verification (insecure)\n");
- printf(" -E .................. emulate IoT eUICC (compatibility mode to use consumer eUICCs)\n");
- printf(" -1 .................. force the IPAd to process only one eUICC package (debug, use with caution)\n");
+ printf(" -a ......................... ask end user for consent\n");
+ printf(" -C ......................... CA (Certificate Authority) Bundle file\n");
+ printf(" -S ......................... disable HTTPS\n");
+ printf(" -I ......................... disable SSL certificate verification (insecure)\n");
+ printf(" -E ......................... emulate IoT eUICC (compatibility mode to use consumer eUICCs)\n");
+ printf(" -1 ......................... force the IPAd to process only one eUICC package (debug, use with caution)\n");
}
struct ipa_buf *load_ber_from_file(char *dir, char *file)
@@ -142,10 +144,13 @@
int rc;
char *getopt_initial_eim_cfg_file = NULL;
bool getopt_euicc_memory_reset = false;
+ bool getopt_execute_fallback_mechanism = false;
+ bool getopt_refresh_flag = false;
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;
+ int option_index = 0;
signal(SIGUSR1, sig_usr1);
@@ -157,9 +162,20 @@
ipa_binary_from_hexstr(cfg.tac, sizeof(cfg.tac), DEFAULT_TAC);
cfg.esipa_req_retries = DEFAULT_ESIPA_REQ_RETRIES;
+ enum {
+ OPT_EXECFALLBACK = 256,
+ OPT_REFRESHFLAG,
+ };
+
+ struct option long_options[] = {
+ { "execute-fallback-mechanism", no_argument, NULL, OPT_EXECFALLBACK},
+ { "refresh-flag", no_argument, NULL, OPT_REFRESHFLAG},
+ { NULL, 0, NULL, 0}
+ };
+
/* Overwrite configuration values with user defined parameters */
while (1) {
- opt = getopt(argc, argv, "ht:e:r:c:f:mn:C:SIEy:a1");
+ opt = getopt_long(argc, argv, "ht:e:r:c:f:mn:C:SIEy:a1", long_options, &option_index);
if (opt == -1)
break;
@@ -186,6 +202,12 @@
case 'm':
getopt_euicc_memory_reset = true;
break;
+ case OPT_EXECFALLBACK:
+ getopt_execute_fallback_mechanism = true;
+ break;
+ case OPT_REFRESHFLAG:
+ getopt_refresh_flag = true;
+ break;
case 'n':
getopt_nvstate_path = optarg;
break;
@@ -267,6 +289,9 @@
} else if (getopt_euicc_memory_reset) {
/* Perform an eUICC memory reset */
ipa_euicc_mem_rst(ctx, true, true, true, true, true);
+ } else if (getopt_execute_fallback_mechanism) {
+ /* Trigger enabling of fallback profile */
+ ipa_execute_fallback_mechanism(ctx, getopt_refresh_flag);
} else {
IPA_LOGP(SMAIN, LINFO, "-----------------------------8<-----------------------------\n");
rc = eim_init(ctx);
To view, visit change 43041. To unsubscribe, or for help writing mail filters, visit settings.