libnm,nmcli: add a 'wifi.channel-width' setting
At the moment, the access point mode uses 20MHz channels. Introduce a new 'wifi.channel-width' property that allows the use of a larger bandwidth, thus increasing performances.
This commit is contained in:

committed by
Fernando Fernandez Mancera

parent
c32c731272
commit
a591c0ca95
@@ -2002,3 +2002,9 @@ global:
|
||||
nm_setting_wireless_remove_mac_denylist_item_by_value;
|
||||
nm_setting_802_1x_get_openssl_ciphers;
|
||||
} libnm_1_46_0;
|
||||
|
||||
libnm_1_50_0 {
|
||||
global:
|
||||
nm_setting_wireless_channel_width_get_type;
|
||||
nm_setting_wireless_get_channel_width;
|
||||
} libnm_1_48_0;
|
@@ -85,6 +85,10 @@
|
||||
dbus-type="u"
|
||||
gprop-type="guint"
|
||||
/>
|
||||
<property name="channel-width"
|
||||
dbus-type="i"
|
||||
gprop-type="gint"
|
||||
/>
|
||||
<property name="cloned-mac-address"
|
||||
dbus-type="ay"
|
||||
dbus-deprecated="1"
|
||||
|
@@ -44,7 +44,8 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWireless,
|
||||
PROP_POWERSAVE,
|
||||
PROP_MAC_ADDRESS_RANDOMIZATION,
|
||||
PROP_WAKE_ON_WLAN,
|
||||
PROP_AP_ISOLATION, );
|
||||
PROP_AP_ISOLATION,
|
||||
PROP_CHANNEL_WIDTH, );
|
||||
|
||||
typedef struct {
|
||||
GBytes *ssid;
|
||||
@@ -57,6 +58,7 @@ typedef struct {
|
||||
char *generate_mac_address_mask;
|
||||
NMValueStrv mac_address_denylist;
|
||||
int ap_isolation;
|
||||
int channel_width;
|
||||
guint32 mac_address_randomization;
|
||||
guint32 channel;
|
||||
guint32 rate;
|
||||
@@ -1012,6 +1014,24 @@ nm_setting_wireless_get_ap_isolation(NMSettingWireless *setting)
|
||||
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->ap_isolation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
@@ -1317,6 +1337,45 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* from here on, check for NM_SETTING_VERIFY_NORMALIZABLE conditions. */
|
||||
|
||||
_nm_setting_wireless_normalize_mac_address_randomization(NM_SETTING_WIRELESS(setting),
|
||||
@@ -2187,6 +2246,36 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
||||
NMSettingWirelessPrivate,
|
||||
ap_isolation);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
_nm_setting_class_commit(setting_class,
|
||||
|
@@ -92,6 +92,7 @@ typedef enum /*< flags >*/ {
|
||||
#define NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION "mac-address-randomization"
|
||||
#define NM_SETTING_WIRELESS_WAKE_ON_WLAN "wake-on-wlan"
|
||||
#define NM_SETTING_WIRELESS_AP_ISOLATION "ap-isolation"
|
||||
#define NM_SETTING_WIRELESS_CHANNEL_WIDTH "channel-width"
|
||||
|
||||
/**
|
||||
* NM_SETTING_WIRELESS_MODE_ADHOC:
|
||||
@@ -145,6 +146,24 @@ typedef enum {
|
||||
NM_SETTING_WIRELESS_POWERSAVE_LAST = _NM_SETTING_WIRELESS_POWERSAVE_NUM - 1, /*< skip >*/
|
||||
} NMSettingWirelessPowersave;
|
||||
|
||||
/**
|
||||
* NMSettingWirelessChannelWidth:
|
||||
* @NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO: automatically determine the width
|
||||
* @NM_SETTING_WIRELESS_CHANNEL_WIDTH_20MHZ: use a 20MHz channel width
|
||||
* @NM_SETTING_WIRELESS_CHANNEL_WIDTH_40MHZ: use a 40MHz channel width
|
||||
* @NM_SETTING_WIRELESS_CHANNEL_WIDTH_80MHZ: use a 80MHz channel width
|
||||
*
|
||||
* Indicates the wireless channel width.
|
||||
*
|
||||
* Since: 1.50
|
||||
**/
|
||||
typedef enum {
|
||||
NM_SETTING_WIRELESS_CHANNEL_WIDTH_AUTO = 0,
|
||||
NM_SETTING_WIRELESS_CHANNEL_WIDTH_20MHZ = 20,
|
||||
NM_SETTING_WIRELESS_CHANNEL_WIDTH_40MHZ = 40,
|
||||
NM_SETTING_WIRELESS_CHANNEL_WIDTH_80MHZ = 80,
|
||||
} NMSettingWirelessChannelWidth;
|
||||
|
||||
typedef struct _NMSettingWirelessClass NMSettingWirelessClass;
|
||||
|
||||
GType nm_setting_wireless_get_type(void);
|
||||
@@ -221,6 +240,9 @@ NMSettingWirelessWakeOnWLan nm_setting_wireless_get_wake_on_wlan(NMSettingWirele
|
||||
NM_AVAILABLE_IN_1_28
|
||||
NMTernary nm_setting_wireless_get_ap_isolation(NMSettingWireless *setting);
|
||||
|
||||
NM_AVAILABLE_IN_1_50
|
||||
NMSettingWirelessChannelWidth nm_setting_wireless_get_channel_width(NMSettingWireless *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_WIRELESS_H__ */
|
||||
|
@@ -8339,6 +8339,9 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS[] = {
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_AP_ISOLATION,
|
||||
.property_type = &_pt_gobject_ternary,
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CHANNEL_WIDTH,
|
||||
.property_type = &_pt_gobject_enum,
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@@ -417,6 +417,7 @@
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("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.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("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. 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.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("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.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL_WIDTH N_("Specifies width of the wireless channel in Access Point (AP) mode. When set to \"auto\" (0) (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 \"auto\" (0), 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 \"auto\" (0) only when the interface is configured in AP mode.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\", \"stable\" and \"stable-ssid\" are supported. \"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. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. \"stable-ssid\" creates a hashed MAC address based on the SSID, the same as setting the stable-id to \"${NETWORK_SSID}\". If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits 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. If the value contains more than one additional MAC addresses, one of 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.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("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, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution. 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.")
|
||||
|
@@ -89,6 +89,10 @@
|
||||
nmcli-description="Configures AP isolation, which prevents communication between wireless devices connected to this AP. This property can be set to a value different from "default" (-1) only when the interface is configured in AP mode. If set to "true" (1), devices are not able to communicate with each other. This increases security because it protects 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 "false" (0), devices can talk to each other. When set to "default" (-1), the global default is used; in case the global default is unspecified it is assumed to be "false" (0)."
|
||||
format="ternary"
|
||||
values="true/yes/on, false/no/off, default/unknown" />
|
||||
<property name="channel-width"
|
||||
nmcli-description="Specifies width of the wireless channel in Access Point (AP) mode. When set to "auto" (0) (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 "auto" (0), 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 "auto" (0) only when the interface is configured in AP mode."
|
||||
format="choice (NMSettingWirelessChannelWidth)"
|
||||
values="auto (0), 20mhz (20), 40mhz (40), 80mhz (80)" />
|
||||
</setting>
|
||||
<setting name="802-11-wireless-security"
|
||||
alias="wifi-sec" >
|
||||
|
@@ -58,12 +58,12 @@ location: src/tests/client/test-client.py:test_004()/7
|
||||
cmd: $NMCLI connection mod con-xx1 ipv4.addresses 192.168.77.5/24 ipv4.routes '2.3.4.5/32 192.168.77.1' ipv6.addresses 1:2:3:4::6/64 ipv6.routes 1:2:3:4:5:6::5/128
|
||||
lang: C
|
||||
returncode: 0
|
||||
size: 5598
|
||||
size: 5647
|
||||
location: src/tests/client/test-client.py:test_004()/8
|
||||
cmd: $NMCLI con s con-xx1
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 5467 bytes
|
||||
stdout: 5516 bytes
|
||||
>>>
|
||||
connection.id: con-xx1
|
||||
connection.uuid: UUID-con-xx1-REPLACED-REPLACED-REPLA
|
||||
@@ -112,6 +112,7 @@ connection.wait-activation-delay: -1
|
||||
802-11-wireless.powersave: 0 (default)
|
||||
802-11-wireless.wake-on-wlan: 0x1 (default)
|
||||
802-11-wireless.ap-isolation: -1 (default)
|
||||
802-11-wireless.channel-width: 0 (auto)
|
||||
ipv4.method: auto
|
||||
ipv4.dns: --
|
||||
ipv4.dns-search: --
|
||||
@@ -182,12 +183,12 @@ proxy.pac-url: --
|
||||
proxy.pac-script: --
|
||||
|
||||
<<<
|
||||
size: 5633
|
||||
size: 5682
|
||||
location: src/tests/client/test-client.py:test_004()/9
|
||||
cmd: $NMCLI con s con-xx1
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 5492 bytes
|
||||
stdout: 5541 bytes
|
||||
>>>
|
||||
connection.id: con-xx1
|
||||
connection.uuid: UUID-con-xx1-REPLACED-REPLACED-REPLA
|
||||
@@ -236,6 +237,7 @@ connection.wait-activation-delay: -1
|
||||
802-11-wireless.powersave: 0 (default)
|
||||
802-11-wireless.wake-on-wlan: 0x1 (default)
|
||||
802-11-wireless.ap-isolation: -1 (default)
|
||||
802-11-wireless.channel-width: 0 (auto)
|
||||
ipv4.method: auto
|
||||
ipv4.dns: --
|
||||
ipv4.dns-search: --
|
||||
|
Reference in New Issue
Block a user