Merge request !1389 from 'fix/set-supl-server'

shared-qmi: fix setting URL to supl server

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1389
This commit is contained in:
Dan Williams
2025-08-16 16:23:06 -05:00
+18 -4
View File
@@ -4525,13 +4525,20 @@ pds_set_supl_server (GTask *task)
MMSharedQmi *self; MMSharedQmi *self;
SetSuplServerContext *ctx; SetSuplServerContext *ctx;
QmiMessagePdsSetAgpsConfigInput *input; QmiMessagePdsSetAgpsConfigInput *input;
guint32 ip; guint32 ip = 0;
guint16 port; guint16 port;
GArray *url; GArray *url;
GError *error = NULL;
self = g_task_get_source_object (task); self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_parse_supl_address (ctx->supl, NULL, &ip, &port, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
input = qmi_message_pds_set_agps_config_input_new (); input = qmi_message_pds_set_agps_config_input_new ();
/* For multimode devices, prefer UMTS by default */ /* For multimode devices, prefer UMTS by default */
@@ -4540,7 +4547,7 @@ pds_set_supl_server (GTask *task)
else if (mm_iface_modem_is_cdma (MM_IFACE_MODEM (self))) else if (mm_iface_modem_is_cdma (MM_IFACE_MODEM (self)))
qmi_message_pds_set_agps_config_input_set_network_mode (input, QMI_PDS_NETWORK_MODE_CDMA, NULL); qmi_message_pds_set_agps_config_input_set_network_mode (input, QMI_PDS_NETWORK_MODE_CDMA, NULL);
if (mm_parse_supl_address (ctx->supl, NULL, &ip, &port, NULL)) if (ip)
qmi_message_pds_set_agps_config_input_set_location_server_address (input, GUINT32_FROM_BE (ip), port, NULL); qmi_message_pds_set_agps_config_input_set_location_server_address (input, GUINT32_FROM_BE (ip), port, NULL);
else { else {
url = parse_as_utf16_url (ctx->supl); url = parse_as_utf16_url (ctx->supl);
@@ -4640,12 +4647,19 @@ loc_set_supl_server (GTask *task)
MMSharedQmi *self; MMSharedQmi *self;
SetSuplServerContext *ctx; SetSuplServerContext *ctx;
QmiMessageLocSetServerInput *input; QmiMessageLocSetServerInput *input;
guint32 ip; guint32 ip = 0;
guint16 port; guint16 port;
GError *error = NULL;
self = g_task_get_source_object (task); self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
if (!mm_parse_supl_address (ctx->supl, NULL, &ip, &port, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
input = qmi_message_loc_set_server_input_new (); input = qmi_message_loc_set_server_input_new ();
/* For multimode devices, prefer UMTS by default */ /* For multimode devices, prefer UMTS by default */
@@ -4654,7 +4668,7 @@ loc_set_supl_server (GTask *task)
else if (mm_iface_modem_is_cdma (MM_IFACE_MODEM (self))) else if (mm_iface_modem_is_cdma (MM_IFACE_MODEM (self)))
qmi_message_loc_set_server_input_set_server_type (input, QMI_LOC_SERVER_TYPE_CDMA_PDE, NULL); qmi_message_loc_set_server_input_set_server_type (input, QMI_LOC_SERVER_TYPE_CDMA_PDE, NULL);
if (mm_parse_supl_address (ctx->supl, NULL, &ip, &port, NULL)) if (ip)
qmi_message_loc_set_server_input_set_ipv4 (input, GUINT32_FROM_BE (ip), (guint32) port, NULL); qmi_message_loc_set_server_input_set_ipv4 (input, GUINT32_FROM_BE (ip), (guint32) port, NULL);
else else
qmi_message_loc_set_server_input_set_url (input, ctx->supl, NULL); qmi_message_loc_set_server_input_set_url (input, ctx->supl, NULL);