mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 14:10:36 +01:00
core: use _NMSettingWirelessWakeOnWLan instead of NMSettingWirelessWakeOnWLan
This commit is contained in:
parent
8a3df8419a
commit
d2abd70932
8 changed files with 61 additions and 57 deletions
|
|
@ -114,8 +114,8 @@ typedef struct {
|
|||
guint wps_timeout_id;
|
||||
guint sup_timeout_id; /* supplicant association timeout */
|
||||
|
||||
NMDeviceWifiCapabilities capabilities;
|
||||
NMSettingWirelessWakeOnWLan wowlan_restore;
|
||||
NMDeviceWifiCapabilities capabilities;
|
||||
_NMSettingWirelessWakeOnWLan wowlan_restore;
|
||||
|
||||
NMDeviceWifiP2P *p2p_device;
|
||||
NM80211Mode mode;
|
||||
|
|
@ -845,14 +845,14 @@ remove_all_aps(NMDeviceWifi *self)
|
|||
static gboolean
|
||||
wake_on_wlan_restore(NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate * priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
|
||||
NMSettingWirelessWakeOnWLan w;
|
||||
NMDeviceWifiPrivate * priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
|
||||
_NMSettingWirelessWakeOnWLan w;
|
||||
|
||||
w = priv->wowlan_restore;
|
||||
if (w == NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE)
|
||||
if (w == _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE)
|
||||
return TRUE;
|
||||
|
||||
priv->wowlan_restore = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
priv->wowlan_restore = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
return nm_platform_wifi_set_wake_on_wlan(NM_PLATFORM_GET,
|
||||
nm_device_get_ifindex(NM_DEVICE(self)),
|
||||
w);
|
||||
|
|
@ -2956,9 +2956,10 @@ error:
|
|||
static gboolean
|
||||
wake_on_wlan_enable(NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate * priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
|
||||
NMSettingWirelessWakeOnWLan wowl;
|
||||
NMSettingWireless * s_wireless;
|
||||
NMDeviceWifiPrivate * priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
|
||||
NMSettingWirelessWakeOnWLan wowl;
|
||||
_NMSettingWirelessWakeOnWLan wowl2;
|
||||
NMSettingWireless * s_wireless;
|
||||
|
||||
s_wireless = nm_device_get_applied_setting(NM_DEVICE(self), NM_TYPE_SETTING_WIRELESS);
|
||||
if (s_wireless) {
|
||||
|
|
@ -2990,9 +2991,11 @@ wake_on_wlan_enable(NMDeviceWifi *self)
|
|||
goto found;
|
||||
|
||||
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
|
||||
found:
|
||||
if (wowl == NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE) {
|
||||
priv->wowlan_restore = wowl;
|
||||
wowl2 = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_CAST(wowl);
|
||||
if (wowl2 == _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE) {
|
||||
priv->wowlan_restore = wowl2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -3001,7 +3004,7 @@ found:
|
|||
|
||||
return nm_platform_wifi_set_wake_on_wlan(NM_PLATFORM_GET,
|
||||
nm_device_get_ifindex(NM_DEVICE(self)),
|
||||
wowl);
|
||||
wowl2);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
|
|
@ -3695,7 +3698,7 @@ nm_device_wifi_init(NMDeviceWifi *self)
|
|||
priv->scan_last_request_started_at_msec = G_MININT64;
|
||||
priv->hidden_probe_scan_warn = TRUE;
|
||||
priv->mode = NM_802_11_MODE_INFRA;
|
||||
priv->wowlan_restore = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
priv->wowlan_restore = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -8338,7 +8338,7 @@ wifi_indicate_addressing_running(NMPlatform *platform, int ifindex, gboolean run
|
|||
nm_wifi_utils_indicate_addressing_running(wifi_data, running);
|
||||
}
|
||||
|
||||
static NMSettingWirelessWakeOnWLan
|
||||
static _NMSettingWirelessWakeOnWLan
|
||||
wifi_get_wake_on_wlan(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
|
||||
|
|
@ -8346,7 +8346,7 @@ wifi_get_wake_on_wlan(NMPlatform *platform, int ifindex)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_set_wake_on_wlan(NMPlatform *platform, int ifindex, NMSettingWirelessWakeOnWLan wowl)
|
||||
wifi_set_wake_on_wlan(NMPlatform *platform, int ifindex, _NMSettingWirelessWakeOnWLan wowl)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
|
||||
return nm_wifi_utils_set_wake_on_wlan(wifi_data, wowl);
|
||||
|
|
@ -8473,8 +8473,8 @@ link_get_wake_on_lan(NMPlatform *platform, int ifindex)
|
|||
return FALSE;
|
||||
|
||||
return !NM_IN_SET(nm_wifi_utils_get_wake_on_wlan(wifi_data),
|
||||
NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
|
||||
NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE);
|
||||
_NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
|
||||
_NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE);
|
||||
|
||||
} else
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -3134,7 +3134,7 @@ nm_platform_wifi_indicate_addressing_running(NMPlatform *self, int ifindex, gboo
|
|||
klass->wifi_indicate_addressing_running(self, ifindex, running);
|
||||
}
|
||||
|
||||
NMSettingWirelessWakeOnWLan
|
||||
_NMSettingWirelessWakeOnWLan
|
||||
nm_platform_wifi_get_wake_on_wlan(NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF(self, klass, FALSE);
|
||||
|
|
@ -3145,7 +3145,7 @@ nm_platform_wifi_get_wake_on_wlan(NMPlatform *self, int ifindex)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_wifi_set_wake_on_wlan(NMPlatform *self, int ifindex, NMSettingWirelessWakeOnWLan wowl)
|
||||
nm_platform_wifi_set_wake_on_wlan(NMPlatform *self, int ifindex, _NMSettingWirelessWakeOnWLan wowl)
|
||||
{
|
||||
_CHECK_SELF(self, klass, FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -1193,10 +1193,10 @@ typedef struct {
|
|||
void (*wifi_set_powersave)(NMPlatform *self, int ifindex, guint32 powersave);
|
||||
guint32 (*wifi_find_frequency)(NMPlatform *self, int ifindex, const guint32 *freqs);
|
||||
void (*wifi_indicate_addressing_running)(NMPlatform *self, int ifindex, gboolean running);
|
||||
NMSettingWirelessWakeOnWLan (*wifi_get_wake_on_wlan)(NMPlatform *self, int ifindex);
|
||||
gboolean (*wifi_set_wake_on_wlan)(NMPlatform * self,
|
||||
int ifindex,
|
||||
NMSettingWirelessWakeOnWLan wowl);
|
||||
_NMSettingWirelessWakeOnWLan (*wifi_get_wake_on_wlan)(NMPlatform *self, int ifindex);
|
||||
gboolean (*wifi_set_wake_on_wlan)(NMPlatform * self,
|
||||
int ifindex,
|
||||
_NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
guint32 (*mesh_get_channel)(NMPlatform *self, int ifindex);
|
||||
gboolean (*mesh_set_channel)(NMPlatform *self, int ifindex, guint32 channel);
|
||||
|
|
@ -1975,9 +1975,9 @@ void nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, NM80211Mode
|
|||
void nm_platform_wifi_set_powersave(NMPlatform *self, int ifindex, guint32 powersave);
|
||||
guint32 nm_platform_wifi_find_frequency(NMPlatform *self, int ifindex, const guint32 *freqs);
|
||||
void nm_platform_wifi_indicate_addressing_running(NMPlatform *self, int ifindex, gboolean running);
|
||||
NMSettingWirelessWakeOnWLan nm_platform_wifi_get_wake_on_wlan(NMPlatform *self, int ifindex);
|
||||
_NMSettingWirelessWakeOnWLan nm_platform_wifi_get_wake_on_wlan(NMPlatform *self, int ifindex);
|
||||
gboolean
|
||||
nm_platform_wifi_set_wake_on_wlan(NMPlatform *self, int ifindex, NMSettingWirelessWakeOnWLan wowl);
|
||||
nm_platform_wifi_set_wake_on_wlan(NMPlatform *self, int ifindex, _NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
guint32 nm_platform_mesh_get_channel(NMPlatform *self, int ifindex);
|
||||
gboolean nm_platform_mesh_set_channel(NMPlatform *self, int ifindex, guint32 channel);
|
||||
|
|
|
|||
|
|
@ -271,10 +271,10 @@ nla_put_failure:
|
|||
static int
|
||||
nl80211_get_wake_on_wlan_handler(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
NMSettingWirelessWakeOnWLan *wowl = arg;
|
||||
struct nlattr * attrs[NL80211_ATTR_MAX + 1];
|
||||
struct nlattr * trig[NUM_NL80211_WOWLAN_TRIG];
|
||||
struct genlmsghdr * gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||
_NMSettingWirelessWakeOnWLan *wowl = arg;
|
||||
struct nlattr * attrs[NL80211_ATTR_MAX + 1];
|
||||
struct nlattr * trig[NUM_NL80211_WOWLAN_TRIG];
|
||||
struct genlmsghdr * gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||
|
||||
nla_parse_arr(attrs, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
|
||||
|
||||
|
|
@ -286,32 +286,32 @@ nl80211_get_wake_on_wlan_handler(struct nl_msg *msg, void *arg)
|
|||
nla_len(attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
|
||||
NULL);
|
||||
|
||||
*wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE;
|
||||
*wowl = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE;
|
||||
if (trig[NL80211_WOWLAN_TRIG_ANY])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY;
|
||||
if (trig[NL80211_WOWLAN_TRIG_DISCONNECT])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT;
|
||||
if (trig[NL80211_WOWLAN_TRIG_MAGIC_PKT])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC;
|
||||
if (trig[NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE;
|
||||
if (trig[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST;
|
||||
if (trig[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE;
|
||||
if (trig[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE;
|
||||
if (trig[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
|
||||
*wowl |= NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP;
|
||||
*wowl |= _NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP;
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
static NMSettingWirelessWakeOnWLan
|
||||
static _NMSettingWirelessWakeOnWLan
|
||||
wifi_nl80211_get_wake_on_wlan(NMWifiUtils *data)
|
||||
{
|
||||
NMWifiUtilsNl80211 * self = (NMWifiUtilsNl80211 *) data;
|
||||
NMSettingWirelessWakeOnWLan wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
_NMSettingWirelessWakeOnWLan wowl = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
|
||||
msg = nl80211_alloc_msg(self, NL80211_CMD_GET_WOWLAN, 0);
|
||||
|
|
@ -322,14 +322,14 @@ wifi_nl80211_get_wake_on_wlan(NMWifiUtils *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_set_wake_on_wlan(NMWifiUtils *data, NMSettingWirelessWakeOnWLan wowl)
|
||||
wifi_nl80211_set_wake_on_wlan(NMWifiUtils *data, _NMSettingWirelessWakeOnWLan wowl)
|
||||
{
|
||||
NMWifiUtilsNl80211 * self = (NMWifiUtilsNl80211 *) data;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
struct nlattr * triggers;
|
||||
int err;
|
||||
|
||||
if (wowl == NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE)
|
||||
if (wowl == _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE)
|
||||
return TRUE;
|
||||
|
||||
msg = nl80211_alloc_msg(self, NL80211_CMD_SET_WOWLAN, 0);
|
||||
|
|
@ -338,19 +338,19 @@ wifi_nl80211_set_wake_on_wlan(NMWifiUtils *data, NMSettingWirelessWakeOnWLan wow
|
|||
if (!triggers)
|
||||
goto nla_put_failure;
|
||||
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE);
|
||||
if (NM_FLAGS_HAS(wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE))
|
||||
if (NM_FLAGS_HAS(wowl, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE))
|
||||
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE);
|
||||
|
||||
nla_nest_end(msg, triggers);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ typedef struct {
|
|||
gboolean (*set_powersave)(NMWifiUtils *data, guint32 powersave);
|
||||
|
||||
/* Get WakeOnWLAN configuration on an interface */
|
||||
NMSettingWirelessWakeOnWLan (*get_wake_on_wlan)(NMWifiUtils *data);
|
||||
_NMSettingWirelessWakeOnWLan (*get_wake_on_wlan)(NMWifiUtils *data);
|
||||
|
||||
/* Set WakeOnWLAN mode on an interface */
|
||||
gboolean (*set_wake_on_wlan)(NMWifiUtils *data, NMSettingWirelessWakeOnWLan wowl);
|
||||
gboolean (*set_wake_on_wlan)(NMWifiUtils *data, _NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
/* Return current frequency in MHz (really associated BSS frequency) */
|
||||
guint32 (*get_freq)(NMWifiUtils *data);
|
||||
|
|
|
|||
|
|
@ -92,21 +92,21 @@ nm_wifi_utils_set_powersave(NMWifiUtils *data, guint32 powersave)
|
|||
return klass->set_powersave ? klass->set_powersave(data, powersave) : TRUE;
|
||||
}
|
||||
|
||||
NMSettingWirelessWakeOnWLan
|
||||
_NMSettingWirelessWakeOnWLan
|
||||
nm_wifi_utils_get_wake_on_wlan(NMWifiUtils *data)
|
||||
{
|
||||
NMWifiUtilsClass *klass;
|
||||
|
||||
g_return_val_if_fail(data != NULL, NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE);
|
||||
g_return_val_if_fail(data != NULL, _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE);
|
||||
|
||||
klass = NM_WIFI_UTILS_GET_CLASS(data);
|
||||
|
||||
return klass->get_wake_on_wlan ? klass->get_wake_on_wlan(data)
|
||||
: NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
: _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wifi_utils_set_wake_on_wlan(NMWifiUtils *data, NMSettingWirelessWakeOnWLan wowl)
|
||||
nm_wifi_utils_set_wake_on_wlan(NMWifiUtils *data, _NMSettingWirelessWakeOnWLan wowl)
|
||||
{
|
||||
NMWifiUtilsClass *klass;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "nm-dbus-interface.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
#include "libnm-platform/nm-netlink.h"
|
||||
#include "libnm-base/nm-base.h"
|
||||
|
||||
typedef struct NMWifiUtils NMWifiUtils;
|
||||
|
||||
|
|
@ -60,9 +61,9 @@ gboolean nm_wifi_utils_indicate_addressing_running(NMWifiUtils *data, gboolean r
|
|||
|
||||
gboolean nm_wifi_utils_set_powersave(NMWifiUtils *data, guint32 powersave);
|
||||
|
||||
NMSettingWirelessWakeOnWLan nm_wifi_utils_get_wake_on_wlan(NMWifiUtils *data);
|
||||
_NMSettingWirelessWakeOnWLan nm_wifi_utils_get_wake_on_wlan(NMWifiUtils *data);
|
||||
|
||||
gboolean nm_wifi_utils_set_wake_on_wlan(NMWifiUtils *data, NMSettingWirelessWakeOnWLan wowl);
|
||||
gboolean nm_wifi_utils_set_wake_on_wlan(NMWifiUtils *data, _NMSettingWirelessWakeOnWLan wowl);
|
||||
|
||||
/* OLPC Mesh-only functions */
|
||||
guint32 nm_wifi_utils_get_mesh_channel(NMWifiUtils *data);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue