mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 05:18:23 +02:00
wifi/iwd: merge branch 'th/wifi-iwd-config'
https://github.com/NetworkManager/NetworkManager/pull/41
This commit is contained in:
commit
67a20a6ba5
12 changed files with 135 additions and 18 deletions
|
|
@ -50,6 +50,7 @@
|
|||
%bcond_without wwan
|
||||
%bcond_without team
|
||||
%bcond_without wifi
|
||||
%bcond_with iwd
|
||||
%bcond_without ovs
|
||||
%bcond_without ppp
|
||||
%bcond_without nmtui
|
||||
|
|
@ -221,6 +222,11 @@ Summary: Wifi plugin for NetworkManager
|
|||
Group: System Environment/Base
|
||||
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: wpa_supplicant >= 1:1.1
|
||||
# the wifi plugin doesn't require iwd, even if it was build with
|
||||
# iwd support. Note that the plugin supports both supplicant and
|
||||
# iwd backend, that doesn't mean that the user requires to have them
|
||||
# both installed. Maybe both iwd and supplicant should Provide a "wireless-daemon"
|
||||
# meta package.
|
||||
Obsoletes: NetworkManager < %{obsoletes_device_plugins}
|
||||
|
||||
%description wifi
|
||||
|
|
@ -425,6 +431,11 @@ intltoolize --automake --copy --force
|
|||
%endif
|
||||
%else
|
||||
--enable-wifi=no \
|
||||
%endif
|
||||
%if %{with iwd}
|
||||
--with-iwd=yes \
|
||||
%else
|
||||
--with-iwd=no \
|
||||
%endif
|
||||
--enable-vala=yes \
|
||||
--enable-introspection \
|
||||
|
|
|
|||
|
|
@ -927,6 +927,15 @@ managed=1
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="wifi.backend">
|
||||
<term><varname>wifi.backend</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the Wi-Fi backend used for the device. Currently supported
|
||||
are <literal>wpa_supplicant</literal> and <literal>iwd</literal> (experimental).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>wifi.scan-generate-mac-address-mask</varname></term>
|
||||
<listitem>
|
||||
|
|
|
|||
|
|
@ -935,3 +935,38 @@ nm_utils_g_value_set_object_path_array (GValue *value,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
const GSList *specs,
|
||||
int no_match_value)
|
||||
{
|
||||
NMMatchSpecMatchType m;
|
||||
|
||||
/* we can only match by certain properties that are available on the
|
||||
* platform link (and even @pllink might be missing.
|
||||
*
|
||||
* It's still useful because of specs like "*" and "except:interface-name:eth0",
|
||||
* which match even in that case. */
|
||||
m = nm_match_spec_device (specs,
|
||||
pllink ? pllink->name : NULL,
|
||||
match_device_type,
|
||||
pllink ? pllink->driver : NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
switch (m) {
|
||||
case NM_MATCH_SPEC_MATCH:
|
||||
return TRUE;
|
||||
case NM_MATCH_SPEC_NEG_MATCH:
|
||||
return FALSE;
|
||||
case NM_MATCH_SPEC_NO_MATCH:
|
||||
return no_match_value;
|
||||
}
|
||||
nm_assert_not_reached ();
|
||||
return no_match_value;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ void nm_utils_g_value_set_object_path_array (GValue *value,
|
|||
NMUtilsObjectFunc filter_func,
|
||||
gpointer user_data);
|
||||
|
||||
int nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
const GSList *specs,
|
||||
int no_match_value);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __NETWORKMANAGER_UTILS_H__ */
|
||||
|
|
|
|||
|
|
@ -269,7 +269,6 @@ typedef struct _NMDevicePrivate {
|
|||
int ip_ifindex;
|
||||
NMDeviceType type;
|
||||
char * type_desc;
|
||||
char * type_description;
|
||||
NMLinkType link_type;
|
||||
NMDeviceCapabilities capabilities;
|
||||
char * driver;
|
||||
|
|
@ -1988,18 +1987,23 @@ nm_device_get_type_description (NMDevice *self)
|
|||
static const char *
|
||||
get_type_description (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMDeviceClass *klass;
|
||||
|
||||
if (!priv->type_description) {
|
||||
nm_assert (NM_IS_DEVICE (self));
|
||||
|
||||
klass = NM_DEVICE_GET_CLASS (self);
|
||||
if (G_UNLIKELY (!klass->default_type_description)) {
|
||||
const char *typename;
|
||||
gs_free char *s = NULL;
|
||||
|
||||
typename = G_OBJECT_TYPE_NAME (self);
|
||||
if (g_str_has_prefix (typename, "NMDevice"))
|
||||
typename += 8;
|
||||
priv->type_description = g_ascii_strdown (typename, -1);
|
||||
s = g_ascii_strdown (typename, -1);
|
||||
klass->default_type_description = g_intern_string (s);
|
||||
}
|
||||
|
||||
return priv->type_description;
|
||||
return klass->default_type_description;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
@ -14581,7 +14585,6 @@ finalize (GObject *object)
|
|||
g_free (priv->driver_version);
|
||||
g_free (priv->firmware_version);
|
||||
g_free (priv->type_desc);
|
||||
g_free (priv->type_description);
|
||||
g_free (priv->dhcp_anycast_address);
|
||||
g_free (priv->current_stable_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ typedef enum { /*< skip >*/
|
|||
typedef struct {
|
||||
NMExportedObjectClass parent;
|
||||
|
||||
const char *default_type_description;
|
||||
|
||||
const char *connection_type;
|
||||
const NMLinkType *link_types;
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ get_ordered_networks_cb (GObject *source, GAsyncResult *res, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
priv->new_aps = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
priv->new_aps = g_hash_table_new (nm_str_hash, g_str_equal);
|
||||
|
||||
g_variant_get (variant, "(a(osns))", &networks);
|
||||
|
||||
|
|
@ -1791,7 +1791,7 @@ nm_device_iwd_init (NMDeviceIwd *self)
|
|||
{
|
||||
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
|
||||
|
||||
priv->aps = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
priv->aps = g_hash_table_new (nm_str_hash, g_str_equal);
|
||||
|
||||
/* Make sure the manager is running */
|
||||
(void) nm_iwd_manager_get ();
|
||||
|
|
|
|||
|
|
@ -1040,7 +1040,7 @@ _hw_addr_set_scanning (NMDeviceWifi *self, gboolean do_reset)
|
|||
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
|
||||
randomize = nm_config_data_get_device_config_boolean (NM_CONFIG_GET_DATA,
|
||||
"wifi.scan-rand-mac-address",
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_SCAN_RAND_MAC_ADDRESS,
|
||||
device,
|
||||
TRUE, TRUE);
|
||||
|
||||
|
|
|
|||
|
|
@ -104,12 +104,18 @@ create_device (NMDeviceFactory *factory,
|
|||
if (plink->type != NM_LINK_TYPE_WIFI)
|
||||
return nm_device_olpc_mesh_new (iface);
|
||||
|
||||
backend = nm_config_data_get_value (NM_CONFIG_GET_DATA,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_WIFI_BACKEND,
|
||||
NM_CONFIG_GET_VALUE_STRIP);
|
||||
backend = nm_config_data_get_device_config_by_pllink (NM_CONFIG_GET_DATA,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_BACKEND,
|
||||
plink,
|
||||
"wifi",
|
||||
NULL);
|
||||
nm_strstrip (backend);
|
||||
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI, "(%s) config: backend is %s, %i", iface, backend, WITH_IWD);
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s) config: backend is %s%s%s%s",
|
||||
iface,
|
||||
NM_PRINT_FMT_QUOTE_STRING (backend),
|
||||
WITH_IWD ? " (iwd support enabled)" : "");
|
||||
if (!backend || !strcasecmp (backend, "wpa_supplicant"))
|
||||
return nm_device_wifi_new (iface, capabilities);
|
||||
#if WITH_IWD
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,8 @@ _match_section_infos_lookup (const MatchSectionInfo *match_section_infos,
|
|||
GKeyFile *keyfile,
|
||||
const char *property,
|
||||
NMDevice *device,
|
||||
const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
char **out_value)
|
||||
{
|
||||
if (!match_section_infos)
|
||||
|
|
@ -1216,9 +1218,15 @@ _match_section_infos_lookup (const MatchSectionInfo *match_section_infos,
|
|||
if (!value && !match_section_infos->stop_match)
|
||||
continue;
|
||||
|
||||
match = TRUE;
|
||||
if (match_section_infos->match_device.has)
|
||||
match = device && nm_device_spec_match_list (device, match_section_infos->match_device.spec);
|
||||
if (match_section_infos->match_device.has) {
|
||||
if (device)
|
||||
match = nm_device_spec_match_list (device, match_section_infos->match_device.spec);
|
||||
else if (pllink)
|
||||
match = nm_match_spec_device_by_pllink (pllink, match_device_type, match_section_infos->match_device.spec, FALSE);
|
||||
else
|
||||
match = FALSE;
|
||||
} else
|
||||
match = TRUE;
|
||||
|
||||
if (match) {
|
||||
*out_value = value;
|
||||
|
|
@ -1248,6 +1256,35 @@ nm_config_data_get_device_config (const NMConfigData *self,
|
|||
priv->keyfile,
|
||||
property,
|
||||
device,
|
||||
NULL,
|
||||
NULL,
|
||||
&value);
|
||||
NM_SET_OUT (has_match, !!connection_info);
|
||||
return value;
|
||||
}
|
||||
|
||||
char *
|
||||
nm_config_data_get_device_config_by_pllink (const NMConfigData *self,
|
||||
const char *property,
|
||||
const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
gboolean *has_match)
|
||||
{
|
||||
const NMConfigDataPrivate *priv;
|
||||
const MatchSectionInfo *connection_info;
|
||||
char *value = NULL;
|
||||
|
||||
g_return_val_if_fail (self, NULL);
|
||||
g_return_val_if_fail (property && *property, NULL);
|
||||
|
||||
priv = NM_CONFIG_DATA_GET_PRIVATE (self);
|
||||
|
||||
connection_info = _match_section_infos_lookup (&priv->device_infos[0],
|
||||
priv->keyfile,
|
||||
property,
|
||||
NULL,
|
||||
pllink,
|
||||
match_device_type,
|
||||
&value);
|
||||
NM_SET_OUT (has_match, !!connection_info);
|
||||
return value;
|
||||
|
|
@ -1287,6 +1324,8 @@ nm_config_data_get_connection_default (const NMConfigData *self,
|
|||
priv->keyfile,
|
||||
property,
|
||||
device,
|
||||
NULL,
|
||||
NULL,
|
||||
&value);
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,12 @@ char *nm_config_data_get_device_config (const NMConfigData *self,
|
|||
NMDevice *device,
|
||||
gboolean *has_match);
|
||||
|
||||
char *nm_config_data_get_device_config_by_pllink (const NMConfigData *self,
|
||||
const char *property,
|
||||
const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
gboolean *has_match);
|
||||
|
||||
gboolean nm_config_data_get_device_config_boolean (const NMConfigData *self,
|
||||
const char *property,
|
||||
NMDevice *device,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE "hostname-mode"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER "slaves-order"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_WIFI_BACKEND "wifi-backend"
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
||||
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
||||
|
|
@ -79,6 +78,8 @@
|
|||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED "managed"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER "ignore-carrier"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS "sriov-num-vfs"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_BACKEND "wifi.backend"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_SCAN_RAND_MAC_ADDRESS "wifi.scan-rand-mac-address"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT "carrier-wait-timeout"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEYPREFIX_WAS ".was."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue