device-bt, device-modem: listen for data port changes in the `NMModem'
The new ModemManager1-based `NMModemBroadband' objects will set the data port information only after having created the bearer as part of the connection process. The devices, therefore, need to listen to changes in the `data-port' property, so that the `ip-iface' in the `NMDevice' is set before finishing the stage1 of the activation. This is required in order to have a proper ifup of the data port.
This commit is contained in:

committed by
Dan Williams

parent
6463904bff
commit
c9579b1bf0
@@ -578,6 +578,14 @@ modem_ip4_config_result (NMModem *self,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (user_data);
|
||||
|
||||
nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason)
|
||||
{
|
||||
@@ -672,7 +680,12 @@ nm_device_bt_modem_added (NMDeviceBt *self,
|
||||
g_signal_connect (modem, NM_MODEM_AUTH_REQUESTED, G_CALLBACK (modem_auth_requested), self);
|
||||
g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self);
|
||||
|
||||
nm_device_set_ip_iface (NM_DEVICE (self), modem_data_port);
|
||||
/* In the old ModemManager the data port is known from the very beginning;
|
||||
* while in the new ModemManager the data port is set afterwards when the bearer gets
|
||||
* created */
|
||||
if (modem_data_port)
|
||||
nm_device_set_ip_iface (NM_DEVICE (self), modem_data_port);
|
||||
g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
|
||||
|
||||
/* Kick off the modem connection */
|
||||
if (!modem_stage1 (self, modem, &reason))
|
||||
|
@@ -162,6 +162,16 @@ modem_ip4_config_result (NMModem *self,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (user_data);
|
||||
|
||||
/* We set the IP iface in the device as soon as we know it, so that we
|
||||
* properly ifup it if needed */
|
||||
nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
|
||||
}
|
||||
|
||||
static void
|
||||
modem_enabled_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
|
||||
{
|
||||
@@ -417,6 +427,11 @@ set_modem (NMDeviceModem *self, NMModem *modem)
|
||||
g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self);
|
||||
g_signal_connect (modem, "notify::" NM_MODEM_ENABLED, G_CALLBACK (modem_enabled_cb), self);
|
||||
g_signal_connect (modem, "notify::" NM_MODEM_CONNECTED, G_CALLBACK (modem_connected_cb), self);
|
||||
|
||||
/* In the old ModemManager the data port is known from the very beginning;
|
||||
* while in the new ModemManager the data port is set afterwards when the bearer gets
|
||||
* created */
|
||||
g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user