2020-12-23 22:21:36 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2014-07-24 08:53:33 -04:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2007 - 2014 Red Hat, Inc.
|
|
|
|
|
* Copyright (C) 2007 - 2008 Novell, Inc.
|
2014-07-24 08:53:33 -04:00
|
|
|
*/
|
|
|
|
|
|
2021-02-12 15:01:09 +01:00
|
|
|
#include "libnm-core-impl/nm-default-libnm-core.h"
|
2014-11-13 10:07:02 -05:00
|
|
|
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
#include "nm-setting-wireless.h"
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
|
|
|
|
|
#include "nm-utils.h"
|
2021-02-12 15:01:09 +01:00
|
|
|
#include "libnm-core-aux-intern/nm-common-macros.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
#include "nm-utils-private.h"
|
|
|
|
|
#include "nm-setting-private.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:nm-setting-wireless
|
|
|
|
|
* @short_description: Describes connection properties for 802.11 Wi-Fi networks
|
|
|
|
|
*
|
|
|
|
|
* The #NMSettingWireless object is a #NMSetting subclass that describes properties
|
|
|
|
|
* necessary for connection to 802.11 Wi-Fi networks.
|
|
|
|
|
**/
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWireless,
|
|
|
|
|
PROP_SSID,
|
|
|
|
|
PROP_MODE,
|
|
|
|
|
PROP_BAND,
|
|
|
|
|
PROP_CHANNEL,
|
|
|
|
|
PROP_BSSID,
|
|
|
|
|
PROP_RATE,
|
|
|
|
|
PROP_TX_POWER,
|
|
|
|
|
PROP_MAC_ADDRESS,
|
|
|
|
|
PROP_CLONED_MAC_ADDRESS,
|
|
|
|
|
PROP_GENERATE_MAC_ADDRESS_MASK,
|
|
|
|
|
PROP_MAC_ADDRESS_BLACKLIST,
|
2024-02-19 14:51:36 +01:00
|
|
|
PROP_MAC_ADDRESS_DENYLIST,
|
2019-01-11 08:32:54 +01:00
|
|
|
PROP_MTU,
|
|
|
|
|
PROP_SEEN_BSSIDS,
|
|
|
|
|
PROP_HIDDEN,
|
|
|
|
|
PROP_POWERSAVE,
|
|
|
|
|
PROP_MAC_ADDRESS_RANDOMIZATION,
|
|
|
|
|
PROP_WAKE_ON_WLAN,
|
2024-05-24 15:18:20 +02:00
|
|
|
PROP_AP_ISOLATION,
|
|
|
|
|
PROP_CHANNEL_WIDTH, );
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2024-01-08 12:46:53 +01:00
|
|
|
GBytes *ssid;
|
|
|
|
|
GPtrArray *seen_bssids;
|
|
|
|
|
char *mode;
|
|
|
|
|
char *band;
|
|
|
|
|
char *bssid;
|
|
|
|
|
char *device_mac_address;
|
|
|
|
|
char *cloned_mac_address;
|
|
|
|
|
char *generate_mac_address_mask;
|
2024-02-19 14:51:36 +01:00
|
|
|
NMValueStrv mac_address_denylist;
|
2024-01-08 12:46:53 +01:00
|
|
|
int ap_isolation;
|
2024-05-24 15:18:20 +02:00
|
|
|
int channel_width;
|
2024-01-08 12:46:53 +01:00
|
|
|
guint32 mac_address_randomization;
|
|
|
|
|
guint32 channel;
|
|
|
|
|
guint32 rate;
|
|
|
|
|
guint32 tx_power;
|
|
|
|
|
guint32 mtu;
|
|
|
|
|
guint32 powersave;
|
|
|
|
|
guint32 wake_on_wlan;
|
|
|
|
|
bool hidden;
|
2014-07-24 08:53:33 -04:00
|
|
|
} NMSettingWirelessPrivate;
|
|
|
|
|
|
2021-06-11 00:27:31 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:
|
|
|
|
|
*
|
|
|
|
|
* Wi-Fi Settings
|
|
|
|
|
*/
|
|
|
|
|
struct _NMSettingWireless {
|
libnm: embed private structure in NMSetting and avoid g_type_class_add_private()
Historically, the NMSetting types were in public headers. Theoretically,
that allowed users to subtype our classes. However in practice that was
impossible because they lacked required access to internal functions to
fully create an NMSetting class outside of libnm. And it also was not
useful, because you simply cannot extend libnm by subtyping a libnm
class. And supporting such a use case would be hard and limit what we can
do in libnm.
Having GObject structs in public headers also require that we don't
change it's layout. The ABI of those structs must not change, if anybody
out there was actually subclassing our GObjects.
In libnm 1.34 (commit e46d484fae9e ('libnm: hide NMSetting types from
public headers')) we moved the structs from headers to internal.
This would have caused a compiler error if anybody was using those
struct definitions. However, we still didn't change the ABI/layout so
that we didn't break users who relied on it (for whatever reason).
It doesn't seem there were any affected user. We waited long enough.
Change internal ABI.
No longer use g_type_class_add_private(). Instead, embed the private
structs directly (_NM_GET_PRIVATE()) or indirectly
(_NM_GET_PRIVATE_PTR()) in the object.
The main benefit is for debugging in the debugger, where we can now
easily find the private data. Previously that was so cumbersome to be
effectively impossible.
It's also the fastest possible way, since NM_SETTING_*_GET_PRIVATE()
literally resolves to "&self->_priv" (plus static asserts and
nm_assert() for type checking).
_NM_GET_PRIVATE() also propagates constness and requires that the
argument is a compatible pointer type (at compile time).
Note that g_type_class_add_private() is also deprecated in glib 2.58 and
replaced by G_ADD_PRIVATE(). For one, we still don't rely on 2.58. Also,
G_ADD_PRIVATE() is a worse solution as it supports a usecase that we
don't care for (public structs in headers). _NM_GET_PRIVATE() is still
faster, works with older glib and most importantly: is better for
debugging as you can find the private data from an object pointer.
For NMSettingIPConfig this is rather awkward, because all direct
properties require a common "klass->private_offset". This was however
the case before this change. Nothing new here. And if you ever touch
this and do something wrong, many unit tests will fail. It's almost
impossible to get wrong, albeit it can be confusing to understand.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1773
2023-10-24 19:05:50 +02:00
|
|
|
NMSetting parent;
|
|
|
|
|
NMSettingWirelessPrivate _priv;
|
2021-06-11 00:27:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _NMSettingWirelessClass {
|
|
|
|
|
NMSettingClass parent;
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
G_DEFINE_TYPE(NMSettingWireless, nm_setting_wireless, NM_TYPE_SETTING)
|
|
|
|
|
|
|
|
|
|
#define NM_SETTING_WIRELESS_GET_PRIVATE(o) \
|
libnm: embed private structure in NMSetting and avoid g_type_class_add_private()
Historically, the NMSetting types were in public headers. Theoretically,
that allowed users to subtype our classes. However in practice that was
impossible because they lacked required access to internal functions to
fully create an NMSetting class outside of libnm. And it also was not
useful, because you simply cannot extend libnm by subtyping a libnm
class. And supporting such a use case would be hard and limit what we can
do in libnm.
Having GObject structs in public headers also require that we don't
change it's layout. The ABI of those structs must not change, if anybody
out there was actually subclassing our GObjects.
In libnm 1.34 (commit e46d484fae9e ('libnm: hide NMSetting types from
public headers')) we moved the structs from headers to internal.
This would have caused a compiler error if anybody was using those
struct definitions. However, we still didn't change the ABI/layout so
that we didn't break users who relied on it (for whatever reason).
It doesn't seem there were any affected user. We waited long enough.
Change internal ABI.
No longer use g_type_class_add_private(). Instead, embed the private
structs directly (_NM_GET_PRIVATE()) or indirectly
(_NM_GET_PRIVATE_PTR()) in the object.
The main benefit is for debugging in the debugger, where we can now
easily find the private data. Previously that was so cumbersome to be
effectively impossible.
It's also the fastest possible way, since NM_SETTING_*_GET_PRIVATE()
literally resolves to "&self->_priv" (plus static asserts and
nm_assert() for type checking).
_NM_GET_PRIVATE() also propagates constness and requires that the
argument is a compatible pointer type (at compile time).
Note that g_type_class_add_private() is also deprecated in glib 2.58 and
replaced by G_ADD_PRIVATE(). For one, we still don't rely on 2.58. Also,
G_ADD_PRIVATE() is a worse solution as it supports a usecase that we
don't care for (public structs in headers). _NM_GET_PRIVATE() is still
faster, works with older glib and most importantly: is better for
debugging as you can find the private data from an object pointer.
For NMSettingIPConfig this is rather awkward, because all direct
properties require a common "klass->private_offset". This was however
the case before this change. Nothing new here. And if you ever touch
this and do something wrong, many unit tests will fail. It's almost
impossible to get wrong, albeit it can be confusing to understand.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1773
2023-10-24 19:05:50 +02:00
|
|
|
_NM_GET_PRIVATE(o, NMSettingWireless, NM_IS_SETTING_WIRELESS, NMSetting)
|
2019-01-11 08:32:54 +01:00
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
match_cipher(const char *cipher,
|
|
|
|
|
const char *expected,
|
|
|
|
|
guint32 wpa_flags,
|
|
|
|
|
guint32 rsn_flags,
|
|
|
|
|
guint32 flag)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(cipher, expected) != 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (!(wpa_flags & flag) && !(rsn_flags & flag))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_ap_security_compatible:
|
|
|
|
|
* @s_wireless: a #NMSettingWireless
|
|
|
|
|
* @s_wireless_sec: a #NMSettingWirelessSecurity or %NULL
|
|
|
|
|
* @ap_flags: the %NM80211ApFlags of the given access point
|
|
|
|
|
* @ap_wpa: the %NM80211ApSecurityFlags of the given access point's WPA
|
|
|
|
|
* capabilities
|
|
|
|
|
* @ap_rsn: the %NM80211ApSecurityFlags of the given access point's WPA2/RSN
|
|
|
|
|
* capabilities
|
|
|
|
|
* @ap_mode: the 802.11 mode of the AP, either Ad-Hoc or Infrastructure
|
|
|
|
|
*
|
|
|
|
|
* Given a #NMSettingWireless and an optional #NMSettingWirelessSecurity,
|
|
|
|
|
* determine if the configuration given by the settings is compatible with
|
|
|
|
|
* the security of an access point using that access point's capability flags
|
|
|
|
|
* and mode. Useful for clients that wish to filter a set of connections
|
|
|
|
|
* against a set of access points and determine which connections are
|
|
|
|
|
* compatible with which access points.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the given settings are compatible with the access point's
|
|
|
|
|
* security flags and mode, %FALSE if they are not.
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2021-11-09 13:28:54 +01:00
|
|
|
nm_setting_wireless_ap_security_compatible(NMSettingWireless *s_wireless,
|
2014-07-24 08:53:33 -04:00
|
|
|
NMSettingWirelessSecurity *s_wireless_sec,
|
|
|
|
|
NM80211ApFlags ap_flags,
|
|
|
|
|
NM80211ApSecurityFlags ap_wpa,
|
|
|
|
|
NM80211ApSecurityFlags ap_rsn,
|
|
|
|
|
NM80211Mode ap_mode)
|
|
|
|
|
{
|
|
|
|
|
const char *key_mgmt = NULL, *cipher;
|
|
|
|
|
guint32 num, i;
|
|
|
|
|
gboolean found = FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(s_wireless), FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!s_wireless_sec) {
|
2022-06-16 19:58:00 +02:00
|
|
|
/* A OWE-TM network can be used w/o security */
|
|
|
|
|
if (ap_wpa == NM_802_11_AP_SEC_KEY_MGMT_OWE_TM
|
|
|
|
|
|| (ap_rsn == NM_802_11_AP_SEC_KEY_MGMT_OWE_TM))
|
|
|
|
|
return TRUE;
|
2014-07-24 08:53:33 -04:00
|
|
|
if ((ap_flags & NM_802_11_AP_FLAGS_PRIVACY) || (ap_wpa != NM_802_11_AP_SEC_NONE)
|
|
|
|
|
|| (ap_rsn != NM_802_11_AP_SEC_NONE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
key_mgmt = nm_setting_wireless_security_get_key_mgmt(s_wireless_sec);
|
|
|
|
|
if (!key_mgmt)
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Static WEP */
|
|
|
|
|
if (!strcmp(key_mgmt, "none")) {
|
|
|
|
|
if (!(ap_flags & NM_802_11_AP_FLAGS_PRIVACY) || (ap_wpa != NM_802_11_AP_SEC_NONE)
|
|
|
|
|
|| (ap_rsn != NM_802_11_AP_SEC_NONE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Adhoc WPA2 (ie, RSN IBSS) */
|
|
|
|
|
if (ap_mode == NM_802_11_MODE_ADHOC) {
|
|
|
|
|
if (strcmp(key_mgmt, "wpa-psk"))
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Ensure the AP has RSN PSK capability */
|
|
|
|
|
if (!(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK))
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Fall through and check ciphers in generic WPA-PSK code */
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Dynamic WEP or LEAP */
|
|
|
|
|
if (!strcmp(key_mgmt, "ieee8021x")) {
|
|
|
|
|
if (!(ap_flags & NM_802_11_AP_FLAGS_PRIVACY))
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* If the AP is advertising a WPA IE, make sure it supports WEP ciphers */
|
|
|
|
|
if (ap_wpa != NM_802_11_AP_SEC_NONE) {
|
|
|
|
|
if (!(ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_802_1X))
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* quick check; can't use AP if it doesn't support at least one
|
|
|
|
|
* WEP cipher in both pairwise and group suites.
|
|
|
|
|
*/
|
|
|
|
|
if (!(ap_wpa & (NM_802_11_AP_SEC_PAIR_WEP40 | NM_802_11_AP_SEC_PAIR_WEP104))
|
|
|
|
|
|| !(ap_wpa & (NM_802_11_AP_SEC_GROUP_WEP40 | NM_802_11_AP_SEC_GROUP_WEP104)))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Match at least one pairwise cipher with AP's capability if the
|
|
|
|
|
* wireless-security setting explicitly lists pairwise ciphers
|
|
|
|
|
*/
|
|
|
|
|
num = nm_setting_wireless_security_get_num_pairwise(s_wireless_sec);
|
|
|
|
|
for (i = 0, found = FALSE; i < num; i++) {
|
|
|
|
|
cipher = nm_setting_wireless_security_get_pairwise(s_wireless_sec, i);
|
|
|
|
|
if ((found = match_cipher(cipher,
|
|
|
|
|
"wep40",
|
|
|
|
|
ap_wpa,
|
|
|
|
|
ap_wpa,
|
|
|
|
|
NM_802_11_AP_SEC_PAIR_WEP40)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher(cipher,
|
|
|
|
|
"wep104",
|
|
|
|
|
ap_wpa,
|
|
|
|
|
ap_wpa,
|
|
|
|
|
NM_802_11_AP_SEC_PAIR_WEP104)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found && num)
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Match at least one group cipher with AP's capability if the
|
|
|
|
|
* wireless-security setting explicitly lists group ciphers
|
|
|
|
|
*/
|
|
|
|
|
num = nm_setting_wireless_security_get_num_groups(s_wireless_sec);
|
|
|
|
|
for (i = 0, found = FALSE; i < num; i++) {
|
|
|
|
|
cipher = nm_setting_wireless_security_get_group(s_wireless_sec, i);
|
|
|
|
|
if ((found = match_cipher(cipher,
|
|
|
|
|
"wep40",
|
|
|
|
|
ap_wpa,
|
|
|
|
|
ap_wpa,
|
|
|
|
|
NM_802_11_AP_SEC_GROUP_WEP40)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher(cipher,
|
|
|
|
|
"wep104",
|
|
|
|
|
ap_wpa,
|
|
|
|
|
ap_wpa,
|
|
|
|
|
NM_802_11_AP_SEC_GROUP_WEP104)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found && num)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* WPA[2]-PSK and WPA[2] Enterprise */
|
2019-09-16 16:55:49 +02:00
|
|
|
if (!strcmp(key_mgmt, "wpa-psk") || !strcmp(key_mgmt, "wpa-eap") || !strcmp(key_mgmt, "sae")
|
2019-11-17 23:57:38 +01:00
|
|
|
|| !strcmp(key_mgmt, "owe")) {
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!strcmp(key_mgmt, "wpa-psk")) {
|
|
|
|
|
if (!(ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
|
|
|
|
&& !(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK))
|
|
|
|
|
return FALSE;
|
|
|
|
|
} else if (!strcmp(key_mgmt, "wpa-eap")) {
|
|
|
|
|
if (!(ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
|
|
|
|
|
&& !(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_802_1X))
|
|
|
|
|
return FALSE;
|
2019-09-16 16:55:49 +02:00
|
|
|
} else if (!strcmp(key_mgmt, "sae")) {
|
|
|
|
|
if (!(ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_SAE)
|
|
|
|
|
&& !(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_SAE))
|
|
|
|
|
return FALSE;
|
2019-11-17 23:57:38 +01:00
|
|
|
} else if (!strcmp(key_mgmt, "owe")) {
|
2020-05-09 03:30:21 +02:00
|
|
|
if (!NM_FLAGS_ANY(ap_wpa,
|
|
|
|
|
NM_802_11_AP_SEC_KEY_MGMT_OWE | NM_802_11_AP_SEC_KEY_MGMT_OWE_TM)
|
|
|
|
|
&& !NM_FLAGS_ANY(ap_rsn,
|
|
|
|
|
NM_802_11_AP_SEC_KEY_MGMT_OWE | NM_802_11_AP_SEC_KEY_MGMT_OWE_TM))
|
2019-11-17 23:57:38 +01:00
|
|
|
return FALSE;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
// FIXME: should handle WPA and RSN separately here to ensure that
|
|
|
|
|
// if the Connection only uses WPA we don't match a cipher against
|
|
|
|
|
// the AP's RSN IE instead
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Match at least one pairwise cipher with AP's capability if the
|
|
|
|
|
* wireless-security setting explicitly lists pairwise ciphers
|
|
|
|
|
*/
|
|
|
|
|
num = nm_setting_wireless_security_get_num_pairwise(s_wireless_sec);
|
|
|
|
|
for (i = 0, found = FALSE; i < num; i++) {
|
|
|
|
|
cipher = nm_setting_wireless_security_get_pairwise(s_wireless_sec, i);
|
|
|
|
|
if ((found = match_cipher(cipher, "tkip", ap_wpa, ap_rsn, NM_802_11_AP_SEC_PAIR_TKIP)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher(cipher, "ccmp", ap_wpa, ap_rsn, NM_802_11_AP_SEC_PAIR_CCMP)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found && num)
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Match at least one group cipher with AP's capability if the
|
|
|
|
|
* wireless-security setting explicitly lists group ciphers
|
|
|
|
|
*/
|
|
|
|
|
num = nm_setting_wireless_security_get_num_groups(s_wireless_sec);
|
|
|
|
|
for (i = 0, found = FALSE; i < num; i++) {
|
|
|
|
|
cipher = nm_setting_wireless_security_get_group(s_wireless_sec, i);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
if ((found =
|
|
|
|
|
match_cipher(cipher, "wep40", ap_wpa, ap_rsn, NM_802_11_AP_SEC_GROUP_WEP40)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found =
|
|
|
|
|
match_cipher(cipher, "wep104", ap_wpa, ap_rsn, NM_802_11_AP_SEC_GROUP_WEP104)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher(cipher, "tkip", ap_wpa, ap_rsn, NM_802_11_AP_SEC_GROUP_TKIP)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher(cipher, "ccmp", ap_wpa, ap_rsn, NM_802_11_AP_SEC_GROUP_CCMP)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found && num)
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2021-12-19 16:58:20 +09:00
|
|
|
/* WPA3 Enterprise Suite B 192 */
|
|
|
|
|
if (!strcmp(key_mgmt, "wpa-eap-suite-b-192")) {
|
|
|
|
|
if (!(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_EAP_SUITE_B_192)) {
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Since NetworkManager doesn't handle GCMP-256 directly, cipher check can be skipped */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_ssid:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
2014-11-13 14:14:11 -05:00
|
|
|
* Returns: (transfer none): the #NMSettingWireless:ssid property of the setting
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
2014-06-26 10:42:11 -04:00
|
|
|
GBytes *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wireless_get_ssid(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->ssid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mode:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:mode property of the setting
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wireless_get_mode(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_band:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:band property of the setting
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wireless_get_band(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->band;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_channel:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:channel property of the setting
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_channel(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->channel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_bssid:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:bssid property of the setting
|
|
|
|
|
**/
|
2014-07-30 10:57:45 -04:00
|
|
|
const char *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wireless_get_bssid(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->bssid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_rate:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:rate property of the setting
|
2023-03-14 08:26:48 +01:00
|
|
|
*
|
|
|
|
|
* Deprecated: 1.44: This setting is not implemented and has no effect.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_rate(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->rate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_tx_power:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:tx-power property of the setting
|
2023-03-14 08:26:48 +01:00
|
|
|
*
|
|
|
|
|
* Deprecated: 1.44: This setting is not implemented and has no effect.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_tx_power(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->tx_power;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mac_address:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:mac-address property of the setting
|
|
|
|
|
**/
|
2014-07-30 10:57:45 -04:00
|
|
|
const char *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wireless_get_mac_address(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->device_mac_address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_cloned_mac_address:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:cloned-mac-address property of the setting
|
|
|
|
|
**/
|
2014-07-30 10:57:45 -04:00
|
|
|
const char *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wireless_get_cloned_mac_address(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->cloned_mac_address;
|
|
|
|
|
}
|
|
|
|
|
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_generate_mac_address_mask:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:generate-mac-address-mask property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.4
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wireless_get_generate_mac_address_mask(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->generate_mac_address_mask;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_get_mac_address_denylist:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Returns: the #NMSettingWireless:mac-address-denylist property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
2014-10-22 12:31:31 -04:00
|
|
|
const char *const *
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_get_mac_address_denylist(NMSettingWireless *setting)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
2024-01-08 12:46:53 +01:00
|
|
|
return nm_strvarray_get_strv_notnull(
|
2024-02-19 14:51:36 +01:00
|
|
|
NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mac_address_denylist.arr,
|
2024-01-08 12:46:53 +01:00
|
|
|
NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_get_num_mac_denylist_items:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Returns: the number of denylisted MAC addresses
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
2024-02-19 14:51:36 +01:00
|
|
|
guint
|
|
|
|
|
nm_setting_wireless_get_num_mac_denylist_items(NMSettingWireless *setting)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
return nm_g_array_len(NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mac_address_denylist.arr);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_get_mac_denylist_item:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @idx: the zero-based index of the MAC address entry
|
|
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Returns: the denylisted MAC address string (hex-digits-and-colons notation)
|
2014-07-24 08:53:33 -04:00
|
|
|
* at index @idx
|
2024-02-19 14:51:36 +01:00
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
const char *
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_get_mac_denylist_item(NMSettingWireless *setting, guint32 idx)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NULL);
|
|
|
|
|
|
2024-01-08 12:46:53 +01:00
|
|
|
return nm_strvarray_get_idxnull_or_greturn(
|
2024-02-19 14:51:36 +01:00
|
|
|
NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mac_address_denylist.arr,
|
2024-01-08 12:46:53 +01:00
|
|
|
idx);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_add_mac_denylist_item:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
2024-02-19 14:51:36 +01:00
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to denylist
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Adds a new MAC address to the #NMSettingWireless:mac-address-denylist property.
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was added; %FALSE if the MAC address
|
|
|
|
|
* is invalid or was already present
|
2024-02-19 14:51:36 +01:00
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
gboolean
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_add_mac_denylist_item(NMSettingWireless *setting, const char *mac)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv;
|
2024-01-08 12:46:53 +01:00
|
|
|
guint8 mac_bin[ETH_ALEN];
|
2021-11-09 13:28:54 +01:00
|
|
|
const char *candidate;
|
2024-01-08 12:46:53 +01:00
|
|
|
guint i;
|
|
|
|
|
guint len;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), FALSE);
|
|
|
|
|
g_return_val_if_fail(mac != NULL, FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-01-08 12:46:53 +01:00
|
|
|
if (!_nm_utils_hwaddr_aton_exact(mac, mac_bin, ETH_ALEN))
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
2024-02-19 14:51:36 +01:00
|
|
|
len = nm_g_array_len(priv->mac_address_denylist.arr);
|
2024-01-08 12:46:53 +01:00
|
|
|
for (i = 0; i < len; i++) {
|
2024-02-19 14:51:36 +01:00
|
|
|
candidate = nm_g_array_index(priv->mac_address_denylist.arr, char *, i);
|
2024-01-08 12:46:53 +01:00
|
|
|
if (nm_utils_hwaddr_matches(mac_bin, ETH_ALEN, candidate, -1))
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_g_array_append_simple(nm_strvarray_ensure(&priv->mac_address_denylist.arr),
|
2024-01-08 12:46:53 +01:00
|
|
|
nm_utils_hwaddr_ntoa(mac_bin, ETH_ALEN));
|
2024-02-19 14:51:36 +01:00
|
|
|
_notify(setting, PROP_MAC_ADDRESS_DENYLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_remove_mac_denylist_item:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @idx: index number of the MAC address
|
|
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Removes the MAC address at index @idx from the denylist.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
void
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_remove_mac_denylist_item(NMSettingWireless *setting, guint idx)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail(NM_IS_SETTING_WIRELESS(setting));
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
2024-02-19 14:51:36 +01:00
|
|
|
if (!priv->mac_address_denylist.arr) {
|
2024-01-08 12:46:53 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
g_return_if_fail(idx < priv->mac_address_denylist.arr->len);
|
2024-01-08 12:46:53 +01:00
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
g_array_remove_index(priv->mac_address_denylist.arr, idx);
|
|
|
|
|
_notify(setting, PROP_MAC_ADDRESS_DENYLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_remove_mac_denylist_item_by_value:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to remove from
|
2024-02-19 14:51:36 +01:00
|
|
|
* the denylist
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Removes the MAC address @mac from the denylist.
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was found and removed; %FALSE if it was not.
|
2024-02-19 14:51:36 +01:00
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
gboolean
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_remove_mac_denylist_item_by_value(NMSettingWireless *setting, const char *mac)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv;
|
2024-01-08 12:46:53 +01:00
|
|
|
guint8 mac_bin[ETH_ALEN];
|
2021-11-09 13:28:54 +01:00
|
|
|
const char *candidate;
|
2024-01-08 12:46:53 +01:00
|
|
|
guint i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), FALSE);
|
|
|
|
|
g_return_val_if_fail(mac != NULL, FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-01-08 12:46:53 +01:00
|
|
|
if (!_nm_utils_hwaddr_aton_exact(mac, mac_bin, ETH_ALEN))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
2024-01-08 12:46:53 +01:00
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
if (priv->mac_address_denylist.arr) {
|
|
|
|
|
for (i = 0; i < priv->mac_address_denylist.arr->len; i++) {
|
|
|
|
|
candidate = nm_g_array_index(priv->mac_address_denylist.arr, char *, i);
|
2024-01-08 12:46:53 +01:00
|
|
|
if (nm_utils_hwaddr_matches(mac_bin, ETH_ALEN, candidate, -1)) {
|
2024-02-19 14:51:36 +01:00
|
|
|
g_array_remove_index(priv->mac_address_denylist.arr, i);
|
|
|
|
|
_notify(setting, PROP_MAC_ADDRESS_DENYLIST);
|
2024-01-08 12:46:53 +01:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-01-08 12:46:53 +01:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-02-19 14:51:36 +01:00
|
|
|
* nm_setting_wireless_clear_mac_denylist_items:
|
2014-07-24 08:53:33 -04:00
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
2024-02-19 14:51:36 +01:00
|
|
|
* Removes all denylisted MAC addresses.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.48
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
void
|
2024-02-19 14:51:36 +01:00
|
|
|
nm_setting_wireless_clear_mac_denylist_items(NMSettingWireless *setting)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_if_fail(NM_IS_SETTING_WIRELESS(setting));
|
|
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
if (nm_strvarray_clear(&NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mac_address_denylist.arr))
|
|
|
|
|
_notify(setting, PROP_MAC_ADDRESS_DENYLIST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mac_address_blacklist:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:mac-address-blacklist property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_get_mac_address_denylist() instead.
|
|
|
|
|
**/
|
|
|
|
|
const char *const *
|
|
|
|
|
nm_setting_wireless_get_mac_address_blacklist(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_get_mac_address_denylist(setting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_num_mac_blacklist_items:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the number of blacklist MAC addresses
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_get_num_mac_denylist_items() instead.
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_num_mac_blacklist_items(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_get_num_mac_denylist_items(setting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @idx: the zero-based index of the MAC address entry
|
|
|
|
|
*
|
|
|
|
|
* Since 1.46, access at index "len" is allowed and returns NULL.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the denylisted MAC address string (hex-digits-and-colons notation)
|
|
|
|
|
* at index @idx
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_get_mac_denylist_item() instead.
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wireless_get_mac_blacklist_item(NMSettingWireless *setting, guint32 idx)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_get_mac_denylist_item(setting, idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_add_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to denylist
|
|
|
|
|
*
|
|
|
|
|
* Adds a new MAC address to the #NMSettingWireless:mac-address-denylist property.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was added; %FALSE if the MAC address
|
|
|
|
|
* is invalid or was already present
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_add_mac_denylist_item() instead.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wireless_add_mac_blacklist_item(NMSettingWireless *setting, const char *mac)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_add_mac_denylist_item(setting, mac);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_remove_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @idx: index number of the MAC address
|
|
|
|
|
*
|
|
|
|
|
* Removes the MAC address at index @idx from the denylist.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_remove_mac_denylist_item() instead.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
nm_setting_wireless_remove_mac_blacklist_item(NMSettingWireless *setting, guint32 idx)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_remove_mac_denylist_item(setting, idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_remove_mac_blacklist_item_by_value:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to remove from
|
|
|
|
|
* the denylist
|
|
|
|
|
*
|
|
|
|
|
* Removes the MAC address @mac from the denylist.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was found and removed; %FALSE if it was not.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_remove_mac_denylist_item_by_value() instead.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wireless_remove_mac_blacklist_item_by_value(NMSettingWireless *setting, const char *mac)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_remove_mac_denylist_item_by_value(setting, mac);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_clear_mac_blacklist_items:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Removes all denylisted MAC addresses.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.48. Use nm_setting_wireless_clear_mac_denylist_items() instead.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
nm_setting_wireless_clear_mac_blacklist_items(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
return nm_setting_wireless_clear_mac_denylist_items(setting);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mtu:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:mtu property of the setting
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_mtu(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mtu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_hidden:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:hidden property of the setting
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wireless_get_hidden(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), FALSE);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->hidden;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-30 09:49:38 -05:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_powersave:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:powersave property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_powersave(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->powersave;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-06 17:42:15 -04:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_mac_address_randomization:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:mac-address-randomization property of the
|
|
|
|
|
* setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
NMSettingMacRandomization
|
|
|
|
|
nm_setting_wireless_get_mac_address_randomization(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->mac_address_randomization;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_add_seen_bssid:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @bssid: the new BSSID to add to the list
|
|
|
|
|
*
|
|
|
|
|
* Adds a new Wi-Fi AP's BSSID to the previously seen BSSID list of the setting.
|
|
|
|
|
* NetworkManager now tracks previously seen BSSIDs internally so this function
|
|
|
|
|
* no longer has much use. Actually, changes you make using this function will
|
|
|
|
|
* not be preserved.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if @bssid was already known, %FALSE if not
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wireless_add_seen_bssid(NMSettingWireless *setting, const char *bssid)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv;
|
2021-11-09 13:28:54 +01:00
|
|
|
gs_free char *lower_bssid = NULL;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), FALSE);
|
|
|
|
|
g_return_val_if_fail(bssid != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
|
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
lower_bssid = g_ascii_strdown(bssid, -1);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
if (!priv->seen_bssids) {
|
|
|
|
|
priv->seen_bssids = g_ptr_array_new_with_free_func(g_free);
|
|
|
|
|
} else {
|
2021-07-29 08:50:39 +02:00
|
|
|
if (nm_strv_ptrarray_find_first(priv->seen_bssids, lower_bssid) >= 0)
|
2019-06-27 10:08:54 +02:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
g_ptr_array_add(priv->seen_bssids, g_steal_pointer(&lower_bssid));
|
|
|
|
|
_notify(setting, PROP_SEEN_BSSIDS);
|
|
|
|
|
return TRUE;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_num_seen_bssids:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the number of BSSIDs in the previously seen BSSID list
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wireless_get_num_seen_bssids(NMSettingWireless *setting)
|
|
|
|
|
{
|
2019-06-27 10:08:54 +02:00
|
|
|
NMSettingWirelessPrivate *priv;
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
|
|
|
|
|
|
|
|
|
return priv->seen_bssids ? priv->seen_bssids->len : 0u;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_seen_bssid:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
* @i: index of a BSSID in the previously seen BSSID list
|
|
|
|
|
*
|
|
|
|
|
* Returns: the BSSID at index @i
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wireless_get_seen_bssid(NMSettingWireless *setting, guint32 i)
|
|
|
|
|
{
|
2019-06-27 10:08:54 +02:00
|
|
|
NMSettingWirelessPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), 0);
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
|
|
|
|
|
|
|
|
|
if (!priv->seen_bssids || i >= priv->seen_bssids->len)
|
|
|
|
|
return NULL;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
return priv->seen_bssids->pdata[i];
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2019-06-27 09:09:06 +02:00
|
|
|
static GVariant *
|
libnm: use macros function arguments for NMSettInfoPropertType
These functions tend to have many arguments. They are also quite som
boilerplate to implement the hundereds of properties we have, while
we want that properties have common behaviors and similarities.
Instead of repeatedly spelling out the function arguments, use a macro.
Advantages:
- the usage of a _NM_SETT_INFO_PROP_*_FCN_ARGS macro signals that this
is an implementation of a property. You can now grep for these macros
to find all implementation. That was previously rather imprecise, you
could only `git grep '\.to_dbus_fcn'` to find the uses, but not the
implementations.
As the goal is to keep properties "similar", there is a desire to
reduce the number of similar implementations and to find them.
- changing the arguments now no longer will require you to go through
all implementations. At least not, if you merely add an argument that
has a reasonable default behavior and does not require explicit
handling by most implementation.
- it's convenient to be able to patch the argument list to let the
compiler help to reason about something. For example, the
"connection_dict" argument to from_dbus_fcn() is usually unused.
If you'd like to find who uses it, rename the parameter, and
review the (few) compiler errors.
- it does save 573 LOC of boilerplate with no actual logic or useful
information. I argue, that this simplifies the code and review, by
increasing the relative amount of actually meaningful code.
Disadvantages:
- the user no longer directly sees the argument list. They would need
cscope/ctags or an IDE to jump to the macro definition and conveniently
see all arguments.
Also use _nm_nil, so that clang-format interprets this as a function
parameter list. Otherwise, it formats the function differently.
2021-07-26 23:45:31 +02:00
|
|
|
_to_dbus_fcn_seen_bssids(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
{
|
|
|
|
|
if (options && options->seen_bssids)
|
|
|
|
|
return options->seen_bssids[0] ? g_variant_new_strv(options->seen_bssids, -1) : NULL;
|
|
|
|
|
|
|
|
|
|
/* The seen-bssid property is special. It cannot be converted to D-Bus
|
|
|
|
|
* like regular properties, only via the "options".
|
|
|
|
|
*
|
|
|
|
|
* This basically means, that only the daemon can provide seen-bssids as GVariant,
|
|
|
|
|
* while when a client converts the property to GVariant, it gets lost.
|
|
|
|
|
*
|
|
|
|
|
* This has the odd effect, that when the client converts the setting to GVariant
|
|
|
|
|
* and back, the seen-bssids gets lost. That is kinda desired here, because the to_dbus_fcn()
|
|
|
|
|
* and from_dbus_fcn() have the meaning of how a setting gets transferred via D-Bus,
|
|
|
|
|
* and not necessarily a loss-less conversion into another format and back. And when
|
|
|
|
|
* transferring via D-Bus, then the option makes only sense when sending it from
|
|
|
|
|
* the daemon to the client, not otherwise. */
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
gboolean
|
|
|
|
|
_nm_setting_wireless_mac_blacklist_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
|
|
|
|
{
|
|
|
|
|
const gchar **mac_blacklist;
|
|
|
|
|
|
|
|
|
|
if (!_nm_setting_use_legacy_property(setting,
|
|
|
|
|
connection_dict,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_DENYLIST)) {
|
|
|
|
|
*out_is_modified = FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
mac_blacklist = g_variant_get_strv(value, NULL);
|
|
|
|
|
|
|
|
|
|
g_object_set(setting, NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, mac_blacklist, NULL);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
_nm_setting_wireless_mac_denylist_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
|
|
|
|
{
|
|
|
|
|
const gchar **mac_blacklist;
|
|
|
|
|
|
|
|
|
|
if (!_nm_setting_use_legacy_property(setting,
|
|
|
|
|
connection_dict,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_DENYLIST)) {
|
|
|
|
|
*out_is_modified = FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
mac_blacklist = g_variant_get_strv(value, NULL);
|
|
|
|
|
|
|
|
|
|
g_object_set(setting, NM_SETTING_WIRELESS_MAC_ADDRESS_DENYLIST, mac_blacklist, NULL);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GVariant *
|
|
|
|
|
_nm_setting_wireless_mac_denylist_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
|
|
|
|
{
|
|
|
|
|
const char *const *mac_denylist;
|
|
|
|
|
/* FIXME: `mac-address-denylist` is an alias of `mac-address-blacklist` property.
|
|
|
|
|
* Serializing the property to the clients would break them as they won't
|
|
|
|
|
* be able to drop it if they are not aware of the existance of
|
|
|
|
|
* `mac-address-denylist`. In order to give them time to adapt their code,
|
|
|
|
|
* NetworkManager is not serializing `mac-address-denylist` on DBus.
|
|
|
|
|
*/
|
|
|
|
|
if (_nm_utils_is_manager_process) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mac_denylist = nm_setting_wireless_get_mac_address_denylist(NM_SETTING_WIRELESS(setting));
|
|
|
|
|
|
|
|
|
|
return g_variant_new_strv(mac_denylist, -1);
|
|
|
|
|
}
|
|
|
|
|
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
static gboolean
|
libnm: use macros function arguments for NMSettInfoPropertType
These functions tend to have many arguments. They are also quite som
boilerplate to implement the hundereds of properties we have, while
we want that properties have common behaviors and similarities.
Instead of repeatedly spelling out the function arguments, use a macro.
Advantages:
- the usage of a _NM_SETT_INFO_PROP_*_FCN_ARGS macro signals that this
is an implementation of a property. You can now grep for these macros
to find all implementation. That was previously rather imprecise, you
could only `git grep '\.to_dbus_fcn'` to find the uses, but not the
implementations.
As the goal is to keep properties "similar", there is a desire to
reduce the number of similar implementations and to find them.
- changing the arguments now no longer will require you to go through
all implementations. At least not, if you merely add an argument that
has a reasonable default behavior and does not require explicit
handling by most implementation.
- it's convenient to be able to patch the argument list to let the
compiler help to reason about something. For example, the
"connection_dict" argument to from_dbus_fcn() is usually unused.
If you'd like to find who uses it, rename the parameter, and
review the (few) compiler errors.
- it does save 573 LOC of boilerplate with no actual logic or useful
information. I argue, that this simplifies the code and review, by
increasing the relative amount of actually meaningful code.
Disadvantages:
- the user no longer directly sees the argument list. They would need
cscope/ctags or an IDE to jump to the macro definition and conveniently
see all arguments.
Also use _nm_nil, so that clang-format interprets this as a function
parameter list. Otherwise, it formats the function differently.
2021-07-26 23:45:31 +02:00
|
|
|
_from_dbus_fcn_seen_bssids(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
2019-06-27 09:09:06 +02:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv;
|
2021-11-09 13:28:54 +01:00
|
|
|
gs_free const char **s = NULL;
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
gsize len;
|
|
|
|
|
gsize i;
|
2019-06-27 09:09:06 +02:00
|
|
|
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
if (_nm_utils_is_manager_process) {
|
|
|
|
|
/* in the manager process, we don't accept seen-bssid from the client.
|
|
|
|
|
* Do nothing. */
|
2021-07-27 10:27:44 +02:00
|
|
|
*out_is_modified = FALSE;
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
return TRUE;
|
2019-06-27 09:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
|
|
|
|
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
nm_clear_pointer(&priv->seen_bssids, g_ptr_array_unref);
|
2019-06-27 09:09:06 +02:00
|
|
|
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
s = g_variant_get_strv(value, &len);
|
|
|
|
|
if (len > 0) {
|
|
|
|
|
priv->seen_bssids = g_ptr_array_new_full(len, g_free);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
g_ptr_array_add(priv->seen_bssids, g_strdup(s[i]));
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2019-06-27 09:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-29 17:33:12 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_ap_isolation:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWireless:ap-isolation property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.28
|
|
|
|
|
*/
|
|
|
|
|
NMTernary
|
|
|
|
|
nm_setting_wireless_get_ap_isolation(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NM_TERNARY_DEFAULT);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->ap_isolation;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 15:18:20 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_channel_width:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns the #NMSettingWireless:channel-width property.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the channel width
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.50
|
|
|
|
|
*/
|
|
|
|
|
NMSettingWirelessChannelWidth
|
|
|
|
|
nm_setting_wireless_get_channel_width(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->channel_width;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-27 09:09:06 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-12-12 19:36:35 +01:00
|
|
|
void
|
|
|
|
|
_nm_setting_wireless_normalize_mac_address_randomization(
|
|
|
|
|
NMSettingWireless *s_wifi,
|
|
|
|
|
const char **out_cloned_mac_address,
|
|
|
|
|
NMSettingMacRandomization *out_mac_address_randomization)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE(s_wifi);
|
|
|
|
|
guint32 mac_address_randomization;
|
|
|
|
|
const char *cloned_mac_address;
|
|
|
|
|
|
|
|
|
|
mac_address_randomization = priv->mac_address_randomization;
|
|
|
|
|
cloned_mac_address = priv->cloned_mac_address;
|
|
|
|
|
|
|
|
|
|
if (cloned_mac_address) {
|
|
|
|
|
/* If cloned_mac_address is set, it takes precedence and determines
|
|
|
|
|
* mac_address_randomization. */
|
|
|
|
|
if (nm_streq(cloned_mac_address, "random"))
|
|
|
|
|
mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_ALWAYS;
|
|
|
|
|
else if (nm_streq(cloned_mac_address, "permanent"))
|
|
|
|
|
mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_NEVER;
|
|
|
|
|
else
|
|
|
|
|
mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_DEFAULT;
|
|
|
|
|
} else if (!NM_IN_SET(mac_address_randomization,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_NEVER,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_ALWAYS)) {
|
|
|
|
|
/* cloned_mac_address is NULL and mac_address_randomization is invalid. Normalize
|
|
|
|
|
* mac_address_randomization to the default. */
|
|
|
|
|
mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_DEFAULT;
|
|
|
|
|
} else if (mac_address_randomization != NM_SETTING_MAC_RANDOMIZATION_DEFAULT) {
|
|
|
|
|
/* mac_address_randomization is not (guint32)set to the default. cloned_mac_address gets
|
|
|
|
|
* overwritten. */
|
|
|
|
|
cloned_mac_address = mac_address_randomization == NM_SETTING_MAC_RANDOMIZATION_ALWAYS
|
|
|
|
|
? "random"
|
|
|
|
|
: "permanent";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*out_cloned_mac_address = cloned_mac_address;
|
|
|
|
|
*out_mac_address_randomization = mac_address_randomization;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
static gboolean
|
2014-10-21 22:30:31 -04:00
|
|
|
verify(NMSetting *setting, NMConnection *connection, GError **error)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
|
2021-11-09 13:28:54 +01:00
|
|
|
const char *valid_modes[] = {NM_SETTING_WIRELESS_MODE_INFRA,
|
2019-01-24 15:32:06 +01:00
|
|
|
NM_SETTING_WIRELESS_MODE_ADHOC,
|
|
|
|
|
NM_SETTING_WIRELESS_MODE_AP,
|
|
|
|
|
NM_SETTING_WIRELESS_MODE_MESH,
|
|
|
|
|
NULL};
|
2021-11-09 13:28:54 +01:00
|
|
|
const char *valid_bands[] = {"a", "bg", NULL};
|
2019-06-27 10:08:54 +02:00
|
|
|
guint i;
|
2014-06-26 10:42:11 -04:00
|
|
|
gsize length;
|
2021-11-09 13:28:54 +01:00
|
|
|
GError *local = NULL;
|
2023-12-12 19:36:35 +01:00
|
|
|
const char *desired_cloned_mac_address;
|
|
|
|
|
NMSettingMacRandomization desired_mac_address_randomization;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!priv->ssid) {
|
|
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("property is missing"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_SSID);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-06-26 10:42:11 -04:00
|
|
|
length = g_bytes_get_size(priv->ssid);
|
|
|
|
|
if (length == 0 || length > 32) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("SSID length is out of range <1-32> bytes"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_SSID);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-06-17 11:40:50 +02:00
|
|
|
if (priv->mode && !g_strv_contains(valid_modes, priv->mode)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%s' is not a valid Wi-Fi mode"),
|
|
|
|
|
priv->mode);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_MODE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-06-17 11:40:50 +02:00
|
|
|
if (priv->band && !g_strv_contains(valid_bands, priv->band)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%s' is not a valid band"),
|
|
|
|
|
priv->band);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_BAND);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
if (priv->channel && !priv->band) {
|
|
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
|
|
|
|
_("'%s' requires setting '%s' property"),
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL,
|
|
|
|
|
NM_SETTING_WIRELESS_BAND);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_BAND);
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
if (priv->channel) {
|
|
|
|
|
if (!nm_utils_wifi_is_channel_valid(priv->channel, priv->band)) {
|
|
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%d' is not a valid channel"),
|
|
|
|
|
priv->channel);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL);
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-02-20 10:20:14 +01:00
|
|
|
if ((g_strcmp0(priv->mode, NM_SETTING_WIRELESS_MODE_MESH) == 0)
|
|
|
|
|
&& !(priv->channel && priv->band)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
|
|
|
|
_("'%s' requires '%s' and '%s' property"),
|
|
|
|
|
priv->mode,
|
|
|
|
|
NM_SETTING_WIRELESS_BAND,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_MODE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-30 10:57:45 -04:00
|
|
|
if (priv->bssid && !nm_utils_hwaddr_valid(priv->bssid, ETH_ALEN)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("property is invalid"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_BSSID);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-30 10:57:45 -04:00
|
|
|
if (priv->device_mac_address && !nm_utils_hwaddr_valid(priv->device_mac_address, ETH_ALEN)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("property is invalid"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2023-11-14 11:56:30 +01:00
|
|
|
if (priv->cloned_mac_address && !NM_CLONED_MAC_IS_SPECIAL(priv->cloned_mac_address, TRUE)
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
&& !nm_utils_hwaddr_valid(priv->cloned_mac_address, ETH_ALEN)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("property is invalid"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
/* generate-mac-address-mask only makes sense with cloned-mac-address "random" or
|
|
|
|
|
* "stable". Still, let's not be so strict about that and accept the value
|
|
|
|
|
* even if it is unused. */
|
|
|
|
|
if (!_nm_utils_generate_mac_address_mask_parse(priv->generate_mac_address_mask,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
&local)) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
local->message);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK);
|
|
|
|
|
g_error_free(local);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-02-19 14:51:36 +01:00
|
|
|
if (priv->mac_address_denylist.arr) {
|
|
|
|
|
for (i = 0; i < priv->mac_address_denylist.arr->len; i++) {
|
|
|
|
|
const char *mac = nm_g_array_index(priv->mac_address_denylist.arr, const char *, i);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-01-08 12:46:53 +01:00
|
|
|
if (!nm_utils_hwaddr_valid(mac, ETH_ALEN)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid MAC address"),
|
|
|
|
|
mac);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
2024-02-19 14:51:36 +01:00
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_DENYLIST);
|
2024-01-08 12:46:53 +01:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
if (priv->seen_bssids) {
|
|
|
|
|
for (i = 0; i < priv->seen_bssids->len; i++) {
|
|
|
|
|
const char *b;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
b = priv->seen_bssids->pdata[i];
|
|
|
|
|
if (!nm_utils_hwaddr_valid(b, ETH_ALEN)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid MAC address"),
|
|
|
|
|
b);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_SEEN_BSSIDS);
|
|
|
|
|
return FALSE;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-19 13:01:57 +02:00
|
|
|
if (!NM_IN_SET(priv->mac_address_randomization,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_NEVER,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_ALWAYS)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("invalid value"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2021-12-28 10:50:05 +01:00
|
|
|
if (NM_FLAGS_ANY(priv->wake_on_wlan, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS)) {
|
|
|
|
|
if (!nm_utils_is_power_of_two(priv->wake_on_wlan)) {
|
2018-05-25 16:44:52 +02:00
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("Wake-on-WLAN mode 'default' and 'ignore' are exclusive flags"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_WAKE_ON_WLAN);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2021-12-28 10:50:05 +01:00
|
|
|
} else if (NM_FLAGS_ANY(priv->wake_on_wlan, ~NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL)) {
|
2018-05-25 16:44:52 +02:00
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("Wake-on-WLAN trying to set unknown flag"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_WAKE_ON_WLAN);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2020-06-29 17:33:12 +02:00
|
|
|
if (priv->ap_isolation != NM_TERNARY_DEFAULT
|
|
|
|
|
&& !nm_streq0(priv->mode, NM_SETTING_WIRELESS_MODE_AP)) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("AP isolation can be set only in AP mode"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_AP_ISOLATION);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-05-24 15:18:20 +02:00
|
|
|
if (priv->channel_width != NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO) {
|
|
|
|
|
if (!nm_streq0(priv->mode, NM_SETTING_WIRELESS_MODE_AP)) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("a specific channel width can be set only in AP mode"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL_WIDTH);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
if (!priv->channel) {
|
|
|
|
|
g_set_error_literal(
|
|
|
|
|
error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("a specific channel width can be set only together with a fixed channel"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL_WIDTH);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->channel_width == NM_SETTING_WIRELESS_CHANNEL_WIDTH_80MHZ
|
|
|
|
|
&& !nm_streq0(priv->band, "a")) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("80MHz channels are only supported in the 5GHz band"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL_WIDTH);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-19 13:01:57 +02:00
|
|
|
/* from here on, check for NM_SETTING_VERIFY_NORMALIZABLE conditions. */
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2023-12-12 19:36:35 +01:00
|
|
|
_nm_setting_wireless_normalize_mac_address_randomization(NM_SETTING_WIRELESS(setting),
|
|
|
|
|
&desired_cloned_mac_address,
|
|
|
|
|
&desired_mac_address_randomization);
|
|
|
|
|
if (desired_mac_address_randomization != priv->mac_address_randomization
|
|
|
|
|
|| !nm_streq0(desired_cloned_mac_address, priv->cloned_mac_address)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("conflicting value of mac-address-randomization and cloned-mac-address"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS);
|
|
|
|
|
return NM_SETTING_VERIFY_NORMALIZABLE;
|
|
|
|
|
}
|
2016-06-19 13:01:57 +02:00
|
|
|
|
2023-03-14 09:35:48 +01:00
|
|
|
if (priv->tx_power != 0 || priv->rate != 0) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("property is deprecated and not implemented"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRELESS_SETTING_NAME,
|
|
|
|
|
priv->tx_power != 0 ? NM_SETTING_WIRELESS_TX_POWER
|
|
|
|
|
: NM_SETTING_WIRELESS_RATE);
|
|
|
|
|
return NM_SETTING_VERIFY_NORMALIZABLE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
libnm: rework compare_property() implementation for NMSetting
NMSetting's compare_property() has and had two callers:
nm_setting_compare() and nm_setting_diff().
compare_property() accepts a NMSettingCompareFlags argument, but
at the same time, both callers have another complex (and
inconsistent!) set of pre-checks for shortcuting the call of
compare_property(): should_compare_prop().
Merge should_compare_prop() into compare_property(). This way,
nm_setting_compare() and nm_setting_diff() has less additional
code, and are simpler to follow. Especially nm_setting_compare()
is now trivial. And nm_setting_diff() is still complicated, but
not related to the question how the property compares or whether
it should be compared at all.
If you want to know whether it should be compared, all you need to do
now is follow NMSettingClass.compare_property().
This changes function pointer NMSettingClass.compare_property(),
which is public API. However, no user can actually use this (and shall
not!), because _nm_setting_class_commit_full() etc. is private API. A
user outside of libnm-core cannot create his/her own subclasses of
NMSetting, and never could in the past. So, this API/ABI change doesn't
matter.
2019-01-09 09:08:39 +01:00
|
|
|
static NMTernary
|
libnm: use macros function arguments for NMSettInfoPropertType
These functions tend to have many arguments. They are also quite som
boilerplate to implement the hundereds of properties we have, while
we want that properties have common behaviors and similarities.
Instead of repeatedly spelling out the function arguments, use a macro.
Advantages:
- the usage of a _NM_SETT_INFO_PROP_*_FCN_ARGS macro signals that this
is an implementation of a property. You can now grep for these macros
to find all implementation. That was previously rather imprecise, you
could only `git grep '\.to_dbus_fcn'` to find the uses, but not the
implementations.
As the goal is to keep properties "similar", there is a desire to
reduce the number of similar implementations and to find them.
- changing the arguments now no longer will require you to go through
all implementations. At least not, if you merely add an argument that
has a reasonable default behavior and does not require explicit
handling by most implementation.
- it's convenient to be able to patch the argument list to let the
compiler help to reason about something. For example, the
"connection_dict" argument to from_dbus_fcn() is usually unused.
If you'd like to find who uses it, rename the parameter, and
review the (few) compiler errors.
- it does save 573 LOC of boilerplate with no actual logic or useful
information. I argue, that this simplifies the code and review, by
increasing the relative amount of actually meaningful code.
Disadvantages:
- the user no longer directly sees the argument list. They would need
cscope/ctags or an IDE to jump to the macro definition and conveniently
see all arguments.
Also use _nm_nil, so that clang-format interprets this as a function
parameter list. Otherwise, it formats the function differently.
2021-07-26 23:45:31 +02:00
|
|
|
compare_fcn_cloned_mac_address(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
{
|
2021-06-29 14:37:16 +02:00
|
|
|
return !set_b
|
|
|
|
|
|| nm_streq0(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->cloned_mac_address,
|
|
|
|
|
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->cloned_mac_address);
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2021-06-29 14:37:16 +02:00
|
|
|
static NMTernary
|
libnm: use macros function arguments for NMSettInfoPropertType
These functions tend to have many arguments. They are also quite som
boilerplate to implement the hundereds of properties we have, while
we want that properties have common behaviors and similarities.
Instead of repeatedly spelling out the function arguments, use a macro.
Advantages:
- the usage of a _NM_SETT_INFO_PROP_*_FCN_ARGS macro signals that this
is an implementation of a property. You can now grep for these macros
to find all implementation. That was previously rather imprecise, you
could only `git grep '\.to_dbus_fcn'` to find the uses, but not the
implementations.
As the goal is to keep properties "similar", there is a desire to
reduce the number of similar implementations and to find them.
- changing the arguments now no longer will require you to go through
all implementations. At least not, if you merely add an argument that
has a reasonable default behavior and does not require explicit
handling by most implementation.
- it's convenient to be able to patch the argument list to let the
compiler help to reason about something. For example, the
"connection_dict" argument to from_dbus_fcn() is usually unused.
If you'd like to find who uses it, rename the parameter, and
review the (few) compiler errors.
- it does save 573 LOC of boilerplate with no actual logic or useful
information. I argue, that this simplifies the code and review, by
increasing the relative amount of actually meaningful code.
Disadvantages:
- the user no longer directly sees the argument list. They would need
cscope/ctags or an IDE to jump to the macro definition and conveniently
see all arguments.
Also use _nm_nil, so that clang-format interprets this as a function
parameter list. Otherwise, it formats the function differently.
2021-07-26 23:45:31 +02:00
|
|
|
compare_fcn_seen_bssids(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
2021-06-29 14:37:16 +02:00
|
|
|
{
|
|
|
|
|
return !set_b
|
|
|
|
|
|| (nm_strv_ptrarray_cmp(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->seen_bssids,
|
|
|
|
|
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->seen_bssids)
|
|
|
|
|
== 0);
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2014-08-16 10:09:48 -04:00
|
|
|
static GVariant *
|
2022-10-21 14:50:27 +02:00
|
|
|
security_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
2014-07-29 18:42:02 -04:00
|
|
|
{
|
2021-03-25 16:39:35 +01:00
|
|
|
if (!_nm_connection_serialize_non_secret(flags))
|
2019-01-02 15:54:18 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
2019-01-02 15:24:35 +01:00
|
|
|
if (!connection)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2019-01-02 15:54:18 +01:00
|
|
|
if (!nm_connection_get_setting_wireless_security(connection))
|
2014-08-16 10:09:48 -04:00
|
|
|
return NULL;
|
2019-01-02 15:54:18 +01:00
|
|
|
|
|
|
|
|
return g_variant_new_string(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
2014-07-29 18:42:02 -04:00
|
|
|
}
|
|
|
|
|
|
2018-05-25 16:44:52 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_get_wake_on_wlan:
|
|
|
|
|
* @setting: the #NMSettingWireless
|
|
|
|
|
*
|
|
|
|
|
* Returns the Wake-on-WLAN options enabled for the connection
|
|
|
|
|
*
|
|
|
|
|
* Returns: the Wake-on-WLAN options
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.12
|
|
|
|
|
*/
|
|
|
|
|
NMSettingWirelessWakeOnWLan
|
|
|
|
|
nm_setting_wireless_get_wake_on_wlan(NMSettingWireless *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE);
|
|
|
|
|
|
2021-12-28 10:50:05 +01:00
|
|
|
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->wake_on_wlan;
|
2018-05-25 16:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
static void
|
2019-01-11 08:32:54 +01:00
|
|
|
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2021-11-09 13:28:54 +01:00
|
|
|
NMSettingWireless *setting = NM_SETTING_WIRELESS(object);
|
2014-07-24 08:53:33 -04:00
|
|
|
NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE(object);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_CLONED_MAC_ADDRESS:
|
|
|
|
|
g_value_set_string(value, nm_setting_wireless_get_cloned_mac_address(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SEEN_BSSIDS:
|
2021-07-29 10:02:11 +02:00
|
|
|
g_value_take_boxed(
|
|
|
|
|
value,
|
|
|
|
|
priv->seen_bssids
|
|
|
|
|
? nm_strv_dup((char **) priv->seen_bssids->pdata, priv->seen_bssids->len, TRUE)
|
|
|
|
|
: NULL);
|
2019-01-11 08:32:54 +01:00
|
|
|
break;
|
|
|
|
|
default:
|
2021-10-20 16:13:14 +02:00
|
|
|
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
2019-01-11 08:32:54 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
2023-12-12 19:37:58 +01:00
|
|
|
NMSettingWireless *self = NM_SETTING_WIRELESS(object);
|
|
|
|
|
NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE(self);
|
2017-01-28 16:30:38 +01:00
|
|
|
gboolean bool_val;
|
2023-12-12 19:37:58 +01:00
|
|
|
_PropertyEnums prop1 = PROP_0;
|
|
|
|
|
_PropertyEnums prop2 = PROP_0;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_CLONED_MAC_ADDRESS:
|
2017-01-28 16:30:38 +01:00
|
|
|
bool_val = !!priv->cloned_mac_address;
|
2023-12-12 19:37:58 +01:00
|
|
|
|
|
|
|
|
if (nm_strdup_reset_take(
|
|
|
|
|
&priv->cloned_mac_address,
|
|
|
|
|
_nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), ETH_ALEN)))
|
|
|
|
|
prop1 = prop_id;
|
|
|
|
|
|
2017-01-28 16:30:38 +01:00
|
|
|
if (bool_val && !priv->cloned_mac_address) {
|
|
|
|
|
/* cloned-mac-address was set before but was now explicitly cleared.
|
|
|
|
|
* In this case, we also clear mac-address-randomization flag */
|
|
|
|
|
if (priv->mac_address_randomization != NM_SETTING_MAC_RANDOMIZATION_DEFAULT) {
|
|
|
|
|
priv->mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_DEFAULT;
|
2023-12-12 19:37:58 +01:00
|
|
|
prop2 = PROP_MAC_ADDRESS_RANDOMIZATION;
|
2017-01-28 16:30:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
2023-12-12 19:37:58 +01:00
|
|
|
|
|
|
|
|
nm_gobject_notify_together(self, prop1, prop2);
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
2019-06-27 10:08:54 +02:00
|
|
|
case PROP_SEEN_BSSIDS:
|
|
|
|
|
{
|
|
|
|
|
gs_unref_ptrarray GPtrArray *arr_old = NULL;
|
2021-11-09 13:28:54 +01:00
|
|
|
const char *const *strv;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
arr_old = g_steal_pointer(&priv->seen_bssids);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
strv = g_value_get_boxed(value);
|
|
|
|
|
if (strv && strv[0]) {
|
|
|
|
|
gsize i, l;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-06-27 10:08:54 +02:00
|
|
|
l = NM_PTRARRAY_LEN(strv);
|
|
|
|
|
priv->seen_bssids = g_ptr_array_new_full(l, g_free);
|
|
|
|
|
for (i = 0; i < l; i++)
|
|
|
|
|
g_ptr_array_add(priv->seen_bssids, g_strdup(strv[i]));
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
2019-06-27 10:08:54 +02:00
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
default:
|
2021-10-20 16:13:14 +02:00
|
|
|
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
static void
|
2019-01-11 08:32:54 +01:00
|
|
|
nm_setting_wireless_init(NMSettingWireless *setting)
|
2024-01-08 12:46:53 +01:00
|
|
|
{}
|
2019-01-11 08:32:54 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wireless_new:
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #NMSettingWireless object with default values.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the new empty #NMSettingWireless object
|
|
|
|
|
**/
|
|
|
|
|
NMSetting *
|
|
|
|
|
nm_setting_wireless_new(void)
|
|
|
|
|
{
|
2020-11-12 15:57:06 +01:00
|
|
|
return g_object_new(NM_TYPE_SETTING_WIRELESS, NULL);
|
2019-01-11 08:32:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize(GObject *object)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-08-21 13:19:53 -04:00
|
|
|
NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE(object);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
g_free(priv->cloned_mac_address);
|
2022-01-05 16:12:09 +01:00
|
|
|
nm_g_ptr_array_unref(priv->seen_bssids);
|
2019-01-11 08:32:54 +01:00
|
|
|
|
|
|
|
|
G_OBJECT_CLASS(nm_setting_wireless_parent_class)->finalize(object);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2021-11-09 13:28:54 +01:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
|
2023-10-25 16:10:06 +02:00
|
|
|
GArray *properties_override = _nm_sett_info_property_override_create_array_sized(25);
|
2024-02-19 14:51:36 +01:00
|
|
|
guint prop_idx;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
|
object_class->finalize = finalize;
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
|
2021-06-29 14:37:16 +02:00
|
|
|
setting_class->verify = verify;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:ssid:
|
|
|
|
|
*
|
|
|
|
|
* SSID of the Wi-Fi network. Must be specified.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: ssid
|
|
|
|
|
* format: string (or decimal-byte list - obsolete)
|
|
|
|
|
* description: SSID of Wi-Fi network.
|
|
|
|
|
* example: ssid=Quick Net
|
|
|
|
|
* ---end---
|
2022-08-29 15:05:39 +02:00
|
|
|
*/
|
|
|
|
|
/* ---ifcfg-rh---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* property: ssid
|
|
|
|
|
* variable: ESSID
|
|
|
|
|
* description: SSID of Wi-Fi network.
|
|
|
|
|
* example: ESSID="Quick Net"
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-10-20 16:13:14 +02:00
|
|
|
_nm_setting_property_define_direct_bytes(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_SSID,
|
|
|
|
|
PROP_SSID,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
ssid);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mode:
|
|
|
|
|
*
|
2019-07-29 12:59:19 +02:00
|
|
|
* Wi-Fi network mode; one of "infrastructure", "mesh", "adhoc" or "ap". If blank,
|
2014-07-24 08:53:33 -04:00
|
|
|
* infrastructure is assumed.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: mode
|
|
|
|
|
* variable: MODE
|
|
|
|
|
* values: Ad-Hoc, Managed (Auto) [case insensitive]
|
|
|
|
|
* description: Wi-Fi network mode.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MODE,
|
|
|
|
|
PROP_MODE,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2024-01-08 11:46:53 +01:00
|
|
|
mode,
|
|
|
|
|
.direct_string_allow_empty = TRUE);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:band:
|
|
|
|
|
*
|
|
|
|
|
* 802.11 frequency band of the network. One of "a" for 5GHz 802.11a or
|
|
|
|
|
* "bg" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network
|
|
|
|
|
* to the specific band, i.e. if "a" is specified, the device will not
|
|
|
|
|
* associate with the same network in the 2.4GHz band even if the network's
|
|
|
|
|
* settings are compatible. This setting depends on specific driver
|
|
|
|
|
* capability and may not work with all drivers.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: band
|
2014-11-19 09:21:23 +01:00
|
|
|
* variable: BAND(+)
|
|
|
|
|
* values: a, bg
|
|
|
|
|
* description: BAND alone is honored, but CHANNEL overrides BAND since it
|
|
|
|
|
* implies a band.
|
|
|
|
|
* example: BAND=bg
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_BAND,
|
|
|
|
|
PROP_BAND,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2024-01-08 11:46:53 +01:00
|
|
|
band,
|
|
|
|
|
.direct_string_allow_empty = TRUE);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:channel:
|
|
|
|
|
*
|
|
|
|
|
* Wireless channel to use for the Wi-Fi connection. The device will only
|
|
|
|
|
* join (or create for Ad-Hoc networks) a Wi-Fi network on the specified
|
|
|
|
|
* channel. Because channel numbers overlap between bands, this property
|
|
|
|
|
* also requires the "band" property to be set.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: channel
|
|
|
|
|
* variable: CHANNEL
|
|
|
|
|
* description: Channel used for the Wi-Fi communication.
|
2014-11-19 09:21:23 +01:00
|
|
|
* Channels greater than 14 mean "a" band, otherwise the
|
|
|
|
|
* band is "bg".
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* example: CHANNEL=6
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL,
|
|
|
|
|
PROP_CHANNEL,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
channel);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:bssid:
|
|
|
|
|
*
|
|
|
|
|
* If specified, directs the device to only associate with the given access
|
|
|
|
|
* point. This capability is highly driver dependent and not supported by
|
|
|
|
|
* all devices. Note: this property does not control the BSSID used when
|
|
|
|
|
* creating an Ad-Hoc network and is unlikely to in the future.
|
2022-06-21 10:31:02 +02:00
|
|
|
*
|
|
|
|
|
* Locking a client profile to a certain BSSID will prevent roaming and also
|
|
|
|
|
* disable background scanning. That can be useful, if there is only one access
|
|
|
|
|
* point for the SSID.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: bssid
|
|
|
|
|
* variable: BSSID(+)
|
|
|
|
|
* description: Restricts association only to a single AP.
|
|
|
|
|
* example: BSSID=00:1E:BD:64:83:21
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-07-14 07:40:35 +02:00
|
|
|
_nm_setting_property_define_direct_mac_address(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_BSSID,
|
|
|
|
|
PROP_BSSID,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
bssid,
|
|
|
|
|
.direct_set_string_mac_address_len = ETH_ALEN);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:rate:
|
|
|
|
|
*
|
2023-03-14 08:26:48 +01:00
|
|
|
* This property is not implemented and has no effect.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.44: This property is not implemented and has no effect.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: rate
|
|
|
|
|
* variable: (none)
|
2023-03-14 08:26:48 +01:00
|
|
|
* description: This property is deprecated and not handled by ifcfg-rh plugin.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_RATE,
|
|
|
|
|
PROP_RATE,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2023-03-14 08:26:48 +01:00
|
|
|
rate,
|
|
|
|
|
.is_deprecated = TRUE, );
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:tx-power:
|
|
|
|
|
*
|
2023-03-14 08:26:48 +01:00
|
|
|
* This property is not implemented and has no effect.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 1.44: This property is not implemented and has no effect.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: tx-power
|
|
|
|
|
* variable: (none)
|
2023-03-14 08:26:48 +01:00
|
|
|
* description: This property is deprecated and not handled by ifcfg-rh plugin.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_TX_POWER,
|
|
|
|
|
PROP_TX_POWER,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2023-03-14 08:26:48 +01:00
|
|
|
tx_power,
|
|
|
|
|
.is_deprecated = TRUE, );
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mac-address:
|
|
|
|
|
*
|
|
|
|
|
* If specified, this connection will only apply to the Wi-Fi device whose
|
|
|
|
|
* permanent MAC address matches. This property does not change the MAC
|
|
|
|
|
* address of the device (i.e. MAC spoofing).
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: mac-address
|
2016-03-30 12:00:54 +02:00
|
|
|
* format: usual hex-digits-and-colons notation
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* description: MAC address in traditional hex-digits-and-colons notation
|
|
|
|
|
* (e.g. 00:22:68:12:79:A2), or semicolon separated list of 6 bytes (obsolete)
|
|
|
|
|
* (e.g. 0;34;104;18;121;162).
|
|
|
|
|
* ---end---
|
2022-08-29 15:05:39 +02:00
|
|
|
*/
|
|
|
|
|
/* ---ifcfg-rh---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* property: mac-address
|
|
|
|
|
* variable: HWADDR
|
|
|
|
|
* description: Hardware address of the device in traditional hex-digits-and-colons
|
|
|
|
|
* notation (e.g. 00:22:68:14:5A:05).
|
2016-11-10 14:08:16 +01:00
|
|
|
* Note that for initscripts this is the current MAC address of the device as found
|
|
|
|
|
* during ifup. For NetworkManager this is the permanent MAC address. Or in case no
|
|
|
|
|
* permanent MAC address exists, the MAC address initially configured on the device.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-07-14 07:40:35 +02:00
|
|
|
_nm_setting_property_define_direct_mac_address(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS,
|
|
|
|
|
PROP_MAC_ADDRESS,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
device_mac_address,
|
|
|
|
|
.direct_set_string_mac_address_len = ETH_ALEN);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:cloned-mac-address:
|
|
|
|
|
*
|
2016-09-01 16:18:34 +02:00
|
|
|
* If specified, request that the device use this MAC address instead.
|
|
|
|
|
* This is known as MAC cloning or spoofing.
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
*
|
2017-05-28 17:34:31 +03:00
|
|
|
* Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
|
2023-11-14 13:07:50 +01:00
|
|
|
* "random", "stable" and "stable-ssid" are supported.
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
* "preserve" means not to touch the MAC address on activation.
|
|
|
|
|
* "permanent" means to use the permanent hardware address of the device.
|
|
|
|
|
* "random" creates a random MAC address on each connect.
|
2016-12-18 13:54:26 +01:00
|
|
|
* "stable" creates a hashed MAC address based on connection.stable-id and a
|
|
|
|
|
* machine dependent key.
|
2023-11-14 13:07:50 +01:00
|
|
|
* "stable-ssid" creates a hashed MAC address based on the SSID, the same as setting the
|
|
|
|
|
* stable-id to "${NETWORK_SSID}".
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
*
|
|
|
|
|
* If unspecified, the value can be overwritten via global defaults, see manual
|
2016-09-01 16:18:34 +02:00
|
|
|
* of NetworkManager.conf. If still unspecified, it defaults to "preserve"
|
|
|
|
|
* (older versions of NetworkManager may use a different default value).
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
*
|
|
|
|
|
* On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
|
|
|
|
|
* "cloned-mac-address".
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: cloned-mac-address
|
2016-03-30 12:00:54 +02:00
|
|
|
* format: usual hex-digits-and-colons notation
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* description: Cloned MAC address in traditional hex-digits-and-colons notation
|
|
|
|
|
* (e.g. 00:22:68:12:79:B2), or semicolon separated list of 6 bytes (obsolete)
|
|
|
|
|
* (e.g. 0;34;104;18;121;178).
|
|
|
|
|
* ---end---
|
2022-08-29 15:05:39 +02:00
|
|
|
*/
|
|
|
|
|
/* ---ifcfg-rh---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* property: cloned-mac-address
|
|
|
|
|
* variable: MACADDR
|
|
|
|
|
* description: Cloned (spoofed) MAC address in traditional hex-digits-and-colons
|
|
|
|
|
* notation (e.g. 00:22:68:14:5A:99).
|
|
|
|
|
* ---end---
|
2022-08-29 15:05:39 +02:00
|
|
|
*/
|
|
|
|
|
/* ---dbus---
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
* property: cloned-mac-address
|
|
|
|
|
* format: byte array
|
|
|
|
|
* description: This D-Bus field is deprecated in favor of "assigned-mac-address"
|
|
|
|
|
* which is more flexible and allows specifying special variants like "random".
|
2016-08-30 14:32:10 +02:00
|
|
|
* For libnm and nmcli, this field is called "cloned-mac-address".
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
* ---end---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
*/
|
2023-12-12 19:37:58 +01:00
|
|
|
obj_properties[PROP_CLONED_MAC_ADDRESS] =
|
|
|
|
|
g_param_spec_string(NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY
|
|
|
|
|
| NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
2021-06-29 14:37:16 +02:00
|
|
|
_nm_properties_override_gobj(
|
|
|
|
|
properties_override,
|
|
|
|
|
obj_properties[PROP_CLONED_MAC_ADDRESS],
|
2022-10-21 14:50:27 +02:00
|
|
|
NM_SETT_INFO_PROPERT_TYPE_DBUS(
|
|
|
|
|
G_VARIANT_TYPE_BYTESTRING,
|
2022-10-24 11:01:15 +02:00
|
|
|
.compare_fcn = compare_fcn_cloned_mac_address,
|
|
|
|
|
.to_dbus_fcn = _nm_sett_info_prop_to_dbus_fcn_cloned_mac_address,
|
|
|
|
|
.from_dbus_fcn = _nm_sett_info_prop_from_dbus_fcn_cloned_mac_address,
|
|
|
|
|
.missing_from_dbus_fcn = _nm_sett_info_prop_missing_from_dbus_fcn_cloned_mac_address, ),
|
|
|
|
|
.dbus_deprecated = TRUE, );
|
2020-09-28 16:03:33 +02:00
|
|
|
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
/* ---dbus---
|
|
|
|
|
* property: assigned-mac-address
|
|
|
|
|
* format: string
|
|
|
|
|
* description: The new field for the cloned MAC address. It can be either
|
|
|
|
|
* a hardware address in ASCII representation, or one of the special values
|
2016-07-11 21:13:17 +02:00
|
|
|
* "preserve", "permanent", "random" or "stable".
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
* This field replaces the deprecated "cloned-mac-address" on D-Bus, which
|
2018-09-15 07:20:54 -04:00
|
|
|
* can only contain explicit hardware addresses. Note that this property
|
2016-08-30 14:32:10 +02:00
|
|
|
* only exists in D-Bus API. libnm and nmcli continue to call this property
|
|
|
|
|
* "cloned-mac-address".
|
device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.
"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.
"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5.
"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".
On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.
There is some overlap with the "wifi.mac-address-randomization" setting.
https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-05-24 15:57:16 +02:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_dbus(properties_override,
|
|
|
|
|
"assigned-mac-address",
|
|
|
|
|
&nm_sett_info_propert_type_assigned_mac_address);
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:generate-mac-address-mask:
|
|
|
|
|
*
|
|
|
|
|
* With #NMSettingWireless:cloned-mac-address setting "random" or "stable",
|
|
|
|
|
* by default all bits of the MAC address are scrambled and a locally-administered,
|
2025-02-28 17:56:00 +01:00
|
|
|
* unicast MAC address is created. This property allows one to specify that certain bits
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
* are fixed. Note that the least significant bit of the first MAC address will
|
|
|
|
|
* always be unset to create a unicast MAC address.
|
|
|
|
|
*
|
|
|
|
|
* If the property is %NULL, it is eligible to be overwritten by a default
|
|
|
|
|
* connection setting. If the value is still %NULL or an empty string, the
|
|
|
|
|
* default is to create a locally-administered, unicast MAC address.
|
|
|
|
|
*
|
|
|
|
|
* If the value contains one MAC address, this address is used as mask. The set
|
|
|
|
|
* bits of the mask are to be filled with the current MAC address of the device,
|
|
|
|
|
* while the unset bits are subject to randomization.
|
|
|
|
|
* Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
|
|
|
|
|
* and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
|
|
|
|
|
*
|
|
|
|
|
* If the value contains one additional MAC address after the mask,
|
|
|
|
|
* this address is used instead of the current MAC address to fill the bits
|
|
|
|
|
* that shall not be randomized. For example, a value of
|
|
|
|
|
* "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
|
|
|
|
|
* to 68:F7:28, while the lower bits are randomized. A value of
|
|
|
|
|
* "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
|
|
|
|
|
* globally-administered, burned-in MAC address.
|
|
|
|
|
*
|
2017-08-11 11:05:12 +02:00
|
|
|
* If the value contains more than one additional MAC addresses, one of
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
* them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
|
|
|
|
|
* will create a fully scrambled MAC address, randomly locally or globally
|
|
|
|
|
* administered.
|
|
|
|
|
**/
|
|
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: generate-mac-address-mask
|
2016-12-09 22:19:48 +01:00
|
|
|
* variable: GENERATE_MAC_ADDRESS_MASK(+)
|
all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.
Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.
By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.
By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.
One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.
One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.
To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.
With this, the following macchanger options can be implemented:
`macchanger --random`
This is the default if no mask is configured.
-> ""
while is the same as:
-> "00:00:00:00:00:00"
-> "02:00:00:00:00:00 02:00:00:00:00:00"
`macchanger --random --bia`
-> "02:00:00:00:00:00 00:00:00:00:00:00"
`macchanger --ending`
This option cannot be fully implemented, because macchanger
uses the current MAC address but also implies --bia.
-> "FF:FF:FF:00:00:00"
This would yields the same result only if the current MAC address
is already a burned-in address too. Otherwise, it has not the same
effect as --ending.
-> "FF:FF:FF:00:00:00 <MAC_ADDR>"
Alternatively, instead of using the current MAC address,
spell the OUI part out. But again, that is not really the
same as macchanger does because you explictly have to name
the OUI part to use.
`machanger --another`
`machanger --another_any`
-> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
"$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-22 20:31:39 +02:00
|
|
|
* description: the MAC address mask for generating randomized and stable
|
|
|
|
|
* cloned-mac-address.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK,
|
|
|
|
|
PROP_GENERATE_MAC_ADDRESS_MASK,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2024-01-08 11:46:53 +01:00
|
|
|
generate_mac_address_mask,
|
|
|
|
|
.direct_string_allow_empty = TRUE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mac-address-blacklist:
|
|
|
|
|
*
|
|
|
|
|
* A list of permanent MAC addresses of Wi-Fi devices to which this
|
|
|
|
|
* connection should never apply. Each MAC address should be given in the
|
|
|
|
|
* standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: mac-address-blacklist
|
|
|
|
|
* format: list of MACs (separated with semicolons)
|
|
|
|
|
* description: MAC address blacklist.
|
|
|
|
|
* example: mac-address-blacklist= 00:22:68:12:79:A6;00:22:68:12:79:78
|
|
|
|
|
* ---end---
|
2022-08-29 15:05:39 +02:00
|
|
|
*/
|
|
|
|
|
/* ---ifcfg-rh---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* property: mac-address-blacklist
|
|
|
|
|
* variable: HWADDR_BLACKLIST(+)
|
|
|
|
|
* description: It denies usage of the connection for any device whose address
|
|
|
|
|
* is listed.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2024-02-19 14:51:36 +01:00
|
|
|
prop_idx = _nm_setting_property_define_direct_strv(
|
|
|
|
|
properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
PROP_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING_ARRAY,
|
|
|
|
|
.direct_type = NM_VALUE_TYPE_STRV,
|
|
|
|
|
.compare_fcn = _nm_setting_property_compare_fcn_direct,
|
|
|
|
|
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
|
|
|
|
|
.from_dbus_fcn =
|
|
|
|
|
_nm_setting_wireless_mac_blacklist_from_dbus, ),
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
mac_address_denylist,
|
|
|
|
|
.direct_set_strv_normalize_hwaddr = TRUE,
|
|
|
|
|
.direct_strv_not_null = TRUE,
|
|
|
|
|
.direct_is_aliased_field = TRUE,
|
|
|
|
|
.is_deprecated = TRUE);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mac-address-denylist:
|
|
|
|
|
*
|
|
|
|
|
* A list of permanent MAC addresses of Wi-Fi devices to which this
|
|
|
|
|
* connection should never apply. Each MAC address should be given in the
|
|
|
|
|
* standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
|
|
|
|
|
**/
|
|
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: mac-address-denylist
|
|
|
|
|
* format: list of MACs (separated with semicolons)
|
|
|
|
|
* description: MAC address denylist.
|
|
|
|
|
* example: mac-address-denylist= 00:22:68:12:79:A6;00:22:68:12:79:78
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
|
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: mac-address-denylist
|
|
|
|
|
* variable: HWADDR_BLACKLIST(+)
|
|
|
|
|
* description: It denies usage of the connection for any device whose address
|
|
|
|
|
* is listed.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
|
|
|
|
_nm_setting_property_define_direct_strv(
|
|
|
|
|
properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_DENYLIST,
|
|
|
|
|
PROP_MAC_ADDRESS_DENYLIST,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING_ARRAY,
|
|
|
|
|
.direct_type = NM_VALUE_TYPE_STRV,
|
|
|
|
|
.compare_fcn = _nm_setting_property_compare_fcn_direct,
|
|
|
|
|
.to_dbus_fcn = _nm_setting_wireless_mac_denylist_to_dbus,
|
|
|
|
|
.from_dbus_fcn =
|
|
|
|
|
_nm_setting_wireless_mac_denylist_from_dbus, ),
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
mac_address_denylist,
|
|
|
|
|
.direct_set_strv_normalize_hwaddr = TRUE,
|
|
|
|
|
.direct_strv_not_null = TRUE,
|
|
|
|
|
.direct_also_notify = obj_properties[PROP_MAC_ADDRESS_BLACKLIST], );
|
|
|
|
|
|
|
|
|
|
nm_g_array_index(properties_override, NMSettInfoProperty, prop_idx).direct_also_notify =
|
|
|
|
|
obj_properties[PROP_MAC_ADDRESS_DENYLIST];
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:seen-bssids:
|
|
|
|
|
*
|
|
|
|
|
* A list of BSSIDs (each BSSID formatted as a MAC address like
|
|
|
|
|
* "00:11:22:33:44:55") that have been detected as part of the Wi-Fi
|
|
|
|
|
* network. NetworkManager internally tracks previously seen BSSIDs. The
|
|
|
|
|
* property is only meant for reading and reflects the BSSID list of
|
|
|
|
|
* NetworkManager. The changes you make to this property will not be
|
|
|
|
|
* preserved.
|
2023-03-14 08:42:08 +01:00
|
|
|
*
|
|
|
|
|
* This is not a regular property that the user would configure. Instead,
|
|
|
|
|
* NetworkManager automatically sets the seen BSSIDs and tracks them internally
|
|
|
|
|
* in "/var/lib/NetworkManager/seen-bssids" file.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: seen-bssids
|
|
|
|
|
* variable: (none)
|
2023-03-14 08:42:08 +01:00
|
|
|
* description: This is not a regular property that would be configured by the
|
|
|
|
|
* user. It is not handled by ifcfg-rh plugin.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_SEEN_BSSIDS] = g_param_spec_boxed(
|
|
|
|
|
NM_SETTING_WIRELESS_SEEN_BSSIDS,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
G_TYPE_STRV,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_gobj(
|
|
|
|
|
properties_override,
|
|
|
|
|
obj_properties[PROP_SEEN_BSSIDS],
|
2021-06-18 09:44:46 +02:00
|
|
|
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING_ARRAY,
|
libnm: special handle serialization to D-Bus for "wifi.seen-bssid"
"wifi.seen-bssid" is an unusual property, therefore very ugly due to the
inconsistency.
It is not a regular user configuration that makes sense to store to
disk or modify by the user. It gets populated by the daemon, and
stored in "/var/lib/NetworkManager/seen-bssids" file.
As such, how to convert this to/from D-Bus needs special handling.
This means, that the to/from D-Bus functions will only serialize the
property when the seen-bssids are specified via
NMConnectionSerializationOptions, which is what the daemon does.
Also, the daemon ignores seen-bssids when parsing the variant.
This has the odd effect that when the client converts a setting to
GVariant, the seen-bssids gets lost. That means, a conversion to GVariant
and back looses information. I think that is OK in this case, because the
main point of to/from D-Bus is not to have a lossless GVariant representation
of a setting, but to transfer the setting via D-Bus between client and
daemon. And transferring seen-bssids via D-Bus makes only sense from the daemon
to the client.
2021-06-24 22:37:36 +02:00
|
|
|
.to_dbus_fcn = _to_dbus_fcn_seen_bssids,
|
2021-06-29 14:23:16 +02:00
|
|
|
.from_dbus_fcn = _from_dbus_fcn_seen_bssids,
|
2021-06-29 14:37:16 +02:00
|
|
|
.compare_fcn = compare_fcn_seen_bssids, ));
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mtu:
|
|
|
|
|
*
|
|
|
|
|
* If non-zero, only transmit packets of the specified size or smaller,
|
|
|
|
|
* breaking larger packets up into multiple Ethernet frames.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: mtu
|
|
|
|
|
* variable: MTU
|
|
|
|
|
* description: MTU of the wireless interface.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MTU,
|
|
|
|
|
PROP_MTU,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
mtu);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:hidden:
|
|
|
|
|
*
|
2018-09-26 11:13:14 +02:00
|
|
|
* If %TRUE, indicates that the network is a non-broadcasting network that
|
|
|
|
|
* hides its SSID. This works both in infrastructure and AP mode.
|
|
|
|
|
*
|
|
|
|
|
* In infrastructure mode, various workarounds are used for a more reliable
|
|
|
|
|
* discovery of hidden networks, such as probe-scanning the SSID. However,
|
2014-07-24 08:53:33 -04:00
|
|
|
* these workarounds expose inherent insecurities with hidden SSID networks,
|
|
|
|
|
* and thus hidden SSID networks should be used with caution.
|
2018-04-26 16:05:02 +02:00
|
|
|
*
|
2018-09-26 11:13:14 +02:00
|
|
|
* In AP mode, the created network does not broadcast its SSID.
|
|
|
|
|
*
|
|
|
|
|
* Note that marking the network as hidden may be a privacy issue for you
|
|
|
|
|
* (in infrastructure mode) or client stations (in AP mode), as the explicit
|
|
|
|
|
* probe-scans are distinctly recognizable on the air.
|
|
|
|
|
*
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: hidden
|
|
|
|
|
* variable: SSID_HIDDEN(+)
|
|
|
|
|
* description: Whether the network hides the SSID.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_HIDDEN,
|
|
|
|
|
PROP_HIDDEN,
|
|
|
|
|
FALSE,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
hidden);
|
2014-07-29 18:42:02 -04:00
|
|
|
|
2014-10-30 09:49:38 -05:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:powersave:
|
|
|
|
|
*
|
2016-02-10 16:46:34 +01:00
|
|
|
* One of %NM_SETTING_WIRELESS_POWERSAVE_DISABLE (disable Wi-Fi power
|
|
|
|
|
* saving), %NM_SETTING_WIRELESS_POWERSAVE_ENABLE (enable Wi-Fi power
|
|
|
|
|
* saving), %NM_SETTING_WIRELESS_POWERSAVE_IGNORE (don't touch currently
|
|
|
|
|
* configure setting) or %NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (use the
|
|
|
|
|
* globally configured value). All other values are reserved.
|
2014-10-30 09:49:38 -05:00
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2015-05-12 15:25:40 +02:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: powersave
|
|
|
|
|
* variable: POWERSAVE(+)
|
2016-02-10 16:46:34 +01:00
|
|
|
* values: default, ignore, enable, disable
|
2015-05-12 15:25:40 +02:00
|
|
|
* description: Enables or disables Wi-Fi power saving.
|
2016-02-10 16:46:34 +01:00
|
|
|
* example: POWERSAVE=enable
|
2015-05-12 15:25:40 +02:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_POWERSAVE,
|
|
|
|
|
PROP_POWERSAVE,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
NM_SETTING_WIRELESS_POWERSAVE_DEFAULT,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
powersave);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-06 17:42:15 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:mac-address-randomization:
|
|
|
|
|
*
|
|
|
|
|
* One of %NM_SETTING_MAC_RANDOMIZATION_DEFAULT (never randomize unless
|
|
|
|
|
* the user has set a global default to randomize and the supplicant
|
|
|
|
|
* supports randomization), %NM_SETTING_MAC_RANDOMIZATION_NEVER (never
|
|
|
|
|
* randomize the MAC address), or %NM_SETTING_MAC_RANDOMIZATION_ALWAYS
|
2022-09-06 18:08:04 +02:00
|
|
|
* (always randomize the MAC address).
|
2015-10-06 17:42:15 -04:00
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
2022-09-06 18:08:04 +02:00
|
|
|
* Deprecated: 1.4: Use the #NMSettingWireless:cloned-mac-address property instead.
|
2015-10-06 17:42:15 -04:00
|
|
|
**/
|
2015-10-08 13:32:36 +02:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: mac-address-randomization
|
|
|
|
|
* variable: MAC_ADDRESS_RANDOMIZATION(+)
|
2016-02-11 10:25:26 +01:00
|
|
|
* values: default, never, always
|
2015-10-08 13:32:36 +02:00
|
|
|
* description: Enables or disables Wi-Fi MAC address randomization.
|
2016-02-11 10:25:26 +01:00
|
|
|
* example: MAC_ADDRESS_RANDOMIZATION=always
|
2015-10-08 13:32:36 +02:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION,
|
|
|
|
|
PROP_MAC_ADDRESS_RANDOMIZATION,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
2022-10-24 11:01:15 +02:00
|
|
|
mac_address_randomization,
|
|
|
|
|
.is_deprecated = TRUE, );
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2022-08-29 15:05:39 +02:00
|
|
|
/* ---dbus---
|
2014-11-16 15:36:18 -05:00
|
|
|
* property: security
|
2023-03-14 09:54:58 +01:00
|
|
|
* description: This property is deprecated and has no effect.
|
|
|
|
|
* For backwards compatibility, it can be set to "802-11-wireless-security"
|
|
|
|
|
* if the profile has a wireless security setting.
|
2014-11-16 15:36:18 -05:00
|
|
|
* ---end---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
*/
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_dbus(
|
|
|
|
|
properties_override,
|
|
|
|
|
"security",
|
2021-06-18 09:44:46 +02:00
|
|
|
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
|
2022-10-21 14:50:27 +02:00
|
|
|
.to_dbus_fcn = security_to_dbus,
|
2022-10-24 11:01:15 +02:00
|
|
|
.compare_fcn = _nm_setting_property_compare_fcn_ignore, ),
|
|
|
|
|
.dbus_deprecated = TRUE, );
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2018-05-25 16:44:52 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:wake-on-wlan:
|
|
|
|
|
*
|
|
|
|
|
* The #NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options.
|
|
|
|
|
* May be any combination of %NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE,
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP or the special values
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT (to use global settings) and
|
|
|
|
|
* %NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE (to disable management of Wake-on-LAN in
|
|
|
|
|
* NetworkManager).
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.12
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_WAKE_ON_WLAN,
|
|
|
|
|
PROP_WAKE_ON_WLAN,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
wake_on_wlan);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2020-06-29 17:33:12 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:ap-isolation
|
|
|
|
|
*
|
|
|
|
|
* Configures AP isolation, which prevents communication between
|
|
|
|
|
* wireless devices connected to this AP. This property can be set
|
|
|
|
|
* to a value different from %NM_TERNARY_DEFAULT only when the
|
|
|
|
|
* interface is configured in AP mode.
|
|
|
|
|
*
|
|
|
|
|
* If set to %NM_TERNARY_TRUE, devices are not able to communicate
|
2020-07-04 11:37:01 +03:00
|
|
|
* with each other. This increases security because it protects
|
2020-06-29 17:33:12 +02:00
|
|
|
* devices against attacks from other clients in the network. At
|
|
|
|
|
* the same time, it prevents devices to access resources on the
|
|
|
|
|
* same wireless networks as file shares, printers, etc.
|
|
|
|
|
*
|
|
|
|
|
* If set to %NM_TERNARY_FALSE, devices can talk to each other.
|
|
|
|
|
*
|
|
|
|
|
* When set to %NM_TERNARY_DEFAULT, the global default is used; in
|
|
|
|
|
* case the global default is unspecified it is assumed to be
|
|
|
|
|
* %NM_TERNARY_FALSE.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.28
|
|
|
|
|
**/
|
|
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: ap-isolation
|
|
|
|
|
* variable: AP_ISOLATION(+)
|
|
|
|
|
* values: "yes", "no"
|
|
|
|
|
* default: missing variable means global default
|
|
|
|
|
* description: Whether AP isolation is enabled
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2021-11-24 09:43:37 +01:00
|
|
|
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_AP_ISOLATION,
|
|
|
|
|
PROP_AP_ISOLATION,
|
|
|
|
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
ap_isolation);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2024-05-24 15:18:20 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWireless:channel-width:
|
|
|
|
|
*
|
|
|
|
|
* Specifies width of the wireless channel in Access Point (AP) mode.
|
|
|
|
|
*
|
|
|
|
|
* When set to %NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO (the default), the
|
|
|
|
|
* channel width is automatically determined. At the moment, this means that
|
|
|
|
|
* the safest (smallest) width is chosen.
|
|
|
|
|
*
|
|
|
|
|
* If the value is not %NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO, then the
|
|
|
|
|
* 'channel' property must also be set. When using the 2.4GHz band, the width
|
|
|
|
|
* can be at most 40MHz.
|
|
|
|
|
*
|
|
|
|
|
* This property can be set to a value different from
|
|
|
|
|
* %NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO only when the interface is configured
|
|
|
|
|
* in AP mode.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.50
|
|
|
|
|
**/
|
|
|
|
|
_nm_setting_property_define_direct_enum(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL_WIDTH,
|
|
|
|
|
PROP_CHANNEL_WIDTH,
|
|
|
|
|
NM_TYPE_SETTING_WIRELESS_CHANNEL_WIDTH,
|
|
|
|
|
NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO,
|
|
|
|
|
NM_SETTING_PARAM_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
NMSettingWirelessPrivate,
|
|
|
|
|
channel_width);
|
|
|
|
|
|
2019-01-11 08:28:26 +01:00
|
|
|
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2021-06-28 14:53:16 +02:00
|
|
|
_nm_setting_class_commit(setting_class,
|
|
|
|
|
NM_META_SETTING_TYPE_WIRELESS,
|
|
|
|
|
NULL,
|
|
|
|
|
properties_override,
|
libnm: embed private structure in NMSetting and avoid g_type_class_add_private()
Historically, the NMSetting types were in public headers. Theoretically,
that allowed users to subtype our classes. However in practice that was
impossible because they lacked required access to internal functions to
fully create an NMSetting class outside of libnm. And it also was not
useful, because you simply cannot extend libnm by subtyping a libnm
class. And supporting such a use case would be hard and limit what we can
do in libnm.
Having GObject structs in public headers also require that we don't
change it's layout. The ABI of those structs must not change, if anybody
out there was actually subclassing our GObjects.
In libnm 1.34 (commit e46d484fae9e ('libnm: hide NMSetting types from
public headers')) we moved the structs from headers to internal.
This would have caused a compiler error if anybody was using those
struct definitions. However, we still didn't change the ABI/layout so
that we didn't break users who relied on it (for whatever reason).
It doesn't seem there were any affected user. We waited long enough.
Change internal ABI.
No longer use g_type_class_add_private(). Instead, embed the private
structs directly (_NM_GET_PRIVATE()) or indirectly
(_NM_GET_PRIVATE_PTR()) in the object.
The main benefit is for debugging in the debugger, where we can now
easily find the private data. Previously that was so cumbersome to be
effectively impossible.
It's also the fastest possible way, since NM_SETTING_*_GET_PRIVATE()
literally resolves to "&self->_priv" (plus static asserts and
nm_assert() for type checking).
_NM_GET_PRIVATE() also propagates constness and requires that the
argument is a compatible pointer type (at compile time).
Note that g_type_class_add_private() is also deprecated in glib 2.58 and
replaced by G_ADD_PRIVATE(). For one, we still don't rely on 2.58. Also,
G_ADD_PRIVATE() is a worse solution as it supports a usecase that we
don't care for (public structs in headers). _NM_GET_PRIVATE() is still
faster, works with older glib and most importantly: is better for
debugging as you can find the private data from an object pointer.
For NMSettingIPConfig this is rather awkward, because all direct
properties require a common "klass->private_offset". This was however
the case before this change. Nothing new here. And if you ever touch
this and do something wrong, many unit tests will fail. It's almost
impossible to get wrong, albeit it can be confusing to understand.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1773
2023-10-24 19:05:50 +02:00
|
|
|
G_STRUCT_OFFSET(NMSettingWireless, _priv));
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|