summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-12-02 16:10:44 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-12-03 13:15:27 +0100
commit77b6623bfe85de2c8f702098521e5e3a243f5a7f (patch)
tree1080b51bcee6d96db0f7193be2caec7d8c2f1e4b
parent267f64d6623adc12471139c7e6f581b8de1a4c01 (diff)
bearer-qmi: current settings are mandatory when using 'static' addressing
If for any reason getting current settings fails and we require static IP addressing (when using raw-ip), then that must be a hard error, otherwise we'll end up with the modem reported as connected but without any IP settings to use: <info> error: couldn't get current settings: QMI protocol error (15): 'OutOfCall' <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (registered -> connected) <info> Simple connect state (8/8): All done <warn> Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall' # mmcli -b 0 Bearer '/org/freedesktop/ModemManager1/Bearer/0' ------------------------- Status | connected: 'yes' | suspended: 'no' | interface: 'wwan1' | IP timeout: '20' ------------------------- Properties | apn: 'm2minternet' | roaming: 'allowed' | IP type: 'none' | user: 'none' | password: 'none' | number: 'none' | Rm protocol: 'unknown' ------------------------- IPv4 configuration | method: 'unknown' ------------------------- IPv6 configuration | method: 'unknown' ------------------------- Stats | Duration: '0' | Bytes received: 'N/A' | Bytes transmitted: 'N/A' # mmcli -m 0 /org/freedesktop/ModemManager1/Modem/0 (device id '48f6c35f3d0376aa261a91c0cf7e6340d5a91601') ... Status | lock: 'sim-pin2' | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)' | state: 'connected' | power state: 'on' | access tech: 'lte' | signal quality: '96' (recent) (cherry picked from commit 03e6375a95ace2c1c1ecd8b621fc90b7e86ebe8b)
-rw-r--r--src/mm-bearer-qmi.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 3b005979..8565efb0 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -860,12 +860,31 @@ get_current_settings_ready (QmiClientWds *client,
g_assert (ctx->running_ipv4 || ctx->running_ipv6);
output = qmi_client_wds_get_current_settings_finish (client, res, &error);
- if (!output ||
- !qmi_message_wds_get_current_settings_output_get_result (output, &error)) {
- /* Never treat this as a hard connection error; not all devices support
- * "WDS Get Current Settings" */
- mm_info ("error: couldn't get current settings: %s", error->message);
+ if (!output || !qmi_message_wds_get_current_settings_output_get_result (output, &error)) {
+ MMBearerIpConfig *config;
+
+ /* When we're using static IP address, the current settings are mandatory */
+ if (ctx->ip_method == MM_BEARER_IP_METHOD_STATIC) {
+ mm_warn ("Failed to retrieve mandatory IP settings: %s", error->message);
+ if (output)
+ qmi_message_wds_get_current_settings_output_unref (output);
+ complete_connect (task, NULL, error);
+ return;
+ }
+
+ /* Otherwise, just go on as we're asking for DHCP */
+ mm_dbg ("Couldn't get current settings: %s", error->message);
g_error_free (error);
+
+ config = mm_bearer_ip_config_new ();
+ mm_bearer_ip_config_set_method (config, ctx->ip_method);
+
+ if (ctx->running_ipv4)
+ ctx->ipv4_config = config;
+ else if (ctx->running_ipv6)
+ ctx->ipv6_config = config;
+ else
+ g_assert_not_reached ();
} else {
QmiWdsIpFamily ip_family = QMI_WDS_IP_FAMILY_UNSPECIFIED;
guint32 mtu = 0;