[PATCH 2/3] bearer-qmi: use static IP if LLP is raw-ip
Aleksander Morgado
aleksander at aleksander.es
Tue Dec 29 08:56:55 PST 2015
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.
---
src/mm-broadband-modem-qmi.c | 9 ++++++++-
src/mm-port-qmi.c | 25 +++++++++++++++++++++----
src/mm-port-qmi.h | 2 ++
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 0dd8851..f738ba1 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -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);
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c
index fa723db..33519ee 100644
--- a/src/mm-port-qmi.c
+++ b/src/mm-port-qmi.c
@@ -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;
diff --git a/src/mm-port-qmi.h b/src/mm-port-qmi.h
index 9c38b0c..2724140 100644
--- a/src/mm-port-qmi.h
+++ b/src/mm-port-qmi.h
@@ -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 */
--
2.6.4
More information about the ModemManager-devel
mailing list