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)
This commit is contained in:
Aleksander Morgado
2019-12-02 16:10:44 +01:00
parent 76cafbb603
commit 03e6375a95

View File

@@ -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;