[PATCH] core: fix auto-activation of ignore-carrier devices when carrier appears (rh #1076592)



If a device had its carrier ignored, and did not have a carrier on startup,
then NetworkManager would not re-check autoconnect connections when the
device's carrier appeared.  Because ignore-carrier devices are always
in DISCONNECTED state when they are managed, the nm-device.c::carrier_changed()
code essentially did nothing when the carrier appeared.  It needs to
also trigger an auto-activation recheck signal when the carrier appears
to ensure that now-valid connections (like those that require DHCP or
IPv6) can be auto-activated.
---
 src/devices/nm-device.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index d5c4386..110a1f3 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1037,14 +1037,21 @@ carrier_changed (NMDevice *device, gboolean carrier)
 
        if (carrier) {
                g_warn_if_fail (priv->state >= NM_DEVICE_STATE_UNAVAILABLE);
 
                if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) {
                        nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED,
                                               NM_DEVICE_STATE_REASON_CARRIER);
+               } else if (priv->state == NM_DEVICE_STATE_DISCONNECTED) {
+                       /* If the device is already in DISCONNECTED state without a carrier
+                        * (probably because it is tagged for carrier ignore) ensure that
+                        * when the carrier appears, auto connections are rechecked for
+                        * the device.
+                        */
+                       nm_device_emit_recheck_auto_activate (device);
                }
        } else {
                g_return_if_fail (priv->state >= NM_DEVICE_STATE_UNAVAILABLE);
 
                if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) {
                        if (nm_device_queued_state_peek (device) >= NM_DEVICE_STATE_DISCONNECTED)
                                nm_device_queued_state_clear (device);
-- 
1.8.5.3




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]