mm-iface-modem-3gpp-profile-manager: do not override Bearer 3gpp profile properties during connection

When connecting via AT commands requiring a 3gpp profile with undefined
profile-id, the corresponding bearer 3gpp profile is later modified
adding the selected PDP context.

For this reason when a next connection is requested with the same
properties (that is no profile-id) the already existing bearers is not
selected because of the different profile-id value and a new one is
created.

This change lets the connection logic use a copy of the user-requested
bearer's 3gpp profile which can be modified for the logic needs, but it
is not stored and then does not compromise a bearer comparison in a next
connection request.
This commit is contained in:
Carlo Lobrano
2022-07-14 12:14:13 +02:00
committed by Aleksander Morgado
parent 85d4ad1158
commit 7464940971

View File

@@ -674,15 +674,29 @@ mm_iface_modem_3gpp_profile_manager_set_profile (MMIfaceModem3gppProfileManager
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
SetProfileContext *ctx;
MMBearerIpFamily ip_family;
GError *error;
GTask *task;
SetProfileContext *ctx;
MMBearerIpFamily ip_family;
g_autoptr(GVariant) dict = NULL;
g_autoptr(MM3gppProfile) requested_copy = NULL;
task = g_task_new (self, NULL, callback, user_data);
/* The MM3gppProfile passed to the SetProfileContext is going to
* be modified, so we make a copy to preserve the original one. */
dict = mm_3gpp_profile_get_dictionary (requested);
requested_copy = mm_3gpp_profile_new_from_dictionary (dict, &error);
if (!requested_copy) {
g_prefix_error (&error, "Couldn't copy 3GPP profile:");
g_task_return_error (task, error);
g_object_unref (task);
return;
}
ctx = g_slice_new0 (SetProfileContext);
ctx->step = SET_PROFILE_STEP_FIRST;
ctx->requested = g_object_ref (requested);
ctx->requested = g_object_ref (requested_copy);
ctx->index_field = g_strdup (index_field);
ctx->strict = strict;
ctx->profile_id = mm_3gpp_profile_get_profile_id (requested);