mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 19:30:41 +01:00
core: use _NM80211Mode instead of NM80211Mode
This commit is contained in:
parent
a5865cef1a
commit
82e2a694d7
19 changed files with 196 additions and 190 deletions
|
|
@ -265,7 +265,7 @@ ap_from_network(NMDeviceIwd *self,
|
|||
.bss_path = bss_path,
|
||||
.last_seen_msec = last_seen_msec,
|
||||
.bssid_valid = TRUE,
|
||||
.mode = NM_802_11_MODE_INFRA,
|
||||
.mode = _NM_802_11_MODE_INFRA,
|
||||
.rsn_flags = ap_security_flags_from_network_type(type),
|
||||
.ssid = ssid,
|
||||
.signal_percent = nm_wifi_utils_level_to_quality(signal / 100),
|
||||
|
|
@ -2610,9 +2610,9 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
switch (prop_id) {
|
||||
case PROP_MODE:
|
||||
if (!priv->current_ap)
|
||||
g_value_set_uint(value, NM_802_11_MODE_UNKNOWN);
|
||||
g_value_set_uint(value, _NM_802_11_MODE_UNKNOWN);
|
||||
else if (nm_wifi_ap_is_hotspot(priv->current_ap))
|
||||
g_value_set_uint(value, NM_802_11_MODE_AP);
|
||||
g_value_set_uint(value, _NM_802_11_MODE_AP);
|
||||
else
|
||||
g_value_set_uint(value, nm_wifi_ap_get_mode(priv->current_ap));
|
||||
|
||||
|
|
@ -3452,9 +3452,9 @@ nm_device_iwd_class_init(NMDeviceIwdClass *klass)
|
|||
obj_properties[PROP_MODE] = g_param_spec_uint(NM_DEVICE_IWD_MODE,
|
||||
"",
|
||||
"",
|
||||
NM_802_11_MODE_UNKNOWN,
|
||||
NM_802_11_MODE_AP,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_UNKNOWN,
|
||||
_NM_802_11_MODE_AP,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_BITRATE] = g_param_spec_uint(NM_DEVICE_IWD_BITRATE,
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ typedef struct {
|
|||
_NMSettingWirelessWakeOnWLan wowlan_restore;
|
||||
|
||||
NMDeviceWifiP2P *p2p_device;
|
||||
NM80211Mode mode;
|
||||
_NM80211Mode mode;
|
||||
|
||||
guint32 failed_iface_count;
|
||||
gint32 hw_addr_scan_expire;
|
||||
|
|
@ -487,7 +487,7 @@ _scan_notify_allowed(NMDeviceWifi *self, NMTernary do_kickoff)
|
|||
|
||||
if (!c_list_is_empty(&priv->scanning_prohibited_lst_head)) {
|
||||
/* something prohibits scanning. */
|
||||
} else if (NM_IN_SET(priv->mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_AP)) {
|
||||
} else if (NM_IN_SET(priv->mode, _NM_802_11_MODE_ADHOC, _NM_802_11_MODE_AP)) {
|
||||
/* Don't scan when a an AP or Ad-Hoc connection is active as it will
|
||||
* disrupt connected clients or peers. */
|
||||
} else if (NM_IN_SET(state, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_FAILED)) {
|
||||
|
|
@ -678,7 +678,7 @@ update_seen_bssids_cache(NMDeviceWifi *self, NMWifiAP *ap)
|
|||
return;
|
||||
|
||||
/* Don't cache the BSSID for Ad-Hoc APs */
|
||||
if (nm_wifi_ap_get_mode(ap) != NM_802_11_MODE_INFRA)
|
||||
if (nm_wifi_ap_get_mode(ap) != _NM_802_11_MODE_INFRA)
|
||||
return;
|
||||
|
||||
if (nm_device_get_state(NM_DEVICE(self)) == NM_DEVICE_STATE_ACTIVATED
|
||||
|
|
@ -712,10 +712,11 @@ set_current_ap(NMDeviceWifi *self, NMWifiAP *new_ap, gboolean recheck_available_
|
|||
priv->current_ap = NULL;
|
||||
|
||||
if (old_ap) {
|
||||
NM80211Mode mode = nm_wifi_ap_get_mode(old_ap);
|
||||
_NM80211Mode mode = nm_wifi_ap_get_mode(old_ap);
|
||||
|
||||
/* Remove any AP from the internal list if it was created by NM or isn't known to the supplicant */
|
||||
if (NM_IN_SET(mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_AP) || nm_wifi_ap_get_fake(old_ap))
|
||||
if (NM_IN_SET(mode, _NM_802_11_MODE_ADHOC, _NM_802_11_MODE_AP)
|
||||
|| nm_wifi_ap_get_fake(old_ap))
|
||||
ap_add_remove(self, FALSE, old_ap, recheck_available_connections);
|
||||
g_object_unref(old_ap);
|
||||
}
|
||||
|
|
@ -750,7 +751,7 @@ periodic_update(NMDeviceWifi *self)
|
|||
return;
|
||||
}
|
||||
|
||||
if (priv->mode == NM_802_11_MODE_AP) {
|
||||
if (priv->mode == _NM_802_11_MODE_AP) {
|
||||
/* In AP mode we currently have nothing to do. */
|
||||
return;
|
||||
}
|
||||
|
|
@ -937,14 +938,14 @@ deactivate(NMDevice *device)
|
|||
* (usually older ones) don't scan well in adhoc mode.
|
||||
*/
|
||||
if (nm_platform_wifi_get_mode(nm_device_get_platform(device), ifindex)
|
||||
!= NM_802_11_MODE_INFRA) {
|
||||
!= _NM_802_11_MODE_INFRA) {
|
||||
nm_device_take_down(NM_DEVICE(self), TRUE);
|
||||
nm_platform_wifi_set_mode(nm_device_get_platform(device), ifindex, NM_802_11_MODE_INFRA);
|
||||
nm_platform_wifi_set_mode(nm_device_get_platform(device), ifindex, _NM_802_11_MODE_INFRA);
|
||||
nm_device_bring_up(NM_DEVICE(self), TRUE, NULL);
|
||||
}
|
||||
|
||||
if (priv->mode != NM_802_11_MODE_INFRA) {
|
||||
priv->mode = NM_802_11_MODE_INFRA;
|
||||
if (priv->mode != _NM_802_11_MODE_INFRA) {
|
||||
priv->mode = _NM_802_11_MODE_INFRA;
|
||||
_notify(self, PROP_MODE);
|
||||
}
|
||||
|
||||
|
|
@ -2481,8 +2482,8 @@ supplicant_iface_state(NMDeviceWifi * self,
|
|||
|
||||
_LOGI(LOGD_DEVICE | LOGD_WIFI,
|
||||
"Activation: (wifi) Stage 2 of 5 (Device Configure) successful. %s %s",
|
||||
priv->mode == NM_802_11_MODE_AP ? "Started Wi-Fi Hotspot"
|
||||
: "Connected to wireless network",
|
||||
priv->mode == _NM_802_11_MODE_AP ? "Started Wi-Fi Hotspot"
|
||||
: "Connected to wireless network",
|
||||
(ssid_str = _nm_utils_ssid_to_string_gbytes(ssid)));
|
||||
nm_device_activate_schedule_stage3_ip_config_start(device);
|
||||
} else if (devstate == NM_DEVICE_STATE_ACTIVATED)
|
||||
|
|
@ -2790,21 +2791,21 @@ supplicant_connection_timeout_cb(gpointer user_data)
|
|||
connection = nm_act_request_get_applied_connection(req);
|
||||
g_assert(connection);
|
||||
|
||||
if (NM_IN_SET(priv->mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_MESH, NM_802_11_MODE_AP)) {
|
||||
if (NM_IN_SET(priv->mode, _NM_802_11_MODE_ADHOC, _NM_802_11_MODE_MESH, _NM_802_11_MODE_AP)) {
|
||||
/* In Ad-Hoc and AP modes there's nothing to check the encryption key
|
||||
* (if any), so supplicant timeouts here are almost certainly the wifi
|
||||
* driver being really stupid.
|
||||
*/
|
||||
_LOGW(LOGD_DEVICE | LOGD_WIFI,
|
||||
"Activation: (wifi) %s network creation took too long, failing activation",
|
||||
priv->mode == NM_802_11_MODE_ADHOC ? "Ad-Hoc" : "Hotspot");
|
||||
priv->mode == _NM_802_11_MODE_ADHOC ? "Ad-Hoc" : "Hotspot");
|
||||
nm_device_state_changed(device,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_assert(priv->mode == NM_802_11_MODE_INFRA);
|
||||
g_assert(priv->mode == _NM_802_11_MODE_INFRA);
|
||||
|
||||
if (priv->ssid_found && nm_connection_get_setting_wireless_security(connection)) {
|
||||
guint64 timestamp = 0;
|
||||
|
|
@ -3033,16 +3034,16 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
|
||||
mode = nm_setting_wireless_get_mode(s_wireless);
|
||||
if (g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_INFRA) == 0)
|
||||
priv->mode = NM_802_11_MODE_INFRA;
|
||||
priv->mode = _NM_802_11_MODE_INFRA;
|
||||
else if (g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0)
|
||||
priv->mode = NM_802_11_MODE_ADHOC;
|
||||
priv->mode = _NM_802_11_MODE_ADHOC;
|
||||
else if (g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_AP) == 0) {
|
||||
priv->mode = NM_802_11_MODE_AP;
|
||||
priv->mode = _NM_802_11_MODE_AP;
|
||||
|
||||
/* Scanning not done in AP mode; clear the scan list */
|
||||
remove_all_aps(self);
|
||||
} else if (g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_MESH) == 0)
|
||||
priv->mode = NM_802_11_MODE_MESH;
|
||||
priv->mode = _NM_802_11_MODE_MESH;
|
||||
_notify(self, PROP_MODE);
|
||||
|
||||
/* expire the temporary MAC address used during scanning */
|
||||
|
|
@ -3055,7 +3056,7 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
}
|
||||
|
||||
/* AP and Mesh modes never use a specific object or existing scanned AP */
|
||||
if (!NM_IN_SET(priv->mode, NM_802_11_MODE_AP, NM_802_11_MODE_MESH)) {
|
||||
if (!NM_IN_SET(priv->mode, _NM_802_11_MODE_AP, _NM_802_11_MODE_MESH)) {
|
||||
ap_path = nm_active_connection_get_specific_object(NM_ACTIVE_CONNECTION(req));
|
||||
ap = ap_path ? nm_wifi_ap_lookup_for_device(NM_DEVICE(self), ap_path) : NULL;
|
||||
}
|
||||
|
|
@ -3157,7 +3158,7 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
NMDeviceWifi * self = NM_DEVICE_WIFI(device);
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
|
||||
gs_unref_object NMSupplicantConfig *config = NULL;
|
||||
NM80211Mode ap_mode;
|
||||
_NM80211Mode ap_mode;
|
||||
NMActRequest * req;
|
||||
NMWifiAP * ap;
|
||||
NMConnection * connection;
|
||||
|
|
@ -3224,10 +3225,11 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
* if the user didn't specify one and we didn't find an AP that matched
|
||||
* the connection, just pick a frequency the device supports.
|
||||
*/
|
||||
if (NM_IN_SET(ap_mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_MESH) || nm_wifi_ap_is_hotspot(ap))
|
||||
if (NM_IN_SET(ap_mode, _NM_802_11_MODE_ADHOC, _NM_802_11_MODE_MESH)
|
||||
|| nm_wifi_ap_is_hotspot(ap))
|
||||
ensure_hotspot_frequency(self, s_wireless, ap);
|
||||
|
||||
if (ap_mode == NM_802_11_MODE_INFRA)
|
||||
if (ap_mode == _NM_802_11_MODE_INFRA)
|
||||
set_powersave(device);
|
||||
|
||||
/* Build up the supplicant configuration */
|
||||
|
|
@ -3344,7 +3346,7 @@ act_stage4_ip_config_timeout(NMDevice * device,
|
|||
s_ip = nm_connection_get_setting_ip_config(connection, addr_family);
|
||||
may_fail = nm_setting_ip_config_get_may_fail(s_ip);
|
||||
|
||||
if (priv->mode == NM_802_11_MODE_AP)
|
||||
if (priv->mode == _NM_802_11_MODE_AP)
|
||||
goto call_parent;
|
||||
|
||||
if (may_fail || !is_static_wep(connection)) {
|
||||
|
|
@ -3697,7 +3699,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->mode = _NM_802_11_MODE_INFRA;
|
||||
priv->wowlan_restore = _NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
|
||||
}
|
||||
|
||||
|
|
@ -3825,9 +3827,9 @@ nm_device_wifi_class_init(NMDeviceWifiClass *klass)
|
|||
obj_properties[PROP_MODE] = g_param_spec_uint(NM_DEVICE_WIFI_MODE,
|
||||
"",
|
||||
"",
|
||||
NM_802_11_MODE_UNKNOWN,
|
||||
NM_802_11_MODE_AP,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_UNKNOWN,
|
||||
_NM_802_11_MODE_AP,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_BITRATE] = g_param_spec_uint(NM_DEVICE_WIFI_BITRATE,
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMWifiAP,
|
|||
|
||||
struct _NMWifiAPPrivate {
|
||||
/* Scanned or cached values */
|
||||
GBytes * ssid;
|
||||
char * address;
|
||||
NM80211Mode mode;
|
||||
guint8 strength;
|
||||
guint32 freq; /* Frequency in MHz; ie 2412 (== 2.412 GHz) */
|
||||
guint32 max_bitrate; /* Maximum bitrate of the AP in Kbit/s (ie 54000 Kb/s == 54Mbit/s) */
|
||||
GBytes * ssid;
|
||||
char * address;
|
||||
_NM80211Mode mode;
|
||||
guint8 strength;
|
||||
guint32 freq; /* Frequency in MHz; ie 2412 (== 2.412 GHz) */
|
||||
guint32 max_bitrate; /* Maximum bitrate of the AP in Kbit/s (ie 54000 Kb/s == 54Mbit/s) */
|
||||
|
||||
gint64
|
||||
last_seen_msec; /* Timestamp when the AP was seen lastly (in nm_utils_get_monotonic_timestamp_*() scale).
|
||||
|
|
@ -191,24 +191,24 @@ nm_wifi_ap_set_address(NMWifiAP *ap, const char *addr)
|
|||
return nm_wifi_ap_set_address_bin(ap, &addr_buf);
|
||||
}
|
||||
|
||||
NM80211Mode
|
||||
_NM80211Mode
|
||||
nm_wifi_ap_get_mode(NMWifiAP *ap)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_WIFI_AP(ap), NM_802_11_MODE_UNKNOWN);
|
||||
g_return_val_if_fail(NM_IS_WIFI_AP(ap), _NM_802_11_MODE_UNKNOWN);
|
||||
|
||||
return NM_WIFI_AP_GET_PRIVATE(ap)->mode;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nm_wifi_ap_set_mode(NMWifiAP *ap, NM80211Mode mode)
|
||||
nm_wifi_ap_set_mode(NMWifiAP *ap, _NM80211Mode mode)
|
||||
{
|
||||
NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE(ap);
|
||||
|
||||
nm_assert(NM_IN_SET(mode,
|
||||
NM_802_11_MODE_UNKNOWN,
|
||||
NM_802_11_MODE_ADHOC,
|
||||
NM_802_11_MODE_INFRA,
|
||||
NM_802_11_MODE_MESH));
|
||||
_NM_802_11_MODE_UNKNOWN,
|
||||
_NM_802_11_MODE_ADHOC,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_MESH));
|
||||
|
||||
if (priv->mode != mode) {
|
||||
priv->mode = mode;
|
||||
|
|
@ -513,34 +513,35 @@ nm_wifi_ap_to_string(const NMWifiAP *self, char *str_buf, gulong buf_len, gint64
|
|||
|
||||
nm_utils_get_monotonic_timestamp_msec_cached(&now_msec);
|
||||
|
||||
g_snprintf(str_buf,
|
||||
buf_len,
|
||||
"%17s %-35s [ %c %3u %3u%% %c%c %c%c W:%04X R:%04X ] %s sup:%s [nm:%s]",
|
||||
priv->address ?: "(none)",
|
||||
(ssid_to_free = _nm_utils_ssid_to_string_gbytes(priv->ssid)),
|
||||
(priv->mode == NM_802_11_MODE_ADHOC
|
||||
? '*'
|
||||
: (priv->hotspot
|
||||
? '#'
|
||||
: (priv->fake ? 'f' : (priv->mode == NM_802_11_MODE_MESH ? 'm' : 'a')))),
|
||||
chan,
|
||||
priv->strength,
|
||||
priv->flags & NM_802_11_AP_FLAGS_PRIVACY ? 'P' : '_',
|
||||
priv->metered ? 'M' : '_',
|
||||
priv->flags & NM_802_11_AP_FLAGS_WPS ? 'W' : '_',
|
||||
priv->flags & NM_802_11_AP_FLAGS_WPS_PIN
|
||||
? 'p'
|
||||
: (priv->flags & NM_802_11_AP_FLAGS_WPS_PBC ? '#' : '_'),
|
||||
priv->wpa_flags & 0xFFFF,
|
||||
priv->rsn_flags & 0xFFFF,
|
||||
priv->last_seen_msec != G_MININT64
|
||||
? nm_sprintf_buf(str_buf_ts,
|
||||
"%3u.%03us",
|
||||
(guint)((now_msec - priv->last_seen_msec) / 1000),
|
||||
(guint)((now_msec - priv->last_seen_msec) % 1000))
|
||||
: " ",
|
||||
supplicant_id,
|
||||
export_path);
|
||||
g_snprintf(
|
||||
str_buf,
|
||||
buf_len,
|
||||
"%17s %-35s [ %c %3u %3u%% %c%c %c%c W:%04X R:%04X ] %s sup:%s [nm:%s]",
|
||||
priv->address ?: "(none)",
|
||||
(ssid_to_free = _nm_utils_ssid_to_string_gbytes(priv->ssid)),
|
||||
(priv->mode == _NM_802_11_MODE_ADHOC
|
||||
? '*'
|
||||
: (priv->hotspot
|
||||
? '#'
|
||||
: (priv->fake ? 'f' : (priv->mode == _NM_802_11_MODE_MESH ? 'm' : 'a')))),
|
||||
chan,
|
||||
priv->strength,
|
||||
priv->flags & NM_802_11_AP_FLAGS_PRIVACY ? 'P' : '_',
|
||||
priv->metered ? 'M' : '_',
|
||||
priv->flags & NM_802_11_AP_FLAGS_WPS ? 'W' : '_',
|
||||
priv->flags & NM_802_11_AP_FLAGS_WPS_PIN
|
||||
? 'p'
|
||||
: (priv->flags & NM_802_11_AP_FLAGS_WPS_PBC ? '#' : '_'),
|
||||
priv->wpa_flags & 0xFFFF,
|
||||
priv->rsn_flags & 0xFFFF,
|
||||
priv->last_seen_msec != G_MININT64
|
||||
? nm_sprintf_buf(str_buf_ts,
|
||||
"%3u.%03us",
|
||||
(guint)((now_msec - priv->last_seen_msec) / 1000),
|
||||
(guint)((now_msec - priv->last_seen_msec) % 1000))
|
||||
: " ",
|
||||
supplicant_id,
|
||||
export_path);
|
||||
return str_buf;
|
||||
}
|
||||
|
||||
|
|
@ -589,13 +590,13 @@ nm_wifi_ap_check_compatible(NMWifiAP *self, NMConnection *connection)
|
|||
|
||||
mode = nm_setting_wireless_get_mode(s_wireless);
|
||||
if (mode) {
|
||||
if (!strcmp(mode, "infrastructure") && (priv->mode != NM_802_11_MODE_INFRA))
|
||||
if (!strcmp(mode, "infrastructure") && (priv->mode != _NM_802_11_MODE_INFRA))
|
||||
return FALSE;
|
||||
if (!strcmp(mode, "adhoc") && (priv->mode != NM_802_11_MODE_ADHOC))
|
||||
if (!strcmp(mode, "adhoc") && (priv->mode != _NM_802_11_MODE_ADHOC))
|
||||
return FALSE;
|
||||
if (!strcmp(mode, "ap") && (priv->mode != NM_802_11_MODE_INFRA || priv->hotspot != TRUE))
|
||||
if (!strcmp(mode, "ap") && (priv->mode != _NM_802_11_MODE_INFRA || priv->hotspot != TRUE))
|
||||
return FALSE;
|
||||
if (!strcmp(mode, "mesh") && (priv->mode != NM_802_11_MODE_MESH))
|
||||
if (!strcmp(mode, "mesh") && (priv->mode != _NM_802_11_MODE_MESH))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -624,7 +625,7 @@ nm_wifi_ap_check_compatible(NMWifiAP *self, NMConnection *connection)
|
|||
priv->flags,
|
||||
priv->wpa_flags,
|
||||
priv->rsn_flags,
|
||||
priv->mode);
|
||||
NM_802_11_MODE_CAST(priv->mode));
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
@ -713,7 +714,7 @@ nm_wifi_ap_init(NMWifiAP *self)
|
|||
|
||||
c_list_init(&self->aps_lst);
|
||||
|
||||
priv->mode = NM_802_11_MODE_INFRA;
|
||||
priv->mode = _NM_802_11_MODE_INFRA;
|
||||
priv->flags = NM_802_11_AP_FLAGS_NONE;
|
||||
priv->wpa_flags = NM_802_11_AP_SEC_NONE;
|
||||
priv->rsn_flags = NM_802_11_AP_SEC_NONE;
|
||||
|
|
@ -758,19 +759,19 @@ nm_wifi_ap_new_fake_from_connection(NMConnection *connection)
|
|||
mode = nm_setting_wireless_get_mode(s_wireless);
|
||||
if (mode) {
|
||||
if (!strcmp(mode, "infrastructure"))
|
||||
nm_wifi_ap_set_mode(ap, NM_802_11_MODE_INFRA);
|
||||
nm_wifi_ap_set_mode(ap, _NM_802_11_MODE_INFRA);
|
||||
else if (!strcmp(mode, "adhoc")) {
|
||||
nm_wifi_ap_set_mode(ap, NM_802_11_MODE_ADHOC);
|
||||
nm_wifi_ap_set_mode(ap, _NM_802_11_MODE_ADHOC);
|
||||
adhoc = TRUE;
|
||||
} else if (!strcmp(mode, "mesh"))
|
||||
nm_wifi_ap_set_mode(ap, NM_802_11_MODE_MESH);
|
||||
nm_wifi_ap_set_mode(ap, _NM_802_11_MODE_MESH);
|
||||
else if (!strcmp(mode, "ap")) {
|
||||
nm_wifi_ap_set_mode(ap, NM_802_11_MODE_INFRA);
|
||||
nm_wifi_ap_set_mode(ap, _NM_802_11_MODE_INFRA);
|
||||
NM_WIFI_AP_GET_PRIVATE(ap)->hotspot = TRUE;
|
||||
} else
|
||||
goto error;
|
||||
} else {
|
||||
nm_wifi_ap_set_mode(ap, NM_802_11_MODE_INFRA);
|
||||
nm_wifi_ap_set_mode(ap, _NM_802_11_MODE_INFRA);
|
||||
}
|
||||
|
||||
band = nm_setting_wireless_get_band(s_wireless);
|
||||
|
|
@ -955,9 +956,9 @@ nm_wifi_ap_class_init(NMWifiAPClass *ap_class)
|
|||
obj_properties[PROP_MODE] = g_param_spec_uint(NM_WIFI_AP_MODE,
|
||||
"",
|
||||
"",
|
||||
NM_802_11_MODE_ADHOC,
|
||||
NM_802_11_MODE_INFRA,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_ADHOC,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_MAX_BITRATE] = g_param_spec_uint(NM_WIFI_AP_MAX_BITRATE,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "nm-dbus-object.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-connection.h"
|
||||
#include "libnm-base/nm-base.h"
|
||||
|
||||
#define NM_TYPE_WIFI_AP (nm_wifi_ap_get_type())
|
||||
#define NM_WIFI_AP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_WIFI_AP, NMWifiAP))
|
||||
|
|
@ -69,7 +70,7 @@ gboolean nm_wifi_ap_set_ssid(NMWifiAP *ap, GBytes *ssid);
|
|||
const char * nm_wifi_ap_get_address(const NMWifiAP *ap);
|
||||
gboolean nm_wifi_ap_set_address(NMWifiAP *ap, const char *addr);
|
||||
gboolean nm_wifi_ap_set_address_bin(NMWifiAP *ap, const NMEtherAddr *addr);
|
||||
NM80211Mode nm_wifi_ap_get_mode(NMWifiAP *ap);
|
||||
_NM80211Mode nm_wifi_ap_get_mode(NMWifiAP *ap);
|
||||
gboolean nm_wifi_ap_is_hotspot(NMWifiAP *ap);
|
||||
gint8 nm_wifi_ap_get_strength(NMWifiAP *ap);
|
||||
gboolean nm_wifi_ap_set_strength(NMWifiAP *ap, gint8 strength);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ create_device(NMDeviceFactory * factory,
|
|||
if (!backend || !g_ascii_strcasecmp(backend, "wpa_supplicant")) {
|
||||
NMDevice * device;
|
||||
_NMDeviceWifiCapabilities capabilities;
|
||||
NM80211Mode mode;
|
||||
_NM80211Mode mode;
|
||||
|
||||
if (!nm_platform_wifi_get_capabilities(NM_PLATFORM_GET, plink->ifindex, &capabilities)) {
|
||||
nm_log_warn(LOGD_PLATFORM | LOGD_WIFI,
|
||||
|
|
@ -114,7 +114,7 @@ create_device(NMDeviceFactory * factory,
|
|||
* them if/when they change to a handled type.
|
||||
*/
|
||||
mode = nm_platform_wifi_get_mode(NM_PLATFORM_GET, plink->ifindex);
|
||||
if (mode == NM_802_11_MODE_UNKNOWN) {
|
||||
if (mode == _NM_802_11_MODE_UNKNOWN) {
|
||||
*out_ignore = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ verify_adhoc(NMSettingWirelessSecurity *s_wsec,
|
|||
gboolean
|
||||
nm_wifi_utils_complete_connection(GBytes * ap_ssid,
|
||||
const char * bssid,
|
||||
NM80211Mode ap_mode,
|
||||
_NM80211Mode ap_mode,
|
||||
guint32 ap_freq,
|
||||
guint32 ap_flags,
|
||||
guint32 ap_wpa_flags,
|
||||
|
|
@ -575,14 +575,14 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid,
|
|||
/* Make sure the supplied mode matches the AP's */
|
||||
if (!strcmp(mode, NM_SETTING_WIRELESS_MODE_INFRA)
|
||||
|| !strcmp(mode, NM_SETTING_WIRELESS_MODE_AP)) {
|
||||
if (ap_mode == NM_802_11_MODE_INFRA)
|
||||
if (ap_mode == _NM_802_11_MODE_INFRA)
|
||||
valid = TRUE;
|
||||
} else if (!strcmp(mode, NM_SETTING_WIRELESS_MODE_ADHOC)) {
|
||||
if (ap_mode == NM_802_11_MODE_ADHOC)
|
||||
if (ap_mode == _NM_802_11_MODE_ADHOC)
|
||||
valid = TRUE;
|
||||
adhoc = TRUE;
|
||||
} else if (!strcmp(mode, NM_SETTING_WIRELESS_MODE_MESH)) {
|
||||
if (ap_mode == NM_802_11_MODE_MESH)
|
||||
if (ap_mode == _NM_802_11_MODE_MESH)
|
||||
valid = TRUE;
|
||||
mesh = TRUE;
|
||||
}
|
||||
|
|
@ -600,10 +600,10 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid,
|
|||
}
|
||||
} else {
|
||||
mode = NM_SETTING_WIRELESS_MODE_INFRA;
|
||||
if (ap_mode == NM_802_11_MODE_ADHOC) {
|
||||
if (ap_mode == _NM_802_11_MODE_ADHOC) {
|
||||
mode = NM_SETTING_WIRELESS_MODE_ADHOC;
|
||||
adhoc = TRUE;
|
||||
} else if (ap_mode == NM_802_11_MODE_MESH) {
|
||||
} else if (ap_mode == _NM_802_11_MODE_MESH) {
|
||||
mode = NM_SETTING_WIRELESS_MODE_MESH;
|
||||
mesh = TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "nm-setting-wireless.h"
|
||||
#include "nm-setting-wireless-security.h"
|
||||
#include "nm-setting-8021x.h"
|
||||
#include "libnm-base/nm-base.h"
|
||||
|
||||
typedef enum {
|
||||
NM_IWD_NETWORK_SECURITY_OPEN,
|
||||
|
|
@ -21,7 +22,7 @@ typedef enum {
|
|||
|
||||
gboolean nm_wifi_utils_complete_connection(GBytes * ssid,
|
||||
const char * bssid,
|
||||
NM80211Mode mode,
|
||||
_NM80211Mode mode,
|
||||
guint32 ap_freq,
|
||||
guint32 flags,
|
||||
guint32 wpa_flags,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
static gboolean
|
||||
complete_connection(const char * ssid,
|
||||
const char * bssid,
|
||||
NM80211Mode mode,
|
||||
_NM80211Mode mode,
|
||||
guint32 flags,
|
||||
guint32 wpa_flags,
|
||||
guint32 rsn_flags,
|
||||
|
|
@ -197,7 +197,7 @@ fill_8021x(NMConnection *connection, const KeyData items[])
|
|||
}
|
||||
|
||||
static NMConnection *
|
||||
create_basic(const char *ssid, const char *bssid, NM80211Mode mode)
|
||||
create_basic(const char *ssid, const char *bssid, _NM80211Mode mode)
|
||||
{
|
||||
NMConnection * connection;
|
||||
NMSettingWireless *s_wifi = NULL;
|
||||
|
|
@ -217,9 +217,9 @@ create_basic(const char *ssid, const char *bssid, NM80211Mode mode)
|
|||
if (bssid)
|
||||
g_object_set(G_OBJECT(s_wifi), NM_SETTING_WIRELESS_BSSID, bssid, NULL);
|
||||
|
||||
if (mode == NM_802_11_MODE_INFRA)
|
||||
if (mode == _NM_802_11_MODE_INFRA)
|
||||
g_object_set(G_OBJECT(s_wifi), NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);
|
||||
else if (mode == NM_802_11_MODE_ADHOC)
|
||||
else if (mode == _NM_802_11_MODE_ADHOC)
|
||||
g_object_set(G_OBJECT(s_wifi), NM_SETTING_WIRELESS_MODE, "adhoc", NULL);
|
||||
else
|
||||
g_assert_not_reached();
|
||||
|
|
@ -241,14 +241,14 @@ test_lock_bssid(void)
|
|||
src = nm_simple_connection_new();
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
TRUE,
|
||||
src,
|
||||
&error);
|
||||
expected = create_basic(ssid, bssid, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, bssid, _NM_802_11_MODE_INFRA);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
||||
g_object_unref(src);
|
||||
|
|
@ -273,14 +273,14 @@ test_open_ap_empty_connection(void)
|
|||
src = nm_simple_connection_new();
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
FALSE,
|
||||
src,
|
||||
&error);
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
||||
g_object_unref(src);
|
||||
|
|
@ -311,7 +311,7 @@ test_open_ap_leap_connection_1(gconstpointer add_wifi)
|
|||
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -345,7 +345,7 @@ test_open_ap_leap_connection_2(void)
|
|||
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -383,7 +383,7 @@ test_open_ap_wep_connection(gconstpointer add_wifi)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -427,7 +427,7 @@ test_ap_wpa_psk_connection_base(const char * key_mgmt,
|
|||
fill_wsec(src, both_wsec);
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
flags,
|
||||
wpa_flags,
|
||||
rsn_flags,
|
||||
|
|
@ -553,7 +553,7 @@ test_ap_wpa_eap_connection_base(const char *key_mgmt,
|
|||
fill_8021x(src, src_empty);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
flags,
|
||||
wpa_flags,
|
||||
rsn_flags,
|
||||
|
|
@ -751,7 +751,7 @@ test_priv_ap_empty_connection(void)
|
|||
src = nm_simple_connection_new();
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -760,7 +760,7 @@ test_priv_ap_empty_connection(void)
|
|||
&error);
|
||||
|
||||
/* Static WEP connection expected */
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
fill_wsec(expected, exp_wsec);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
||||
|
|
@ -798,7 +798,7 @@ test_priv_ap_leap_connection_1(gconstpointer add_wifi)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -809,7 +809,7 @@ test_priv_ap_leap_connection_1(gconstpointer add_wifi)
|
|||
* there's no way to determine from the AP's beacon whether it's static WEP,
|
||||
* dynamic WEP, or LEAP.
|
||||
*/
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
fill_wsec(expected, exp_wsec);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
||||
|
|
@ -840,7 +840,7 @@ test_priv_ap_leap_connection_2(void)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -885,7 +885,7 @@ test_priv_ap_dynamic_wep_1(void)
|
|||
fill_8021x(src, both_8021x);
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -894,7 +894,7 @@ test_priv_ap_dynamic_wep_1(void)
|
|||
&error);
|
||||
|
||||
/* We expect a completed Dynamic WEP connection */
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
fill_wsec(expected, exp_wsec);
|
||||
fill_8021x(expected, both_8021x);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
|
@ -933,7 +933,7 @@ test_priv_ap_dynamic_wep_2(void)
|
|||
fill_8021x(src, both_8021x);
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -942,7 +942,7 @@ test_priv_ap_dynamic_wep_2(void)
|
|||
&error);
|
||||
|
||||
/* We expect a completed Dynamic WEP connection */
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
fill_wsec(expected, exp_wsec);
|
||||
fill_8021x(expected, both_8021x);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
|
@ -976,7 +976,7 @@ test_priv_ap_dynamic_wep_3(void)
|
|||
fill_8021x(src, src_8021x);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
NM_802_11_AP_SEC_NONE,
|
||||
|
|
@ -1102,7 +1102,7 @@ test_wpa_ap_empty_connection(gconstpointer data)
|
|||
src = nm_simple_connection_new();
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
wpa_flags_for_idx(idx),
|
||||
rsn_flags_for_idx(idx),
|
||||
|
|
@ -1111,7 +1111,7 @@ test_wpa_ap_empty_connection(gconstpointer data)
|
|||
&error);
|
||||
|
||||
/* WPA connection expected */
|
||||
expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA);
|
||||
expected = create_basic(ssid, NULL, _NM_802_11_MODE_INFRA);
|
||||
fill_wsec(expected, exp_wsec);
|
||||
COMPARE(src, expected, success, error, 0, 0);
|
||||
|
||||
|
|
@ -1144,7 +1144,7 @@ test_wpa_ap_leap_connection_1(gconstpointer data)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection(ssid,
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
wpa_flags_for_idx(idx),
|
||||
rsn_flags_for_idx(idx),
|
||||
|
|
@ -1180,7 +1180,7 @@ test_wpa_ap_leap_connection_2(gconstpointer data)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
wpa_flags_for_idx(idx),
|
||||
rsn_flags_for_idx(idx),
|
||||
|
|
@ -1214,7 +1214,7 @@ test_wpa_ap_dynamic_wep_connection(gconstpointer data)
|
|||
fill_wsec(src, src_wsec);
|
||||
success = complete_connection("blahblah",
|
||||
bssid,
|
||||
NM_802_11_MODE_INFRA,
|
||||
_NM_802_11_MODE_INFRA,
|
||||
NM_802_11_AP_FLAGS_PRIVACY,
|
||||
wpa_flags_for_idx(idx),
|
||||
rsn_flags_for_idx(idx),
|
||||
|
|
|
|||
|
|
@ -861,14 +861,14 @@ wifi_get_rate(NMPlatform *platform, int ifindex)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
static _NM80211Mode
|
||||
wifi_get_mode(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
return NM_802_11_MODE_UNKNOWN;
|
||||
return _NM_802_11_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_set_mode(NMPlatform *platform, int ifindex, NM80211Mode mode)
|
||||
wifi_set_mode(NMPlatform *platform, int ifindex, _NM80211Mode mode)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8303,15 +8303,15 @@ wifi_get_station(NMPlatform * platform,
|
|||
return nm_wifi_utils_get_station(wifi_data, out_bssid, out_quality, out_rate);
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
static _NM80211Mode
|
||||
wifi_get_mode(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, NM_802_11_MODE_UNKNOWN);
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, _NM_802_11_MODE_UNKNOWN);
|
||||
return nm_wifi_utils_get_mode(wifi_data);
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_set_mode(NMPlatform *platform, int ifindex, NM80211Mode mode)
|
||||
wifi_set_mode(NMPlatform *platform, int ifindex, _NM80211Mode mode)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, );
|
||||
nm_wifi_utils_set_mode(wifi_data, mode);
|
||||
|
|
|
|||
|
|
@ -3077,18 +3077,18 @@ nm_platform_wifi_get_station(NMPlatform * self,
|
|||
return klass->wifi_get_station(self, ifindex, out_bssid, out_quality, out_rate);
|
||||
}
|
||||
|
||||
NM80211Mode
|
||||
_NM80211Mode
|
||||
nm_platform_wifi_get_mode(NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF(self, klass, NM_802_11_MODE_UNKNOWN);
|
||||
_CHECK_SELF(self, klass, _NM_802_11_MODE_UNKNOWN);
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, NM_802_11_MODE_UNKNOWN);
|
||||
g_return_val_if_fail(ifindex > 0, _NM_802_11_MODE_UNKNOWN);
|
||||
|
||||
return klass->wifi_get_mode(self, ifindex);
|
||||
}
|
||||
|
||||
void
|
||||
nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, NM80211Mode mode)
|
||||
nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, _NM80211Mode mode)
|
||||
{
|
||||
_CHECK_SELF_VOID(self, klass);
|
||||
|
||||
|
|
|
|||
|
|
@ -1188,8 +1188,8 @@ typedef struct {
|
|||
guint32 (*wifi_get_frequency)(NMPlatform *self, int ifindex);
|
||||
int (*wifi_get_quality)(NMPlatform *self, int ifindex);
|
||||
guint32 (*wifi_get_rate)(NMPlatform *self, int ifindex);
|
||||
NM80211Mode (*wifi_get_mode)(NMPlatform *self, int ifindex);
|
||||
void (*wifi_set_mode)(NMPlatform *self, int ifindex, NM80211Mode mode);
|
||||
_NM80211Mode (*wifi_get_mode)(NMPlatform *self, int ifindex);
|
||||
void (*wifi_set_mode)(NMPlatform *self, int ifindex, _NM80211Mode mode);
|
||||
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);
|
||||
|
|
@ -1964,16 +1964,16 @@ gboolean nm_platform_link_tun_get_properties(NMPlatform * self,
|
|||
|
||||
gboolean
|
||||
nm_platform_wifi_get_capabilities(NMPlatform *self, int ifindex, _NMDeviceWifiCapabilities *caps);
|
||||
guint32 nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex);
|
||||
gboolean nm_platform_wifi_get_station(NMPlatform * self,
|
||||
int ifindex,
|
||||
NMEtherAddr *out_bssid,
|
||||
int * out_quality,
|
||||
guint32 * out_rate);
|
||||
NM80211Mode nm_platform_wifi_get_mode(NMPlatform *self, int ifindex);
|
||||
void nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, NM80211Mode mode);
|
||||
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);
|
||||
guint32 nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex);
|
||||
gboolean nm_platform_wifi_get_station(NMPlatform * self,
|
||||
int ifindex,
|
||||
NMEtherAddr *out_bssid,
|
||||
int * out_quality,
|
||||
guint32 * out_rate);
|
||||
_NM80211Mode nm_platform_wifi_get_mode(NMPlatform *self, int ifindex);
|
||||
void nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, _NM80211Mode mode);
|
||||
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);
|
||||
gboolean
|
||||
|
|
|
|||
|
|
@ -162,8 +162,8 @@ dispose(GObject *object)
|
|||
}
|
||||
|
||||
struct nl80211_iface_info {
|
||||
NM80211Mode mode;
|
||||
uint32_t freq;
|
||||
_NM80211Mode mode;
|
||||
uint32_t freq;
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
@ -181,16 +181,16 @@ nl80211_iface_info_handler(struct nl_msg *msg, void *arg)
|
|||
|
||||
switch (nla_get_u32(tb[NL80211_ATTR_IFTYPE])) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
info->mode = NM_802_11_MODE_ADHOC;
|
||||
info->mode = _NM_802_11_MODE_ADHOC;
|
||||
break;
|
||||
case NL80211_IFTYPE_AP:
|
||||
info->mode = NM_802_11_MODE_AP;
|
||||
info->mode = _NM_802_11_MODE_AP;
|
||||
break;
|
||||
case NL80211_IFTYPE_STATION:
|
||||
info->mode = NM_802_11_MODE_INFRA;
|
||||
info->mode = _NM_802_11_MODE_INFRA;
|
||||
break;
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
info->mode = NM_802_11_MODE_MESH;
|
||||
info->mode = _NM_802_11_MODE_MESH;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -200,25 +200,25 @@ nl80211_iface_info_handler(struct nl_msg *msg, void *arg)
|
|||
return NL_SKIP;
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
static _NM80211Mode
|
||||
wifi_nl80211_get_mode(NMWifiUtils *data)
|
||||
{
|
||||
NMWifiUtilsNl80211 * self = (NMWifiUtilsNl80211 *) data;
|
||||
struct nl80211_iface_info iface_info = {
|
||||
.mode = NM_802_11_MODE_UNKNOWN,
|
||||
.mode = _NM_802_11_MODE_UNKNOWN,
|
||||
};
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
|
||||
msg = nl80211_alloc_msg(self, NL80211_CMD_GET_INTERFACE, 0);
|
||||
|
||||
if (nl80211_send_and_recv(self, msg, nl80211_iface_info_handler, &iface_info) < 0)
|
||||
return NM_802_11_MODE_UNKNOWN;
|
||||
return _NM_802_11_MODE_UNKNOWN;
|
||||
|
||||
return iface_info.mode;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_set_mode(NMWifiUtils *data, const NM80211Mode mode)
|
||||
wifi_nl80211_set_mode(NMWifiUtils *data, const _NM80211Mode mode)
|
||||
{
|
||||
NMWifiUtilsNl80211 * self = (NMWifiUtilsNl80211 *) data;
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
|
|
@ -227,16 +227,16 @@ wifi_nl80211_set_mode(NMWifiUtils *data, const NM80211Mode mode)
|
|||
msg = nl80211_alloc_msg(self, NL80211_CMD_SET_INTERFACE, 0);
|
||||
|
||||
switch (mode) {
|
||||
case NM_802_11_MODE_INFRA:
|
||||
case _NM_802_11_MODE_INFRA:
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_STATION);
|
||||
break;
|
||||
case NM_802_11_MODE_ADHOC:
|
||||
case _NM_802_11_MODE_ADHOC:
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_ADHOC);
|
||||
break;
|
||||
case NM_802_11_MODE_AP:
|
||||
case _NM_802_11_MODE_AP:
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_AP);
|
||||
break;
|
||||
case NM_802_11_MODE_MESH:
|
||||
case _NM_802_11_MODE_MESH:
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MESH_POINT);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
NM80211Mode (*get_mode)(NMWifiUtils *data);
|
||||
_NM80211Mode (*get_mode)(NMWifiUtils *data);
|
||||
|
||||
gboolean (*set_mode)(NMWifiUtils *data, const NM80211Mode mode);
|
||||
gboolean (*set_mode)(NMWifiUtils *data, const _NM80211Mode mode);
|
||||
|
||||
/* Set power saving mode on an interface */
|
||||
gboolean (*set_powersave)(NMWifiUtils *data, guint32 powersave);
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ get_ifname(int ifindex, char *buffer, const char *op)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
static _NM80211Mode
|
||||
wifi_wext_get_mode_ifname(NMWifiUtils *data, const char *ifname)
|
||||
{
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
|
|
@ -129,24 +129,24 @@ wifi_wext_get_mode_ifname(NMWifiUtils *data, const char *ifname)
|
|||
if (errsv != ENODEV) {
|
||||
_LOGW(LOGD_PLATFORM | LOGD_WIFI, "(%s): error %d getting card mode", ifname, errsv);
|
||||
}
|
||||
return NM_802_11_MODE_UNKNOWN;
|
||||
return _NM_802_11_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (wrq.u.mode) {
|
||||
case IW_MODE_ADHOC:
|
||||
return NM_802_11_MODE_ADHOC;
|
||||
return _NM_802_11_MODE_ADHOC;
|
||||
case IW_MODE_MASTER:
|
||||
return NM_802_11_MODE_AP;
|
||||
return _NM_802_11_MODE_AP;
|
||||
case IW_MODE_INFRA:
|
||||
case IW_MODE_AUTO: /* hack for WEXT devices reporting IW_MODE_AUTO */
|
||||
return NM_802_11_MODE_INFRA;
|
||||
return _NM_802_11_MODE_INFRA;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NM_802_11_MODE_UNKNOWN;
|
||||
return _NM_802_11_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
static NM80211Mode
|
||||
static _NM80211Mode
|
||||
wifi_wext_get_mode(NMWifiUtils *data)
|
||||
{
|
||||
char ifname[IFNAMSIZ];
|
||||
|
|
@ -158,7 +158,7 @@ wifi_wext_get_mode(NMWifiUtils *data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_set_mode(NMWifiUtils *data, const NM80211Mode mode)
|
||||
wifi_wext_set_mode(NMWifiUtils *data, const _NM80211Mode mode)
|
||||
{
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
struct iwreq wrq;
|
||||
|
|
@ -172,13 +172,13 @@ wifi_wext_set_mode(NMWifiUtils *data, const NM80211Mode mode)
|
|||
|
||||
memset(&wrq, 0, sizeof(struct iwreq));
|
||||
switch (mode) {
|
||||
case NM_802_11_MODE_ADHOC:
|
||||
case _NM_802_11_MODE_ADHOC:
|
||||
wrq.u.mode = IW_MODE_ADHOC;
|
||||
break;
|
||||
case NM_802_11_MODE_AP:
|
||||
case _NM_802_11_MODE_AP:
|
||||
wrq.u.mode = IW_MODE_MASTER;
|
||||
break;
|
||||
case NM_802_11_MODE_INFRA:
|
||||
case _NM_802_11_MODE_INFRA:
|
||||
wrq.u.mode = IW_MODE_INFRA;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -58,21 +58,21 @@ nm_wifi_utils_get_caps(NMWifiUtils *data)
|
|||
return data->caps;
|
||||
}
|
||||
|
||||
NM80211Mode
|
||||
_NM80211Mode
|
||||
nm_wifi_utils_get_mode(NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail(data != NULL, NM_802_11_MODE_UNKNOWN);
|
||||
g_return_val_if_fail(data != NULL, _NM_802_11_MODE_UNKNOWN);
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->get_mode(data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wifi_utils_set_mode(NMWifiUtils *data, const NM80211Mode mode)
|
||||
nm_wifi_utils_set_mode(NMWifiUtils *data, const _NM80211Mode mode)
|
||||
{
|
||||
NMWifiUtilsClass *klass;
|
||||
|
||||
g_return_val_if_fail(data != NULL, FALSE);
|
||||
g_return_val_if_fail((mode == NM_802_11_MODE_INFRA) || (mode == NM_802_11_MODE_AP)
|
||||
|| (mode == NM_802_11_MODE_ADHOC) || (mode == NM_802_11_MODE_MESH),
|
||||
g_return_val_if_fail((mode == _NM_802_11_MODE_INFRA) || (mode == _NM_802_11_MODE_AP)
|
||||
|| (mode == _NM_802_11_MODE_ADHOC) || (mode == _NM_802_11_MODE_MESH),
|
||||
FALSE);
|
||||
|
||||
klass = NM_WIFI_UTILS_GET_CLASS(data);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ NMWifiUtils *nm_wifi_utils_new(int ifindex, struct nl_sock *genl, gboolean check
|
|||
|
||||
_NMDeviceWifiCapabilities nm_wifi_utils_get_caps(NMWifiUtils *data);
|
||||
|
||||
NM80211Mode nm_wifi_utils_get_mode(NMWifiUtils *data);
|
||||
_NM80211Mode nm_wifi_utils_get_mode(NMWifiUtils *data);
|
||||
|
||||
gboolean nm_wifi_utils_set_mode(NMWifiUtils *data, const NM80211Mode mode);
|
||||
gboolean nm_wifi_utils_set_mode(NMWifiUtils *data, const _NM80211Mode mode);
|
||||
|
||||
/* Returns frequency in MHz */
|
||||
guint32 nm_wifi_utils_get_freq(NMWifiUtils *data);
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ _bss_info_properties_changed(NMSupplicantInterface *self,
|
|||
guint16 v_u16;
|
||||
guint32 v_u32;
|
||||
NM80211ApFlags p_ap_flags;
|
||||
NM80211Mode p_mode;
|
||||
_NM80211Mode p_mode;
|
||||
guint8 p_signal_percent;
|
||||
const guint8 * arr_data;
|
||||
gsize arr_len;
|
||||
|
|
@ -605,15 +605,15 @@ _bss_info_properties_changed(NMSupplicantInterface *self,
|
|||
|
||||
if (nm_g_variant_lookup(properties, "Mode", "&s", &v_s)) {
|
||||
if (nm_streq(v_s, "infrastructure"))
|
||||
p_mode = NM_802_11_MODE_INFRA;
|
||||
p_mode = _NM_802_11_MODE_INFRA;
|
||||
else if (nm_streq(v_s, "ad-hoc"))
|
||||
p_mode = NM_802_11_MODE_ADHOC;
|
||||
p_mode = _NM_802_11_MODE_ADHOC;
|
||||
else if (nm_streq(v_s, "mesh"))
|
||||
p_mode = NM_802_11_MODE_MESH;
|
||||
p_mode = _NM_802_11_MODE_MESH;
|
||||
else
|
||||
p_mode = NM_802_11_MODE_UNKNOWN;
|
||||
p_mode = _NM_802_11_MODE_UNKNOWN;
|
||||
} else if (initial)
|
||||
p_mode = NM_802_11_MODE_UNKNOWN;
|
||||
p_mode = _NM_802_11_MODE_UNKNOWN;
|
||||
else
|
||||
p_mode = bss_info->mode;
|
||||
if (bss_info->mode != p_mode) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define __NETWORKMANAGER_SUPPLICANT_TYPES_H__
|
||||
|
||||
#include "c-list/src/c-list.h"
|
||||
#include "libnm-base/nm-base.h"
|
||||
|
||||
#define NM_WPAS_DBUS_SERVICE "fi.w1.wpa_supplicant1"
|
||||
#define NM_WPAS_DBUS_PATH "/fi/w1/wpa_supplicant1"
|
||||
|
|
@ -178,7 +179,7 @@ typedef struct _NMSupplicantBssInfo {
|
|||
|
||||
NM80211ApFlags ap_flags : 5;
|
||||
|
||||
NM80211Mode mode : 4;
|
||||
_NM80211Mode mode : 4;
|
||||
|
||||
bool bssid_valid : 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue