mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 17:50:16 +01:00
bridge: device availability shouldn't depend on carrier state
The bridge master's carrier follows IFF_UP when no ports are added and the ports' carrier when ports are added, so we shouldn't depend on carrier when deciding whether to activate a bridge which may not have any ports. Also when the
This commit is contained in:
parent
dfef198801
commit
8ed4b5109a
1 changed files with 17 additions and 5 deletions
|
|
@ -90,17 +90,26 @@ device_state_changed (NMDevice *device,
|
|||
{
|
||||
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device);
|
||||
|
||||
if (new_state == NM_DEVICE_STATE_UNAVAILABLE) {
|
||||
/* Use NM_DEVICE_STATE_REASON_CARRIER to make sure num retries is reset */
|
||||
nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER);
|
||||
}
|
||||
|
||||
if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state > NM_DEVICE_STATE_ACTIVATED) {
|
||||
priv->ip4_waiting = FALSE;
|
||||
priv->ip6_waiting = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
carrier_action (NMDeviceWired *self, NMDeviceState state, gboolean carrier)
|
||||
{
|
||||
/* Bridge carrier state follows IFF_UP with no ports, and port carrier
|
||||
* states when ports are added. Thus carrier isn't useful when deciding
|
||||
* to auto-activate the bridge master. Also, like bond masters, when the
|
||||
* carrier state changes due to slave changes, we shouldn't deactivate the
|
||||
* bridge since the user may be reconfiguring ports.
|
||||
*
|
||||
* For these reasons, carrier changes are effectively ignored by overriding
|
||||
* the parent class' carrier handling and doing nothing.
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
update_hw_address (NMDevice *dev)
|
||||
{
|
||||
|
|
@ -626,6 +635,7 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
NMDeviceWiredClass *wired_class = NM_DEVICE_WIRED_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMDeviceBridgePrivate));
|
||||
|
||||
|
|
@ -653,6 +663,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
|||
|
||||
parent_class->state_changed = device_state_changed;
|
||||
|
||||
wired_class->carrier_action = carrier_action;
|
||||
|
||||
/* properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_HW_ADDRESS,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue