mm-iface-modem-3gpp: reject unspecified values for 5G reg settings

It seems like users can put the "unsupported" value for
both DRX cycle and MICO mode, so we should reject that.
This commit is contained in:
Eric Caruso
2023-01-31 16:26:36 -05:00
parent 652a562aeb
commit e31c43ebd2

View File

@@ -1697,6 +1697,8 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
GError *error = NULL;
GVariant *old_dictionary;
g_autoptr(MMNr5gRegistrationSettings) old_settings = NULL;
MMModem3gppDrxCycle new_drx_cycle;
MMModem3gppMicoMode new_mico_mode;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
g_dbus_method_invocation_take_error (ctx->invocation, error);
@@ -1720,6 +1722,24 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
return;
}
new_drx_cycle = mm_nr5g_registration_settings_get_drx_cycle (ctx->settings);
if (new_drx_cycle == MM_MODEM_3GPP_DRX_CYCLE_UNSUPPORTED) {
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "Invalid value for DRX cycle: %s",
mm_modem_3gpp_drx_cycle_get_string (new_drx_cycle));
g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
new_mico_mode = mm_nr5g_registration_settings_get_mico_mode (ctx->settings);
if (new_mico_mode == MM_MODEM_3GPP_MICO_MODE_UNSUPPORTED) {
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "Invalid value for MICO mode: %s",
mm_modem_3gpp_mico_mode_get_string (new_mico_mode));
g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
mm_obj_info (self, "processing user request to set 5GNR registration settings...");
old_dictionary = mm_gdbus_modem3gpp_get_nr5g_registration_settings (ctx->skeleton);