core: ignore carrier changes on enslaved interfaces

It's not very helpful to deactivate a slave of a bond or a bridge
port because the carrier is lost.  Carrier failures are normal
operation when using various bonding failover modes.  For bridge
ports, it's probably not very helpful either.  Given that the
masters are all virtual interfaces and have been explicitly
configured and started by a user, the configuration should
generally be left alone unless explicitly deactivated or changed.
This commit is contained in:
Dan Williams 2013-01-18 11:03:29 -06:00
parent 39bd9f893a
commit 763b6c31d4
3 changed files with 16 additions and 1 deletions

View file

@ -82,4 +82,6 @@ void nm_device_queued_state_clear (NMDevice *device);
NMDeviceState nm_device_queued_state_peek (NMDevice *device);
gboolean nm_device_get_enslaved (NMDevice *device);
#endif /* NM_DEVICE_PRIVATE_H */

View file

@ -152,7 +152,7 @@ carrier_action_defer_cb (gpointer user_data)
nm_device_queued_state_clear (NM_DEVICE (self));
}
} else if (state >= NM_DEVICE_STATE_DISCONNECTED) {
if (!priv->carrier)
if (!priv->carrier && !nm_device_get_enslaved (NM_DEVICE (self)))
nm_device_queue_state (NM_DEVICE (self), NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_CARRIER);
}

View file

@ -1062,6 +1062,19 @@ nm_device_slave_notify_enslaved (NMDevice *dev,
}
}
/**
* nm_device_get_enslaved:
* @device: the #NMDevice
*
* Returns: %TRUE if the device is enslaved to a master device (eg bridge or
* bond), %FALSE if not
*/
gboolean
nm_device_get_enslaved (NMDevice *device)
{
return NM_DEVICE_GET_PRIVATE (device)->enslaved;
}
/*
* nm_device_get_act_request
*