mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 11:50:18 +01:00
device: add functions to get and set sys-iface-state before sleep
This commit is contained in:
parent
fc0fc4ab0d
commit
1494774bd1
2 changed files with 27 additions and 1 deletions
|
|
@ -570,6 +570,8 @@ typedef struct _NMDevicePrivate {
|
|||
NMDeviceSysIfaceState sys_iface_state_;
|
||||
};
|
||||
|
||||
NMDeviceSysIfaceState sys_iface_state_before_sleep;
|
||||
|
||||
bool carrier : 1;
|
||||
bool ignore_carrier : 1;
|
||||
|
||||
|
|
@ -3052,6 +3054,22 @@ nm_device_sys_iface_state_set(NMDevice *self, NMDeviceSysIfaceState sys_iface_st
|
|||
nm_assert(priv->sys_iface_state == sys_iface_state);
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_notify_sleeping(NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
priv->sys_iface_state_before_sleep = priv->sys_iface_state;
|
||||
}
|
||||
|
||||
NMDeviceSysIfaceState
|
||||
nm_device_get_sys_iface_state_before_sleep(NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
return priv->sys_iface_state_before_sleep;
|
||||
}
|
||||
|
||||
static void
|
||||
_active_connection_set_state_flags_full(NMDevice *self,
|
||||
NMActivationStateFlags flags,
|
||||
|
|
@ -17961,7 +17979,11 @@ nm_device_init(NMDevice *self)
|
|||
priv->unmanaged_mask = priv->unmanaged_flags;
|
||||
priv->available_connections = g_hash_table_new_full(nm_direct_hash, NULL, g_object_unref, NULL);
|
||||
priv->ip6_saved_properties = g_hash_table_new_full(nm_str_hash, g_str_equal, NULL, g_free);
|
||||
priv->sys_iface_state_ = NM_DEVICE_SYS_IFACE_STATE_EXTERNAL;
|
||||
|
||||
priv->sys_iface_state_ = NM_DEVICE_SYS_IFACE_STATE_EXTERNAL;
|
||||
/* If networking is already disabled at boot, we want to manage all devices
|
||||
* after re-enabling networking; hence, the initial state is MANAGED. */
|
||||
priv->sys_iface_state_before_sleep = NM_DEVICE_SYS_IFACE_STATE_MANAGED;
|
||||
|
||||
priv->promisc_reset = NM_OPTION_BOOL_DEFAULT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -728,6 +728,10 @@ gboolean nm_device_sys_iface_state_is_external_or_assume(NMDevice *self);
|
|||
|
||||
void nm_device_sys_iface_state_set(NMDevice *device, NMDeviceSysIfaceState sys_iface_state);
|
||||
|
||||
void nm_device_notify_sleeping(NMDevice *self);
|
||||
|
||||
NMDeviceSysIfaceState nm_device_get_sys_iface_state_before_sleep(NMDevice *self);
|
||||
|
||||
void nm_device_state_changed(NMDevice *device, NMDeviceState state, NMDeviceStateReason reason);
|
||||
|
||||
void nm_device_queue_state(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue