diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-02-24 01:01:55 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-03-10 12:58:12 +0100 |
commit | b0f26a1f0bce13cd8785fefdb004d178768e201a (patch) | |
tree | bffc340604e2ac6762d5b1adfabc74966780f69b /src/mm-bearer-qmi.c | |
parent | 1643c3d3db73a2e731e92efa26466c1501c8899d (diff) |
bearer-qmi: bring master interface up on connection attempt
The user of the ModemManager API will bring up the data network
interface exposed in the Bearer IP settings (i.e. the link interface
when using multiplexing). But for instantiated network links, we also
need to have the master interface brought up before any traffic can go
through the link interface.
We don't check whether the master interface is already up before
attempting to bring it up, we just attempt to bring it up.
Diffstat (limited to 'src/mm-bearer-qmi.c')
-rw-r--r-- | src/mm-bearer-qmi.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index ab3059fe..c0a8889a 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -417,6 +417,7 @@ typedef enum { CONNECT_STEP_OPEN_QMI_PORT, CONNECT_STEP_SETUP_DATA_FORMAT, CONNECT_STEP_SETUP_LINK, + CONNECT_STEP_SETUP_LINK_MASTER_UP, CONNECT_STEP_IP_METHOD, CONNECT_STEP_IPV4, CONNECT_STEP_WDS_CLIENT_IPV4, @@ -1336,6 +1337,27 @@ qmi_port_allocate_client_ready (MMPortQmi *qmi, } static void +master_interface_up_ready (MMPortNet *link, + GAsyncResult *res, + GTask *task) +{ + ConnectContext *ctx; + GError *error = NULL; + + ctx = g_task_get_task_data (task); + + if (!mm_port_net_link_setup_finish (link, res, &error)) { + g_prefix_error (&error, "Couldn't bring master interface up: "); + complete_connect (task, NULL, error); + return; + } + + /* Keep on */ + ctx->step++; + connect_context_step (task); +} + +static void wait_link_port_ready (MMBaseModem *modem, GAsyncResult *res, GTask *task) @@ -1551,6 +1573,21 @@ connect_context_step (GTask *task) ctx->step++; /* fall through */ + case CONNECT_STEP_SETUP_LINK_MASTER_UP: + /* if the connection is done through a new link, we need to ifup the master interface */ + if (ctx->link) { + mm_obj_dbg (self, "bringing master interface %s up...", mm_port_get_device (ctx->data)); + mm_port_net_link_setup (MM_PORT_NET (ctx->data), + TRUE, + 0, /* ignore */ + g_task_get_cancellable (task), + (GAsyncReadyCallback) master_interface_up_ready, + task); + return; + } + ctx->step++; + /* fall through */ + case CONNECT_STEP_IP_METHOD: /* Once the QMI port is open, we decide the IP method we're going * to request. If the LLP is raw-ip, we force Static IP, because not |