bearer-qmi: use static IP if LLP is raw-ip

When using raw-ip we'll default to request static IP setup for now, so that we
don't rely on the DHCP client supporting raw-ip interfaces.
This commit is contained in:
Aleksander Morgado
2016-01-24 17:23:46 +01:00
parent f8ba106a20
commit cf66d1bcbf
3 changed files with 31 additions and 5 deletions
+8 -1
View File
@@ -311,6 +311,13 @@ modem_create_bearer (MMIfaceModem *self,
{
MMBaseBearer *bearer;
GSimpleAsyncResult *result;
MMPortQmi *port;
gboolean force_dhcp = TRUE;
/* We use static IP setup when raw IP link layer protocol in use */
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
if (port && mm_port_qmi_llp_is_raw_ip (port))
force_dhcp = FALSE;
/* Set a new ref to the bearer object as result */
result = g_simple_async_result_new (G_OBJECT (self),
@@ -320,7 +327,7 @@ modem_create_bearer (MMIfaceModem *self,
/* We just create a MMBearerQmi */
mm_dbg ("Creating QMI bearer in QMI modem");
bearer = mm_bearer_qmi_new (MM_BROADBAND_MODEM_QMI (self), properties, TRUE);
bearer = mm_bearer_qmi_new (MM_BROADBAND_MODEM_QMI (self), properties, force_dhcp);
g_simple_async_result_set_op_res_gpointer (result, bearer, g_object_unref);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
+21 -4
View File
@@ -36,6 +36,7 @@ struct _MMPortQmiPrivate {
gboolean opening;
QmiDevice *qmi_device;
GList *services;
gboolean llp_is_raw_ip;
};
/*****************************************************************************/
@@ -163,6 +164,14 @@ mm_port_qmi_allocate_client (MMPortQmi *self,
/*****************************************************************************/
gboolean
mm_port_qmi_llp_is_raw_ip (MMPortQmi *self)
{
return self->priv->llp_is_raw_ip;
}
/*****************************************************************************/
typedef enum {
PORT_OPEN_STEP_FIRST,
PORT_OPEN_STEP_CHECK_OPENING,
@@ -421,10 +430,18 @@ port_open_context_step (PortOpenContext *ctx)
mm_dbg ("Checking data format: kernel %s, device %s",
qmi_device_expected_data_format_get_string (ctx->kernel_data_format),
qmi_wda_link_layer_protocol_get_string (ctx->llp));
if ((ctx->kernel_data_format == QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3 &&
ctx->llp == QMI_WDA_LINK_LAYER_PROTOCOL_802_3) ||
(ctx->kernel_data_format == QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP &&
ctx->llp == QMI_WDA_LINK_LAYER_PROTOCOL_RAW_IP)) {
if (ctx->kernel_data_format == QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3 &&
ctx->llp == QMI_WDA_LINK_LAYER_PROTOCOL_802_3) {
ctx->self->priv->llp_is_raw_ip = FALSE;
ctx->step = PORT_OPEN_STEP_LAST;
port_open_context_step (ctx);
return;
}
if (ctx->kernel_data_format == QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP &&
ctx->llp == QMI_WDA_LINK_LAYER_PROTOCOL_RAW_IP) {
ctx->self->priv->llp_is_raw_ip = TRUE;
ctx->step = PORT_OPEN_STEP_LAST;
port_open_context_step (ctx);
return;
+2
View File
@@ -82,4 +82,6 @@ QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
gboolean mm_port_qmi_llp_is_raw_ip (MMPortQmi *self);
#endif /* MM_PORT_QMI_H */