Clear forbidden operator list via SimManager
v3 cover Clear forbidden operator list via SimManager
IoT providers allow for enabling and disabling of operators. If the modem have detected an forbiddel operator it will block connections to that network.
This will allow controlling software to clear that list. (Our IoT provider recommends to clear the list everytime we power off the modem).
Clear:
$ busctl call org.ofono /sim76xx_0 org.ofono.SimManager ClearForbiddenNetworkOperators
---
Changes in v3:
- Add check for the FPLMN list length, and clear the whole list.
- Check if write_file_transparent() is implemented.
- Remove unused variables.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Created new method in SimManager called ClearForbiddenNetworkOperators
- Scrapped previous Get and SetProperty options. It's to complicated to read the list, so rely on NetworkRegistration GetOperators showing the "forbidden" status.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Sean Nyekjaer (3):
simutil: Add forbidden operator list fileid
sim: Create new dbus method to clear the forbidden network operator list
doc: sim-api document ClearForbiddenNetworkOperators
doc/sim-api.txt | 8 ++++++ src/sim.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/simutil.c | 1 + src/simutil.h | 1 + 4 files changed, 89 insertions(+)
---
base-commit: 8d892785e47bde9a0912a05725405bb60c140f87
change-id: 20250626-fplmn-bcb3eaa8baa4
Best regards,
Signature · 1 line
Sean Nyekjaer <[email protected]>
PATCH v3 1/3 simutil: Add forbidden operator list fileid
Add the FPLMN both as a define and as a entry in the struct sim_ef_info.
--- src/simutil.c | 1 + src/simutil.h | 1 + 2 files changed, 2 insertions(+)
src/simutil.c +1 -0
@@ -84,6 +84,7 @@ static struct sim_ef_info ef_db[] = { { 0x6F50, 0x7F20, 0x7FFF, EF, BINARY, 0, PIN, PIN }, { 0x6F56, 0x0000, 0x7FFF, EF, BINARY, 0, PIN, PIN2 }, { 0x6F57, 0x7F20, 0x7FFF, EF, BINARY, 0, PIN, PIN2 }, +{ 0x6F7B, ROOTMF, 0x7FFF, EF, BINARY, 12, PIN, PIN }, { 0x6FAD, 0x7F20, 0x7FFF, EF, BINARY, 0, ALW, ADM }, { 0x6FAE, 0x7F20, 0x0000, EF, BINARY, 1, ALW, ADM }, { 0x6FB7, 0x7F20, 0x7FFF, EF, BINARY, 0, ALW, ADM },
src/simutil.h +1 -0
@@ -40,6 +40,7 @@ enum sim_fileid {SIM_EFBDN_FILEID =0x6F4D ,SIM_EFCBMIR_FILEID =0x6F50 ,SIM_EFEST_FILEID =0x6F56 , +SIM_EF_FPLMN_FILEID =0x6F7B ,SIM_EFAD_FILEID =0x6FAD ,SIM_EFPHASE_FILEID =0x6FAE , SIM_EFECC_FILEID = 0x6FB7,
Signature · 1 line
2.49.0
PATCH v3 2/3 sim: Create new dbus method to clear the forbidden network operator list
In reply to Sean NyekjaerTo clear the list:
busctl call org.ofono /sim76xx_0 org.ofono.SimManager ClearForbiddenNetworkOperators
--- src/sim.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)
src/sim.c +79 -0
@@ -649,6 +649,83 @@ static gboolean set_own_numbers(struct ofono_sim *sim,return TRUE; } +static void sim_efplmn_cb (const struct ofono_error *error,void *data) +{ +struct ofono_sim *sim = data; +DBusMessage *reply; + +if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { +ofono_error ("Unable to clear Forbidden PLMN" ); + reply =__ofono_error_failed (sim->pending); + }else { + reply =dbus_message_new_method_return (sim->pending); + } + +__ofono_dbus_pending_reply (&sim->pending, reply); +} + +static void sim_fplmn_info_read_cb (int ok,unsigned char file_status, +int total_length,int record_length, +void *userdata) +{ +struct ofono_sim *sim = userdata; +uint8_t *plmn_list; +DBusMessage *reply; + +if (!ok) { + reply =__ofono_error_failed (sim->pending); + goto out; + } + +if (!(file_status &SIM_FILE_STATUS_VALID )) { + reply =__ofono_error_failed (sim->pending); + goto out; + } + +if (sim->driver->write_file_transparent ==NULL ) { + reply =__ofono_error_not_implemented (sim->pending); + goto out; + } + +DBG ("total_length %d" , total_length); + +/* Minimum size according TS 31.102, Section 4.2.16 is 3n bytes, (n≥ 4) */ +if (total_length <12 || total_length %3 !=0 ) { + reply =__ofono_error_failed (sim->pending); + goto out; + } + + plmn_list =l_malloc (total_length); +memset (plmn_list,0xFF , total_length); + + sim->driver->write_file_transparent (sim,SIM_EF_FPLMN_FILEID ,0 , total_length, + plmn_list,NULL ,0 , sim_efplmn_cb, sim); + +l_free (plmn_list); + +return ; + +out: +__ofono_dbus_pending_reply (&sim->pending, reply); +} + +static DBusMessage *sim_clear_forbidden_plmn (DBusConnection *conn,DBusMessage *msg, +void *data) +{ +struct ofono_sim *sim = data; + +if (sim->pending) +return __ofono_error_busy (msg); + + sim->pending =dbus_message_ref (msg); + +sim_fs_read_info (sim->context,SIM_EF_FPLMN_FILEID , +OFONO_SIM_FILE_STRUCTURE_TRANSPARENT , + sim_fplmn_info_read_cb, sim); + +return NULL ; +} +static void sim_set_slot_callback (const struct ofono_error *error,void *data) {struct ofono_sim *sim = data;
@@ -1297,6 +1374,8 @@ static const GDBusMethodTable sim_methods[] = { {GDBUS_ASYNC_METHOD ("SetProperty" , GDBUS_ARGS({ "property", "s" }, { "value", "v" }), NULL, sim_set_property) }, + { GDBUS_ASYNC_METHOD("ClearForbiddenNetworkOperators", + NULL, NULL, sim_clear_forbidden_plmn) }, { GDBUS_ASYNC_METHOD("ChangePin", GDBUS_ARGS({ "type", "s" }, { "oldpin", "s" }, { "newpin", "s" }), NULL,
Signature · 1 line
2.49.0
PATCH v3 3/3 doc: sim-api document ClearForbiddenNetworkOperators
In reply to Sean Nyekjaer--- doc/sim-api.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
doc/sim-api.txt +8 -0
@@ -89,6 +89,14 @@ Methods dict GetProperties() [service].Error.InvalidArguments [service].Error.Failed + void ClearForbiddenNetworkOperators() + + Clear the forbidden operator list. + + Possible Errors: [service].Error.NotImplemented + [service].Error.InProgress + [service].Error.Failed + Signals PropertyChanged(string name, variant value) This signal indicates a changed value of the given
Signature · 1 line
2.49.0
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:
Hello:
This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:
Quoted 8 lines · On Fri, 04 Jul 2025 14:23:12 +0200 you wrote:
IoT providers allow for enabling and disabling of operators. If the modem have detected an forbiddel operator it will block connections to that network.
This will allow controlling software to clear that list. (Our IoT provider recommends to clear the list everytime we power off the modem).[...]
Here is the summary with links:
- [v3,1/3] simutil: Add forbidden operator list fileid
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=3945760adaa7 - [v3,2/3] sim: Create new dbus method to clear the forbidden network operator list https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=10f683763805 - [v3,3/3] doc: sim-api document ClearForbiddenNetworkOperators https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=73b7b9dbe3a5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html